• Elastic Volume Service

evs
  1. Help Center
  2. Elastic Volume Service
  3. API Reference
  4. API v3
  5. EVS Tag
  6. Querying the Number of EVS Disks by Tag

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

  • URI format

    POST /v3/{project_id}/os-vendor-volumes/resource_instances/action

  • Parameter description

    Parameter

    Mandatory

    Description

    project_id

    Yes

    Specifies the project ID.

Request

  • Parameter description

    Parameter

    Type

    Mandatory

    Description

    tags

    list<resource_tag>

    No

    Specifies the key-value pairs of the tag.

    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 EVS disks having all specified keys are queried.

    NOTE:

    If multiple tag lists are specified in the request, only the EVS disks that meet the requirements of the last tag list are queried.

    action

    string

    Yes

    Specifies the operation identifier.

    The value can be as follows:

    • filter
    • count

    Specifying count queries the number of EVS disks by tag.

    matches

    list<match>

    No

    Specifies the search criteria supported by the disks.

    The matches field cannot be left empty.

    Tag keys in the list must be unique.

  • Parameters in the tags field

    Parameter

    Type

    Mandatory

    Description

    key

    string

    Yes

    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

    list

    Yes

    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, EVS disks that have any of the specified values are queried.

  • Parameters in the matches 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 is of the enumerated type. It can be EVS or DSS 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

    int

    Specifies the total number of EVS disks that meet the query criteria.

  • 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
        }
    }

Returned Values

  • Normal

    200

Error Codes

For details, see Error Codes.