Updated on 2023-11-21 GMT+08:00

Adding a Protected Instance Tag

Function

You can add a maximum of 10 tags to a protected instance.

This API is idempotent.

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

URI

  • URI format

    POST /v1/{project_id}/protected-instances/{protected_instance_id}/tags

  • Parameter description

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Specifies the project ID.

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

    protected_instance_id

    Yes

    String

    Specifies the ID of a protected instance.

    For details, see Querying Protected Instances.

Request

  • Parameter description

    Parameter

    Mandatory

    Type

    Description

    tag

    Yes

    Object

    Specifies the tag to be added.

    For details, see Table 1.

    Table 1 tag field description

    Parameter

    Mandatory

    Type

    Description

    key

    Yes

    String

    Specifies the tag key. The tag key of a resource must be unique.

    It can contain up to 36 Unicode characters. The key cannot be left blank or be an empty string. It cannot contain non-printable ASCII characters (0–31) or special characters, including asterisks (*), left angle brackets (<), right angle brackets (>), backslashes (\), equal signs (=), commas (,), vertical bars (|), and slashes (/). The key cannot be left blank, and must be unique for each resource.

    value

    Yes

    String

    Specifies the tag value.

    It can contain up to 43 Unicode characters. The value cannot be left blank but can be an empty string. It cannot contain non-printable ASCII characters (0–31) or special characters, including asterisks (*), left angle brackets (<), right angle brackets (>), backslashes (\), equal signs (=), commas (,), vertical bars (|), and slashes (/).

  • Example request
    POST https://{Endpoint}/v1/{project_id}/protected-instances/67a2cc7e-fb87-41a8-ba28-9c032abcaee1/tags
    {
        "tag": {
            "key": "DEV",
            "value": "DEV1"
        }
    }

Response

  • Example response

    None

Returned Value

  • Normal

    Returned Value

    Description

    204

    No Content

  • Abnormal

    Returned Value

    Description

    400

    Invalid parameters.

    401

    Authentication failed.

    403

    Insufficient permission.

    404

    The requested resource was not found.

    500

    Internal service error.