7.Key pair
1. Import key pair
API address: /v1/keystore/loadAdbKey
Request method:POST
Request data type:application/json
Response data type:*/*,application/json
Supported version:v1.4.0
API description:
Import the key pair
Request parameters:
| Parameter name | Parameter description | Location | Whether required | Data type | Description |
|---|---|---|---|---|---|
| projectId | Project Id | body | false | string | Defaults to the current user's default project |
| name | Key pair name | body | true | string | |
| type | Type | body | true | string | Fixed value [ 2 ] |
| publicKey | Public key | body | true | string | |
| remark | Remarks | body | false | string |
Request example. Replace parameter values in the actual request:
POST "/openapi/v1/keystore/loadAdbKey"
body:
{
"name": "btnt1",
"projectId": "project_admin",
"publicKey": "QAAAAJMd+fRldygaF366zSFm26/pqYq9biFDO85oQtRBIlCHtXPxlVMVL0gAYP9JcZFqmDpdfBHi19zAl29l2+CW5Smy9py7YT3y09x/3aTaliXd4GK9LtR0UQdDtH3nR/e0dYLG3PtUP1T+t0w3t8Mcyad+Q7VvJmtDAcggKp9e0wcXSJSqUFXAP5J4TtnOtaud4RHcqKeGZ8t1f36qhlSG8NPUDr9vjrQhKoS8d803KfvF/WEzCf+5VspPtB7U0JuBsFzBtPiSrDAAkDedX//6pFehVbya58lmwkv6quXwZ9TdGzKXAkzx+KjxD421ZOoRvH6J4pDX1GLfbhJogh6j95O5h7/cZGLsOTfNQjn929660+Wtjn/v0WjjrPmM6/1WqEtpL8H4n9WmFHbtJPQBV8SSj420fEa5UlojEGWg3bWccI6wRjyyT1GFQe3R6gT6t9vdRL3EvPKFl4YgE9N9wKAsVqWzFEN6tO1YfRQSGnEf+6PQeYFB3iRNllbq8ZU3d+n5GX1LOQWqlxuG+bGbrqL4y6JPbcRdGJYQtjZuqWDdrMgrExt5Glo+v8XvSod7vaIdia79G5LL8T/u5Wi+uKHb35seJssYv4Imjw6jxiFnsqhEiQDRCHs9A2OhQMg1xT0agP4l95LoFCrLL53wr9OV4MGsbu+TcgPyC/zxFyVbRZ22ugEAAQA= root@docker-swarm-3",
"type": 2
}
Response parameters:
| Parameter name | Parameter description | Type | Description |
|---|---|---|---|
| code | Return code | integer(int32) | |
| message | Return processing message | string | |
| result | Returned data object | object | |
| jobId | Task ID | string | |
| uuid | Container uuid | string | |
| status | Task status code | integer | 0:failed 2:succeeded |
| beginTime | Start time | string | |
| endTime | End time | string | |
| timestamp | Timestamp | integer(int64) | |
| traceId | Request processing ID | string |
Response example:
{
"message": "操作成功!",
"code": 200,
"result": {
"uuid": "47b78ac884fb44ec8ac5843d54060be0",
"jobId": "4730ee885e6845ec8a4f026fe90e7920",
"status": 2,
"beginTime": "2024-01-17 16:14:21",
"endTime": "2024-01-17 16:14:22"
},
"timestamp": 1705479262853,
"traceId": "C20240117161421507001"
}
2. Bind key pair to container
API address: /v1/keystore/bindInstancesAdbKey
Request method:POST
Request data type:application/json
Response data type:*/*,application/json
Supported version:v1.4.0
callbackUrl provided by version v1.7.4
API description:
Bind a key pair to the container
Request parameters:
| Parameter name | Parameter description | Location | Whether required | Data type | Description |
|---|---|---|---|---|---|
| secretKeyId | Key pair id | body | true | string | uuid returned by the create key API |
| instanceUuids | Container uuid list | body | true | list | Single or multiple data entries |
| callbackUrl | Notification callback address | body | false | string | POST request |
Request example. Replace parameter values in the actual request:
POST "/openapi/v1/keystore/bindInstancesAdbKey"
body:
{
"instanceIds": [
"i-236a0f378e9f109584d13c3591c42dff",
"i-39757fe1833c29fd0ef8263b8d2f46d3"
],
"secretKeyId": "9b6a005ee876312e0bdf2b7a3de2c4e6"
}
Response parameters:
| Parameter name | Parameter description | Type | Description |
|---|---|---|---|
| code | Return code | integer(int32) | |
| message | Return processing message | string | |
| result | Returned data object | object | |
| jobId | Task ID | string | |
| code | Task submission status code | integer | 200 when the task is submitted successfully; otherwise, the task submission failed |
| message | Task description | string | |
| uuid | Container uuid | string | |
| traceId | Request processing ID | string | |
| timestamp | Timestamp | integer(int64) |
Response example:
{
"message": "操作成功!",
"code": 200,
"result": [
{
"uuid": "i-236a0f378e9f109584d13c3591c42dff",
"jobId": "ff3144359ef54e4eb18f295b3f45f9e2",
"code": 200,
"message": "SUCCESS"
},
{
"uuid": "i-39757fe1833c29fd0ef8263b8d2f46d3",
"jobId": "c152d74720c64228b8b14e52e754fe1d",
"code": 200,
"message": "SUCCESS"
}
],
"timestamp": 1705482616364,
"traceId": "C20240117171016046003"
}
3. Unbind key pair from container
API address: /v1/keystore/unbindInstancesAdbKey
Request method:POST
Request data type:application/json
Response data type:*/*,application/json
Supported version:v1.4.0
callbackUrl provided by version v1.7.4
API description:
Unbind the key pair from the container
Request parameters:
| Parameter name | Parameter description | Location | Whether required | Data type | Description |
|---|---|---|---|---|---|
| secretKeyId | Key pair id | body | true | string | uuid returned by the create key API |
| instanceUuids | Container uuid list | body | true | list | Single or multiple data entries |
| callbackUrl | Notification callback address | body | false | string | POST request |
Request example. Replace parameter values in the actual request:
POST "/openapi/v1/keystore/unbindInstancesAdbKey"
body:
{
"instanceIds": [
"i-236a0f378e9f109584d13c3591c42dff",
"i-39757fe1833c29fd0ef8263b8d2f46d3"
],
"secretKeyId": "9b6a005ee876312e0bdf2b7a3de2c4e6"
}
Response parameters:
| Parameter name | Parameter description | Type | Description |
|---|---|---|---|
| code | Return code | integer(int32) | |
| message | Return processing message | string | |
| result | Returned data object | object | |
| jobId | Task ID | string | |
| code | Task submission status code | integer | 200 when the task is submitted successfully; otherwise, the task submission failed |
| message | Task description | string | |
| uuid | Container uuid | string | |
| traceId | Request processing ID | string | |
| timestamp | Timestamp | integer(int64) |
Response example:
{
"message": "操作成功!",
"code": 200,
"result": [
{
"uuid": "i-236a0f378e9f109584d13c3591c42dff",
"jobId": "ff3144359ef54e4eb18f295b3f45f9e2",
"code": 200,
"message": "SUCCESS"
},
{
"uuid": "i-39757fe1833c29fd0ef8263b8d2f46d3",
"jobId": "c152d74720c64228b8b14e52e754fe1d",
"code": 200,
"message": "SUCCESS"
}
],
"timestamp": 1705482616364,
"traceId": "C20240117171016046003"
}
4. Key pair list
API address: /v1/keystore/listAdbKey
Request method:POST
Request data type:application/json
Response data type:*/*,application/json
Supported version:v1.4.0
API description:
Paginated retrieval of ADB key pairs in the system
Request parameters:
| Parameter name | Parameter description | Location | Whether required | Data type | Description |
|---|---|---|---|---|---|
| projectId | Project Id | body | false | string | Defaults to the current user's default project |
| pageNum | Current page number | false | integer | Default 1 | |
| pageSize | Amount of data on the current page | false | integer | Default 10 |
Request example. Replace parameter values in the actual request:
POST "/openapi/v1/keystore/listAdbKey"
body:
{
"pageNum": 1,
"pageSize": 10,
"projectId": "project_admin"
}
Response parameters:
| Parameter name | Parameter description | Type | Description |
|---|---|---|---|
| code | Return code | integer(int32) | |
| message | Return processing message | string | |
| result | Returned data object | object | |
| records | Data list on the current page | list<object> | |
| id | Key pair id | string | |
| name | Key pair name | string | |
| digest | Summary | string | Remove colon |
| digestColon | Summary | string | |
| publicKey | Public key | string | |
| remark | Remarks | string | |
| createTime | Creation time | string | |
| bindInstanceNum | Number of bound containers | integer | |
| createUserId | User id | long | |
| username | Username | string | |
| total | Total number of records | integer | |
| current | Current page number | integer | |
| pages | Total pages | integer | |
| size | Number of items displayed per page | integer | |
| timestamp | Timestamp | integer(int64) | |
| traceId | Request processing ID | string |
Response example:
{
"message": "操作成功!",
"code": 200,
"result": {
"records": [
{
"id": "47b78ac884fb44ec8ac5843d54060be0",
"name": "btnt1",
"digest": "12E1B68B6E10A550358B4538B232D1F2",
"digestColon": "12:E1:B6:8B:6E:10:A5:50:35:8B:45:38:B2:32:D1:F2",
"publicKey": "QAAAAJMd+fRldygaF366zSFm26/pqYq9biFDO85oQtRBIlCHtXPxlVMVL0gAYP9JcZFqmDpdfBHi19zAl29l2+CW5Smy9py7YT3y09x/3aTaliXd4GK9LtR0UQdDtH3nR/e0dYLG3PtUP1T+t0w3t8Mcyad+Q7VvJmtDAcggKp9e0wcXSJSqUFXAP5J4TtnOtaud4RHcqKeGZ8t1f36qhlSG8NPUDr9vjrQhKoS8d803KfvF/WEzCf+5VspPtB7U0JuBsFzBtPiSrDAAkDedX//6pFehVbya58lmwkv6quXwZ9TdGzKXAkzx+KjxD421ZOoRvH6J4pDX1GLfbhJogh6j95O5h7/cZGLsOTfNQjn929660+Wtjn/v0WjjrPmM6/1WqEtpL8H4n9WmFHbtJPQBV8SSj420fEa5UlojEGWg3bWccI6wRjyyT1GFQe3R6gT6t9vdRL3EvPKFl4YgE9N9wKAsVqWzFEN6tO1YfRQSGnEf+6PQeYFB3iRNllbq8ZU3d+n5GX1LOQWqlxuG+bGbrqL4y6JPbcRdGJYQtjZuqWDdrMgrExt5Glo+v8XvSod7vaIdia79G5LL8T/u5Wi+uKHb35seJssYv4Imjw6jxiFnsqhEiQDRCHs9A2OhQMg1xT0agP4l95LoFCrLL53wr9OV4MGsbu+TcgPyC/zxFyVbRZ22ugEAAQA= root@docker-swarm-3",
"remark": null,
"createTime": "2024-01-17 16:14:22",
"createUserId": 7,
"bindInstanceNum": 0,
"username": "zlf"
}
],
"total": 1,
"current": 1,
"size": 10,
"pages": 1
},
"timestamp": 1705482652441,
"traceId": "C20240117171052441005"
}