-
Notifications
You must be signed in to change notification settings - Fork 0
/
PVSServer.gen.go
207 lines (172 loc) · 5.22 KB
/
PVSServer.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
199
200
201
202
203
204
205
206
207
// This is a generated file. DO NOT EDIT manually.
//go:generate goimports -w PVSServer.gen.go
package go_xen_client
import (
"reflect"
"strconv"
"github.com/nilshell/xmlrpc"
)
//PVSServer: individual machine serving provisioning (block) data
type PVSServer struct {
Uuid string // Unique identifier/object reference
Addresses []string // IPv4 addresses of this server
FirstPort int // First UDP port accepted by this server
LastPort int // Last UDP port accepted by this server
Site string // PVS site this server is part of
}
func FromPVSServerToXml(PVS_server *PVSServer) (result xmlrpc.Struct) {
result = make(xmlrpc.Struct)
result["uuid"] = PVS_server.Uuid
result["addresses"] = PVS_server.Addresses
result["first_port"] = strconv.Itoa(PVS_server.FirstPort)
result["last_port"] = strconv.Itoa(PVS_server.LastPort)
result["site"] = PVS_server.Site
return result
}
func ToPVSServer(obj interface{}) (resultObj *PVSServer) {
objValue := reflect.ValueOf(obj)
resultObj = &PVSServer{}
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 "addresses":
if interim, ok := keyValue.([]interface{}); ok {
resultObj.Addresses = make([]string, len(interim))
for i, interimValue := range interim {
if v, ok := interimValue.(string); ok {
resultObj.Addresses[i] = v
}
}
}
case "first_port":
if v, ok := keyValue.(int); ok {
resultObj.FirstPort = v
}
case "last_port":
if v, ok := keyValue.(int); ok {
resultObj.LastPort = v
}
case "site":
if v, ok := keyValue.(string); ok {
resultObj.Site = v
}
}
}
return resultObj
}
/* GetAllRecords: Return a map of PVS_server references to PVS_server records for all PVS_servers known to the system. */
func (client *XenClient) PVSServerGetAllRecords() (result map[string]PVSServer, err error) {
obj, err := client.APICall("PVS_server.get_all_records")
if err != nil {
return
}
interim := reflect.ValueOf(obj)
result = map[string]PVSServer{}
for _, key := range interim.MapKeys() {
obj := interim.MapIndex(key)
mapObj := ToPVSServer(obj.Interface())
result[key.String()] = *mapObj
}
return
}
/* GetAll: Return a list of all the PVS_servers known to the system. */
func (client *XenClient) PVSServerGetAll() (result []string, err error) {
obj, err := client.APICall("PVS_server.get_all")
if err != nil {
return
}
result = make([]string, len(obj.([]interface{})))
for i, value := range obj.([]interface{}) {
result[i] = value.(string)
}
return
}
/* Forget: forget a PVS server */
func (client *XenClient) PVSServerForget(self string) (err error) {
_, err = client.APICall("PVS_server.forget", self)
if err != nil {
return
}
// no return result
return
}
/* Introduce: introduce new PVS server */
func (client *XenClient) PVSServerIntroduce(addresses []string, first_port int, last_port int, site string) (result string, err error) {
obj, err := client.APICall("PVS_server.introduce", addresses, first_port, last_port, site)
if err != nil {
return
}
result = obj.(string)
return
}
/* GetSite: Get the site field of the given PVS_server. */
func (client *XenClient) PVSServerGetSite(self string) (result string, err error) {
obj, err := client.APICall("PVS_server.get_site", self)
if err != nil {
return
}
result = obj.(string)
return
}
/* GetLastPort: Get the last_port field of the given PVS_server. */
func (client *XenClient) PVSServerGetLastPort(self string) (result int, err error) {
obj, err := client.APICall("PVS_server.get_last_port", self)
if err != nil {
return
}
result = obj.(int)
return
}
/* GetFirstPort: Get the first_port field of the given PVS_server. */
func (client *XenClient) PVSServerGetFirstPort(self string) (result int, err error) {
obj, err := client.APICall("PVS_server.get_first_port", self)
if err != nil {
return
}
result = obj.(int)
return
}
/* GetAddresses: Get the addresses field of the given PVS_server. */
func (client *XenClient) PVSServerGetAddresses(self string) (result []string, err error) {
obj, err := client.APICall("PVS_server.get_addresses", self)
if err != nil {
return
}
result = make([]string, len(obj.([]interface{})))
for i, value := range obj.([]interface{}) {
result[i] = value.(string)
}
return
}
/* GetUuid: Get the uuid field of the given PVS_server. */
func (client *XenClient) PVSServerGetUuid(self string) (result string, err error) {
obj, err := client.APICall("PVS_server.get_uuid", self)
if err != nil {
return
}
result = obj.(string)
return
}
/* GetByUuid: Get a reference to the PVS_server instance with the specified UUID. */
func (client *XenClient) PVSServerGetByUuid(uuid string) (result string, err error) {
obj, err := client.APICall("PVS_server.get_by_uuid", uuid)
if err != nil {
return
}
result = obj.(string)
return
}
/* GetRecord: Get a record containing the current state of the given PVS_server. */
func (client *XenClient) PVSServerGetRecord(self string) (result PVSServer, err error) {
obj, err := client.APICall("PVS_server.get_record", self)
if err != nil {
return
}
result = *ToPVSServer(obj.(interface{}))
return
}