software.amazon.awssdk.services.cloud9.model.CreateEnvironmentEc2Request 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.util.Arrays;
import java.util.Collection;
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 java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class CreateEnvironmentEc2Request extends Cloud9Request implements
ToCopyableBuilder {
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("name")
.getter(getter(CreateEnvironmentEc2Request::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(CreateEnvironmentEc2Request::description))
.setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("description").build()).build();
private static final SdkField CLIENT_REQUEST_TOKEN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("clientRequestToken").getter(getter(CreateEnvironmentEc2Request::clientRequestToken))
.setter(setter(Builder::clientRequestToken))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("clientRequestToken").build())
.build();
private static final SdkField INSTANCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("instanceType").getter(getter(CreateEnvironmentEc2Request::instanceType))
.setter(setter(Builder::instanceType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("instanceType").build()).build();
private static final SdkField SUBNET_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("subnetId").getter(getter(CreateEnvironmentEc2Request::subnetId)).setter(setter(Builder::subnetId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("subnetId").build()).build();
private static final SdkField AUTOMATIC_STOP_TIME_MINUTES_FIELD = SdkField
. builder(MarshallingType.INTEGER).memberName("automaticStopTimeMinutes")
.getter(getter(CreateEnvironmentEc2Request::automaticStopTimeMinutes))
.setter(setter(Builder::automaticStopTimeMinutes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("automaticStopTimeMinutes").build())
.build();
private static final SdkField OWNER_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ownerArn").getter(getter(CreateEnvironmentEc2Request::ownerArn)).setter(setter(Builder::ownerArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ownerArn").build()).build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("tags")
.getter(getter(CreateEnvironmentEc2Request::tags))
.setter(setter(Builder::tags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("tags").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Tag::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField CONNECTION_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("connectionType").getter(getter(CreateEnvironmentEc2Request::connectionTypeAsString))
.setter(setter(Builder::connectionType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("connectionType").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NAME_FIELD, DESCRIPTION_FIELD,
CLIENT_REQUEST_TOKEN_FIELD, INSTANCE_TYPE_FIELD, SUBNET_ID_FIELD, AUTOMATIC_STOP_TIME_MINUTES_FIELD, OWNER_ARN_FIELD,
TAGS_FIELD, CONNECTION_TYPE_FIELD));
private final String name;
private final String description;
private final String clientRequestToken;
private final String instanceType;
private final String subnetId;
private final Integer automaticStopTimeMinutes;
private final String ownerArn;
private final List tags;
private final String connectionType;
private CreateEnvironmentEc2Request(BuilderImpl builder) {
super(builder);
this.name = builder.name;
this.description = builder.description;
this.clientRequestToken = builder.clientRequestToken;
this.instanceType = builder.instanceType;
this.subnetId = builder.subnetId;
this.automaticStopTimeMinutes = builder.automaticStopTimeMinutes;
this.ownerArn = builder.ownerArn;
this.tags = builder.tags;
this.connectionType = builder.connectionType;
}
/**
*
* The name of the environment to create.
*
*
* This name is visible to other AWS IAM users in the same AWS account.
*
*
* @return The name of the environment to create.
*
* This name is visible to other AWS IAM users in the same AWS account.
*/
public final String name() {
return name;
}
/**
*
* The description of the environment to create.
*
*
* @return The description of the environment to create.
*/
public final String description() {
return description;
}
/**
*
* A unique, case-sensitive string that helps AWS Cloud9 to ensure this operation completes no more than one time.
*
*
* For more information, see Client Tokens in
* the Amazon EC2 API Reference.
*
*
* @return A unique, case-sensitive string that helps AWS Cloud9 to ensure this operation completes no more than one
* time.
*
* For more information, see Client
* Tokens in the Amazon EC2 API Reference.
*/
public final String clientRequestToken() {
return clientRequestToken;
}
/**
*
* The type of instance to connect to the environment (for example, t2.micro
).
*
*
* @return The type of instance to connect to the environment (for example, t2.micro
).
*/
public final String instanceType() {
return instanceType;
}
/**
*
* The ID of the subnet in Amazon VPC that AWS Cloud9 will use to communicate with the Amazon EC2 instance.
*
*
* @return The ID of the subnet in Amazon VPC that AWS Cloud9 will use to communicate with the Amazon EC2 instance.
*/
public final String subnetId() {
return subnetId;
}
/**
*
* The number of minutes until the running instance is shut down after the environment has last been used.
*
*
* @return The number of minutes until the running instance is shut down after the environment has last been used.
*/
public final Integer automaticStopTimeMinutes() {
return automaticStopTimeMinutes;
}
/**
*
* The Amazon Resource Name (ARN) of the environment owner. This ARN can be the ARN of any AWS IAM principal. If
* this value is not specified, the ARN defaults to this environment's creator.
*
*
* @return The Amazon Resource Name (ARN) of the environment owner. This ARN can be the ARN of any AWS IAM
* principal. If this value is not specified, the ARN defaults to this environment's creator.
*/
public final String ownerArn() {
return ownerArn;
}
/**
* Returns true if the Tags property was specified by the sender (it may be empty), or false if the sender did not
* specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service.
*/
public final boolean hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructList);
}
/**
*
* An array of key-value pairs that will be associated with the new AWS Cloud9 development environment.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasTags()} to see if a value was sent in this field.
*
*
* @return An array of key-value pairs that will be associated with the new AWS Cloud9 development environment.
*/
public final List tags() {
return tags;
}
/**
*
* 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;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(clientRequestToken());
hashCode = 31 * hashCode + Objects.hashCode(instanceType());
hashCode = 31 * hashCode + Objects.hashCode(subnetId());
hashCode = 31 * hashCode + Objects.hashCode(automaticStopTimeMinutes());
hashCode = 31 * hashCode + Objects.hashCode(ownerArn());
hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null);
hashCode = 31 * hashCode + Objects.hashCode(connectionTypeAsString());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof CreateEnvironmentEc2Request)) {
return false;
}
CreateEnvironmentEc2Request other = (CreateEnvironmentEc2Request) obj;
return Objects.equals(name(), other.name()) && Objects.equals(description(), other.description())
&& Objects.equals(clientRequestToken(), other.clientRequestToken())
&& Objects.equals(instanceType(), other.instanceType()) && Objects.equals(subnetId(), other.subnetId())
&& Objects.equals(automaticStopTimeMinutes(), other.automaticStopTimeMinutes())
&& Objects.equals(ownerArn(), other.ownerArn()) && hasTags() == other.hasTags()
&& Objects.equals(tags(), other.tags())
&& Objects.equals(connectionTypeAsString(), other.connectionTypeAsString());
}
/**
* 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("CreateEnvironmentEc2Request").add("Name", name())
.add("Description", description() == null ? null : "*** Sensitive Data Redacted ***")
.add("ClientRequestToken", clientRequestToken()).add("InstanceType", instanceType()).add("SubnetId", subnetId())
.add("AutomaticStopTimeMinutes", automaticStopTimeMinutes()).add("OwnerArn", ownerArn())
.add("Tags", hasTags() ? tags() : null).add("ConnectionType", connectionTypeAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "name":
return Optional.ofNullable(clazz.cast(name()));
case "description":
return Optional.ofNullable(clazz.cast(description()));
case "clientRequestToken":
return Optional.ofNullable(clazz.cast(clientRequestToken()));
case "instanceType":
return Optional.ofNullable(clazz.cast(instanceType()));
case "subnetId":
return Optional.ofNullable(clazz.cast(subnetId()));
case "automaticStopTimeMinutes":
return Optional.ofNullable(clazz.cast(automaticStopTimeMinutes()));
case "ownerArn":
return Optional.ofNullable(clazz.cast(ownerArn()));
case "tags":
return Optional.ofNullable(clazz.cast(tags()));
case "connectionType":
return Optional.ofNullable(clazz.cast(connectionTypeAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function