nav-img
Advanced

Querying the File System List by Tag

Function

Querying the File System List by Tag

URI

POST /v1/{project_id}/sfs-turbo/resource_instances/action

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Account token

Content-Type

Yes

String

MIME type.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

action

No

String

Operation type of querying the file system list by tag. The value can only be "filter" or "count."

limit

No

String

Sets the maximum number of returned file systems.

offset

No

String

Sets the offset of the returned file system.

without_any_tag

No

Boolean

No tag is included. If this parameter is set to true, all resources without tags are queried. In this case, the tags parameter is ignored. If this parameter is set to false or is not specified, this condition does not take effect. That is, all resources are returned or resources are filtered by tags or matches.

tags

No

Array of Tag objects

The resources to be queried contain tags listed in tags. Each resource to be queried contains a maximum of 20 keys. Each tag key can have a maximum of 20 tag values. The tag value corresponding to each tag key can be an empty array but the structure cannot be missing. Each tag key must be unique, and each tag value in a tag must be unique. Resources with all tags listed in tags will be returned. Keys in this list are in an AND relationship while values in each key-value structure are in an OR relationship. If no filtering condition is specified, full data is returned.

matches

No

Array of ResourceTag objects

Search field. The key is the field to be matched. The value can only be resource_name. value indicates the matched value. If the value ends with *, the search is performed based on the prefix. For example, if the value is sfsturbo*, all resources whose names start with sfsturbo are returned.

Table 4 Tag

Parameter

Mandatory

Type

Description

key

Yes

String

Tag key.

A key can contain a maximum of 128 characters and cannot be left blank.

values

Yes

Array of strings

Tag values. Each value can contain a maximum of 255 characters. An empty list of values can match with any value. All values of a tag key are in the OR relationship.

Table 5 ResourceTag

Parameter

Mandatory

Type

Description

key

Yes

String

Tag key.

The key must be 1 to 128 characters long, cannot start or end with spaces, and cannot be an empty string. It can contain only UTF-8 letters, digits, spaces, and the following characters: _.:=+-@.

value

Yes

String

Tag value.

The value must be 0 to 255 characters long and can be an empty string. It can contain only UTF-8 letters, digits, spaces, and the following characters: _.:=+-@.

Response Parameters

Status code: 200

Table 6 Response header parameters

Parameter

Type

Description

X-request-id

String

Success

Table 7 Response body parameters

Parameter

Type

Description

resources

Array of ListSharesByTagResource objects

Querying the Resource List of a File System by Tag

total_count

Integer

Sets the offset of the returned file system.

Table 8 ListSharesByTagResource

Parameter

Type

Description

resource_id

String

Resource ID

resource_name

String

Resource Name

resource_detail

String

Resource details

tags

Array of ResourceTag objects

List of resource tags.

Table 9 ResourceTag

Parameter

Type

Description

key

String

Tag key.

The key must be 1 to 128 characters long, cannot start or end with spaces, and cannot be an empty string. It can contain only UTF-8 letters, digits, spaces, and the following characters: _.:=+-@.

value

String

Tag value.

The value must be 0 to 255 characters long and can be an empty string. It can contain only UTF-8 letters, digits, spaces, and the following characters: _.:=+-@.

Status code: 400

Table 10 Response header parameters

Parameter

Type

Description

X-request-id

String

Request parameter error.

Table 11 Response body parameters

Parameter

Type

Description

errCode

String

Error code

errMsg

String

Error description

Example Requests

  • Filter file systems by file system tag.
    {
    "action" : "filter",
    "limit" : 10,
    "offset" : 10,
    "tags" : [ {
    "key" : "key1",
    "values" : [ "value1", "value2" ]
    }, {
    "key" : "key2",
    "values" : [ "value1", "value2" ]
    } ]
    }
  • Filter file systems by file system name.
    {
    "action" : "filter",
    "matches" : [ {
    "key" : "resource_name",
    "value" : "sfsturbo*"
    } ]
    }

Example Responses

Status code: 400

Error response.

{
"errCode" : "SFS.TURBO.0001",
"errMsg" : "parameter error"
}

Status Codes

Status Code

Description

200

Success

400

Error response.

Error Codes