Adds a cluster to a security group.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes AddSecurityGroup

The operation that you want to perform. Set the value to AddSecurityGroup.

ClusterId String Yes ehpc-hz-FYUr32****

The ID of the cluster.

You can call the ListClusters operation to query the cluster ID.

SecurityGroupId String Yes sg-bp13n61xsydodfyg****

The ID of the security group.

You can call the DescribeSecurityGroups operation to query available security groups in the current region.

ClientToken String No 123e4567-e89b-12d3-a456-426655440000

The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must make sure that the value is unique among different requests. The ClientToken value can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure the idempotence of a request.

Response parameters

Parameter Type Example Description
RequestId String 04F0F334-1335-436C-A1D7-6C044FE73368

The ID of the request.

Examples

Sample requests

https://ehpc.cn-hangzhou.aliyuncs.com/?Action=AddSecurityGroup
&ClusterId=ehpc-hz-FYUr32****
&SecurityGroupId=sg-bp13n61xsydodfyg****
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<AddSecurityGroupResponse>
      <RequestId>04F0F334-1335-436C-A1D7-6C044FE73368</RequestId>
</AddSecurityGroupResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "04F0F334-1335-436C-A1D7-6C044FE73368"
}

Error codes

HttpCode Error code Error message Description
400 InvalidSecurityGroup The security group ID is invalid. The error message returned because the security group is invalid.
400 InvalidParams The specified parameter %s is invalid. The error message returned because the %s parameter is invalid.
500 UnknownError An unknown error occurred. The error message returned because an unknown error has occurred. Try again later. If the error persists, submit a ticket.
404 SecurityGroupNotSupported The security group is not supported. The error message returned because the security group is not supported.
404 SecurityGroupAlreadyExists The security group already exists. The error message returned because the security group already exists.
404 ClusterNotFound The specified cluster does not exist. The error message returned because the specified cluster does not exist.
503 ServiceUnavailable The request has failed due to a temporary failure of the server The error message returned because the request has failed. The service is temporarily unavailable.
406 EcsError ECS api request error The error message returned because the ECS API call has failed.
406 DbError A database service error occurred. The error message returned because the database request has failed.
406 AliyunError Aliyun api service error The error message returned because the operation has failed to call another Alibaba Cloud service.
407 NotAuthorized You are not authorized by RAM for this request. The error message returned because you are not authorized by RAM for this request.

For a list of error codes, visit the Error Center.