Querying the List of Private Certificates
Function
This API is used to query the private certificate list.
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:cert:list
List
-
g:EnterpriseProjectId
-
-
URI
GET /v1/private-certificates
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
limit |
No |
Integer |
The number of returned records. The default value is 10. Minimum: 0 Maximum: 1000 |
|
name |
No |
String |
The name of the private certificate. The set of certificates whose names contain the name field is returned. Minimum: 1 Maximum: 64 |
|
offset |
No |
Integer |
Index position. The query starts from the next data record indexed by this parameter. Minimum: 0 |
|
status |
No |
String |
The private certificate status. You can query private certificates by status. |
|
sort_key |
No |
String |
Sorting attribute. The following attributes are available now: |
|
sort_dir |
No |
String |
Sorting sequence. The options are as follows: |
Request 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). |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
total |
Integer |
Total number of private certificates. Minimum: 0 Maximum: 1000000 |
|
certificates |
Array of Certificates objects |
For details, see data structure for the Certificates field. Array Length: 0 - 1000 |
|
Parameter |
Type |
Description |
|---|---|---|
|
certificate_id |
String |
ID of the private certificate. Minimum: 36 Maximum: 36 |
|
status |
String |
Certificate status: |
|
issuer_id |
String |
ID of the parent CA. Minimum: 36 Maximum: 36 |
|
issuer_name |
String |
The name of the parent CA certificate. Minimum: 1 Maximum: 64 |
|
key_algorithm |
String |
Key algorithm. |
|
signature_algorithm |
String |
Signature algorithm. |
|
freeze_flag |
Integer |
Freezing tag: |
|
gen_mode |
String |
Certificate generation method. |
|
serial_number |
String |
Serial number. Minimum: 1 Maximum: 64 |
|
create_time |
Long |
Time the certificate was created. The value is a timestamp in milliseconds. |
|
delete_time |
Long |
Time the certificate was deleted. The value is a timestamp in milliseconds. |
|
not_before |
Long |
Time the certificate was created. The value is a timestamp in milliseconds. |
|
not_after |
Long |
Time the certificate expires. The value is a timestamp in milliseconds. |
|
distinguished_name |
DistinguishedName object |
Certificate name. For details, see data structure for the DistinguishedName field. |
|
enc_cert_info |
EncCertInfo object |
For details, see data structure of the EncCertInfo field. |
|
enterprise_project_id |
String |
Enterprise project ID. The default value is 0. For users who have enabled the enterprise project function, this value indicates that resources are in the default enterprise project. For users who have not enabled the enterprise project function, this value indicates that resources are not in the default enterprise project. |
|
Parameter |
Type |
Description |
|---|---|---|
|
common_name |
String |
Common name (CN) of a certificate. The value can contain a maximum of 64 characters, including only letters, digits, spaces, Chinese characters, hyphens (-), underscores (_), periods (.), commas (,), and asterisks (*). Minimum: 1 Maximum: 64 |
|
country |
String |
Country code. The value is a string of two characters and can contain only letters. Minimum: 2 Maximum: 2 |
|
state |
String |
Name of a province or city. The value can contain a maximum of 128 characters, including only letters, digits, Chinese characters, spaces, hyphens (-), underscores (_), periods (.), and commas (,). Minimum: 1 Maximum: 128 |
|
locality |
String |
Region name. The value can contain a maximum of 128 characters, including only letters, digits, Chinese characters, spaces, hyphens (-), underscores (_), periods (.), and commas (,). Minimum: 1 Maximum: 128 |
|
organization |
String |
Organization name. The value can contain a maximum of 64 characters, including only letters, digits, Chinese characters, spaces, hyphens (-), underscores (_), periods (.), and commas (,). Minimum: 1 Maximum: 64 |
|
organizational_unit |
String |
Organization unit name. The value can contain a maximum of 64 characters, including only letters, digits, Chinese characters, spaces, hyphens (-), underscores (_), periods (.), and commas (,). Minimum: 1 Maximum: 64 |
|
Parameter |
Type |
Description |
|---|---|---|
|
enc_serial_number |
String |
Encryption certificate serial number. Minimum: 1 Maximum: 64 |
Status code: 400
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Error code Minimum: 3 Maximum: 36 |
|
error_msg |
String |
Error message Minimum: 0 Maximum: 1024 |
Status code: 401
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Error code Minimum: 3 Maximum: 36 |
|
error_msg |
String |
Error message Minimum: 0 Maximum: 1024 |
Status code: 403
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Error code Minimum: 3 Maximum: 36 |
|
error_msg |
String |
Error message Minimum: 0 Maximum: 1024 |
Status code: 404
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Error code Minimum: 3 Maximum: 36 |
|
error_msg |
String |
Error message Minimum: 0 Maximum: 1024 |
Status code: 500
|
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.
GET https://ccm.cn-north-4.myhuaweicloud.com/v1/private-certificates
Example Responses
Status code: 200
Request succeeded.
{
"total" : 2,
"certificates" : [ {
"signature_algorithm" : "SHA256",
"issuer_id" : "ef5d84d1-4f52-47d2-b1c8-a91a672487a0",
"issuer_name" : "12",
"not_after" : 1665539214000,
"not_before" : 1634295475000,
"status" : "ISSUED",
"freeze_flag" : 0,
"gen_mode" : "GENERATE",
"serial_number" : "202110151057541266081861",
"distinguished_name" : {
"country" : "cn",
"state" : "guizhou",
"locality" : "guiyang",
"organization" : "hw",
"organizational_unit" : "IT",
"common_name" : "test.huawei.com"
},
"key_algorithm" : "RSA4096",
"create_time" : 1634295475000,
"delete_time" : null,
"certificate_id" : "6434f74f-2d13-4e6a-89eb-93ee313f1a43",
"enc_cert_info" : {
"enc_serial_number" : "2ad6c3e393a95bf13f95"
}
}, {
"signature_algorithm" : "SHA256",
"issuer_id" : "ef5d84d1-4f52-47d2-b1c8-a91a672487a0",
"issuer_name" : "12",
"not_after" : 1665539214000,
"not_before" : 1634110315000,
"status" : "ISSUED",
"freeze_flag" : 0,
"gen_mode" : "GENERATE",
"serial_number" : "202110130731541908887138",
"distinguished_name" : {
"country" : "cn",
"state" : "sichuan",
"locality" : "chengdu",
"organization" : "hw",
"organizational_unit" : "HR",
"common_name" : "hr.huawei.com"
},
"key_algorithm" : "RSA4096",
"create_time" : 1634110316000,
"delete_time" : null,
"certificate_id" : "1cbb5a52-806b-469c-b182-7446e1851a1c",
"enc_cert_info" : {
"enc_serial_number" : "448ad305b90e0a266e9"
}
} ]
}
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"
}
SDK Sample Code
The SDK sample code is as follows.
Java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.GlobalCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.ccm.v1.region.CcmRegion; import com.huaweicloud.sdk.ccm.v1.*; import com.huaweicloud.sdk.ccm.v1.model.*; public class ListCertificateSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); ICredential auth = new GlobalCredentials() .withAk(ak) .withSk(sk); CcmClient client = CcmClient.newBuilder() .withCredential(auth) .withRegion(CcmRegion.valueOf("<YOUR REGION>")) .build(); ListCertificateRequest request = new ListCertificateRequest(); try { ListCertificateResponse response = client.listCertificate(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } } |
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import GlobalCredentials from huaweicloudsdkccm.v1.region.ccm_region import CcmRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkccm.v1 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] credentials = GlobalCredentials(ak, sk) client = CcmClient.new_builder() \ .with_credentials(credentials) \ .with_region(CcmRegion.value_of("<YOUR REGION>")) \ .build() try: request = ListCertificateRequest() response = client.list_certificate(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
Go
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/global" ccm "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/ccm/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/ccm/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/ccm/v1/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") auth := global.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). Build() client := ccm.NewCcmClient( ccm.CcmClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.ListCertificateRequest{} response, err := client.ListCertificate(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
More
For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.
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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot