证书关联操作
更新时间:2023-05-16
增加&修改域名证书
public void setCertificate(CdnClient client) {
String domain = "my.test.com";
Cert cert = new Cert().withCertName("test-certName")
.withCertServerData("-----BEGIN CERTIFICATE----END CERTIFICATE-----")
.withCertPrivateData("-----BEGIN RSA PRIVATE KEY----END RSA PRIVATE KEY-----")
.withCertLinkData("x").withCertType(1);
SetDomainCertRequest request = new SetDomainCertRequest()
.withDomain(domain).withHttpsEnable("ON").withCertificate(cert);
client.setDomainCert(request);
}
查询域名证书
public void getCertificate(CdnClient client) {
String domain = "my.test.com";
GetDomainCertResponse response = client.getDomainCert(domain);
}
删除域名证书
public void delCertificate(CdnClient client) {
String domain = "my.test.com";
DelDomainCertResponse response = client.deleteDomainCert(domain);
}
查询开启https域名
public void getHttpsDomains(CdnClient client) {
String domain = "my.test.com";
GetHttpsDomainRequest request = new GetHttpsDomainRequest(1, 1);
GetHttpsDomainResponse response = client.getHttpsDomains(request);
}
批量上传证书
public void bathUploadDomainCert(CdnClient client) {
String domain1 = "my.test.com";
String domain1 = "my.test2.com";
List<String> domains = new ArrayList<String>();
domains.add(domain1);
domains.add(domain2);
Cert cert = new Cert().withCertName("test-certName")
.withCertServerData("-----BEGIN CERTIFICATE----END CERTIFICATE-----")
.withCertPrivateData("-----BEGIN RSA PRIVATE KEY----END RSA PRIVATE KEY-----")
.withCertLinkData("x").withCertType(1);
BatchUploadCertRequest request = new BatchUploadCertRequest()
.withDomains(domains).withCertificate(cert);
client.bathUploadDomainCert(request);
}