// 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 ( // ServerIron type is a specific device identifier used to provide more specific // information about the ServerIron type in admin.mydatapipe. ServerIron struct { DeviceID string `xmlrpc:"DeviceID"` DevicePrimaryIP string `xmlrpc:"Device_PrimaryIP"` LocationTitle string `xmlrpc:"Location_Title"` RackTitle string `xmlrpc:"RackTitle"` RackID string `xmlrpc:"RackID"` RackU string `xmlrpc:"RackU"` 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"` OSVersion string `xmlrpc:"OSVersion"` Model string `xmlrpc:"Model"` FailoverPartnerID string `xmlrpc:"FailoverPartnerID"` PartnerName string `xmlrpc:"Partner_Name"` Serial string `xmlrpc:"Serial"` FirewallID string `xmlrpc:"FirewallID"` FirewallName string `xmlrpc:"firewall_Name"` AdaptSysid string `xmlrpc:"AdaptSysid"` StartSupportContract string `xmlrpc:"StartSupportContract"` EndSupportContract string `xmlrpc:"EndSupportContract"` ContractNotes string `xmlrpc:"ContractNotes"` } ) // GetServerIron method uses the *mydp.Client to invoke an XMLRPC call to the // Service: mydatapipe.ServerIron.Get func (c *Client) GetServerIron(serverIronID int) (*ServerIron, error) { client, err := xmlrpc.NewClient(c.url("xmlrpc/ServerIron.php"), nil) if err != nil { return nil, err } var result ServerIron err = client.Call("mydatapipe.ServerIron.Get", serverIronID, &result) return &result, err } // ServerIronList method uses the *mydp.Client to invoke an XMLRPC call to the // Service: mydatapipe.ServerIron.List func (c *Client) ServerIronList(offset int) ([]ServerIron, error) { client, err := xmlrpc.NewClient(c.url("xmlrpc/ServerIron.php"), nil) if err != nil { return nil, err } var result []ServerIron err = client.Call("mydatapipe.ServerIron.List", offset, &result) return result, err }