tencent cloud

文档反馈

BindSecurityTemplateToEntity

最后更新时间:2024-12-03 16:17:23

    1. API Description

    Domain name for API request: teo.intl.tencentcloudapi.com.

    This API is used to bind/unbind a domain name to/from a specific policy template.

    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: BindSecurityTemplateToEntity.
    Version Yes String Common Params. The value used for this API: 2022-09-01.
    Region No String Common Params. This parameter is not required.
    ZoneId Yes String Site ID of the policy template to be bound to or unbound from.
    Entities.N Yes Array of String List of domain names to bind to/unbind from a policy template
    Operate Yes String Action options. Values include:
  • bind: Bind the domain names to the specified policy template
  • unbind-keep-policy: Unbind a domain name from a policy template and keep the current policy when unbinding
  • unbind-use-default: Unbind domain names from policy templates and use default blank policy.
  • Note: Only one domain name can be unbound at one time. When Operate is unbind-keep-policy or unbind-use-default, there can only be one domain name specified in Entities.
    TemplateId Yes String Specifies the ID of the policy template or the site's global policy to be bound or unbound.
    - To bind to a policy template, or unbind from it, specify the policy template ID.
    - To bind to the site's global policy, or unbind from it, use the @ZoneLevel@domain parameter value.

    Note: After unbinding, the domain name will use an independent policy and rule quota will be calculated separately. Please make sure there is sufficient rule quota before unbinding.
    OverWrite No Boolean Whether to replace the existing policy template bound with the domain name. Values:
  • true: Replace the template bound to the domain.
  • false: Do not replace the template.
  • Note: In this case, the API returns an error if there is already a policy template bound to the specified domain name.

    3. Output Parameters

    Parameter Name Type Description
    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 Unbinding a domain name from a policy template

    In this example, we unbind the domain name a.test.com from the policy template temp-cuwg1hki of the site zone-2aq0e8rhu6jx. Only one domain name can be unbound at one time. There are two options:

    1. unbind-keep-policy: Unbind the domain name from the specified policy and create a new policy for the domain name with the same configuration as the original one. This takes additional rule quota.
    2. unbind-use-default: Unbind the domain name from the specified policy and then bind it with the default policy with default configurations. Custom rules no longer take effect.

    Note: To use unbind-keep-policy, make sure your rule quota is enough. If the remaining quota is insufficient, the unbinding fails and the domain name remains bound to the current policy template.

    Input Example

    POST / HTTP/1.1
    Host: teo.intl.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: OperateSecurityTemplate
    <Common request parameters>
    
    {
        "ZoneId": "zone-2aq0e8rhu6jx",
        "Entities": [
            "a.test.com"
        ],
        "TemplateId": "temp-cuwg1hki",
        "Operate": "unbind-keep-policy"
    }
    

    Output Example

    {
        "Response": {
            "RequestId": "09ce3d28-1119-49cd-xxxx-27cb34dac669"
        }
    }
    

    Example2 Binding domain names to a policy template

    In this example, we bind two domain names (a.test.com and b.example.com) to the policy template temp-cuwg1hki under the site zone-2aq 0e8rhu6jx.

    Note: You need to have permissions to the related sites.

    Input Example

    POST / HTTP/1.1
    Host: teo.intl.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: OperateSecurityTemplate
    <Common request parameters>
    
    {
        "ZoneId": "zone-2aq0e8rhu6jx",
        "Entities": [
            "a.test.com",
            "b.example.com"
        ],
        "TemplateId": "temp-cuwg1hki",
        "Operate": "bind",
        "OverWrite": true
    }
    

    Output Example

    {
        "Response": {
            "RequestId": "09ce3d28-1119-49cd-xxxx-27cb34dac669"
        }
    }
    

    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
    InternalError.ConfigLocked The configuration is locked. Please unlock and try again.
    InternalError.ProxyServer An unknown error occurred in the backend server.
    InvalidParameter.Security Invalid parameter.
    OperationDenied Operation denied.
    ResourceInUse The resource is occupied.
    UnauthorizedOperation.CamUnauthorized CAM is not authorized.
    UnsupportedOperation Unsupported operation.
    联系我们

    联系我们,为您的业务提供专属服务。

    技术支持

    如果你想寻求进一步的帮助,通过工单与我们进行联络。我们提供7x24的工单服务。

    7x24 电话支持