创建密钥对
接口描述
POST /compute/bms/data/v1/subscriptions/{subscription_name}/resourceGroups/{resource_group_name}/zones/{zone}/kaypair/create
请求头(Request Header)
请求参数(Request Parameters)
| 名称 | 类型 | 必须 | 位置 | 默认值 | 取值范围 | 描述 |
|---|---|---|---|---|---|---|
| subscription_name | string | 否 | path | - | - | 订阅 |
| resource_group_name | string | 否 | path | - | - | 资源组 |
| zone | string | 否 | path | - | - | 可用区 |
请求体(Request Body)
| 参数名 | 类型 | 必须 | 默认值 | 取值范围 | 描述 |
|---|---|---|---|---|---|
| name | string | 是 | - | - | 密钥对名称 |
请求示例(Request Example)
curl -L -X POST 'https://bms.cn-sh-01.sensecoreapi.dev/compute/bms/data/v1/subscriptions/2488c031-873f-4396-8b9e-98c68ca016ae/resourceGroups/default/zones/cn-sh-01a/keypair/create' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: xxx' \
--data-raw '{
"name": "test"
}'
响应参数(Response Parameters)
| 名称 | 类型 | 描述 |
|---|---|---|
| code | string | 响应码 |
| message | string | 响应消息 |
| data | object | 创建的密钥对数据 |
其中,data的参数如下:
| 名称 | 类型 | 描述 |
|---|---|---|
| id | string | 密钥对 id |
| name | string | 密钥对名称 |
| public_key | string | 公钥 |
| private_key | string | 私钥 |
| key_id | string | 公钥 id |
| tenant_id | string | 租户 id |
| user_id | string | 用户 id |
| tags | string | 标签 |
| instances | object | 绑定实例列表 |
| create_time | string | 创建时间 |
| update_time | string | 更新时间 |
其中,instances的参数如下:
| 名称 | 类型 | 描述 |
|---|---|---|
| id | string | 裸金属实例 id |
| name | string | 裸金属实例标识 |
| display_name | string | 裸金属实例名称 |
响应示例(Response Example)
{
"code": 0,
"message": "",
"data": {
"id": "0AF000F7000018B84B16EF799F891E59",
"name": "test",
"public_key": "",
"private_key": "",
"key_id": "",
"tenant_id": "",
"user_id": "",
"tags": {},
"instances": [],
"create_time": "2023-10-31T07:45:02.712946597Z",
"update_time": "2023-10-31T07:45:02.712947080Z"
}
}