• MapReduce Service

mrs
  1. Help Center
  2. MapReduce Service
  3. API Reference
  4. APIs
  5. Tag Management APIs
  6. Adding or Deleting Cluster Tags in Batches

Adding or Deleting Cluster Tags in Batches

Function

This API is used to add or delete tags to or from a specified cluster in batches.

You can add a maximum of 10 tags to a cluster.

This API is idempotent.

If a tag to be created has the same key as an existing tag in a cluster, the tag will overwrite the existing one.

When tags are being deleted and some tags do not exist, the operation is considered successful by default. The character set of the tags will not be checked. A key and a value can respectively contain up to 36 and 43 Unicode characters. When tags are deleted, the tag structure body cannot be missing, and the key cannot be left blank or set to an empty string.

URI

  • Format

    POST /v1.1/{project_id}/clusters/{cluster_id}/tags/action

  • Parameter description
    Table 1 URI parameter description

    Parameter

    Mandatory or Not

    Description

    project_id

    Yes

    Project ID. For details on how to obtain the project ID, see Obtaining a Project ID.

    cluster_id

    Yes

    Cluster ID

Request

  • Example:
    { 
        "action": "create", 
        "tags": [ 
            { 
                "key": "key1", 
                "value": "value1" 
            }, 
            { 
                "key": "key", 
                "value": "value3" 
            } 
        ] 
    } 
  • Parameter description
    Table 2 Request parameter description

    Parameter

    Mandatory or Not

    Type

    Description

    action

    Yes

    String

    Operation identifier

    • create: Create tags
    • delete: Delete tags

    tags

    Yes

    List<tag>

    Tag list. For details about parameter description, see Table 3.

    Table 3 tag field description

    Parameter

    Mandatory or Not

    Type

    Description

    key

    Yes

    String

    Tag key. A tag key can contain only uppercase letters, lowercase letters, digits, hyphens (-), and underscores (_).

    value

    Yes

    String

    Tag value. A tag value can contain only uppercase letters, lowercase letters, digits, hyphens (-), and underscores (_).

    Note:

    • This parameter is mandatory for adding tags.
    • This parameter is optional for deleting tags.

Response

  • Example

    None

  • Parameter description

    None

Status Code

Table 4 describes the status code of this API.

Table 4 Status code

Status Code

Description

204

No Content