• Native OpenStack API

noa
  1. Help Center
  2. Native OpenStack API
  3. API Reference
  4. Nova
  5. Metadata
  6. Setting ECS Metadata

Setting ECS Metadata

Function Description

This interface is used to configure ECS metadata.

When you call this interface, all the metadata of this ECS will be deleted, and the ECS uses the value configured in the request.

URI

  • URI format

    PUT /v2/{tenant_id}/servers/{server_id}/metadata

    PUT /v2.1/{tenant_id}/servers/{server_id}/metadata

  • Parameter description

    Parameter

    Mandatory

    Description

    tenant_id

    Yes

    Specifies the tenant or project ID.

    server_id

    Yes

    Specifies the ECS ID.

Restrictions

The ECS must be in the active, stopped, paused, or suspended state. That is, the value of the OS-EXT-STS:vm_state attribute of the ECS must be active, stopped, paused, or suspended.

Extension Description

N/A

Request

Table 1 Request

Parameter

Type

Mandatory

Description

metadata

Dict

Yes

Specifies the user-defined metadata key-value pair.

Table 2 Data structure description of the metadata field

Parameter

Mandatory

Type

Description

key

Yes

String

Specifies the key name.

The value contains a maximum of 255 Unicode characters and cannot be empty. It can contain letters in upper or lower cases, digits, hyphens (-), underscores (_), colons (:), and periods (.).

value

Yes

String

Specifies the key value.

The value can contain a maximum of 255 Unicode characters.

Response

Parameter

Type

Mandatory

Description

metadata

Dict

Yes

Specifies the user-defined metadata key-value pair.

Request Example

{
"metadata": {
            "key1": "value1",
            "key2": "value2"
}
}

Response Example

{
"metadata": {
            "key1": "value1",
            "key2": "value2"
}
}

Returned Values

See General Request Returned Values.