Updated on 2025-11-28 GMT+08:00

Querying the CA List by Tags

Function

This API is used to query the CA list by tags.

Debugging

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

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    pca:ca:listByTag

    List

    ca *

    -

    -

    -

    -

    • g:EnterpriseProjectId

    • g:RequestTag/<tag-key>

    • g:TagKeys

URI

POST /v1/private-certificate-authorities/resource-instances/filter

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. For details, see [Obtaining a User Token] (https://support.huaweicloud.com/intl/en-us/api-iam/iam_30_0001.html).

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

tags

No

Array of DomainTags objects

Tag list.

The list contains a maximum of 20 keys with each containing no more than 20 values. A key can have empty arrays, but must have the complete structure. Each tag key must be unique, and each tag value in a tag must be unique. The response returns resources containing all tags in this list. 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.

Array Length: 1 - 20

limit

No

Integer

Records on each page. The values can be:

  • 10: Each page contains 10 resource records.

  • 20: Each page contains 20 resource records.

  • 50: Each page contains 50 resource records.

Minimum: 10

Maximum: 50

Default: 10

offset

No

Integer

Index position. The query will start from the next records from the position specified by offset.

Minimum: 0

Default: 0

matches

No

Array of ResourceTag objects

The key-value pair to be matched.

The tag key indicates the field to be matched, such as resource_name. The tag value indicates the value to be matched. The key is a fixed dictionary value and cannot be a duplicate key or unsupported key.

Array Length: 0 - 20

Table 3 DomainTags

Parameter

Mandatory

Type

Description

key

Yes

String

Tag key.

It can contain letters in Chinese, Spanish, or Portuguese, digits, spaces, and the following characters in UTF-8 format: _ . : = + - @

Minimum: 1

Maximum: 128

values

Yes

Array of strings

Tag value list.

Each value can contain letters in Chinese, Spanish, or Portuguese, digits, spaces, and the following characters in UTF-8 format: _ . : = + - @

Minimum: 0

Maximum: 255

Array Length: 1 - 20

Table 4 ResourceTag

Parameter

Mandatory

Type

Description

key

Yes

String

Tag key.

It can contain letters in Chinese, Spanish, or Portuguese, digits, spaces, and the following characters in UTF-8 format: _ . : = + - @

Minimum: 1

Maximum: 128

value

Yes

String

Tag value.

It can contain letters in Chinese, Spanish, or Portuguese, digits, spaces, and the following characters in UTF-8 format: _ . : / = + - @

Minimum: 0

Maximum: 255

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

total_count

Integer

Total number of records.

Minimum: 0

Maximum: 100

resources

Array of TagResource objects

Resource instance list. For details, see the data structure of the TagResource field.

Array Length: 0 - 100

Table 6 TagResource

Parameter

Type

Description

resource_id

String

Specifies the resource ID.

Minimum: 0

Maximum: 63

resource_detail

Object

Specifies resource details.

tags

Array of ResourceTag objects

Tag list. If there is no tag in the list, an empty array is returned.

Array Length: 0 - 100

resource_name

String

Resource name. This parameter is an empty string by default.

Minimum: 0

Maximum: 63

Table 7 ResourceTag

Parameter

Type

Description

key

String

Tag key.

It can contain letters in Chinese, Spanish, or Portuguese, digits, spaces, and the following characters in UTF-8 format: _ . : = + - @

Minimum: 1

Maximum: 128

value

String

Tag value.

It can contain letters in Chinese, Spanish, or Portuguese, digits, spaces, and the following characters in UTF-8 format: _ . : / = + - @

Minimum: 0

Maximum: 255

Status code: 400

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code

Minimum: 3

Maximum: 36

error_msg

String

Error message

Minimum: 0

Maximum: 1024

Status code: 401

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code

Minimum: 3

Maximum: 36

error_msg

String

Error message

Minimum: 0

Maximum: 1024

Status code: 403

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Error code

Minimum: 3

Maximum: 36

error_msg

String

Error message

Minimum: 0

Maximum: 1024

Status code: 404

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Error code

Minimum: 3

Maximum: 36

error_msg

String

Error message

Minimum: 0

Maximum: 1024

Status code: 500

Table 12 Response body parameters

Parameter

Type

Description

error_code

String

Error code

Minimum: 3

Maximum: 36

error_msg

String

Error message

Minimum: 0

Maximum: 1024

Example Requests

When you call this API, a token with the permission to use this API is mandatory for the X-Auth-Token field.

POST https://ccm.cn-north-4.myhuaweicloud.com/v1/private-certificate-authorities/resource-instances/filter

{
  "tags" : [ {
    "key" : "key1",
    "values" : [ "value1", "value2" ]
  } ]
}

Example Responses

Status code: 200

Request succeeded.

{
  "total_count" : 1,
  "resources" : [ {
    "resource_id" : "806064a8-7478-4657-a8b0-2edc90621235"
  }, {
    "resource_name" : "test"
  }, {
    "resource_detail" : [ {
      "ca_id" : "806064a8-7478-4657-a8b0-2edc90621235",
      "create_time" : 1681436805000,
      "delete_time" : null,
      "crl_configuration" : {
        "enabled" : false,
        "obs_bucket_name" : null,
        "valid_days" : null,
        "crl_name" : null,
        "crl_dis_point" : null
      },
      "distinguished_name" : {
        "country" : "CN",
        "state" : "guangdong",
        "locality" : "shenzhen",
        "organization" : "Huawei",
        "organizational_unit" : "IT",
        "common_name" : "Huawei IT Root CA"
      },
      "enc_cert_info" : null,
      "enterprise_project_id" : "57d71362-6a1a-4f51-8fa9-693bc3c07f43",
      "freeze_flag" : 0,
      "gen_mode" : "GENERATE",
      "issuer_id" : null,
      "issuer_name" : null,
      "key_algorithm" : "SM2",
      "not_before" : 1681436805000,
      "not_after" : 1713059205000,
      "path_length" : 7,
      "serial_number" : "202203070322544291829058",
      "signature_algorithm" : "SM3",
      "status" : "ACTIVED",
      "type" : "ROOT"
    } ]
  }, {
    "tags" : [ {
      "key" : "key1",
      "value" : "value1"
    } ]
  } ]
}

Status code: 400

Invalid request parameters.

{
  "error_code" : "PCA.XXX",
  "error_msg" : "XXX"
}

Status code: 401

Token required for the requested page.

{
  "error_code" : "PCA.XXX",
  "error_msg" : "XXX"
}

Status code: 403

Authentication failed.

{
  "error_code" : "PCA.XXX",
  "error_msg" : "XXX"
}

Status code: 404

No resources available or found.

{
  "error_code" : "PCA.XXX",
  "error_msg" : "XXX"
}

Status code: 500

Internal service error.

{
  "error_code" : "PCA.XXX",
  "error_msg" : "XXX"
}

Status Codes

Status Code

Description

200

Request succeeded.

400

Invalid request parameters.

401

Token required for the requested page.

403

Authentication failed.

404

No resources available or found.

500

Internal service error.

Error Codes

See Error Codes.