
software.amazon.awssdk.services.proton.model.EnvironmentTemplateVersion 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.proton.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;
/**
*
* The environment template version data.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class EnvironmentTemplateVersion implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("arn")
.getter(getter(EnvironmentTemplateVersion::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("arn").build()).build();
private static final SdkField CREATED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("createdAt").getter(getter(EnvironmentTemplateVersion::createdAt)).setter(setter(Builder::createdAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("createdAt").build()).build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("description").getter(getter(EnvironmentTemplateVersion::description))
.setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("description").build()).build();
private static final SdkField LAST_MODIFIED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("lastModifiedAt").getter(getter(EnvironmentTemplateVersion::lastModifiedAt))
.setter(setter(Builder::lastModifiedAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lastModifiedAt").build()).build();
private static final SdkField MAJOR_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("majorVersion").getter(getter(EnvironmentTemplateVersion::majorVersion))
.setter(setter(Builder::majorVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("majorVersion").build()).build();
private static final SdkField MINOR_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("minorVersion").getter(getter(EnvironmentTemplateVersion::minorVersion))
.setter(setter(Builder::minorVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("minorVersion").build()).build();
private static final SdkField RECOMMENDED_MINOR_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("recommendedMinorVersion").getter(getter(EnvironmentTemplateVersion::recommendedMinorVersion))
.setter(setter(Builder::recommendedMinorVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("recommendedMinorVersion").build())
.build();
private static final SdkField SCHEMA_FIELD = SdkField. builder(MarshallingType.STRING).memberName("schema")
.getter(getter(EnvironmentTemplateVersion::schema)).setter(setter(Builder::schema))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("schema").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("status")
.getter(getter(EnvironmentTemplateVersion::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build();
private static final SdkField STATUS_MESSAGE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("statusMessage").getter(getter(EnvironmentTemplateVersion::statusMessage))
.setter(setter(Builder::statusMessage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("statusMessage").build()).build();
private static final SdkField TEMPLATE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("templateName").getter(getter(EnvironmentTemplateVersion::templateName))
.setter(setter(Builder::templateName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("templateName").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD, CREATED_AT_FIELD,
DESCRIPTION_FIELD, LAST_MODIFIED_AT_FIELD, MAJOR_VERSION_FIELD, MINOR_VERSION_FIELD, RECOMMENDED_MINOR_VERSION_FIELD,
SCHEMA_FIELD, STATUS_FIELD, STATUS_MESSAGE_FIELD, TEMPLATE_NAME_FIELD));
private static final long serialVersionUID = 1L;
private final String arn;
private final Instant createdAt;
private final String description;
private final Instant lastModifiedAt;
private final String majorVersion;
private final String minorVersion;
private final String recommendedMinorVersion;
private final String schema;
private final String status;
private final String statusMessage;
private final String templateName;
private EnvironmentTemplateVersion(BuilderImpl builder) {
this.arn = builder.arn;
this.createdAt = builder.createdAt;
this.description = builder.description;
this.lastModifiedAt = builder.lastModifiedAt;
this.majorVersion = builder.majorVersion;
this.minorVersion = builder.minorVersion;
this.recommendedMinorVersion = builder.recommendedMinorVersion;
this.schema = builder.schema;
this.status = builder.status;
this.statusMessage = builder.statusMessage;
this.templateName = builder.templateName;
}
/**
*
* The Amazon Resource Name (ARN) of the version of an environment template.
*
*
* @return The Amazon Resource Name (ARN) of the version of an environment template.
*/
public final String arn() {
return arn;
}
/**
*
* The time when the version of an environment template was created.
*
*
* @return The time when the version of an environment template was created.
*/
public final Instant createdAt() {
return createdAt;
}
/**
*
* A description of the minor version of an environment template.
*
*
* @return A description of the minor version of an environment template.
*/
public final String description() {
return description;
}
/**
*
* The time when the version of an environment template was last modified.
*
*
* @return The time when the version of an environment template was last modified.
*/
public final Instant lastModifiedAt() {
return lastModifiedAt;
}
/**
*
* The latest major version that's associated with the version of an environment template.
*
*
* @return The latest major version that's associated with the version of an environment template.
*/
public final String majorVersion() {
return majorVersion;
}
/**
*
* The minor version of an environment template.
*
*
* @return The minor version of an environment template.
*/
public final String minorVersion() {
return minorVersion;
}
/**
*
* The recommended minor version of the environment template.
*
*
* @return The recommended minor version of the environment template.
*/
public final String recommendedMinorVersion() {
return recommendedMinorVersion;
}
/**
*
* The schema of the version of an environment template.
*
*
* @return The schema of the version of an environment template.
*/
public final String schema() {
return schema;
}
/**
*
* The status of the version of an environment template.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link TemplateVersionStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #statusAsString}.
*
*
* @return The status of the version of an environment template.
* @see TemplateVersionStatus
*/
public final TemplateVersionStatus status() {
return TemplateVersionStatus.fromValue(status);
}
/**
*
* The status of the version of an environment template.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link TemplateVersionStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #statusAsString}.
*
*
* @return The status of the version of an environment template.
* @see TemplateVersionStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* The status message of the version of an environment template.
*
*
* @return The status message of the version of an environment template.
*/
public final String statusMessage() {
return statusMessage;
}
/**
*
* The name of the version of an environment template.
*
*
* @return The name of the version of an environment template.
*/
public final String templateName() {
return templateName;
}
@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(arn());
hashCode = 31 * hashCode + Objects.hashCode(createdAt());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(lastModifiedAt());
hashCode = 31 * hashCode + Objects.hashCode(majorVersion());
hashCode = 31 * hashCode + Objects.hashCode(minorVersion());
hashCode = 31 * hashCode + Objects.hashCode(recommendedMinorVersion());
hashCode = 31 * hashCode + Objects.hashCode(schema());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(statusMessage());
hashCode = 31 * hashCode + Objects.hashCode(templateName());
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 EnvironmentTemplateVersion)) {
return false;
}
EnvironmentTemplateVersion other = (EnvironmentTemplateVersion) obj;
return Objects.equals(arn(), other.arn()) && Objects.equals(createdAt(), other.createdAt())
&& Objects.equals(description(), other.description()) && Objects.equals(lastModifiedAt(), other.lastModifiedAt())
&& Objects.equals(majorVersion(), other.majorVersion()) && Objects.equals(minorVersion(), other.minorVersion())
&& Objects.equals(recommendedMinorVersion(), other.recommendedMinorVersion())
&& Objects.equals(schema(), other.schema()) && Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(statusMessage(), other.statusMessage()) && Objects.equals(templateName(), other.templateName());
}
/**
* 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("EnvironmentTemplateVersion").add("Arn", arn()).add("CreatedAt", createdAt())
.add("Description", description() == null ? null : "*** Sensitive Data Redacted ***")
.add("LastModifiedAt", lastModifiedAt()).add("MajorVersion", majorVersion()).add("MinorVersion", minorVersion())
.add("RecommendedMinorVersion", recommendedMinorVersion())
.add("Schema", schema() == null ? null : "*** Sensitive Data Redacted ***").add("Status", statusAsString())
.add("StatusMessage", statusMessage() == null ? null : "*** Sensitive Data Redacted ***")
.add("TemplateName", templateName()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "arn":
return Optional.ofNullable(clazz.cast(arn()));
case "createdAt":
return Optional.ofNullable(clazz.cast(createdAt()));
case "description":
return Optional.ofNullable(clazz.cast(description()));
case "lastModifiedAt":
return Optional.ofNullable(clazz.cast(lastModifiedAt()));
case "majorVersion":
return Optional.ofNullable(clazz.cast(majorVersion()));
case "minorVersion":
return Optional.ofNullable(clazz.cast(minorVersion()));
case "recommendedMinorVersion":
return Optional.ofNullable(clazz.cast(recommendedMinorVersion()));
case "schema":
return Optional.ofNullable(clazz.cast(schema()));
case "status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "statusMessage":
return Optional.ofNullable(clazz.cast(statusMessage()));
case "templateName":
return Optional.ofNullable(clazz.cast(templateName()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function