-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPVSProxy.gen.go
198 lines (163 loc) · 4.92 KB
/
PVSProxy.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
187
188
189
190
191
192
193
194
195
196
197
198
// This is a generated file. DO NOT EDIT manually.
//go:generate goimports -w PVSProxy.gen.go
package go_xen_client
import (
"reflect"
"github.com/nilshell/xmlrpc"
)
//PVSProxy: a proxy connects a VM/VIF with a PVS site
type PVSProxy struct {
Uuid string // Unique identifier/object reference
Site string // PVS site this proxy is part of
VIF string // VIF of the VM using the proxy
CurrentlyAttached bool // true = VM is currently proxied
Status PvsProxyStatus // The run-time status of the proxy
}
func FromPVSProxyToXml(PVS_proxy *PVSProxy) (result xmlrpc.Struct) {
result = make(xmlrpc.Struct)
result["uuid"] = PVS_proxy.Uuid
result["site"] = PVS_proxy.Site
result["VIF"] = PVS_proxy.VIF
result["currently_attached"] = PVS_proxy.CurrentlyAttached
result["status"] = PVS_proxy.Status.String()
return result
}
func ToPVSProxy(obj interface{}) (resultObj *PVSProxy) {
objValue := reflect.ValueOf(obj)
resultObj = &PVSProxy{}
for _, oKey := range objValue.MapKeys() {
keyName := oKey.String()
keyValue := objValue.MapIndex(oKey).Interface()
switch keyName {
case "uuid":
if v, ok := keyValue.(string); ok {
resultObj.Uuid = v
}
case "site":
if v, ok := keyValue.(string); ok {
resultObj.Site = v
}
case "VIF":
if v, ok := keyValue.(string); ok {
resultObj.VIF = v
}
case "currently_attached":
if v, ok := keyValue.(bool); ok {
resultObj.CurrentlyAttached = v
}
case "status":
if v, ok := keyValue.(PvsProxyStatus); ok {
resultObj.Status = v
}
}
}
return resultObj
}
/* GetAllRecords: Return a map of PVS_proxy references to PVS_proxy records for all PVS_proxys known to the system. */
func (client *XenClient) PVSProxyGetAllRecords() (result map[string]PVSProxy, err error) {
obj, err := client.APICall("PVS_proxy.get_all_records")
if err != nil {
return
}
interim := reflect.ValueOf(obj)
result = map[string]PVSProxy{}
for _, key := range interim.MapKeys() {
obj := interim.MapIndex(key)
mapObj := ToPVSProxy(obj.Interface())
result[key.String()] = *mapObj
}
return
}
/* GetAll: Return a list of all the PVS_proxys known to the system. */
func (client *XenClient) PVSProxyGetAll() (result []string, err error) {
obj, err := client.APICall("PVS_proxy.get_all")
if err != nil {
return
}
result = make([]string, len(obj.([]interface{})))
for i, value := range obj.([]interface{}) {
result[i] = value.(string)
}
return
}
/* Destroy: remove (or switch off) a PVS proxy for this VM */
func (client *XenClient) PVSProxyDestroy(self string) (err error) {
_, err = client.APICall("PVS_proxy.destroy", self)
if err != nil {
return
}
// no return result
return
}
/* Create: Configure a VM/VIF to use a PVS proxy */
func (client *XenClient) PVSProxyCreate(site string, VIF string) (result string, err error) {
obj, err := client.APICall("PVS_proxy.create", site, VIF)
if err != nil {
return
}
result = obj.(string)
return
}
/* GetStatus: Get the status field of the given PVS_proxy. */
func (client *XenClient) PVSProxyGetStatus(self string) (result PvsProxyStatus, err error) {
obj, err := client.APICall("PVS_proxy.get_status", self)
if err != nil {
return
}
result = ToPvsProxyStatus(obj.(string))
return
}
/* GetCurrentlyAttached: Get the currently_attached field of the given PVS_proxy. */
func (client *XenClient) PVSProxyGetCurrentlyAttached(self string) (result bool, err error) {
obj, err := client.APICall("PVS_proxy.get_currently_attached", self)
if err != nil {
return
}
result = obj.(bool)
return
}
/* GetVIF: Get the VIF field of the given PVS_proxy. */
func (client *XenClient) PVSProxyGetVIF(self string) (result string, err error) {
obj, err := client.APICall("PVS_proxy.get_VIF", self)
if err != nil {
return
}
result = obj.(string)
return
}
/* GetSite: Get the site field of the given PVS_proxy. */
func (client *XenClient) PVSProxyGetSite(self string) (result string, err error) {
obj, err := client.APICall("PVS_proxy.get_site", self)
if err != nil {
return
}
result = obj.(string)
return
}
/* GetUuid: Get the uuid field of the given PVS_proxy. */
func (client *XenClient) PVSProxyGetUuid(self string) (result string, err error) {
obj, err := client.APICall("PVS_proxy.get_uuid", self)
if err != nil {
return
}
result = obj.(string)
return
}
/* GetByUuid: Get a reference to the PVS_proxy instance with the specified UUID. */
func (client *XenClient) PVSProxyGetByUuid(uuid string) (result string, err error) {
obj, err := client.APICall("PVS_proxy.get_by_uuid", uuid)
if err != nil {
return
}
result = obj.(string)
return
}
/* GetRecord: Get a record containing the current state of the given PVS_proxy. */
func (client *XenClient) PVSProxyGetRecord(self string) (result PVSProxy, err error) {
obj, err := client.APICall("PVS_proxy.get_record", self)
if err != nil {
return
}
result = *ToPVSProxy(obj.(interface{}))
return
}