software.amazon.awssdk.services.rds.model.Certificate Maven / Gradle / Ivy
Show all versions of rds Show documentation
/*
* Copyright 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.rds.model;
import java.io.Serializable;
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.SdkField;
import software.amazon.awssdk.core.SdkPojo;
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;
/**
*
* A CA certificate for an Amazon Web Services account.
*
*
* For more information, see Using SSL/TLS to encrypt a
* connection to a DB instance in the Amazon RDS User Guide and Using SSL/TLS to encrypt a
* connection to a DB cluster in the Amazon Aurora User Guide.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Certificate implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField CERTIFICATE_IDENTIFIER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CertificateIdentifier").getter(getter(Certificate::certificateIdentifier))
.setter(setter(Builder::certificateIdentifier))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CertificateIdentifier").build())
.build();
private static final SdkField CERTIFICATE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CertificateType").getter(getter(Certificate::certificateType)).setter(setter(Builder::certificateType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CertificateType").build()).build();
private static final SdkField THUMBPRINT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Thumbprint").getter(getter(Certificate::thumbprint)).setter(setter(Builder::thumbprint))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Thumbprint").build()).build();
private static final SdkField VALID_FROM_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("ValidFrom").getter(getter(Certificate::validFrom)).setter(setter(Builder::validFrom))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ValidFrom").build()).build();
private static final SdkField VALID_TILL_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("ValidTill").getter(getter(Certificate::validTill)).setter(setter(Builder::validTill))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ValidTill").build()).build();
private static final SdkField CERTIFICATE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CertificateArn").getter(getter(Certificate::certificateArn)).setter(setter(Builder::certificateArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CertificateArn").build()).build();
private static final SdkField CUSTOMER_OVERRIDE_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("CustomerOverride").getter(getter(Certificate::customerOverride))
.setter(setter(Builder::customerOverride))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CustomerOverride").build()).build();
private static final SdkField CUSTOMER_OVERRIDE_VALID_TILL_FIELD = SdkField
. builder(MarshallingType.INSTANT).memberName("CustomerOverrideValidTill")
.getter(getter(Certificate::customerOverrideValidTill)).setter(setter(Builder::customerOverrideValidTill))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CustomerOverrideValidTill").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CERTIFICATE_IDENTIFIER_FIELD,
CERTIFICATE_TYPE_FIELD, THUMBPRINT_FIELD, VALID_FROM_FIELD, VALID_TILL_FIELD, CERTIFICATE_ARN_FIELD,
CUSTOMER_OVERRIDE_FIELD, CUSTOMER_OVERRIDE_VALID_TILL_FIELD));
private static final long serialVersionUID = 1L;
private final String certificateIdentifier;
private final String certificateType;
private final String thumbprint;
private final Instant validFrom;
private final Instant validTill;
private final String certificateArn;
private final Boolean customerOverride;
private final Instant customerOverrideValidTill;
private Certificate(BuilderImpl builder) {
this.certificateIdentifier = builder.certificateIdentifier;
this.certificateType = builder.certificateType;
this.thumbprint = builder.thumbprint;
this.validFrom = builder.validFrom;
this.validTill = builder.validTill;
this.certificateArn = builder.certificateArn;
this.customerOverride = builder.customerOverride;
this.customerOverrideValidTill = builder.customerOverrideValidTill;
}
/**
*
* The unique key that identifies a certificate.
*
*
* @return The unique key that identifies a certificate.
*/
public final String certificateIdentifier() {
return certificateIdentifier;
}
/**
*
* The type of the certificate.
*
*
* @return The type of the certificate.
*/
public final String certificateType() {
return certificateType;
}
/**
*
* The thumbprint of the certificate.
*
*
* @return The thumbprint of the certificate.
*/
public final String thumbprint() {
return thumbprint;
}
/**
*
* The starting date from which the certificate is valid.
*
*
* @return The starting date from which the certificate is valid.
*/
public final Instant validFrom() {
return validFrom;
}
/**
*
* The final date that the certificate continues to be valid.
*
*
* @return The final date that the certificate continues to be valid.
*/
public final Instant validTill() {
return validTill;
}
/**
*
* The Amazon Resource Name (ARN) for the certificate.
*
*
* @return The Amazon Resource Name (ARN) for the certificate.
*/
public final String certificateArn() {
return certificateArn;
}
/**
*
* Indicates whether there is an override for the default certificate identifier.
*
*
* @return Indicates whether there is an override for the default certificate identifier.
*/
public final Boolean customerOverride() {
return customerOverride;
}
/**
*
* If there is an override for the default certificate identifier, when the override expires.
*
*
* @return If there is an override for the default certificate identifier, when the override expires.
*/
public final Instant customerOverrideValidTill() {
return customerOverrideValidTill;
}
@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 final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(certificateIdentifier());
hashCode = 31 * hashCode + Objects.hashCode(certificateType());
hashCode = 31 * hashCode + Objects.hashCode(thumbprint());
hashCode = 31 * hashCode + Objects.hashCode(validFrom());
hashCode = 31 * hashCode + Objects.hashCode(validTill());
hashCode = 31 * hashCode + Objects.hashCode(certificateArn());
hashCode = 31 * hashCode + Objects.hashCode(customerOverride());
hashCode = 31 * hashCode + Objects.hashCode(customerOverrideValidTill());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(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(certificateType(), other.certificateType()) && Objects.equals(thumbprint(), other.thumbprint())
&& Objects.equals(validFrom(), other.validFrom()) && Objects.equals(validTill(), other.validTill())
&& Objects.equals(certificateArn(), other.certificateArn())
&& Objects.equals(customerOverride(), other.customerOverride())
&& Objects.equals(customerOverrideValidTill(), other.customerOverrideValidTill());
}
/**
* 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 final String toString() {
return ToString.builder("Certificate").add("CertificateIdentifier", certificateIdentifier())
.add("CertificateType", certificateType()).add("Thumbprint", thumbprint()).add("ValidFrom", validFrom())
.add("ValidTill", validTill()).add("CertificateArn", certificateArn())
.add("CustomerOverride", customerOverride()).add("CustomerOverrideValidTill", customerOverrideValidTill())
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "CertificateIdentifier":
return Optional.ofNullable(clazz.cast(certificateIdentifier()));
case "CertificateType":
return Optional.ofNullable(clazz.cast(certificateType()));
case "Thumbprint":
return Optional.ofNullable(clazz.cast(thumbprint()));
case "ValidFrom":
return Optional.ofNullable(clazz.cast(validFrom()));
case "ValidTill":
return Optional.ofNullable(clazz.cast(validTill()));
case "CertificateArn":
return Optional.ofNullable(clazz.cast(certificateArn()));
case "CustomerOverride":
return Optional.ofNullable(clazz.cast(customerOverride()));
case "CustomerOverrideValidTill":
return Optional.ofNullable(clazz.cast(customerOverrideValidTill()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function