Copying an SSH Key Pair (V2)
Function
A tenant may contain multiple users. This function allows you to copy the key pair from the target user to the current user under the same tenant account.
URI
Requests
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| user_name | Yes | String | Name of the target user under the same tenant account |
| force | No | Boolean | Indicates whether to forcibly overwrite an existing key pair. |
Responses
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| changed | Yes | Integer | Number of copied key pairs. |
| success | Yes | Array of objects | List of key pairs that were successfully copied. For details, see Table 4. |
| failed | Yes | Array of objects | List of key pairs that failed to be copied. For details, see Table 4. |
Examples
- Example request
{ "user_name": "kpsuser" }
- Example response
{ "changed": 2, "success": [ { "keypair": "KeyPair-test1", "message": "imported" }, { "keypair": "KeyPair-test2", "message": "imported" } ], "failed": [ { "keypair": "KeyPair-test3", "message": "exist" } ] }or
{ "error_code": "KPS.XXXX", "error_msg": "XXXX" }
Status Code
For details, see Status Codes.
Last Article: Deleting an SSH Key Pair (V2)
Next Article: Application Examples
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.