Querying Instances by Tags
Function
This API is used to query instance by tags.
Calling Method
For details, see Calling APIs.
URI
POST /v2/{project_id}/cbs/instance/filter
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID, which uniquely identifies a project. To obtain the value, see Obtaining a Project ID. Constraints N/A Range The value can contain 32 characters. Only letters and digits are allowed. Default Value N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition User token. You can obtain the token by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. For details, see Obtaining a User Token. Constraints N/A Range String type. The value can contain 1 to 28,000 characters. Default Value N/A |
| limit | No | String | Number of queried records. This parameter is not displayed if action is set to count. The default value is 1000 if action is set to filter. The value must be an integer ranging from 1 to 1000. |
| offset | No | String | Specifies the index position. This parameter is unavailable when action is set to count. If offset is set to N, the resource query starts from the N+1 piece of data. If action is set to filter, offset is 0 by default, indicating that the query starts from the first piece of data. offset must be a non-negative number. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| without_any_tag | No | Boolean | Specifies any tag that is not contained. If this parameter is set to true, all resources without tags are queried. In this case, the tags, tags_any, not_tags, and not_tags_any fields are ignored. |
| tags | No | Array of Tags objects | Resources with tags listed in this field. A maximum of 50 tags can be specified. Each tag key can have a maximum of 10 tag values. Each tag value can be an empty array but the structure cannot be missing. |
| tags_any | No | Array of Tags objects |
|
| not_tags | No | Array of Tags objects |
|
| not_tags_any | No | Array of Tags objects |
|
| sys_tags | No | Array of Tags objects |
|
| matches | No | Array of Match objects |
|
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| resources | Array of Resources objects | Resource instance details obtained by the query mode. |
| total_count | Integer | Total records. |
| Parameter | Type | Description |
|---|---|---|
| resource_id | String | Instance ID. |
| resource_detail | InstanceDetail object | CBH instance details |
| tags | Array of ResourceTag objects | Tags. |
| sys_tags | Array of ResourceTag objects | sys_tags. |
| resource_name | String | Resource name. |
| Parameter | Type | Description |
|---|---|---|
| name | String | Definition CBH instance name. Range String type. The value can contain 1 to 65 characters. |
| server_id | String | Definition ID of the server housing the CBH instance. Range String type. The value can contain 1 to 64 characters. |
| instance_id | String | Definition CBH instance ID. Range String type. The value can contain 1 to 36 characters. |
| alter_permit | Boolean | Definition Whether the CBH instance can be expanded. Range |
| enterprise_project_id | String | Definition Enterprise project ID. Range String type. The value can contain 1 to 36 characters. |
| period_num | String | Definition Number of subscription periods of the CBH instance, in years or months. Range String type. The value can contain 1 to 36 characters. |
| start_time | String | Definition Start time of the CBH instance (discarded). Range Timestamp string. The value can contain 1 to 13 characters. |
| end_time | String | Definition End time of the CBH instance (discarded). Range Timestamp string. The value can contain 1 to 13 characters. |
| created_time | String | Definition Time when the CBH instance is created. The format is yyyy-MM-dd HH:mm:ss.S. Range String type. The value can contain 1 to 25 characters. |
| upgrade_time | Long | Definition Millisecond timestamp corresponding to the scheduled upgrade time. Range N/A |
| update | String | Definition Whether the CBH instance can be upgraded. Range |
| bastion_version | String | Definition Current version of the CBH instance. Range String type. The value can contain 1 to 36 characters. |
| az_info | az_info object | Definition AZ information. Range N/A |
| status_info | status_info object | Definition Status information. Range N/A |
| resource_info | resource_info object | Definition Resource information. Range N/A |
| network | network object | Definition Network information. Range N/A |
| ha_info | ha_info object | Definition Primary and standby node information. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| region | String | Definition ID of the region where the CBH instance is located. Range String type. The value can contain 1 to 36 characters. |
| zone | String | Definition ID of the AZ where the CBH instance is located. (If the instance is deployed in primary/standby mode, this parameter indicates the AZ ID of the primary instance.) Range String type. The value can contain 1 to 36 characters. |
| availability_zone_display | String | Definition Name of the AZ where the CBH instance is located. (If the instance is deployed in primary/standby mode, this parameter indicates the AZ name of the primary instance.) Range String type. The value can contain 1 to 36 characters. |
| slave_zone | String | Definition AZ where the standby host of the CBH instance is located. Range String type. The value can contain 1 to 36 characters. |
| slave_zone_display | String | Definition Name of the AZ where the standby host of the CBH instance is located. Range String type. The value can contain 1 to 36 characters. |
| Parameter | Type | Description |
|---|---|---|
| status | String | Definition CBH instance status. Range |
| task_status | String | Definition Task status of the CBH instance. Range |
| create_instance_status | String | Definition Status of the CBH instance during instance creation. Range |
| instance_status | String | Definition CBH instance status. Range |
| instance_description | String | Definition Description of the CBH instance. Range String type. The value can contain 1 to 256 characters. |
| fail_reason | String | Definition Cause of the CBH instance creation failure. Range String type. The value can contain 1 to 36 characters. |
| Parameter | Type | Description |
|---|---|---|
| specification | String | Definition CBH instance specifications. Range String type. The value can contain 1 to 36 characters. |
| order_id | String | Definition Order ID. Range String type. The value can contain 1 to 64 characters. |
| resource_id | String | Definition Resource ID of the CBH instance, in UUID format. Range String type. The value can contain 1 to 36 characters. |
| data_disk_size | Number | Definition CBH instance data disk size, in TB. Range Number. The value ranges from 0 to 300. |
| disk_resource_id | Array of strings | Definition ID of the CBH instance data disk. A string array with a maximum of 21 elements. |
| Parameter | Type | Description |
|---|---|---|
| vip | String | Definition Floating IP address of the CBH instance. (The corresponding value is returned for the primary/standby instance.) Range String type. The value can contain 1 to 36 characters. |
| web_port | String | Definition Port for accessing the web page of the CBH instance. Range String type. The value can contain 1 to 36 digits. |
| public_ip | String | Definition EIP bound to the CBH instance. Range String type. The value can contain 1 to 15 characters. |
| public_id | String | Definition ID of the EIP bound to the CBH instance, in UUID format. Range String type. The value can contain 1 to 36 characters. |
| private_ip | String | Definition Private IP address of the CBH instance. Range String type. The value can contain 1 to 15 characters. |
| vpc_id | String | Definition ID of the VPC for the CBH instance. Range String type. The value can contain 1 to 36 characters. |
| subnet_id | String | Definition ID of the subnet for the CBH instance. Range String type. The value can contain 1 to 36 characters. |
| security_group_id | String | Definition ID of the security group for the CBH instance. Range String type. The value can contain 1 to 36 characters. |
| Parameter | Type | Description |
|---|---|---|
| ha_id | String | Definition Primary and standby instance IDs. Range String type. The value can contain 1 to 36 characters. |
| instance_type | String | Definition Instance type. Range |
| Parameter | Type | Description |
|---|---|---|
| key | String | Tag key. The value can contain up to 128 characters. |
| value | String | Value. Each value can contain a maximum of 255 characters. |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code. |
| error_description | String | Incorrect request parameters. |
Status code: 401
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code. |
| error_description | String | Token verification failed. |
Status code: 403
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code. |
| error_description | String | Permissions required. |
Status code: 404
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code. |
| error_description | String | Not CBH instances found. |
Example Requests
{
"matches" : [ {
"key" : "resource_name",
"value" : "resource1"
} ],
"not_tags" : [ {
"key" : "key1",
"values" : [ "value1", "value2" ]
} ],
"tags" : [ {
"key" : "key1",
"values" : [ "value1", "value2" ]
} ],
"tags_any" : [ {
"key" : "key1",
"values" : [ "value1", "value2" ]
} ],
"not_tags_any" : [ {
"key" : "key1",
"values" : [ "value1", "value2" ]
} ]
} Example Responses
Status code: 200
{
"resources" : [ {
"resource_id" : "cdfs_cefs_wesas_12_dsad",
"resource_name" : "resource1",
"resource_detail" : {
"name" : "name",
"server_id" : "server_id",
"instance_id" : "instance_id",
"alter_permit" : true,
"enterprise_project_id" : "enterprise_project_id",
"period_num" : "period_num",
"start_time" : "start_time",
"end_time" : "end_time",
"created_time" : "created_time",
"upgrade_time" : 1729895506000,
"update" : "OLD",
"bastion_version" : "bastion_version",
"az_info" : {
"region" : "region",
"zone" : "zone",
"availability_zone_display" : "availability_zone_display",
"slave_zone" : "slave_zone",
"slave_zone_display" : "slave_zone_display"
},
"status_info" : {
"status" : "SHUTOFF",
"task_status" : "powering-off",
"create_instance_status" : "Waiting for payment",
"instance_status" : "building",
"instance_description" : "instance_description",
"fail_reason" : "fail_reason"
},
"resource_info" : {
"specification" : "specification",
"order_id" : "order_id",
"resource_id" : "resource_id",
"data_disk_size" : 200,
"disk_resource_id" : [ "disk_resource_id1", "disk_resource_id2" ]
},
"network" : {
"vip" : "vip",
"web_port" : "web_port",
"public_ip" : "public_ip",
"public_id" : "public_id",
"private_ip" : "private_ip",
"vpc_id" : "vpc_id",
"subnet_id" : "subnet_id",
"security_group_id" : "security_group_id"
},
"ha_info" : {
"ha_id" : "ha_id",
"instance_type" : "master"
}
},
"tags" : [ {
"key" : "key1",
"value" : "value1"
}, {
"key" : "key2",
"value" : "value1"
} ],
"sys_tags" : [ {
"key" : "_sys_enterprise_project_id",
"value" : "5aa119a8-xxxx-45a7-xxxx-88e12788xxxx"
} ]
} ],
"total_count" : 1000
} Status Codes
| Status Code | Description |
|---|---|
| 200 | List CBH ByTags Success |
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not Found |
| 500 | System error. |
Error Codes
See Error Codes.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot