Updated on 2024-03-27 GMT+08:00

Querying the Number of Resource Instances

Function

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

URI

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

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID of a tenant in a region.

For details, see Obtaining a Project ID.

resource_type

Yes

String

Resource type.

  • migration: real-time migration.
  • sync: real-time synchronization.
  • cloudDataGuard: real-time disaster recovery.
  • subscription: data subscription.
  • backupMigration: backup migration.
  • replay: traffic replay.

Enumerated values:

  • migration
  • sync
  • cloudDataGuard
  • subscription
  • backupMigration
  • replay

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

MIME type of the request body. Use the default value application/json. For APIs used to upload objects or images, the value varies depending on the flow type.

The default value is application/json.

X-Auth-Token

Yes

String

User token obtained from IAM. It is a response to the API for obtaining a user token. After a request is processed, the value of X-Subject-Token in the header is the token value.

X-Language

No

String

Request language type.

Default value: en-us

Enumerated values:

  • en-us
  • zh-cn
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. In this case, the tags field is ignored. If this parameter is set to false or not specified, it does not take effect, which means that all resources are returned or resources are filtered by tags or matches.

tags

No

Array of objects

Included tags. A maximum of 20 keys are included. Each key can have a maximum of 20 values.

For details, see Table 4.

matches

No

Array of objects

Search field. The tag key is the field to be matched, for example, resource_name. The tag value indicates the value to be matched.

For details, see Table 5.

Table 4 Data structure description of field tags

Parameter

Mandatory

Type

Description

key

Yes

String

Tag key.

values

Yes

Array of strings

Tag value.

Table 5 Data structure description of field matches

Parameter

Mandatory

Type

Description

key

Yes

String

Key.

value

Yes

String

Value.

Response Parameters

Status code: 200

Table 6 Response body parameters

Parameter

Type

Description

total_count

Integer

Total number.

Example Request

Querying the number of synchronization task resource instances

 https://{endpoint}/v5/5237e10fe9aa4ad5b16b6a5245248314/sync/resource-instances/count

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

Example Response

Status code: 200

OK

{
  "total_count" : 1
}

Status Code

Status Code

Description

200

OK

Error Code

For details, see Error Code.