Reviewed-by: Muller, Martin <martin.muller@t-systems.com> Reviewed-by: Sabelnikov, Dmitriy <dmitriy.sabelnikov@t-systems.com> Co-authored-by: zhangyue <zhangyue164@huawei.com> Co-committed-by: zhangyue <zhangyue164@huawei.com>
20 KiB
Querying the Number of EVS Disks by Tag
Function
This API is used to query the number of EVS disks by tag.
Constraints
None
URI
Request
- Parameter description
Parameter
Type
Mandatory
Description
tags
Array of objects
No
Specifies the key-value pairs of the tag. For details, see Parameters in the tags field.
The tags field cannot be left empty.
One tag list can contain a maximum of 10 keys.
Tag keys in a tag list must be unique.
When multiple keys are specified in a tag list, only the disks having all specified keys are queried.
NOTE:If multiple tag lists are specified in the request, only the disks that meet the requirements of the last tag list are queried.
action
String
Yes
Specifies the operation identifier.
Specifying count queries the number of disks by tag.
matches
Array of objects
No
Specifies the query criteria that the resource supports. For details, see Parameters in the match field.
The matches field cannot be left empty.
Tag keys in the list must be unique.
- Parameters in the resource_tag field
Parameter
Type
Mandatory
Description
key
String
Yes
Specifies the tag key.- Cannot be left blank.
- Must be unique for each resource.
- Can contain a maximum of 36 characters.
- Can contain only digits, letters, hyphens (-), and underscores (_).
values
Array of objects
Yes
Specifies the tag value.- Can contain a maximum of 43 characters.
- Can contain only digits, letters, hyphens (-), and underscores (_).
One value list can contain a maximum of 10 values.
Tag values in a value list must be unique.
If the value list is left empty, any tag value can be matched.
When multiple values are specified in a value list and the key requirements are met, disks that have any of the specified values are queried.
- Parameters in the match field
Parameter
Type
Mandatory
Description
key
String
Yes
Specifies the tag key. The value is of the enumerated type.
The value can be as follows:
- resource_name: disk name.
- service_type: service type.
value
String
Yes
Specifies the tag value.
- It can contain up to 255 Unicode characters.
- An empty string specifies an exact match, and a non-empty string specifies a fuzzy query.
- If resource_name is specified for key, spaces before and after the tag value will be discarded.
- If service_type is specified for key, the value can be EVS and is case-insensitive.
- Example request
{ "action": "count", "tags": [ { "key": "key1", "values": [ "value1", "value2" ] } ], "matches": [ { "key": "resource_name", "value": "resource1" }, { "key": "service_type", "value": "EVS" } ] }
Response
- Parameter description
Parameter
Type
Description
total_count
Integer
Specifies the total number of disks that meet the query criteria.
error
Object
Specifies the error message returned when an error occurs. For details, see Parameters in the error field.
- Parameters in the error field
Parameter
Type
Description
message
String
The error message returned if an error occurs.
code
String
The error code returned if an error occurs.
For details about the error code, see Error Codes.
- Example response
{ "total_count": 1000 }
or
{ "error": { "message": "XXXX", "code": "XXX" } }
In the preceding example, error indicates a general error, for example, badRequest or itemNotFound. An example is provided as follows:
{ "computeFault": { "message": "The server has either erred or is incapable of performing the requested operation.", "code": 500 } }
Error Codes
For details, see Error Codes.