software.amazon.awssdk.services.databasemigration.model.Certificate Maven / Gradle / Ivy
Show all versions of dms Show documentation
/*
* Copyright 2012-2017 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 javax.annotation.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.core.protocol.ProtocolMarshaller;
import software.amazon.awssdk.core.protocol.StructuredPojo;
import software.amazon.awssdk.core.runtime.StandardMemberCopier;
import software.amazon.awssdk.services.databasemigration.transform.CertificateMarshaller;
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 class Certificate implements StructuredPojo, ToCopyableBuilder {
private final String certificateIdentifier;
private final Instant certificateCreationDate;
private final String certificatePem;
private final ByteBuffer 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.
*
*
* This method will return a new read-only {@code ByteBuffer} each time it is invoked.
*
*
* @return The location of the imported Oracle Wallet certificate for use with SSL.
*/
public ByteBuffer certificateWallet() {
return certificateWallet == null ? null : certificateWallet.asReadOnlyBuffer();
}
/**
*
* 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() {
StringBuilder sb = new StringBuilder("{");
if (certificateIdentifier() != null) {
sb.append("CertificateIdentifier: ").append(certificateIdentifier()).append(",");
}
if (certificateCreationDate() != null) {
sb.append("CertificateCreationDate: ").append(certificateCreationDate()).append(",");
}
if (certificatePem() != null) {
sb.append("CertificatePem: ").append(certificatePem()).append(",");
}
if (certificateWallet() != null) {
sb.append("CertificateWallet: ").append(certificateWallet()).append(",");
}
if (certificateArn() != null) {
sb.append("CertificateArn: ").append(certificateArn()).append(",");
}
if (certificateOwner() != null) {
sb.append("CertificateOwner: ").append(certificateOwner()).append(",");
}
if (validFromDate() != null) {
sb.append("ValidFromDate: ").append(validFromDate()).append(",");
}
if (validToDate() != null) {
sb.append("ValidToDate: ").append(validToDate()).append(",");
}
if (signingAlgorithm() != null) {
sb.append("SigningAlgorithm: ").append(signingAlgorithm()).append(",");
}
if (keyLength() != null) {
sb.append("KeyLength: ").append(keyLength()).append(",");
}
if (sb.length() > 1) {
sb.setLength(sb.length() - 1);
}
sb.append("}");
return sb.toString();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "CertificateIdentifier":
return Optional.of(clazz.cast(certificateIdentifier()));
case "CertificateCreationDate":
return Optional.of(clazz.cast(certificateCreationDate()));
case "CertificatePem":
return Optional.of(clazz.cast(certificatePem()));
case "CertificateWallet":
return Optional.of(clazz.cast(certificateWallet()));
case "CertificateArn":
return Optional.of(clazz.cast(certificateArn()));
case "CertificateOwner":
return Optional.of(clazz.cast(certificateOwner()));
case "ValidFromDate":
return Optional.of(clazz.cast(validFromDate()));
case "ValidToDate":
return Optional.of(clazz.cast(validToDate()));
case "SigningAlgorithm":
return Optional.of(clazz.cast(signingAlgorithm()));
case "KeyLength":
return Optional.of(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.
*
*
* To preserve immutability, the remaining bytes in the provided buffer will be copied into a new buffer when
* set.
*
*
* @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(ByteBuffer 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 ByteBuffer 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;
}
@Override
public final Builder certificateWallet(ByteBuffer certificateWallet) {
this.certificateWallet = StandardMemberCopier.copy(certificateWallet);
return this;
}
public final void setCertificateWallet(ByteBuffer certificateWallet) {
this.certificateWallet = StandardMemberCopier.copy(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);
}
}
}