0
votes

When I am trying to create the security group I am getting the following error:

2017/10/03 16:19:15 [DEBUG] Request URL: POST https://api.softlayer.com/rest/v3/SoftLayer_Network_SecurityGroup.json
2017/10/03 16:19:15 [DEBUG] Parameters: {"parameters":[[{"description":"for testing","name":"test_security_sakshi"}]]}
2017/10/03 16:19:17 [DEBUG] Response: {"error":"Function ("createObject") is not a valid method for this service.","code":"SoftLayer_Exception_Public"}
SoftLayer_Exception_Public: Function ("createObject") is not a valid method for this service. (HTTP 404)

Code which I tried running

func doCreateSecurityGroupTest(sess *session.Session) {

service := services.GetNetworkSecurityGroupService(sess)
// Create a Security Group

opts := []datatypes.Network_SecurityGroup{
    {
        Name:        sl.String("test_security_group"),
        Description: sl.String("for testing"),
    },
}

res, err := service.CreateObjects(opts)

if err != nil {
    fmt.Printf("%s\n", err)

} else {
    fmt.Printf("\nNew Security Group created with ID %d\n", *res[0].Id)

}

}
2

2 Answers

0
votes

You need to include your accountId as one of the parameters along with the name and description. You can see a python example here

0
votes

You account must have permissions to use seciruty groups, I suggest you to submit an ticket in softlayer and asnk them if your account has those permissions.