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

Listing Resource Instances

Function

This API is used to list resource instances.

URI

POST /v3/{project_id}/{resource_type}/resource-instances/filter

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID, which is used for resource isolation. For details about how to obtain its value, see Obtaining a Project ID.

resource_type

Yes

String

Resource type. The options are:

  • dli_queue: queue
  • dli_elastic_resource_pool: elastic resource pool
  • dli_enhanced_datasource: enhanced datasource connection
  • dli_database: database
  • dli_package_resource: resource package (built-in resource packages with a module ID specified are not supported)
  • dli_flink_job: Flink job
Table 2 Query parameters

Parameter

Mandatory

Type

Description

limit

No

Integer

Number of records displayed on each page. The default value is 1000.

offset

No

Integer

Query result offset. The default value is 0.

Request Parameters

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

without_any_tag

No

Boolean

Whether no tags are included. The default value is false.

  • true: No tags are included.
  • false: One or multiple tags are specified.

tags

No

Array of objects

Tags. For details, see tags.

  • A maximum of 20 tags can be added.
  • Each key within a resource must be unique, and the values within the same key cannot be duplicated.
  • If left unset, the list of all resource instances is returned.

matches

No

Array of objects

Search field.

For details, see matches.

Table 4 tags

Parameter

Mandatory

Type

Description

key

Yes

String

Tag key.

A tag key can contain a maximum of 128 characters. Only letters, digits, spaces, and special characters (_.:+-@) are allowed, but the value cannot start or end with a space or start with _sys_.

values

Yes

Array of strings

List of tag values.

A tag value can contain a maximum of 255 characters. Only letters, numbers, spaces, and special characters (_.:+-@) are allowed. The value cannot start or end with a space.

The value can be an empty array but cannot be left blank.

If the values are null, it indicates any_value (querying any value). All values of a tag key are in the OR relationship.

Table 5 matches

Parameter

Mandatory

Type

Description

key

Yes

String

Tag key. Currently, only the option resource_name is available.

resource_name: resource name.

By default, a fuzzy search is performed based on the prefix of the resource name entered.

value

Yes

String

Tag value. Enter a maximum of 255 characters.

Response Parameters

Table 6 Response parameters

Parameter

Mandatory

Type

Description

resources

Yes

List<resource>

List of resource instances.

For details, see Table 7.

total_count

Yes

Integer

Total number of records.

Table 7 resource field data structure description

Parameter

Mandatory

Type

Description

resource_id

Yes

String

Resource ID.

resource_detail

Yes

Object

Resource details. This field is an extension field and is left blank by default.

tags

Yes

List<resource_tag>

Tag list, which is an empty array if there are no tags.

For details, see Table 8.

resource_name

Yes

String

Resource name, which is an empty string by default if the resource does not have a name. If the resource is an EIP, the IP address is returned.

Table 8 tags field data structure description

Parameter

Mandatory

Type

Description

key

Yes

String

Resource tag key.

value

Yes

String

Resource tag value.

Example Request

{
    "tags":[
        {
            "key":"key1",
            "values":[
                "value1",
                "value2"
            ]
        },
        {
            "key":"key2",
            "values":[
                "value1",
                "value2"
            ]
        }
    ],
    "matches":[
        {
            "key":"resource_name",
            "value":"resource1"
        }
    ],
    "without_any_tag":"false"
}

Example Response

{ 
      "resources": [
         {
            "resource_detail": null, 
            "resource_id": "test1", 
            "resource_name": "resource1", 
            "tags": [
                {
                   "key": "key1",
                   "value": "value1"
                },
                {
                   "key": "key2",
                   "value": "value1"
                }
             ]
         }
       ], 
      "total_count": 1000
}

Status Codes

Status Code

Description

200

The modification is successful.

400

Request error.

500

Internal server error.

Error Codes

See Error Codes.