software.amazon.awssdk.services.m2.model.EnvironmentSummary Maven / Gradle / Ivy
Show all versions of m2 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.m2.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;
/**
*
* Contains a subset of the possible runtime environment attributes. Used in the environment list.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class EnvironmentSummary implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("creationTime").getter(getter(EnvironmentSummary::creationTime)).setter(setter(Builder::creationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("creationTime").build()).build();
private static final SdkField ENGINE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("engineType").getter(getter(EnvironmentSummary::engineTypeAsString)).setter(setter(Builder::engineType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("engineType").build()).build();
private static final SdkField ENGINE_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("engineVersion").getter(getter(EnvironmentSummary::engineVersion)).setter(setter(Builder::engineVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("engineVersion").build()).build();
private static final SdkField ENVIRONMENT_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("environmentArn").getter(getter(EnvironmentSummary::environmentArn))
.setter(setter(Builder::environmentArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("environmentArn").build()).build();
private static final SdkField ENVIRONMENT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("environmentId").getter(getter(EnvironmentSummary::environmentId)).setter(setter(Builder::environmentId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("environmentId").build()).build();
private static final SdkField INSTANCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("instanceType").getter(getter(EnvironmentSummary::instanceType)).setter(setter(Builder::instanceType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("instanceType").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("name")
.getter(getter(EnvironmentSummary::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("name").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("status")
.getter(getter(EnvironmentSummary::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CREATION_TIME_FIELD,
ENGINE_TYPE_FIELD, ENGINE_VERSION_FIELD, ENVIRONMENT_ARN_FIELD, ENVIRONMENT_ID_FIELD, INSTANCE_TYPE_FIELD,
NAME_FIELD, STATUS_FIELD));
private static final long serialVersionUID = 1L;
private final Instant creationTime;
private final String engineType;
private final String engineVersion;
private final String environmentArn;
private final String environmentId;
private final String instanceType;
private final String name;
private final String status;
private EnvironmentSummary(BuilderImpl builder) {
this.creationTime = builder.creationTime;
this.engineType = builder.engineType;
this.engineVersion = builder.engineVersion;
this.environmentArn = builder.environmentArn;
this.environmentId = builder.environmentId;
this.instanceType = builder.instanceType;
this.name = builder.name;
this.status = builder.status;
}
/**
*
* The timestamp when the runtime environment was created.
*
*
* @return The timestamp when the runtime environment was created.
*/
public final Instant creationTime() {
return creationTime;
}
/**
*
* The target platform for the runtime environment.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #engineType} will
* return {@link EngineType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #engineTypeAsString}.
*
*
* @return The target platform for the runtime environment.
* @see EngineType
*/
public final EngineType engineType() {
return EngineType.fromValue(engineType);
}
/**
*
* The target platform for the runtime environment.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #engineType} will
* return {@link EngineType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #engineTypeAsString}.
*
*
* @return The target platform for the runtime environment.
* @see EngineType
*/
public final String engineTypeAsString() {
return engineType;
}
/**
*
* The version of the runtime engine.
*
*
* @return The version of the runtime engine.
*/
public final String engineVersion() {
return engineVersion;
}
/**
*
* The Amazon Resource Name (ARN) of a particular runtime environment.
*
*
* @return The Amazon Resource Name (ARN) of a particular runtime environment.
*/
public final String environmentArn() {
return environmentArn;
}
/**
*
* The unique identifier of a particular runtime environment.
*
*
* @return The unique identifier of a particular runtime environment.
*/
public final String environmentId() {
return environmentId;
}
/**
*
* The instance type of the runtime environment.
*
*
* @return The instance type of the runtime environment.
*/
public final String instanceType() {
return instanceType;
}
/**
*
* The name of the runtime environment.
*
*
* @return The name of the runtime environment.
*/
public final String name() {
return name;
}
/**
*
* The status of the runtime environment
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link EnvironmentLifecycle#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #statusAsString}.
*
*
* @return The status of the runtime environment
* @see EnvironmentLifecycle
*/
public final EnvironmentLifecycle status() {
return EnvironmentLifecycle.fromValue(status);
}
/**
*
* The status of the runtime environment
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link EnvironmentLifecycle#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #statusAsString}.
*
*
* @return The status of the runtime environment
* @see EnvironmentLifecycle
*/
public final String statusAsString() {
return status;
}
@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(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(engineTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(engineVersion());
hashCode = 31 * hashCode + Objects.hashCode(environmentArn());
hashCode = 31 * hashCode + Objects.hashCode(environmentId());
hashCode = 31 * hashCode + Objects.hashCode(instanceType());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
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 EnvironmentSummary)) {
return false;
}
EnvironmentSummary other = (EnvironmentSummary) obj;
return Objects.equals(creationTime(), other.creationTime())
&& Objects.equals(engineTypeAsString(), other.engineTypeAsString())
&& Objects.equals(engineVersion(), other.engineVersion())
&& Objects.equals(environmentArn(), other.environmentArn())
&& Objects.equals(environmentId(), other.environmentId()) && Objects.equals(instanceType(), other.instanceType())
&& Objects.equals(name(), other.name()) && Objects.equals(statusAsString(), other.statusAsString());
}
/**
* 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("EnvironmentSummary").add("CreationTime", creationTime()).add("EngineType", engineTypeAsString())
.add("EngineVersion", engineVersion()).add("EnvironmentArn", environmentArn())
.add("EnvironmentId", environmentId()).add("InstanceType", instanceType()).add("Name", name())
.add("Status", statusAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "creationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "engineType":
return Optional.ofNullable(clazz.cast(engineTypeAsString()));
case "engineVersion":
return Optional.ofNullable(clazz.cast(engineVersion()));
case "environmentArn":
return Optional.ofNullable(clazz.cast(environmentArn()));
case "environmentId":
return Optional.ofNullable(clazz.cast(environmentId()));
case "instanceType":
return Optional.ofNullable(clazz.cast(instanceType()));
case "name":
return Optional.ofNullable(clazz.cast(name()));
case "status":
return Optional.ofNullable(clazz.cast(statusAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function