software.amazon.awssdk.services.databasemigration.model.Certificate Maven / Gradle / Ivy
Show all versions of dms Show documentation
/*
* Copyright 2013-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.databasemigration.model;
import java.nio.ByteBuffer;
import java.time.Instant;
import java.util.Objects;
import java.util.Optional;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.core.SdkBytes;
import software.amazon.awssdk.core.adapter.StandardMemberCopier;
import software.amazon.awssdk.core.protocol.ProtocolMarshaller;
import software.amazon.awssdk.core.protocol.StructuredPojo;
import software.amazon.awssdk.services.databasemigration.transform.CertificateMarshaller;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* The SSL certificate that can be used to encrypt connections between the endpoints and the replication instance.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Certificate implements StructuredPojo, ToCopyableBuilder {
private final String certificateIdentifier;
private final Instant certificateCreationDate;
private final String certificatePem;
private final SdkBytes certificateWallet;
private final String certificateArn;
private final String certificateOwner;
private final Instant validFromDate;
private final Instant validToDate;
private final String signingAlgorithm;
private final Integer keyLength;
private Certificate(BuilderImpl builder) {
this.certificateIdentifier = builder.certificateIdentifier;
this.certificateCreationDate = builder.certificateCreationDate;
this.certificatePem = builder.certificatePem;
this.certificateWallet = builder.certificateWallet;
this.certificateArn = builder.certificateArn;
this.certificateOwner = builder.certificateOwner;
this.validFromDate = builder.validFromDate;
this.validToDate = builder.validToDate;
this.signingAlgorithm = builder.signingAlgorithm;
this.keyLength = builder.keyLength;
}
/**
*
* The customer-assigned name of the certificate. Valid characters are A-z and 0-9.
*
*
* @return The customer-assigned name of the certificate. Valid characters are A-z and 0-9.
*/
public String certificateIdentifier() {
return certificateIdentifier;
}
/**
*
* The date that the certificate was created.
*
*
* @return The date that the certificate was created.
*/
public Instant certificateCreationDate() {
return certificateCreationDate;
}
/**
*
* The contents of the .pem X.509 certificate file for the certificate.
*
*
* @return The contents of the .pem X.509 certificate file for the certificate.
*/
public String certificatePem() {
return certificatePem;
}
/**
*
* The location of the imported Oracle Wallet certificate for use with SSL.
*
*
* @return The location of the imported Oracle Wallet certificate for use with SSL.
*/
public SdkBytes certificateWallet() {
return certificateWallet;
}
/**
*
* The Amazon Resource Name (ARN) for the certificate.
*
*
* @return The Amazon Resource Name (ARN) for the certificate.
*/
public String certificateArn() {
return certificateArn;
}
/**
*
* The owner of the certificate.
*
*
* @return The owner of the certificate.
*/
public String certificateOwner() {
return certificateOwner;
}
/**
*
* The beginning date that the certificate is valid.
*
*
* @return The beginning date that the certificate is valid.
*/
public Instant validFromDate() {
return validFromDate;
}
/**
*
* The final date that the certificate is valid.
*
*
* @return The final date that the certificate is valid.
*/
public Instant validToDate() {
return validToDate;
}
/**
*
* The signing algorithm for the certificate.
*
*
* @return The signing algorithm for the certificate.
*/
public String signingAlgorithm() {
return signingAlgorithm;
}
/**
*
* The key length of the cryptographic algorithm being used.
*
*
* @return The key length of the cryptographic algorithm being used.
*/
public Integer keyLength() {
return keyLength;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(certificateIdentifier());
hashCode = 31 * hashCode + Objects.hashCode(certificateCreationDate());
hashCode = 31 * hashCode + Objects.hashCode(certificatePem());
hashCode = 31 * hashCode + Objects.hashCode(certificateWallet());
hashCode = 31 * hashCode + Objects.hashCode(certificateArn());
hashCode = 31 * hashCode + Objects.hashCode(certificateOwner());
hashCode = 31 * hashCode + Objects.hashCode(validFromDate());
hashCode = 31 * hashCode + Objects.hashCode(validToDate());
hashCode = 31 * hashCode + Objects.hashCode(signingAlgorithm());
hashCode = 31 * hashCode + Objects.hashCode(keyLength());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof Certificate)) {
return false;
}
Certificate other = (Certificate) obj;
return Objects.equals(certificateIdentifier(), other.certificateIdentifier())
&& Objects.equals(certificateCreationDate(), other.certificateCreationDate())
&& Objects.equals(certificatePem(), other.certificatePem())
&& Objects.equals(certificateWallet(), other.certificateWallet())
&& Objects.equals(certificateArn(), other.certificateArn())
&& Objects.equals(certificateOwner(), other.certificateOwner())
&& Objects.equals(validFromDate(), other.validFromDate()) && Objects.equals(validToDate(), other.validToDate())
&& Objects.equals(signingAlgorithm(), other.signingAlgorithm()) && Objects.equals(keyLength(), other.keyLength());
}
@Override
public String toString() {
return ToString.builder("Certificate").add("CertificateIdentifier", certificateIdentifier())
.add("CertificateCreationDate", certificateCreationDate()).add("CertificatePem", certificatePem())
.add("CertificateWallet", certificateWallet()).add("CertificateArn", certificateArn())
.add("CertificateOwner", certificateOwner()).add("ValidFromDate", validFromDate())
.add("ValidToDate", validToDate()).add("SigningAlgorithm", signingAlgorithm()).add("KeyLength", keyLength())
.build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "CertificateIdentifier":
return Optional.ofNullable(clazz.cast(certificateIdentifier()));
case "CertificateCreationDate":
return Optional.ofNullable(clazz.cast(certificateCreationDate()));
case "CertificatePem":
return Optional.ofNullable(clazz.cast(certificatePem()));
case "CertificateWallet":
return Optional.ofNullable(clazz.cast(certificateWallet()));
case "CertificateArn":
return Optional.ofNullable(clazz.cast(certificateArn()));
case "CertificateOwner":
return Optional.ofNullable(clazz.cast(certificateOwner()));
case "ValidFromDate":
return Optional.ofNullable(clazz.cast(validFromDate()));
case "ValidToDate":
return Optional.ofNullable(clazz.cast(validToDate()));
case "SigningAlgorithm":
return Optional.ofNullable(clazz.cast(signingAlgorithm()));
case "KeyLength":
return Optional.ofNullable(clazz.cast(keyLength()));
default:
return Optional.empty();
}
}
@SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
CertificateMarshaller.getInstance().marshall(this, protocolMarshaller);
}
public interface Builder extends CopyableBuilder {
/**
*
* The customer-assigned name of the certificate. Valid characters are A-z and 0-9.
*
*
* @param certificateIdentifier
* The customer-assigned name of the certificate. Valid characters are A-z and 0-9.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder certificateIdentifier(String certificateIdentifier);
/**
*
* The date that the certificate was created.
*
*
* @param certificateCreationDate
* The date that the certificate was created.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder certificateCreationDate(Instant certificateCreationDate);
/**
*
* The contents of the .pem X.509 certificate file for the certificate.
*
*
* @param certificatePem
* The contents of the .pem X.509 certificate file for the certificate.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder certificatePem(String certificatePem);
/**
*
* The location of the imported Oracle Wallet certificate for use with SSL.
*
*
* @param certificateWallet
* The location of the imported Oracle Wallet certificate for use with SSL.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder certificateWallet(SdkBytes certificateWallet);
/**
*
* The Amazon Resource Name (ARN) for the certificate.
*
*
* @param certificateArn
* The Amazon Resource Name (ARN) for the certificate.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder certificateArn(String certificateArn);
/**
*
* The owner of the certificate.
*
*
* @param certificateOwner
* The owner of the certificate.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder certificateOwner(String certificateOwner);
/**
*
* The beginning date that the certificate is valid.
*
*
* @param validFromDate
* The beginning date that the certificate is valid.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder validFromDate(Instant validFromDate);
/**
*
* The final date that the certificate is valid.
*
*
* @param validToDate
* The final date that the certificate is valid.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder validToDate(Instant validToDate);
/**
*
* The signing algorithm for the certificate.
*
*
* @param signingAlgorithm
* The signing algorithm for the certificate.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder signingAlgorithm(String signingAlgorithm);
/**
*
* The key length of the cryptographic algorithm being used.
*
*
* @param keyLength
* The key length of the cryptographic algorithm being used.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder keyLength(Integer keyLength);
}
static final class BuilderImpl implements Builder {
private String certificateIdentifier;
private Instant certificateCreationDate;
private String certificatePem;
private SdkBytes certificateWallet;
private String certificateArn;
private String certificateOwner;
private Instant validFromDate;
private Instant validToDate;
private String signingAlgorithm;
private Integer keyLength;
private BuilderImpl() {
}
private BuilderImpl(Certificate model) {
certificateIdentifier(model.certificateIdentifier);
certificateCreationDate(model.certificateCreationDate);
certificatePem(model.certificatePem);
certificateWallet(model.certificateWallet);
certificateArn(model.certificateArn);
certificateOwner(model.certificateOwner);
validFromDate(model.validFromDate);
validToDate(model.validToDate);
signingAlgorithm(model.signingAlgorithm);
keyLength(model.keyLength);
}
public final String getCertificateIdentifier() {
return certificateIdentifier;
}
@Override
public final Builder certificateIdentifier(String certificateIdentifier) {
this.certificateIdentifier = certificateIdentifier;
return this;
}
public final void setCertificateIdentifier(String certificateIdentifier) {
this.certificateIdentifier = certificateIdentifier;
}
public final Instant getCertificateCreationDate() {
return certificateCreationDate;
}
@Override
public final Builder certificateCreationDate(Instant certificateCreationDate) {
this.certificateCreationDate = certificateCreationDate;
return this;
}
public final void setCertificateCreationDate(Instant certificateCreationDate) {
this.certificateCreationDate = certificateCreationDate;
}
public final String getCertificatePem() {
return certificatePem;
}
@Override
public final Builder certificatePem(String certificatePem) {
this.certificatePem = certificatePem;
return this;
}
public final void setCertificatePem(String certificatePem) {
this.certificatePem = certificatePem;
}
public final ByteBuffer getCertificateWallet() {
return certificateWallet == null ? null : certificateWallet.asByteBuffer();
}
@Override
public final Builder certificateWallet(SdkBytes certificateWallet) {
this.certificateWallet = StandardMemberCopier.copy(certificateWallet);
return this;
}
public final void setCertificateWallet(ByteBuffer certificateWallet) {
certificateWallet(certificateWallet == null ? null : SdkBytes.fromByteBuffer(certificateWallet));
}
public final String getCertificateArn() {
return certificateArn;
}
@Override
public final Builder certificateArn(String certificateArn) {
this.certificateArn = certificateArn;
return this;
}
public final void setCertificateArn(String certificateArn) {
this.certificateArn = certificateArn;
}
public final String getCertificateOwner() {
return certificateOwner;
}
@Override
public final Builder certificateOwner(String certificateOwner) {
this.certificateOwner = certificateOwner;
return this;
}
public final void setCertificateOwner(String certificateOwner) {
this.certificateOwner = certificateOwner;
}
public final Instant getValidFromDate() {
return validFromDate;
}
@Override
public final Builder validFromDate(Instant validFromDate) {
this.validFromDate = validFromDate;
return this;
}
public final void setValidFromDate(Instant validFromDate) {
this.validFromDate = validFromDate;
}
public final Instant getValidToDate() {
return validToDate;
}
@Override
public final Builder validToDate(Instant validToDate) {
this.validToDate = validToDate;
return this;
}
public final void setValidToDate(Instant validToDate) {
this.validToDate = validToDate;
}
public final String getSigningAlgorithm() {
return signingAlgorithm;
}
@Override
public final Builder signingAlgorithm(String signingAlgorithm) {
this.signingAlgorithm = signingAlgorithm;
return this;
}
public final void setSigningAlgorithm(String signingAlgorithm) {
this.signingAlgorithm = signingAlgorithm;
}
public final Integer getKeyLength() {
return keyLength;
}
@Override
public final Builder keyLength(Integer keyLength) {
this.keyLength = keyLength;
return this;
}
public final void setKeyLength(Integer keyLength) {
this.keyLength = keyLength;
}
@Override
public Certificate build() {
return new Certificate(this);
}
}
}