Querying the Key Instance
Function
This API is used to query a key instance. You can use tags to filter and check CMK details.
Calling Method
For details, see Calling APIs.
URI
POST /v1.0/{project_id}/kms/{resource_instances}/action
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID. For details, see Obtaining a Project ID. Constraints N/A Range The value returned by the IAM API is used, which contains 32 characters. Default Value N/A |
| resource_instances | Yes | String | Definition Resource instance. The value is resource_instances. Constraints N/A Range The value is fixed at resource_instances. Default Value N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition 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. Constraints N/A Range Obtain the value by calling the IAM API for obtaining the user token. Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| limit | No | String | Definition Number of records to be queried Constraints Range 1 to 1000 Default Value If action is set to filter, the default value is 10. |
| offset | No | String | Definition Index location. The query starts from the next data specified by offset. When you query resources on subsequent pages, set offset to the location returned in the response body for the previous query. Constraints Range 0 to 1000 Default Value If the action is set to filter, offset is set to 0 by default. |
| action | No | String | Definition Operation ID Constraints N/A Range Default Value N/A |
| tags | No | Array of Tag objects | Definition Tag list, which is the value pairs of tag keys and values. Constraints
Range N/A Default Value N/A |
| matches | No | Array of TagItem objects | Definition Search field Constraints Range N/A Default Value N/A |
| sequence | No | String | Definition A 36-byte serial number of a request message, for example, 919c82d4-8046-4722-9094-35c3c6524cff. Constraints N/A Range N/A Default Value N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| resources | Array of ActionResources objects | Definition Resource instance list Range N/A |
| total_count | Integer | Definition Total number of records Range N/A |
| Parameter | Type | Description |
|---|---|---|
| resource_id | String | Definition Resource ID Range N/A |
| resource_detail | KeyDetails object | Key details. |
| resource_name | String | Definition Resource name Range N/A |
| tags | Array of TagItem objects | Definition Tag list. If there is no tag, the array is empty by default. Range N/A |
Example Requests
Query the key instance whose tag key is key1 and tag value is value1 or value2. The start position is 100 and 100 results are displayed.
{
"offset" : "100",
"limit" : "100",
"action" : "filter",
"tags" : [ {
"key" : "key1",
"values" : [ "value1", "value2" ]
} ]
} Example Responses
Status code: 200
Request succeeded.
{
"resources" : [ {
"resource_id" : "90c03e67-5534-4ed0-acfa-89780e47a535",
"resource_detail" : {
"key_id" : "90c03e67-5534-4ed0-acfa-89780e47a535",
"domain_id" : "4B688Fb77412Aee5570E7ecdbeB5afdc",
"key_alias" : "tagTest_xmdmi",
"key_description" : "123",
"creation_date" : "1521449277000",
"scheduled_deletion_date" : "",
"key_state" : "2",
"default_key_flag" : "0",
"key_type" : "1",
"key_rotation_enabled" : "false",
"expiration_time" : "",
"origin" : "kms",
"sys_enterprise_project_id" : "0",
"realm" : "test"
},
"resource_name" : "tagTest_xmdmi",
"tags" : [ {
"key" : "key",
"value" : "testValue!"
}, {
"key" : "haha",
"value" : "testValue"
} ]
} ],
"total_count" : 1
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Request succeeded. |
Error Codes
See Error Codes.