-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVTPM.gen.go
130 lines (107 loc) · 2.88 KB
/
VTPM.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
// This is a generated file. DO NOT EDIT manually.
//go:generate goimports -w VTPM.gen.go
package go_xen_client
import (
"reflect"
"github.com/nilshell/xmlrpc"
)
//VTPM: A virtual TPM device
type VTPM struct {
Uuid string // Unique identifier/object reference
VM string // the virtual machine
Backend string // the domain where the backend is located
}
func FromVTPMToXml(VTPM *VTPM) (result xmlrpc.Struct) {
result = make(xmlrpc.Struct)
result["uuid"] = VTPM.Uuid
result["VM"] = VTPM.VM
result["backend"] = VTPM.Backend
return result
}
func ToVTPM(obj interface{}) (resultObj *VTPM) {
objValue := reflect.ValueOf(obj)
resultObj = &VTPM{}
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 "VM":
if v, ok := keyValue.(string); ok {
resultObj.VM = v
}
case "backend":
if v, ok := keyValue.(string); ok {
resultObj.Backend = v
}
}
}
return resultObj
}
/* GetBackend: Get the backend field of the given VTPM. */
func (client *XenClient) VTPMGetBackend(self string) (result string, err error) {
obj, err := client.APICall("VTPM.get_backend", self)
if err != nil {
return
}
result = obj.(string)
return
}
/* GetVM: Get the VM field of the given VTPM. */
func (client *XenClient) VTPMGetVM(self string) (result string, err error) {
obj, err := client.APICall("VTPM.get_VM", self)
if err != nil {
return
}
result = obj.(string)
return
}
/* GetUuid: Get the uuid field of the given VTPM. */
func (client *XenClient) VTPMGetUuid(self string) (result string, err error) {
obj, err := client.APICall("VTPM.get_uuid", self)
if err != nil {
return
}
result = obj.(string)
return
}
/* Destroy: Destroy the specified VTPM instance. */
func (client *XenClient) VTPMDestroy(self string) (err error) {
_, err = client.APICall("VTPM.destroy", self)
if err != nil {
return
}
// no return result
return
}
/* Create: Create a new VTPM instance, and return its handle.
The constructor args are: VM*, backend* (* = non-optional). */
func (client *XenClient) VTPMCreate(args VTPM) (result string, err error) {
obj, err := client.APICall("VTPM.create", FromVTPMToXml(&args))
if err != nil {
return
}
result = obj.(string)
return
}
/* GetByUuid: Get a reference to the VTPM instance with the specified UUID. */
func (client *XenClient) VTPMGetByUuid(uuid string) (result string, err error) {
obj, err := client.APICall("VTPM.get_by_uuid", uuid)
if err != nil {
return
}
result = obj.(string)
return
}
/* GetRecord: Get a record containing the current state of the given VTPM. */
func (client *XenClient) VTPMGetRecord(self string) (result VTPM, err error) {
obj, err := client.APICall("VTPM.get_record", self)
if err != nil {
return
}
result = *ToVTPM(obj.(interface{}))
return
}