• Native OpenStack API

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

Configuring ECS Metadata

Function

This API is used to configure ECS metadata.

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

Constraints

An ECS must be in active, stopped, paused, or suspended state, which is specified by OS-EXT-STS:vm_state.

URI

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

Table 1 describes the parameters in the URI.
Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Specifies the project ID.

server_id

Yes

Specifies the ECS ID.

Request

Request parameters

Table 2 describes the request parameters.

Table 2 Request

Parameter

Type

Mandatory

Description

metadata

Dict

Yes

Specifies the user-defined metadata key-value pair.

Table 3 Data structure description of the metadata field

Parameter

Type

Mandatory

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

Response parameters

Table 4 describes the response parameters.

Table 4 Response parameters

Parameter

Type

Description

metadata

Dict

Specifies the user-defined metadata key-value pair.

Examples

  • Example request
    {
    "metadata": {
                "key1": "value1",
                "key2": "value2"
    }
    }
  • Example response
    {
    "metadata": {
                "key1": "value1",
                "key2": "value2"
    }
    }

Returned Values

See General Request Returned Values.