software.amazon.awssdk.services.databasemigration.model.Certificate Maven / Gradle / Ivy
Show all versions of databasemigration Show documentation
/*
* Copyright 2014-2019 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.io.Serializable;
import java.nio.ByteBuffer;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkBytes;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.adapter.StandardMemberCopier;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
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 SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField CERTIFICATE_IDENTIFIER_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(Certificate::certificateIdentifier)).setter(setter(Builder::certificateIdentifier))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CertificateIdentifier").build())
.build();
private static final SdkField CERTIFICATE_CREATION_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(Certificate::certificateCreationDate)).setter(setter(Builder::certificateCreationDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CertificateCreationDate").build())
.build();
private static final SdkField CERTIFICATE_PEM_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(Certificate::certificatePem)).setter(setter(Builder::certificatePem))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CertificatePem").build()).build();
private static final SdkField CERTIFICATE_WALLET_FIELD = SdkField. builder(MarshallingType.SDK_BYTES)
.getter(getter(Certificate::certificateWallet)).setter(setter(Builder::certificateWallet))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CertificateWallet").build()).build();
private static final SdkField CERTIFICATE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(Certificate::certificateArn)).setter(setter(Builder::certificateArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CertificateArn").build()).build();
private static final SdkField CERTIFICATE_OWNER_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(Certificate::certificateOwner)).setter(setter(Builder::certificateOwner))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CertificateOwner").build()).build();
private static final SdkField VALID_FROM_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(Certificate::validFromDate)).setter(setter(Builder::validFromDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ValidFromDate").build()).build();
private static final SdkField VALID_TO_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(Certificate::validToDate)).setter(setter(Builder::validToDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ValidToDate").build()).build();
private static final SdkField SIGNING_ALGORITHM_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(Certificate::signingAlgorithm)).setter(setter(Builder::signingAlgorithm))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SigningAlgorithm").build()).build();
private static final SdkField KEY_LENGTH_FIELD = SdkField. builder(MarshallingType.INTEGER)
.getter(getter(Certificate::keyLength)).setter(setter(Builder::keyLength))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KeyLength").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CERTIFICATE_IDENTIFIER_FIELD,
CERTIFICATE_CREATION_DATE_FIELD, CERTIFICATE_PEM_FIELD, CERTIFICATE_WALLET_FIELD, CERTIFICATE_ARN_FIELD,
CERTIFICATE_OWNER_FIELD, VALID_FROM_DATE_FIELD, VALID_TO_DATE_FIELD, SIGNING_ALGORITHM_FIELD, KEY_LENGTH_FIELD));
private static final long serialVersionUID = 1L;
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());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@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();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function