
software.amazon.awssdk.services.workspacesweb.model.Certificate Maven / Gradle / Ivy
/*
* 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.workspacesweb.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.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 certificate.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Certificate implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField BODY_FIELD = SdkField. builder(MarshallingType.SDK_BYTES)
.memberName("body").getter(getter(Certificate::body)).setter(setter(Builder::body))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("body").build()).build();
private static final SdkField ISSUER_FIELD = SdkField. builder(MarshallingType.STRING).memberName("issuer")
.getter(getter(Certificate::issuer)).setter(setter(Builder::issuer))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("issuer").build()).build();
private static final SdkField NOT_VALID_AFTER_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("notValidAfter").getter(getter(Certificate::notValidAfter)).setter(setter(Builder::notValidAfter))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("notValidAfter").build()).build();
private static final SdkField NOT_VALID_BEFORE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("notValidBefore").getter(getter(Certificate::notValidBefore)).setter(setter(Builder::notValidBefore))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("notValidBefore").build()).build();
private static final SdkField SUBJECT_FIELD = SdkField. builder(MarshallingType.STRING).memberName("subject")
.getter(getter(Certificate::subject)).setter(setter(Builder::subject))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("subject").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 List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BODY_FIELD, ISSUER_FIELD,
NOT_VALID_AFTER_FIELD, NOT_VALID_BEFORE_FIELD, SUBJECT_FIELD, THUMBPRINT_FIELD));
private static final long serialVersionUID = 1L;
private final SdkBytes body;
private final String issuer;
private final Instant notValidAfter;
private final Instant notValidBefore;
private final String subject;
private final String thumbprint;
private Certificate(BuilderImpl builder) {
this.body = builder.body;
this.issuer = builder.issuer;
this.notValidAfter = builder.notValidAfter;
this.notValidBefore = builder.notValidBefore;
this.subject = builder.subject;
this.thumbprint = builder.thumbprint;
}
/**
*
* The body of the certificate.
*
*
* @return The body of the certificate.
*/
public final SdkBytes body() {
return body;
}
/**
*
* The entity that issued the certificate.
*
*
* @return The entity that issued the certificate.
*/
public final String issuer() {
return issuer;
}
/**
*
* The certificate is not valid after this date.
*
*
* @return The certificate is not valid after this date.
*/
public final Instant notValidAfter() {
return notValidAfter;
}
/**
*
* The certificate is not valid before this date.
*
*
* @return The certificate is not valid before this date.
*/
public final Instant notValidBefore() {
return notValidBefore;
}
/**
*
* The entity the certificate belongs to.
*
*
* @return The entity the certificate belongs to.
*/
public final String subject() {
return subject;
}
/**
*
* A hexadecimal identifier for the certificate.
*
*
* @return A hexadecimal identifier for the certificate.
*/
public final String thumbprint() {
return thumbprint;
}
@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(body());
hashCode = 31 * hashCode + Objects.hashCode(issuer());
hashCode = 31 * hashCode + Objects.hashCode(notValidAfter());
hashCode = 31 * hashCode + Objects.hashCode(notValidBefore());
hashCode = 31 * hashCode + Objects.hashCode(subject());
hashCode = 31 * hashCode + Objects.hashCode(thumbprint());
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(body(), other.body()) && Objects.equals(issuer(), other.issuer())
&& Objects.equals(notValidAfter(), other.notValidAfter())
&& Objects.equals(notValidBefore(), other.notValidBefore()) && Objects.equals(subject(), other.subject())
&& Objects.equals(thumbprint(), other.thumbprint());
}
/**
* 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("Body", body()).add("Issuer", issuer()).add("NotValidAfter", notValidAfter())
.add("NotValidBefore", notValidBefore()).add("Subject", subject()).add("Thumbprint", thumbprint()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "body":
return Optional.ofNullable(clazz.cast(body()));
case "issuer":
return Optional.ofNullable(clazz.cast(issuer()));
case "notValidAfter":
return Optional.ofNullable(clazz.cast(notValidAfter()));
case "notValidBefore":
return Optional.ofNullable(clazz.cast(notValidBefore()));
case "subject":
return Optional.ofNullable(clazz.cast(subject()));
case "thumbprint":
return Optional.ofNullable(clazz.cast(thumbprint()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function
© 2015 - 2025 Weber Informatics LLC | Privacy Policy