forked from terra-farm/go-xen-api-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lvhd_gen.go
186 lines (163 loc) · 6.01 KB
/
lvhd_gen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
//
// This file is generated. To change the content of this file, please do not
// apply the change to this file because it will get overwritten. Instead,
// change xenapi.go and execute 'go generate'.
//
package xenAPI
import (
"errors"
"fmt"
"log"
"github.com/amfranz/go-xmlrpc-client"
"reflect"
"strconv"
"time"
)
var _ = errors.New
var _ = log.Println
var _ = fmt.Errorf
var _ = xmlrpc.NewClient
var _ = reflect.TypeOf
var _ = strconv.Atoi
var _ = time.UTC
type LVHDRecord struct {
// Unique identifier/object reference
UUID string
}
type LVHDRef string
// LVHD SR specific operations
type LVHDClass struct {
client *Client
}
func LVHDClassEnableThinProvisioningMockDefault(sessionID SessionRef, host HostRef, sr SRRef, initialAllocation int, allocationQuantum int) (_retval string, _err error) {
log.Println("LVHD.EnableThinProvisioning not mocked")
_err = errors.New("LVHD.EnableThinProvisioning not mocked")
return
}
var LVHDClassEnableThinProvisioningMockedCallback = LVHDClassEnableThinProvisioningMockDefault
func (_class LVHDClass) EnableThinProvisioningMock(sessionID SessionRef, host HostRef, sr SRRef, initialAllocation int, allocationQuantum int) (_retval string, _err error) {
return LVHDClassEnableThinProvisioningMockedCallback(sessionID, host, sr, initialAllocation, allocationQuantum)
}
// Upgrades an LVHD SR to enable thin-provisioning. Future VDIs created in this SR will be thinly-provisioned, although existing VDIs will be left alone. Note that the SR must be attached to the SRmaster for upgrade to work.
func (_class LVHDClass) EnableThinProvisioning(sessionID SessionRef, host HostRef, sr SRRef, initialAllocation int, allocationQuantum int) (_retval string, _err error) {
if IsMock {
return _class.EnableThinProvisioningMock(sessionID, host, sr, initialAllocation, allocationQuantum)
}
_method := "LVHD.enable_thin_provisioning"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_hostArg, _err := convertHostRefToXen(fmt.Sprintf("%s(%s)", _method, "host"), host)
if _err != nil {
return
}
_srArg, _err := convertSRRefToXen(fmt.Sprintf("%s(%s)", _method, "SR"), sr)
if _err != nil {
return
}
_initialAllocationArg, _err := convertIntToXen(fmt.Sprintf("%s(%s)", _method, "initial_allocation"), initialAllocation)
if _err != nil {
return
}
_allocationQuantumArg, _err := convertIntToXen(fmt.Sprintf("%s(%s)", _method, "allocation_quantum"), allocationQuantum)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _sessionIDArg, _hostArg, _srArg, _initialAllocationArg, _allocationQuantumArg)
if _err != nil {
return
}
_retval, _err = convertStringToGo(_method + " -> ", _result.Value)
return
}
func LVHDClassGetUUIDMockDefault(sessionID SessionRef, self LVHDRef) (_retval string, _err error) {
log.Println("LVHD.GetUUID not mocked")
_err = errors.New("LVHD.GetUUID not mocked")
return
}
var LVHDClassGetUUIDMockedCallback = LVHDClassGetUUIDMockDefault
func (_class LVHDClass) GetUUIDMock(sessionID SessionRef, self LVHDRef) (_retval string, _err error) {
return LVHDClassGetUUIDMockedCallback(sessionID, self)
}
// Get the uuid field of the given LVHD.
func (_class LVHDClass) GetUUID(sessionID SessionRef, self LVHDRef) (_retval string, _err error) {
if IsMock {
return _class.GetUUIDMock(sessionID, self)
}
_method := "LVHD.get_uuid"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertLVHDRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)
if _err != nil {
return
}
_retval, _err = convertStringToGo(_method + " -> ", _result.Value)
return
}
func LVHDClassGetByUUIDMockDefault(sessionID SessionRef, uuid string) (_retval LVHDRef, _err error) {
log.Println("LVHD.GetByUUID not mocked")
_err = errors.New("LVHD.GetByUUID not mocked")
return
}
var LVHDClassGetByUUIDMockedCallback = LVHDClassGetByUUIDMockDefault
func (_class LVHDClass) GetByUUIDMock(sessionID SessionRef, uuid string) (_retval LVHDRef, _err error) {
return LVHDClassGetByUUIDMockedCallback(sessionID, uuid)
}
// Get a reference to the LVHD instance with the specified UUID.
func (_class LVHDClass) GetByUUID(sessionID SessionRef, uuid string) (_retval LVHDRef, _err error) {
if IsMock {
return _class.GetByUUIDMock(sessionID, uuid)
}
_method := "LVHD.get_by_uuid"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_uuidArg, _err := convertStringToXen(fmt.Sprintf("%s(%s)", _method, "uuid"), uuid)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _sessionIDArg, _uuidArg)
if _err != nil {
return
}
_retval, _err = convertLVHDRefToGo(_method + " -> ", _result.Value)
return
}
func LVHDClassGetRecordMockDefault(sessionID SessionRef, self LVHDRef) (_retval LVHDRecord, _err error) {
log.Println("LVHD.GetRecord not mocked")
_err = errors.New("LVHD.GetRecord not mocked")
return
}
var LVHDClassGetRecordMockedCallback = LVHDClassGetRecordMockDefault
func (_class LVHDClass) GetRecordMock(sessionID SessionRef, self LVHDRef) (_retval LVHDRecord, _err error) {
return LVHDClassGetRecordMockedCallback(sessionID, self)
}
// Get a record containing the current state of the given LVHD.
func (_class LVHDClass) GetRecord(sessionID SessionRef, self LVHDRef) (_retval LVHDRecord, _err error) {
if IsMock {
return _class.GetRecordMock(sessionID, self)
}
_method := "LVHD.get_record"
_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
if _err != nil {
return
}
_selfArg, _err := convertLVHDRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
if _err != nil {
return
}
_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)
if _err != nil {
return
}
_retval, _err = convertLVHDRecordToGo(_method + " -> ", _result.Value)
return
}