AttachToPolicy

1. API Description

This API is used to add a protection strategy to a protection target.

2. Input Parameters

The following request parameter list only provides API request parameters.

Parameter Name
Required
Type
Description

policyId

Yes

String

Protection strategy ID.

ipv4IdList

No

Array of String

List of protection targets.

3. Output Parameters

Parameter Name
Type
Description

requestId

String

The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Code Example

Add a protection strategy to a protection target.

POST /api/v2/zec HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: AttachToPolicy
<Common Request Params>

Request:
{
    "policyId": "<policyId>",
    "ipv4IdList": ["eipId1","eipId2"]
}

Response:
{
  "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
  "response": {
    "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3"
  }
}

5. Developer Resources

Zenlayer Cloud API 2.0 SDKs to make it easier for you to call APIs. More programming languages will be supported.

6. Error Codes

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

HTTP Status Code
Error Code
Description

404

INVALID_DDOS_INSTANCE_NOT_FOUND_OF_REGION

Geo-Blocking regions in the DDoS strategy do not include the Elastic IP region.

404

INVALID_DDOS_POLICY_IP_NOT_CONFIG

No IPv4 or IPv6 address is configured for the DDoS strategy.

404

INVALID_DDOS_POLICY_NOT_FOUND

The protection strategy does not exist.

404

INVALID_EIP_NOT_FOUND

The elastic IP is not found.

404

INVALID_IPV6_NOT_FOUND

The IPv6 address is not found.

403

INVALID_IPV6_STATUS

The IPv6 address is not active.

400

OPERATION_DENIED_EIP_DDOS_POLICY_CONFLICT

The elastic IP is already lined to a DDoS strategy.

500

OPERATION_DENIED_EIP_STATUS_NOT_SUPPORT

The elastic IP state does not support this operation.

400

OPERATION_DENIED_IPV6_DDOS_POLICY_CONFLICT

The IPv6 address is already linked to a DDoS strategy.

Last updated