Updated on 2024-11-01 GMT+08:00

Querying Resource Shares by Tag

Function

This API is used to query resource shares by tag.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

URI

POST https://{endpoint}/v1/resource-shares/resource-instances/filter

Table 1 Query Parameters

Parameter

Mandatory

Type

Description

limit

No

Integer

Maximum number of entries that can be displayed on a page.

offset

No

String

Pagination marker.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Security-Token

No

String

Security token (session token) for temporary security credentials. This parameter is mandatory when you make an API call using temporary security credentials.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

without_any_tag

No

Boolean

If this parameter is set to true, all resources without tags are queried.

tags

No

Array of TagFilter objects

A maximum of 20 keys can be queried at a time, and each key can contain a maximum of 20 values. The structure body must be included. The tag key cannot be left blank or be an empty string. Each tag key must be unique, and each tag value for a key 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 tag filtering criteria is specified, all data is returned.

matches

No

Array of Match objects

Matching field used for attaching tags to resource shares.

Table 4 TagFilter

Parameter

Mandatory

Type

Description

key

Yes

String

Identifier or name of the tag key.

values

No

Array of strings

List of values for the tag key.

Table 5 Match

Parameter

Mandatory

Type

Description

key

Yes

String

Key. The value can be policy, organizational-unit, or account.

value

Yes

String

Value. Each value can contain a maximum of 255 characters.

Response Parameters

Status code: 200

Table 6 Response body parameters

Parameter

Type

Description

resources

Array of ResourceDTO objects

List of resources.

total_count

Integer

Total number of records.

Table 7 ResourceDTO

Parameter

Type

Description

resource_id

String

Resource ID.

resource_name

String

Resource name.

tags

Array of Tag objects

List of resource tags.

resource_detail

Object

Resource details.

Table 8 Tag

Parameter

Type

Description

key

String

Identifier or name of the tag key.

value

String

Tag value. You can set the tag value to an empty string but not to null.

Example Requests

Querying resource shares by tag

POST https://{endpoint}/v1/resource-shares/resource-instances/filter

{
  "without_any_tag" : true,
  "tags" : [ {
    "key" : "string",
    "values" : [ "string" ]
  } ],
  "matches" : [ {
    "key" : "string",
    "value" : "string"
  } ]
}

Example Responses

Status code: 200

Request succeeded.

{
  "resources" : [ {
    "resource_id" : "string",
    "resource_name" : "string",
    "resource_detail" : { },
    "tags" : [ {
      "key" : "string",
      "value" : "string"
    } ]
  } ],
  "total_count" : 0
}

Status Codes

Status Code

Description

200

Request succeeded.

Error Codes

See Error Codes.