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.beans.Transient;
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 IMAGE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("imageId").getter(getter(CreateEnvironmentEc2Request::imageId)).setter(setter(Builder::imageId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("imageId").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 SdkField DRY_RUN_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("dryRun").getter(getter(CreateEnvironmentEc2Request::dryRun)).setter(setter(Builder::dryRun))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("dryRun").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, IMAGE_ID_FIELD, AUTOMATIC_STOP_TIME_MINUTES_FIELD,
OWNER_ARN_FIELD, TAGS_FIELD, CONNECTION_TYPE_FIELD, DRY_RUN_FIELD));
private final String name;
private final String description;
private final String clientRequestToken;
private final String instanceType;
private final String subnetId;
private final String imageId;
private final Integer automaticStopTimeMinutes;
private final String ownerArn;
private final List tags;
private final String connectionType;
private final Boolean dryRun;
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.imageId = builder.imageId;
this.automaticStopTimeMinutes = builder.automaticStopTimeMinutes;
this.ownerArn = builder.ownerArn;
this.tags = builder.tags;
this.connectionType = builder.connectionType;
this.dryRun = builder.dryRun;
}
/**
*
* The name of the environment to create.
*
*
* This name is visible to other IAM users in the same Amazon Web Services account.
*
*
* @return The name of the environment to create.
*
* This name is visible to other IAM users in the same Amazon Web Services 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 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 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 Cloud9 will use to communicate with the Amazon EC2 instance.
*
*
* @return The ID of the subnet in Amazon VPC that Cloud9 will use to communicate with the Amazon EC2 instance.
*/
public final String subnetId() {
return subnetId;
}
/**
*
* The identifier for the Amazon Machine Image (AMI) that's used to create the EC2 instance. To choose an AMI for
* the instance, you must specify a valid AMI alias or a valid Amazon EC2 Systems Manager (SSM) path.
*
*
* The default AMI is used if the parameter isn't explicitly assigned a value in the request. Because Amazon Linux
* AMI has ended standard support as of December 31, 2020, we recommend you choose Amazon Linux 2, which includes
* long term support through 2023.
*
*
* AMI aliases
*
*
* -
*
* Amazon Linux (default): amazonlinux-1-x86_64
*
*
* -
*
* Amazon Linux 2: amazonlinux-2-x86_64
*
*
* -
*
* Ubuntu 18.04: ubuntu-18.04-x86_64
*
*
*
*
* SSM paths
*
*
* -
*
* Amazon Linux (default): resolve:ssm:/aws/service/cloud9/amis/amazonlinux-1-x86_64
*
*
* -
*
* Amazon Linux 2: resolve:ssm:/aws/service/cloud9/amis/amazonlinux-2-x86_64
*
*
* -
*
* Ubuntu 18.04: resolve:ssm:/aws/service/cloud9/amis/ubuntu-18.04-x86_64
*
*
*
*
* @return The identifier for the Amazon Machine Image (AMI) that's used to create the EC2 instance. To choose an
* AMI for the instance, you must specify a valid AMI alias or a valid Amazon EC2 Systems Manager (SSM)
* path.
*
* The default AMI is used if the parameter isn't explicitly assigned a value in the request. Because Amazon
* Linux AMI has ended standard support as of December 31, 2020, we recommend you choose Amazon Linux 2,
* which includes long term support through 2023.
*
*
* AMI aliases
*
*
* -
*
* Amazon Linux (default): amazonlinux-1-x86_64
*
*
* -
*
* Amazon Linux 2: amazonlinux-2-x86_64
*
*
* -
*
* Ubuntu 18.04: ubuntu-18.04-x86_64
*
*
*
*
* SSM paths
*
*
* -
*
* Amazon Linux (default): resolve:ssm:/aws/service/cloud9/amis/amazonlinux-1-x86_64
*
*
* -
*
* Amazon Linux 2: resolve:ssm:/aws/service/cloud9/amis/amazonlinux-2-x86_64
*
*
* -
*
* Ubuntu 18.04: resolve:ssm:/aws/service/cloud9/amis/ubuntu-18.04-x86_64
*
*
*/
public final String imageId() {
return imageId;
}
/**
*
* 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 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 IAM principal. If
* this value is not specified, the ARN defaults to this environment's creator.
*/
public final String ownerArn() {
return ownerArn;
}
/**
* For responses, this returns true if the service returned a value for the Tags property. This DOES NOT check that
* the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is useful
* because the SDK will never return a null collection or map, but you may need to differentiate between the service
* returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true
* if a value for the property was specified in the request builder, and false if a value was not specified.
*/
public final boolean hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructList);
}
/**
*
* An array of key-value pairs that will be associated with the new Cloud9 development environment.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasTags} method.
*
*
* @return An array of key-value pairs that will be associated with the new Cloud9 development environment.
*/
public final List tags() {
return tags;
}
/**
*
* The connection type used for connecting to an Amazon EC2 environment. Valid values are CONNECT_SSH
* (default) and CONNECT_SSM
(connected through Amazon EC2 Systems Manager).
*
*
* For more information, see Accessing
* no-ingress EC2 instances with Amazon EC2 Systems Manager in the Cloud9 User Guide.
*
*
* 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. Valid values are
* CONNECT_SSH
(default) and CONNECT_SSM
(connected through Amazon EC2 Systems
* Manager).
*
* For more information, see Accessing no-ingress EC2
* instances with Amazon EC2 Systems Manager in the Cloud9 User Guide.
* @see ConnectionType
*/
public final ConnectionType connectionType() {
return ConnectionType.fromValue(connectionType);
}
/**
*
* The connection type used for connecting to an Amazon EC2 environment. Valid values are CONNECT_SSH
* (default) and CONNECT_SSM
(connected through Amazon EC2 Systems Manager).
*
*
* For more information, see Accessing
* no-ingress EC2 instances with Amazon EC2 Systems Manager in the Cloud9 User Guide.
*
*
* 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. Valid values are
* CONNECT_SSH
(default) and CONNECT_SSM
(connected through Amazon EC2 Systems
* Manager).
*
* For more information, see Accessing no-ingress EC2
* instances with Amazon EC2 Systems Manager in the Cloud9 User Guide.
* @see ConnectionType
*/
public final String connectionTypeAsString() {
return connectionType;
}
/**
*
* Checks whether you have the required permissions for the action, without actually making the request, and
* provides an error response. If you have the required permissions, the error response is
* DryRunOperation
. Otherwise, it is UnauthorizedOperation
.
*
*
* @return Checks whether you have the required permissions for the action, without actually making the request, and
* provides an error response. If you have the required permissions, the error response is
* DryRunOperation
. Otherwise, it is UnauthorizedOperation
.
*/
public final Boolean dryRun() {
return dryRun;
}
@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(imageId());
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());
hashCode = 31 * hashCode + Objects.hashCode(dryRun());
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(imageId(), other.imageId())
&& Objects.equals(automaticStopTimeMinutes(), other.automaticStopTimeMinutes())
&& Objects.equals(ownerArn(), other.ownerArn()) && hasTags() == other.hasTags()
&& Objects.equals(tags(), other.tags())
&& Objects.equals(connectionTypeAsString(), other.connectionTypeAsString())
&& Objects.equals(dryRun(), other.dryRun());
}
/**
* 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("ImageId", imageId()).add("AutomaticStopTimeMinutes", automaticStopTimeMinutes())
.add("OwnerArn", ownerArn()).add("Tags", tags() == null ? null : "*** Sensitive Data Redacted ***")
.add("ConnectionType", connectionTypeAsString()).add("DryRun", dryRun()).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 "imageId":
return Optional.ofNullable(clazz.cast(imageId()));
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()));
case "dryRun":
return Optional.ofNullable(clazz.cast(dryRun()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function