-
Notifications
You must be signed in to change notification settings - Fork 33
/
softlayer_billing_item_cancellation_request.go
50 lines (40 loc) · 1.59 KB
/
softlayer_billing_item_cancellation_request.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
package services
import (
"bytes"
"encoding/json"
"fmt"
datatypes "github.com/maximilien/softlayer-go/data_types"
softlayer "github.com/maximilien/softlayer-go/softlayer"
)
type softLayer_Billing_Item_Cancellation_Request_Service struct {
client softlayer.Client
}
func NewSoftLayer_Billing_Item_Cancellation_Request_Service(client softlayer.Client) *softLayer_Billing_Item_Cancellation_Request_Service {
return &softLayer_Billing_Item_Cancellation_Request_Service{
client: client,
}
}
func (slbicr *softLayer_Billing_Item_Cancellation_Request_Service) GetName() string {
return "SoftLayer_Billing_Item_Cancellation_Request"
}
func (slbicr *softLayer_Billing_Item_Cancellation_Request_Service) CreateObject(request datatypes.SoftLayer_Billing_Item_Cancellation_Request) (datatypes.SoftLayer_Billing_Item_Cancellation_Request, error) {
parameters := datatypes.SoftLayer_Billing_Item_Cancellation_Request_Parameters{
Parameters: []datatypes.SoftLayer_Billing_Item_Cancellation_Request{
request,
},
}
requestBody, err := json.Marshal(parameters)
if err != nil {
return datatypes.SoftLayer_Billing_Item_Cancellation_Request{}, err
}
responseBytes, err := slbicr.client.DoRawHttpRequest(fmt.Sprintf("%s/createObject.json", slbicr.GetName()), "POST", bytes.NewBuffer(requestBody))
if err != nil {
return datatypes.SoftLayer_Billing_Item_Cancellation_Request{}, err
}
result := datatypes.SoftLayer_Billing_Item_Cancellation_Request{}
err = json.Unmarshal(responseBytes, &result)
if err != nil {
return datatypes.SoftLayer_Billing_Item_Cancellation_Request{}, err
}
return result, nil
}