move doc sources to other location Reviewed-by: OpenTelekomCloud Bot <None>
10 KiB
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
PUT /v2/{project_id}/servers/{server_id}/metadata
Request
Table 2 describes the request parameters.
Parameter |
Type |
Mandatory |
Description |
---|---|---|---|
metadata |
Object |
Yes |
Specifies the user-defined metadata key-value pair. For a metadata key: A key contains a maximum of 255 Unicode characters and cannot be empty. A key can contain uppercase letters (A-Z), lowercase letters (a-z), digits (0-9), hyphens (-), underscores (_), colons (:), and periods (.). For a metadata value: A value contains a maximum of 255 Unicode characters. |
Response
Table 3 describes the response parameters.
Example Request
PUT https://{endpoint}/v2/{project_id}/servers/{server_id}/metadata PUT https://{endpoint}/v2.1/{project_id}/servers/{server_id}/metadata
{ "metadata": { "key1": "value1", "key2": "value2" } }
Example Response
{ "metadata": { "key1": "value1", "key2": "value2" } }