tencent cloud

Feedback

ModifyBlockIPList

Last updated: 2024-09-05 19:29:44

    1. API Description

    Domain name for API request: clb.tencentcloudapi.com.

    This API is used to modify the client IP blocklist of a CLB instance. One forwarding rule supports blocking up to 2,000,000 IPs. One blocklist can contain up to 2,000,000 entries.
    (This API is in beta test. To use it, please submit a ticket.)

    A maximum of 20 requests can be initiated per second for this API.

    We recommend you to use API Explorer
    Try it
    API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

    2. Input Parameters

    The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

    Parameter Name Required Type Description
    Action Yes String Common Params. The value used for this API: ModifyBlockIPList.
    Version Yes String Common Params. The value used for this API: 2018-03-17.
    Region No String Common Params. This parameter is not required for this API.
    LoadBalancerIds.N Yes Array of String CLB instance ID
    Type Yes String Operation type. Valid values:
  • add_customized_field (sets header initially to enable the blocklist feature)
  • set_customized_field (modifies header)
  • del_customized_field (deletes header)
  • add_blocked (adds IPs to blocklist)
  • del_blocked (deletes IPs from blocklist)
  • flush_blocked (clears blocklist)
  • ClientIPField Yes String Header field that stores real client IPs
    BlockIPList.N No Array of String List of blocked IPs. The array can contain up to 200,000 entries in one operation.
    ExpireTime No Integer Expiration time in seconds. Default value: 3600
    AddStrategy No String IP adding policy. Valid value: fifo (if a blocklist is full, new IPs added to the blocklist will adopt the first-in first-out policy)

    3. Output Parameters

    Parameter Name Type Description
    JodId String Async task ID
    RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

    4. Example

    Example1 Adding a Blocklist

    This example shows you how to add a blocklist. You should specify the header field containing the real client IP address and enable the blocklist feature. Then you can add a blocklist. You can delete or clear the blocklist in a similar way.

    Input Example

    https://clb.tencentcloudapi.com/?Action=ModifyBlockIPList
    &LoadBalancerIds.0=lb-6efswuxa
    &Type=add_blocked
    &BlockIPList.0=1.2.3.4
    &ExpireTime=3000
    &AddStrategy=fifo
    &ClientIPField=client_ip_test
    &<Common request parameters>
    

    Output Example

    {
        "Response": {
            "JodId": "localjob010916173469001234567890",
            "RequestId": "83329908-a282-4f9f-82ab-033a3025baff"
        }
    }
    

    Example2 Configuring the Header and Enabling the Blocklist Feature

    This example shows you how to use the blocklist feature. You should configure the header first to specify the header field containing the real client IP address, and then enable the blocklist feature.

    Input Example

    https://clb.tencentcloudapi.com/?Action=ModifyBlockIPList
    &LoadBalancerIds.0=lb-6efswuxa
    &Type=add_customized_field
    &ClientIPField=client_ip_test
    &<Common request parameters>
    

    Output Example

    {
        "Response": {
            "JodId": "localjob010916173469001234512345",
            "RequestId": "83329908-a282-4f9f-82ab-033a30212345"
        }
    }
    

    5. Developer Resources

    SDK

    TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

    Command Line Interface

    6. Error Code

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

    Error Code Description
    FailedOperation Operation failed.
    InternalError Internal error.
    InvalidParameter Parameter error.
    InvalidParameter.FormatError Wrong parameter format.
    InvalidParameterValue Incorrect parameter value.
    InvalidParameterValue.Length Wrong parameter length.
    MissingParameter Missing parameter.
    UnauthorizedOperation Unauthorized operation.