@@ -18,6 +18,8 @@ type XapiClient struct {
1818 rpc * xmlrpc.Client
1919}
2020
21+ type Struct map [string ]interface {}
22+
2123// Stand up a new XapiClient. Version should probably be "1.2" unless you know what you are doing.
2224func NewXapiClient (uri , username , password , version string ) (client XapiClient ) {
2325 client .Uri = uri
@@ -134,7 +136,7 @@ func TimeoutDialer() func(net, addr string) (c net.Conn, err error) {
134136 }
135137}
136138
137- // Make a generic RPC call passing in a pointer to a struct (or xmlrpc.Struct ). The call parameter
139+ // Make a generic RPC call passing in a pointer to a struct (or f ). The call parameter
138140// is a combination of class.message. For example: VIF.get_record, host.evacuate, pool.eject.
139141// Any time the XAPI specifies a `type ref` it's really an OpaqueReference, which is a UUID, and
140142// as far as xmlrpc and like library are concerned, a string.
@@ -145,14 +147,9 @@ func TimeoutDialer() func(net, addr string) (c net.Conn, err error) {
145147// fmt.Printf("%v", host)
146148// }
147149func (client * XapiClient ) RpcCall (result interface {}, call string , params ... interface {}) (err error ) {
148- response := xmlrpc.Struct {}
149- p := xmlrpc.Params {}
150- p .Params = make ([]interface {}, len (params ))
151- for i , d := range params {
152- p .Params [i ] = d
153- }
150+ response := Struct {}
154151
155- err = client .rpc .Call (call , p , & response )
152+ err = client .rpc .Call (call , params , & response )
156153
157154 if err != nil {
158155 return
@@ -171,7 +168,7 @@ func (client *XapiClient) RpcCall(result interface{}, call string, params ...int
171168
172169// checkResponse is a way to handle and return meaning status codes based on the payload since the body
173170// of the response changes depending on if it's an error or a success. This handled for you in RpcCall
174- func checkResponse (res xmlrpc. Struct ) error {
171+ func checkResponse (res Struct ) error {
175172 var success interface {}
176173 var ok bool
177174 var error_string interface {}
0 commit comments