All Products
Search
Document Center

Alibaba Cloud CDN:BatchSetCdnDomainConfig

Last Updated:Jan 13, 2023

Configures multiple accelerated domain names at a time.

Operation Description

Note
  • You can call this operation up to 30 times per second per account.
    • You can specify multiple domain names and must separate them with commas (,). You can specify up to 50 domain names in each call.
    • If the BatchSetCdnDomainConfig operation is successful, a unique configuration ID (ConfigId) is generated. You can use configuration IDs to update or delete configurations. For more information, see Usage notes on ConfigId.

    Authorization information

    The following table is the authorization information corresponding to the API, which can be found in the RAM permission policy statement.Action Used in the element to grant the RAM user or RAM role permission to call this API. The specific instructions are as follows:

    • Operation: the value that you can use in the Action element to specify the operation on a resource.
    • Access level: the access level of each operation. The levels are read, write, and list.
    • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
      • The required resource types are displayed in bold characters.
      • If the permissions cannot be granted at the resource level, All resources is used in the Resource type column of the operation.
    • Condition keyword: refers to the condition keyword defined by the cloud product itself.
    • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
    Operate access level Resource type conditional keyword Association operation
    cdn:BatchSetCdnDomainConfig WRITE
    • CDN
      acs:cdn:*:{#accountId}:domain/*
      without
    without

    Request parameters

    Parameter Type Required Description Example
    DomainNames string Yes

    The accelerated domain name. Separate multiple accelerated domain names with commas (,).

    www.example.com
    Functions string Yes

    The features that you want to configure. Format:

    • functionName: the name of the feature. This parameter is required. Separate multiple values with commas (,). For more information, see A list of features.
    • argName: the feature parameter for functionName. This parameter is required. You can specify multiple feature parameters.
    • argValue: the parameter value that is specified for functionName. This parameter is required.
    • parentid: the rule condition ID. This parameter is optional. You can use the condition rule engine to create a rule condition. For information, see BatchSetCdnDomainConfig and SetCdnDomainStagingConfig. A rule condition can identify parameters that are included in requests and filter requests based on the identified parameters. After you create a rule condition, a configid is generated. configid can be used as parentId that is referenced by other features. This way, you can combine rule conditions and features for flexible configurations.

    If you set parentId to -1, the existing rule conditions in the configurations are deleted.

    [{
       "functionArgs": [{
         "argName": "Parameter A", 
         "argValue": Value of parameter A"
        }, 
      {
        "argName": "Parameter B", 
        "argValue": "Value of parameter B"
         }], 
     "functionName": "Feature name"
     "parentId": "Optional, which corresponds to configid of the referenced rule condition"
    }]

    The following code shows a sample configuration if parentId is not used.

    In this example, the origin_request_header feature is used to add back-to-origin HTTP headers, and the rule condition whose configuration ID is 222728944812032 is referenced.

    [{
            "functionArgs": [{
                "argName": "header_operation_type",
                "argValue": "add"
            }, {
                "argName": "header_name",
                "argValue": "Accept-Encoding"
            }, {
                "argName": "header_value",
                "argValue": "gzip"
            }, {
                "argName": "duplicate",
                "argValue": "off"
            }],
            "functionName": "origin_request_header"
    }]

    The following code shows a sample configuration if parentId is used.

    In this example, the origin_request_header feature is used to add back-to-origin HTTP headers, and the rule condition whose configuration ID is 222728944812032 is referenced.

    [{
            "functionArgs": [{
                "argName": "header_operation_type",
                "argValue": "add"
            }, {
                "argName": "header_name",
                "argValue": "Accept-Encoding"
            }, {
                "argName": "header_value",
                "argValue": "gzip"
            }, {
                "argName": "duplicate",
                "argValue": "off"
            }],
            "functionName": "origin_request_header",
            "parentId": "222728944812032"
    }]
    [{"functionArgs": [{"argName": "key","argValue": "Content-Encoding"},{"argName": "value","argValue": "gzip"}],"functionName": "set_resp_header"} ]

    Response parameters

    Parameter Type Description Example
    object
    RequestId string

    The ID of the request.

    04F0F334-1335-436C-A1D7-6C044FE73368
    DomainConfigList array

    The list of domain configurations.

    object
    ConfigId long

    The ID of the configuration.

    1234567
    DomainName string

    The domain name.

    www.example.com
    FunctionName string

    The name of the feature.

    set_resp_header

    Example

    Normal return example

    JSONFormat

    {
      "RequestId": "04F0F334-1335-436C-A1D7-6C044FE73368",
      "DomainConfigList": {
        "DomainConfigModel": [
          {
            "ConfigId": 1234567,
            "DomainName": "www.example.com",
            "FunctionName": "set_resp_header"
          }
        ]
      }
    }

    Error codes

    Http code Error code Error message
    400 InvalidFunctions.Malformed The specified Functions is incorrectly formatted.
    400 InvalidArgValue.Malformed The specified ArgValue is invalid.
    400 Invalid%s.ValueNotSupported [%s] is not supported.
    400 Invalid%s.Malformed The specified ArgValue [%s] is invalid.
    400 MissingParameter%s The specified value of ArgName[%s] is missing.
    400 InvalidFunctionArgs.Malformed The specified FunctionArgs is invalid.
    400 MissingParameter The specified ArgValue is missing.
    400 InvalidHeaderKey.ValueNotSupported The specified value of parameter HeaderKey is not supported.
    400 TooManyDomains The count of domain is over 50.
    400 InvalidRule.Malformed %s
    400 ConfigurationConflicts The staging environment has a configuration in effect and cannot modify the production environment configuration.
    400 InvalidFunction.NotSupported The domain is not supported to set the function.
    400 InvalidDomain.BelongToConfigGroup This Domain activated in configuration group and should modify by config group.
    400 EntityNotExist.Role EntityNotExist.Role
    400 MissingParameterFunctions The specified value of Functions is missing.
    400 NoPermission.SLR The current user does not have permission to create servicelinkedrole. Please contact the Alibaba Cloud account or administrator to authorize AliyunCDNFullAccess or custom policy:Service Name:cdn-ddos.cdn.aliyuncs.com,Role: AliyunServiceRoleForCDNAccessingDDoS,Permission: ram: CreateServiceLinkedRole
    400 ConfigExceedLimit Count of config entries exceeds the limit.

    For a list of error codes, visit the API error center.