Files
doc-exports/docs/dns/api-ref/dns_api_67001.html
fanqinying 2d12bcbbc6 DNS API 20250327 version
Reviewed-by: Hajba, László Antal <laszlo-antal.hajba@t-systems.com>
Co-authored-by: fanqinying <fanqinying@huawei.com>
Co-committed-by: fanqinying <fanqinying@huawei.com>
2025-04-02 09:20:35 +00:00

12 KiB

Adding Resource Tags

Function

Add tags to a specified resource.

You can add up to 20 tags to a resource.

The 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

POST /v2/{project_id}/{resource_type}/{resource_id}/tags

For details, see Table 1.
Table 1 Parameters in the URI

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. You can obtain it in Obtaining a Project ID.

resource_type

Yes

String

Resource type.

  • DNS-public_zone
  • DNS-private_zone
  • DNS-public_recordset
  • DNS-private_recordset
  • DNS-ptr_record

resource_id

Yes

String

Resource ID

Request

  • Parameter description
    Table 2 Parameter in the request

    Parameter

    Mandatory

    Type

    Description

    tag

    Yes

    Object

    Tag

    For details, see Table 3.

    Table 3 Parameters in the tag list

    Parameter

    Mandatory

    Type

    Description

    key

    Yes

    String

    Tag key

    • Cannot be left blank.
    • Must be unique for each resource.
    • Can contain a maximum of 128 Unicode characters.
    • Can contain letters, digits, spaces, and the following characters: _ . : = + - @
    • Cannot start or end with a space, or cannot start with _sys_.

    value

    No

    String

    Tag value

    • Can be left blank.
    • Can contain a maximum of 255 Unicode characters.
    • Can contain letters, digits, spaces, and the following characters: _ . : = + - @
  • Example request
    Add tags for the private zone whose ID is ff8080825b8fc86c015b94bc6f8712c3:
    POST https://{DNS_Endpoint}/v2/{project_id}/DNS-private_zone/ff8080825b8fc86c015b94bc6f8712c3/tags
    {
        "tag": {
            "key": "key1", 
            "value": "value1"
        }
    }

Response

None

Returned Value

If a 2xx status code is returned, for example, 200, 202, or 204, the request is successful.

For details, see Status Code.