// 2020 Rackspace, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"): you may // not use this file except in compliance with the License. You may obtain // a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the // License for the specific language governing permissions and limitations // under the License. package mydp import ( "github.com/kolo/xmlrpc" ) type ( // Router type is a specific device identifier used to provide more specific // information about the router type in admin.mydatapipe. Router struct { DeviceID string `xmlrpc:"DeviceID"` DevicePrimaryIP string `xmlrpc:"Device_PrimaryIP"` LocationTitle string `xmlrpc:"Location_Title"` RackTitle string `xmlrpc:"RackTitle"` RackID string `xmlrpc:"RackID"` CustomerID string `xmlrpc:"CustomerID"` DeviceName string `xmlrpc:"Device_Name"` AXDeviceID string `xmlrpc:"AXDeviceID"` ERPDeviceID string `xmlrpc:"ERPDeviceID"` NetworkZoneTitle string `xmlrpc:"NetworkZoneTitle"` NetworkZoneID string `xmlrpc:"NetworkZoneID"` RackU string `xmlrpc:"RackU"` AdaptSysid string `xmlrpc:"AdaptSysid"` StartSupportContract string `xmlrpc:"StartSupportContract"` EndSupportContract string `xmlrpc:"EndSupportContract"` ContractNotes string `xmlrpc:"ContractNotes"` } ) // GetRouter method uses the *mydp.Client to invoke an XMLRPC call to the // Service: mydatapipe.router.Get func (c *Client) GetRouter(routerID int) (*Router, error) { client, err := xmlrpc.NewClient(c.url("xmlrpc/router.php"), nil) if err != nil { return nil, err } var result Router err = client.Call("mydatapipe.router.Get", routerID, &result) return &result, err } // RouterList method uses the *mydp.Client to invoke an XMLRPC call to the // Service: mydatapipe.router.List func (c *Client) RouterList() ([]Router, error) { client, err := xmlrpc.NewClient(c.url("xmlrpc/router.php"), nil) if err != nil { return nil, err } var result []Router err = client.Call("mydatapipe.router.List", nil, &result) return result, err }