Copying a Key to a Specified Region
Function
Copy the key in the current region to the target region.
Calling Method
For details, see Calling APIs.
URI
POST /v2/{project_id}/kms/keys/{key_id}/replicate
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Project ID |
| key_id | Yes | String | ID of the key to be copied, which is 36-byte long and matches the regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$, for example, 0d0466b0-e727-4d9c-b35d-f84bb474a37f |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | User token. It can be obtained by calling the IAM API. The value of X-Subject-Token in the response header is the user token. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| key_id | Yes | String | ID of the key to be copied, which is 36-byte long and matches the regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$, for example, 0d0466b0-e727-4d9c-b35d-f84bb474a37f |
| replica_region | Yes | String | Target region code of the copied key, for example, cn-north-4 |
| key_alias | Yes | String | Alias of the copied new key |
| key_description | No | String | Description of the copied new key |
| enterprise_project_id | No | String | Enterprise multi-project ID for the copied new key
If you do not have the permission to create resources under the default enterprise project, an error will be reported. |
| replica_project_id | Yes | String | Project ID of the copied new key |
| tags | No | Array of TagItem objects | Tag list, which is the value pairs of tag keys and values. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| key | Yes | String | Key. The value can contain up to 36 unicodes. This parameter cannot be left empty. The following nonprintable characters cannot be included: ASCII(0-31), *, <, >, , and =. |
| value | No | String | Key. The value can contain up to 43 unicodes. This parameter can be left empty. The following nonprintable characters cannot be included: ASCII(0-31), *, <, >, , and =. |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| key_id | String | ID of the copied key, which is 36-byte long and matches the regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$, for example, 0d0466b0-e727-4d9c-b35d-f84bb474a37f |
| domain_id | String | User domain ID |
| region | String | Code of the region where the copied key is located, for example, cn-north-4 |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error | Object | Error message |
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code returned by the error request |
| error_msg | String | Error information returned by the error request |
Status code: 401
| Parameter | Type | Description |
|---|---|---|
| error | Object | Error message |
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code returned by the error request |
| error_msg | String | Error information returned by the error request |
Status code: 403
| Parameter | Type | Description |
|---|---|---|
| error | Object | Error message |
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code returned by the error request |
| error_msg | String | Error information returned by the error request |
Status code: 404
| Parameter | Type | Description |
|---|---|---|
| error | Object | Error message |
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code returned by the error request |
| error_msg | String | Error information returned by the error request |
Status code: 500
| Parameter | Type | Description |
|---|---|---|
| error | Object | Error message |
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code returned by the error request |
| error_msg | String | Error information returned by the error request |
Status code: 502
| Parameter | Type | Description |
|---|---|---|
| error | Object | Error message |
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code returned by the error request |
| error_msg | String | Error information returned by the error request |
Status code: 504
| Parameter | Type | Description |
|---|---|---|
| error | Object | Error message |
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code returned by the error request |
| error_msg | String | Error information returned by the error request |
Example Requests
{
"key_id" : "826314dd-1b5b-4037-b976-5f9b7a17df46",
"replica_region" : "cn-north-4",
"key_alias" : "replica_key_alias",
"replica_project_id" : "2b31ed520xxxxxxebedb6e57xxxxxxxx"
} Example Responses
Status code: 200
Request succeeded.
{
"key_id" : "8e85c00f-f7d0-47c9-ac96-548f977d16ba",
"domain_id" : "3bab8e245e854f68af5967c00dd43127",
"region" : "cn-north-4"
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Request succeeded. |
| 400 | Invalid request parameter. |
| 401 | Username and password are required for the requested page. |
| 403 | Authentication failed. |
| 404 | The resource does not exist. |
| 500 | Internal service error. |
| 502 | Request failed. The server has received an invalid response. |
| 504 | Gateway timed out. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.