Example 1: Updating Defense Policy for an IP Address
Scenario
You can modify the defense policy configured for an IP address on the Anti-DDoS console or by calling the API.
- Query the defense statuses of all IP addresses.
- Query the optional Anti-DDoS defense policies.
- Update the defense policy for an IP address.
- Query the execution status of the defense policy updating task based on the task ID returned in 3.
Involved APIs
- Step 1 is used for querying the defense statuses of all IP addresses.
- Step 2 is used for querying the optional Anti-DDoS defense policies.
- Step 3 is used for updating the defense policy for an IP address.
- Step 4 is used for querying the execution status of the defense policy updating task based on the task ID.
Procedure
- Query the defense statuses of all IP addresses.
- API information
URI format: GET /v1/{project_id}/antiddos
For details, see section "Querying the List of Defense Statuses of EIPs".
- Example request
GET: https://{endpoint}/v1/1858a4e1f99d4454bd6a539d5477f5de/antiddos
Obtain {endpoint} from Regions and Endpoints.
Body:
{ }
- Example response
{ "total": 1, "ddosStatus": [ { "floating_ip_id": "18e6ace5-eb36-4196-a15e-1e000c24e026", "floating_ip_address": "139.9.116.167", "network_type": "EIP", "status": "normal", "blackhole_endtime": 0, "protect_type": "default", "traffic_threshold": 99, "http_threshold": 0 } ] }
- API information
- Query the optional Anti-DDoS defense policies.
- API information
URI format: GET /v2/{project_id}/antiddos/query-config-list
For details, see section "Querying Optional Anti-DDoS Defense Policies".
- Example request
GET: https://{endpoint}/v2/1858a4e1f99d4454bd6a539d5477f5de/antiddos/query-config-list
Obtain {endpoint} from Regions and Endpoints.
Body:
{ }
- Example response
{ "traffic_limited_list": [ { "traffic_pos_id": 1, "traffic_per_second": 10, "packet_per_second": 2000 }, { "traffic_pos_id": 2, "traffic_per_second": 30, "packet_per_second": 6000 }, { "traffic_pos_id": 3, "traffic_per_second": 50, "packet_per_second": 10000 }, { "traffic_pos_id": 4, "traffic_per_second": 70, "packet_per_second": 15000 }, { "traffic_pos_id": 5, "traffic_per_second": 100, "packet_per_second": 20000 }, { "traffic_pos_id": 6, "traffic_per_second": 150, "packet_per_second": 25000 }, { "traffic_pos_id": 7, "traffic_per_second": 200, "packet_per_second": 35000 }, { "traffic_pos_id": 8, "traffic_per_second": 250, "packet_per_second": 50000 }, { "traffic_pos_id": 9, "traffic_per_second": 300, "packet_per_second": 70000 }, { "traffic_pos_id": 88, "traffic_per_second": 1000, "packet_per_second": 300000 } ], "http_limited_list": [ { "http_request_pos_id": 1, "http_packet_per_second": 100 }, { "http_request_pos_id": 2, "http_packet_per_second": 150 }, { "http_request_pos_id": 3, "http_packet_per_second": 240 }, { "http_request_pos_id": 4, "http_packet_per_second": 350 }, { "http_request_pos_id": 5, "http_packet_per_second": 480 }, { "http_request_pos_id": 6, "http_packet_per_second": 550 }, { "http_request_pos_id": 7, "http_packet_per_second": 700 }, { "http_request_pos_id": 8, "http_packet_per_second": 850 }, { "http_request_pos_id": 9, "http_packet_per_second": 1000 }, { "http_request_pos_id": 10, "http_packet_per_second": 1500 }, { "http_request_pos_id": 11, "http_packet_per_second": 2000 }, { "http_request_pos_id": 12, "http_packet_per_second": 3000 }, { "http_request_pos_id": 13, "http_packet_per_second": 5000 }, { "http_request_pos_id": 14, "http_packet_per_second": 10000 }, { "http_request_pos_id": 15, "http_packet_per_second": 20000 } ], "connection_limited_list": [ { "cleaning_access_pos_id": 1, "new_connection_limited": 10, "total_connection_limited": 30 }, { "cleaning_access_pos_id": 2, "new_connection_limited": 20, "total_connection_limited": 100 }, { "cleaning_access_pos_id": 3, "new_connection_limited": 30, "total_connection_limited": 200 }, { "cleaning_access_pos_id": 4, "new_connection_limited": 40, "total_connection_limited": 250 }, { "cleaning_access_pos_id": 5, "new_connection_limited": 50, "total_connection_limited": 300 }, { "cleaning_access_pos_id": 6, "new_connection_limited": 60, "total_connection_limited": 500 }, { "cleaning_access_pos_id": 7, "new_connection_limited": 70, "total_connection_limited": 600 }, { "cleaning_access_pos_id": 8, "new_connection_limited": 80, "total_connection_limited": 700 } ], "extend_ddos_config": [] }
- API information
- Update the defense policy for an IP address.
- API information
URI format: PUT /v1/{project_id}/antiddos/{floating_ip_id}
For details, see section "Updating Anti-DDoS Defense Policies".
- Example request
PUT: https://{endpoint}/v1/1858a4e1f99d4454bd6a539d5477f5de/antiddos/18e6ace5-eb36-4196-a15e-1e000c24e026
Obtain {endpoint} from Regions and Endpoints.
Body:
{ "app_type_id": 1, "cleaning_access_pos_id": 8, "enable_L7": false, "http_request_pos_id": 8, "traffic_pos_id": 8 }
- Example response
{ "error_code": "10000000", "error_msg": "The task has been received and is being handled", "task_id": "59385d2a-6266-4d3a-9122-a228c530f557" }
- API information
- Query the execution status of the defense policy updating task based on the task ID returned in Step 3.
- API information
URI format: GET /v2/{project_id}/query-task-status
For details, see section "Querying Anti-DDoS Tasks".
- Example request
GET: https://{endpoint}/v2/1858a4e1f99d4454bd6a539d5477f5de/query-task-status?task_id=59385d2a-6266-4d3a-9122-a228c530f557
Obtain {endpoint} from Regions and Endpoints.
Body:
{ }
- Example response
{ "task_status": "success", "task_msg": "" }
- API information
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot