com.huaweicloud.sdk.ccm.v1.model.CreateCertificateRequestBody Maven / Gradle / Ivy
package com.huaweicloud.sdk.ccm.v1.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.function.Consumer;
/**
* CreateCertificateRequestBody
*/
public class CreateCertificateRequestBody {
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "issuer_id")
private String issuerId;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "key_algorithm")
private String keyAlgorithm;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "signature_algorithm")
private String signatureAlgorithm;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "distinguished_name")
private CertDistinguishedName distinguishedName;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "validity")
private Validity validity;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "key_usages")
private List keyUsages = null;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "subject_alternative_names")
private List subjectAlternativeNames = null;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "extended_key_usage")
private ExtendedKeyUsage extendedKeyUsage;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "customized_extension")
private CustomizedExtension customizedExtension;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "enterprise_project_id")
private String enterpriseProjectId;
public CreateCertificateRequestBody withIssuerId(String issuerId) {
this.issuerId = issuerId;
return this;
}
/**
* 父CA证书ID。
* @return issuerId
*/
public String getIssuerId() {
return issuerId;
}
public void setIssuerId(String issuerId) {
this.issuerId = issuerId;
}
public CreateCertificateRequestBody withKeyAlgorithm(String keyAlgorithm) {
this.keyAlgorithm = keyAlgorithm;
return this;
}
/**
* 密钥算法,可选值如下: - **RSA2048** : RSA算法,密钥长度2048位; - **RSA4096** : RSA算法,密钥长度4096位; - **EC256** : 椭圆曲线算法(Elliptic Curve Digital Signature Algorithm (ECDSA)),密钥长度256位; - **EC384** : 椭圆曲线算法(Elliptic Curve Digital Signature Algorithm (ECDSA)),密钥长度384位; - **SM2** : 国家密码管理局颁发的椭圆曲线算法(签名哈希算法SM3),密钥长度256位。(中国站)
* @return keyAlgorithm
*/
public String getKeyAlgorithm() {
return keyAlgorithm;
}
public void setKeyAlgorithm(String keyAlgorithm) {
this.keyAlgorithm = keyAlgorithm;
}
public CreateCertificateRequestBody withSignatureAlgorithm(String signatureAlgorithm) {
this.signatureAlgorithm = signatureAlgorithm;
return this;
}
/**
* 签名哈希算法,可选值如下: - **SHA256** - **SHA384** - **SHA512** - **SM3**(中国站)
* @return signatureAlgorithm
*/
public String getSignatureAlgorithm() {
return signatureAlgorithm;
}
public void setSignatureAlgorithm(String signatureAlgorithm) {
this.signatureAlgorithm = signatureAlgorithm;
}
public CreateCertificateRequestBody withDistinguishedName(CertDistinguishedName distinguishedName) {
this.distinguishedName = distinguishedName;
return this;
}
public CreateCertificateRequestBody withDistinguishedName(Consumer distinguishedNameSetter) {
if (this.distinguishedName == null) {
this.distinguishedName = new CertDistinguishedName();
distinguishedNameSetter.accept(this.distinguishedName);
}
return this;
}
/**
* Get distinguishedName
* @return distinguishedName
*/
public CertDistinguishedName getDistinguishedName() {
return distinguishedName;
}
public void setDistinguishedName(CertDistinguishedName distinguishedName) {
this.distinguishedName = distinguishedName;
}
public CreateCertificateRequestBody withValidity(Validity validity) {
this.validity = validity;
return this;
}
public CreateCertificateRequestBody withValidity(Consumer validitySetter) {
if (this.validity == null) {
this.validity = new Validity();
validitySetter.accept(this.validity);
}
return this;
}
/**
* Get validity
* @return validity
*/
public Validity getValidity() {
return validity;
}
public void setValidity(Validity validity) {
this.validity = validity;
}
public CreateCertificateRequestBody withKeyUsages(List keyUsages) {
this.keyUsages = keyUsages;
return this;
}
public CreateCertificateRequestBody addKeyUsagesItem(String keyUsagesItem) {
if (this.keyUsages == null) {
this.keyUsages = new ArrayList<>();
}
this.keyUsages.add(keyUsagesItem);
return this;
}
public CreateCertificateRequestBody withKeyUsages(Consumer> keyUsagesSetter) {
if (this.keyUsages == null) {
this.keyUsages = new ArrayList<>();
}
keyUsagesSetter.accept(this.keyUsages);
return this;
}
/**
* 密钥用法,具体标准参见RFC 5280中:[4.2.1.3节](https://datatracker.ietf.org/doc/html/rfc5280#section-4.2.1.3)。 - **digitalSignature** : 数字签名; - **nonRepudiation** : 不可抵赖; - **keyEncipherment** : 密钥用于加密密钥数据; - **dataEncipherment** : 用于加密数据; - **keyAgreement** : 密钥协商; - **keyCertSign** : 签发证书; - **cRLSign** : 签发吊销列表; - **encipherOnly** : 仅用于加密; - **decipherOnly** : 仅用于解密。
* @return keyUsages
*/
public List getKeyUsages() {
return keyUsages;
}
public void setKeyUsages(List keyUsages) {
this.keyUsages = keyUsages;
}
public CreateCertificateRequestBody withSubjectAlternativeNames(
List subjectAlternativeNames) {
this.subjectAlternativeNames = subjectAlternativeNames;
return this;
}
public CreateCertificateRequestBody addSubjectAlternativeNamesItem(
SubjectAlternativeName subjectAlternativeNamesItem) {
if (this.subjectAlternativeNames == null) {
this.subjectAlternativeNames = new ArrayList<>();
}
this.subjectAlternativeNames.add(subjectAlternativeNamesItem);
return this;
}
public CreateCertificateRequestBody withSubjectAlternativeNames(
Consumer> subjectAlternativeNamesSetter) {
if (this.subjectAlternativeNames == null) {
this.subjectAlternativeNames = new ArrayList<>();
}
subjectAlternativeNamesSetter.accept(this.subjectAlternativeNames);
return this;
}
/**
* 主体备用名称,详情请参见**SubjectAlternativeName**字段数据结构说明。 - array大小:[0,20]。
* @return subjectAlternativeNames
*/
public List getSubjectAlternativeNames() {
return subjectAlternativeNames;
}
public void setSubjectAlternativeNames(List subjectAlternativeNames) {
this.subjectAlternativeNames = subjectAlternativeNames;
}
public CreateCertificateRequestBody withExtendedKeyUsage(ExtendedKeyUsage extendedKeyUsage) {
this.extendedKeyUsage = extendedKeyUsage;
return this;
}
public CreateCertificateRequestBody withExtendedKeyUsage(Consumer extendedKeyUsageSetter) {
if (this.extendedKeyUsage == null) {
this.extendedKeyUsage = new ExtendedKeyUsage();
extendedKeyUsageSetter.accept(this.extendedKeyUsage);
}
return this;
}
/**
* Get extendedKeyUsage
* @return extendedKeyUsage
*/
public ExtendedKeyUsage getExtendedKeyUsage() {
return extendedKeyUsage;
}
public void setExtendedKeyUsage(ExtendedKeyUsage extendedKeyUsage) {
this.extendedKeyUsage = extendedKeyUsage;
}
public CreateCertificateRequestBody withCustomizedExtension(CustomizedExtension customizedExtension) {
this.customizedExtension = customizedExtension;
return this;
}
public CreateCertificateRequestBody withCustomizedExtension(
Consumer customizedExtensionSetter) {
if (this.customizedExtension == null) {
this.customizedExtension = new CustomizedExtension();
customizedExtensionSetter.accept(this.customizedExtension);
}
return this;
}
/**
* Get customizedExtension
* @return customizedExtension
*/
public CustomizedExtension getCustomizedExtension() {
return customizedExtension;
}
public void setCustomizedExtension(CustomizedExtension customizedExtension) {
this.customizedExtension = customizedExtension;
}
public CreateCertificateRequestBody withEnterpriseProjectId(String enterpriseProjectId) {
this.enterpriseProjectId = enterpriseProjectId;
return this;
}
/**
* 企业多项目ID。用户未开通企业多项目时,不需要输入该字段。 用户开通企业多项目时,查询资源可以输入该字段。 若用户不输入该字段,默认查询租户所有有权限的企业多项目下的资源。 此时“enterprise_project_id”取值为“all”。 若用户输入该字段,取值满足以下任一条件. 取值为“all” 取值为“0” 满足正则匹配:“^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$”
* @return enterpriseProjectId
*/
public String getEnterpriseProjectId() {
return enterpriseProjectId;
}
public void setEnterpriseProjectId(String enterpriseProjectId) {
this.enterpriseProjectId = enterpriseProjectId;
}
@Override
public boolean equals(java.lang.Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
CreateCertificateRequestBody that = (CreateCertificateRequestBody) obj;
return Objects.equals(this.issuerId, that.issuerId) && Objects.equals(this.keyAlgorithm, that.keyAlgorithm)
&& Objects.equals(this.signatureAlgorithm, that.signatureAlgorithm)
&& Objects.equals(this.distinguishedName, that.distinguishedName)
&& Objects.equals(this.validity, that.validity) && Objects.equals(this.keyUsages, that.keyUsages)
&& Objects.equals(this.subjectAlternativeNames, that.subjectAlternativeNames)
&& Objects.equals(this.extendedKeyUsage, that.extendedKeyUsage)
&& Objects.equals(this.customizedExtension, that.customizedExtension)
&& Objects.equals(this.enterpriseProjectId, that.enterpriseProjectId);
}
@Override
public int hashCode() {
return Objects.hash(issuerId,
keyAlgorithm,
signatureAlgorithm,
distinguishedName,
validity,
keyUsages,
subjectAlternativeNames,
extendedKeyUsage,
customizedExtension,
enterpriseProjectId);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class CreateCertificateRequestBody {\n");
sb.append(" issuerId: ").append(toIndentedString(issuerId)).append("\n");
sb.append(" keyAlgorithm: ").append(toIndentedString(keyAlgorithm)).append("\n");
sb.append(" signatureAlgorithm: ").append(toIndentedString(signatureAlgorithm)).append("\n");
sb.append(" distinguishedName: ").append(toIndentedString(distinguishedName)).append("\n");
sb.append(" validity: ").append(toIndentedString(validity)).append("\n");
sb.append(" keyUsages: ").append(toIndentedString(keyUsages)).append("\n");
sb.append(" subjectAlternativeNames: ").append(toIndentedString(subjectAlternativeNames)).append("\n");
sb.append(" extendedKeyUsage: ").append(toIndentedString(extendedKeyUsage)).append("\n");
sb.append(" customizedExtension: ").append(toIndentedString(customizedExtension)).append("\n");
sb.append(" enterpriseProjectId: ").append(toIndentedString(enterpriseProjectId)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}