Updated on 2024-08-09 GMT+08:00

Updating a Key Pair

Function

This API is used to update the key pair for connecting to the cloud phone.

URI

PUT /v1/{project_id}/cloud-phone/servers/open-access

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Specifies the project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Specifies the user token. It can be obtained by calling an Identity and Access Management (IAM) API. The value of X-Subject-Token in the response header is the user token.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

servers

Yes

Array of ServerKeypair objects

Specifies the information about the cloud phone server whose key pair is to be changed.

Table 4 ServerKeypair

Parameter

Mandatory

Type

Description

server_id

Yes

String

Specifies the cloud phone server ID, which can contain a maximum of 32 bytes.

keypair_name

Yes

String

Specifies the key pair name.

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

request_id

String

Specifies the unique request ID.

jobs

Array of ServerJob objects

Task information

Table 6 ServerJob

Parameter

Type

Description

server_id

String

Specifies the unique ID of a cloud phone server. This parameter is contained in tasks related to cloud phone servers.

job_id

String

Specifies the unique ID of a task.

error_code

String

Specifies the error code.

error_msg

String

Specifies the error message.

Example Requests

Modifying the Key Pair of the Corresponding Server in the Server List

PUT https://{CPH Endpoint}/v1/{project_id}/cloud-phone/servers/open-access

{
  "servers" : [ {
    "keypair_name" : "mykeypair",
    "server_id" : "ae4d231e44d2a4ccf612660a473fe1e3"
  }, {
    "keypair_name" : "mykeypair",
    "server_id" : "2347275010d3440d963d3fcb8931ff55"
  } ]
}

Example Responses

Status code: 200

OK

{
  "request_id" : "6837531fd3f54550927b930180a706bf",
  "jobs" : [ {
    "server_id" : "ae4d231e44d2a4ccf612660a473fe1e3",
    "job_id" : "1564567b8bab40f34711234cb80d0123"
  }, {
    "server_id" : "2347275010d3440d963d3fcb8931ff55",
    "job_id" : "1564567b8bab40f34711234cb80d5678"
  } ]
}

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.