-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFeature.gen.go
225 lines (187 loc) · 5.67 KB
/
Feature.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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
// This is a generated file. DO NOT EDIT manually.
//go:generate goimports -w Feature.gen.go
package go_xen_client
import (
"reflect"
"github.com/nilshell/xmlrpc"
)
//Feature: A new piece of functionality
type Feature struct {
Uuid string // Unique identifier/object reference
NameLabel string // a human-readable name
NameDescription string // a notes field containing human-readable description
Enabled bool // Indicates whether the feature is enabled
Experimental bool // Indicates whether the feature is experimental (as opposed to stable and fully supported)
Version string // The version of this feature
Host string // The host where this feature is available
}
func FromFeatureToXml(Feature *Feature) (result xmlrpc.Struct) {
result = make(xmlrpc.Struct)
result["uuid"] = Feature.Uuid
result["name_label"] = Feature.NameLabel
result["name_description"] = Feature.NameDescription
result["enabled"] = Feature.Enabled
result["experimental"] = Feature.Experimental
result["version"] = Feature.Version
result["host"] = Feature.Host
return result
}
func ToFeature(obj interface{}) (resultObj *Feature) {
objValue := reflect.ValueOf(obj)
resultObj = &Feature{}
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 "name_label":
if v, ok := keyValue.(string); ok {
resultObj.NameLabel = v
}
case "name_description":
if v, ok := keyValue.(string); ok {
resultObj.NameDescription = v
}
case "enabled":
if v, ok := keyValue.(bool); ok {
resultObj.Enabled = v
}
case "experimental":
if v, ok := keyValue.(bool); ok {
resultObj.Experimental = v
}
case "version":
if v, ok := keyValue.(string); ok {
resultObj.Version = v
}
case "host":
if v, ok := keyValue.(string); ok {
resultObj.Host = v
}
}
}
return resultObj
}
/* GetAllRecords: Return a map of Feature references to Feature records for all Features known to the system. */
func (client *XenClient) FeatureGetAllRecords() (result map[string]Feature, err error) {
obj, err := client.APICall("Feature.get_all_records")
if err != nil {
return
}
interim := reflect.ValueOf(obj)
result = map[string]Feature{}
for _, key := range interim.MapKeys() {
obj := interim.MapIndex(key)
mapObj := ToFeature(obj.Interface())
result[key.String()] = *mapObj
}
return
}
/* GetAll: Return a list of all the Features known to the system. */
func (client *XenClient) FeatureGetAll() (result []string, err error) {
obj, err := client.APICall("Feature.get_all")
if err != nil {
return
}
result = make([]string, len(obj.([]interface{})))
for i, value := range obj.([]interface{}) {
result[i] = value.(string)
}
return
}
/* GetHost: Get the host field of the given Feature. */
func (client *XenClient) FeatureGetHost(self string) (result string, err error) {
obj, err := client.APICall("Feature.get_host", self)
if err != nil {
return
}
result = obj.(string)
return
}
/* GetVersion: Get the version field of the given Feature. */
func (client *XenClient) FeatureGetVersion(self string) (result string, err error) {
obj, err := client.APICall("Feature.get_version", self)
if err != nil {
return
}
result = obj.(string)
return
}
/* GetExperimental: Get the experimental field of the given Feature. */
func (client *XenClient) FeatureGetExperimental(self string) (result bool, err error) {
obj, err := client.APICall("Feature.get_experimental", self)
if err != nil {
return
}
result = obj.(bool)
return
}
/* GetEnabled: Get the enabled field of the given Feature. */
func (client *XenClient) FeatureGetEnabled(self string) (result bool, err error) {
obj, err := client.APICall("Feature.get_enabled", self)
if err != nil {
return
}
result = obj.(bool)
return
}
/* GetNameDescription: Get the name/description field of the given Feature. */
func (client *XenClient) FeatureGetNameDescription(self string) (result string, err error) {
obj, err := client.APICall("Feature.get_name_description", self)
if err != nil {
return
}
result = obj.(string)
return
}
/* GetNameLabel: Get the name/label field of the given Feature. */
func (client *XenClient) FeatureGetNameLabel(self string) (result string, err error) {
obj, err := client.APICall("Feature.get_name_label", self)
if err != nil {
return
}
result = obj.(string)
return
}
/* GetUuid: Get the uuid field of the given Feature. */
func (client *XenClient) FeatureGetUuid(self string) (result string, err error) {
obj, err := client.APICall("Feature.get_uuid", self)
if err != nil {
return
}
result = obj.(string)
return
}
/* GetByNameLabel: Get all the Feature instances with the given label. */
func (client *XenClient) FeatureGetByNameLabel(label string) (result []string, err error) {
obj, err := client.APICall("Feature.get_by_name_label", label)
if err != nil {
return
}
result = make([]string, len(obj.([]interface{})))
for i, value := range obj.([]interface{}) {
result[i] = value.(string)
}
return
}
/* GetByUuid: Get a reference to the Feature instance with the specified UUID. */
func (client *XenClient) FeatureGetByUuid(uuid string) (result string, err error) {
obj, err := client.APICall("Feature.get_by_uuid", uuid)
if err != nil {
return
}
result = obj.(string)
return
}
/* GetRecord: Get a record containing the current state of the given Feature. */
func (client *XenClient) FeatureGetRecord(self string) (result Feature, err error) {
obj, err := client.APICall("Feature.get_record", self)
if err != nil {
return
}
result = *ToFeature(obj.(interface{}))
return
}