software.amazon.awssdk.services.cloud9.model.Environment Maven / Gradle / Ivy
Show all versions of cloud9 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.cloud9.model;
import java.io.Serializable;
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.Consumer;
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;
/**
*
* Information about an AWS Cloud9 development environment.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Environment implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("id")
.getter(getter(Environment::id)).setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("id").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("name")
.getter(getter(Environment::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("name").build()).build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("description").getter(getter(Environment::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("description").build()).build();
private static final SdkField TYPE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("type")
.getter(getter(Environment::typeAsString)).setter(setter(Builder::type))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("type").build()).build();
private static final SdkField CONNECTION_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("connectionType").getter(getter(Environment::connectionTypeAsString))
.setter(setter(Builder::connectionType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("connectionType").build()).build();
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("arn")
.getter(getter(Environment::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("arn").build()).build();
private static final SdkField OWNER_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ownerArn").getter(getter(Environment::ownerArn)).setter(setter(Builder::ownerArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ownerArn").build()).build();
private static final SdkField LIFECYCLE_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("lifecycle")
.getter(getter(Environment::lifecycle)).setter(setter(Builder::lifecycle)).constructor(EnvironmentLifecycle::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lifecycle").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ID_FIELD, NAME_FIELD,
DESCRIPTION_FIELD, TYPE_FIELD, CONNECTION_TYPE_FIELD, ARN_FIELD, OWNER_ARN_FIELD, LIFECYCLE_FIELD));
private static final long serialVersionUID = 1L;
private final String id;
private final String name;
private final String description;
private final String type;
private final String connectionType;
private final String arn;
private final String ownerArn;
private final EnvironmentLifecycle lifecycle;
private Environment(BuilderImpl builder) {
this.id = builder.id;
this.name = builder.name;
this.description = builder.description;
this.type = builder.type;
this.connectionType = builder.connectionType;
this.arn = builder.arn;
this.ownerArn = builder.ownerArn;
this.lifecycle = builder.lifecycle;
}
/**
*
* The ID of the environment.
*
*
* @return The ID of the environment.
*/
public final String id() {
return id;
}
/**
*
* The name of the environment.
*
*
* @return The name of the environment.
*/
public final String name() {
return name;
}
/**
*
* The description for the environment.
*
*
* @return The description for the environment.
*/
public final String description() {
return description;
}
/**
*
* The type of environment. Valid values include the following:
*
*
* -
*
* ec2
: An Amazon Elastic Compute Cloud (Amazon EC2) instance connects to the environment.
*
*
* -
*
* ssh
: Your own server connects to the environment.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #type} will return
* {@link EnvironmentType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #typeAsString}.
*
*
* @return The type of environment. Valid values include the following:
*
* -
*
* ec2
: An Amazon Elastic Compute Cloud (Amazon EC2) instance connects to the environment.
*
*
* -
*
* ssh
: Your own server connects to the environment.
*
*
* @see EnvironmentType
*/
public final EnvironmentType type() {
return EnvironmentType.fromValue(type);
}
/**
*
* The type of environment. Valid values include the following:
*
*
* -
*
* ec2
: An Amazon Elastic Compute Cloud (Amazon EC2) instance connects to the environment.
*
*
* -
*
* ssh
: Your own server connects to the environment.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #type} will return
* {@link EnvironmentType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #typeAsString}.
*
*
* @return The type of environment. Valid values include the following:
*
* -
*
* ec2
: An Amazon Elastic Compute Cloud (Amazon EC2) instance connects to the environment.
*
*
* -
*
* ssh
: Your own server connects to the environment.
*
*
* @see EnvironmentType
*/
public final String typeAsString() {
return type;
}
/**
*
* The connection type used for connecting to an Amazon EC2 environment.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #connectionType}
* will return {@link ConnectionType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #connectionTypeAsString}.
*
*
* @return The connection type used for connecting to an Amazon EC2 environment.
* @see ConnectionType
*/
public final ConnectionType connectionType() {
return ConnectionType.fromValue(connectionType);
}
/**
*
* The connection type used for connecting to an Amazon EC2 environment.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #connectionType}
* will return {@link ConnectionType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #connectionTypeAsString}.
*
*
* @return The connection type used for connecting to an Amazon EC2 environment.
* @see ConnectionType
*/
public final String connectionTypeAsString() {
return connectionType;
}
/**
*
* The Amazon Resource Name (ARN) of the environment.
*
*
* @return The Amazon Resource Name (ARN) of the environment.
*/
public final String arn() {
return arn;
}
/**
*
* The Amazon Resource Name (ARN) of the environment owner.
*
*
* @return The Amazon Resource Name (ARN) of the environment owner.
*/
public final String ownerArn() {
return ownerArn;
}
/**
*
* The state of the environment in its creation or deletion lifecycle.
*
*
* @return The state of the environment in its creation or deletion lifecycle.
*/
public final EnvironmentLifecycle lifecycle() {
return lifecycle;
}
@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(id());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(typeAsString());
hashCode = 31 * hashCode + Objects.hashCode(connectionTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(arn());
hashCode = 31 * hashCode + Objects.hashCode(ownerArn());
hashCode = 31 * hashCode + Objects.hashCode(lifecycle());
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 Environment)) {
return false;
}
Environment other = (Environment) obj;
return Objects.equals(id(), other.id()) && Objects.equals(name(), other.name())
&& Objects.equals(description(), other.description()) && Objects.equals(typeAsString(), other.typeAsString())
&& Objects.equals(connectionTypeAsString(), other.connectionTypeAsString()) && Objects.equals(arn(), other.arn())
&& Objects.equals(ownerArn(), other.ownerArn()) && Objects.equals(lifecycle(), other.lifecycle());
}
/**
* 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("Environment").add("Id", id()).add("Name", name())
.add("Description", description() == null ? null : "*** Sensitive Data Redacted ***").add("Type", typeAsString())
.add("ConnectionType", connectionTypeAsString()).add("Arn", arn()).add("OwnerArn", ownerArn())
.add("Lifecycle", lifecycle()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "id":
return Optional.ofNullable(clazz.cast(id()));
case "name":
return Optional.ofNullable(clazz.cast(name()));
case "description":
return Optional.ofNullable(clazz.cast(description()));
case "type":
return Optional.ofNullable(clazz.cast(typeAsString()));
case "connectionType":
return Optional.ofNullable(clazz.cast(connectionTypeAsString()));
case "arn":
return Optional.ofNullable(clazz.cast(arn()));
case "ownerArn":
return Optional.ofNullable(clazz.cast(ownerArn()));
case "lifecycle":
return Optional.ofNullable(clazz.cast(lifecycle()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function