当我尝试创建安全组时,我收到以下错误:
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)
我尝试过的代码
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)
}
}
答案 0 :(得分:0)
您需要将accountId
作为其中一个参数以及名称和说明。你可以看到一个python示例here
答案 1 :(得分:0)
您的帐户必须拥有使用seciruty群组的权限,我建议您在softlayer中提交一张故障单,如果您的帐户具有这些权限,则会询问它们。