Help Center/ Data Lake Insight/ API Reference/ APIs Related to Resource Tags/ Querying the Number of Resource Instances
Updated on 2024-11-04 GMT+08:00

Querying the Number of Resource Instances

Function

This API is used to query the number of resource instances.

URI

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

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

Request Parameters

Table 2 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 number of all resources is returned.

matches

No

Array of objects

Search field.

For details, see matches.

Table 3 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 4 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 5 Response parameters

Parameter

Mandatory

Type

Description

total_count

Yes

Integer

Total number of records.

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

{
       "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.