Querying All Domain Names Associated with HTTPS Certificates
Function
This API is used to query all domain names associated with HTTPS certificates.
Calling Method
For details, see Calling APIs.
URI
GET /v1.0/cdn/domains/https-certificate-info
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
page_size |
No |
Integer |
Number of records on each page. The value ranges from 1 to 10,000. The default value is 30. |
page_number |
No |
Integer |
Page number. The value ranges from 1 to 65,535. The default value is 1. |
domain_name |
No |
String |
Domain name. |
user_domain_id |
No |
String |
Domain ID of the domain name's owner. |
enterprise_project_id |
No |
String |
ID of the enterprise project to which the resource belongs. This parameter is valid only when the enterprise project function is enabled. The value all indicates all projects. This parameter is mandatory when you use an IAM user to call this API. Obtain the enterprise project ID by calling the ListEnterpriseProject API of Enterprise Project Management Service (EPS). |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
total |
Integer |
Total number of queried records. |
https |
Array of HttpsDetail objects |
HTTPS settings. |
Parameter |
Type |
Description |
---|---|---|
domain_id |
String |
Domain name ID. |
domain_name |
String |
Domain name associated with the certificate. |
cert_name |
String |
Certificate name. |
certificate |
String |
Certificate content. |
private_key |
String |
Private key. |
certificate_type |
Integer |
Possible values: 0 (your own certificate) and 1 (Huawei-managed certificate). |
expiration_time |
Long |
Certificate expiration time. |
https_status |
Integer |
Whether HTTPS is enabled. 0: HTTPS is disabled. 1: HTTPS is enabled and the origin protocol is the same as that of user requests. 2: HTTPS is enabled and the origin protocol is HTTP. |
force_redirect_https |
Integer |
Whether force redirect is enabled. Possible values: 0 (no), 1 (yes), and 2 (force HTTP.) |
force_redirect_config |
ForceRedirect object |
Force redirect. |
http2 |
Integer |
Whether HTTP/2 is used. Possible values: 1 (yes) and 0 (no). |
Example Requests
GET https://cdn.myhuaweicloud.com/v1.0/cdn/domains/https-certificate-info?domain_name=www.example.com&page_size=10&page_number=1
Example Responses
Status code: 200
OK
{ "total" : 1, "https" : [ { "https_status" : 1, "force_redirect_https" : 2, "force_redirect_config" : { "redirect_type" : "http", "switch" : 1 }, "http2" : 0, "cert_name" : "cdn_test", "certificate" : "-----BEGIN CERTIFICATE-----XX-----END CERTIFICATE-----", "private_key" : null, "certificate_type" : 0, "expiration_time" : 1606187416000, "domain_id" : "3e****************************63", "domain_name" : "www.example.com" } ] }
SDK Sample Code
The SDK sample code is as follows.
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.cdn.v2.region.CdnRegion; import com.huaweicloud.sdk.cdn.v2.*; import com.huaweicloud.sdk.cdn.v2.model.*; public class ShowCertificatesHttpsInfoSolution { 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); CdnClient client = CdnClient.newBuilder() .withCredential(auth) .withRegion(CdnRegion.valueOf("<YOUR REGION>")) .build(); ShowCertificatesHttpsInfoRequest request = new ShowCertificatesHttpsInfoRequest(); try { ShowCertificatesHttpsInfoResponse response = client.showCertificatesHttpsInfo(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()); } } } |
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 huaweicloudsdkcdn.v2.region.cdn_region import CdnRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkcdn.v2 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 = CdnClient.new_builder() \ .with_credentials(credentials) \ .with_region(CdnRegion.value_of("<YOUR REGION>")) \ .build() try: request = ShowCertificatesHttpsInfoRequest() response = client.show_certificates_https_info(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
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" cdn "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cdn/v2" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cdn/v2/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cdn/v2/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 := cdn.NewCdnClient( cdn.CdnClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.ShowCertificatesHttpsInfoRequest{} response, err := client.ShowCertificatesHttpsInfo(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
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 |
OK |
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