All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.cloud9.model.CreateEnvironmentEc2Request Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS Cloud9 module holds the client classes that are used for communicating with AWS Cloud9 Service

There is a newer version: 2.29.39
Show newest version
/*
 * 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 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 getter(Function g) { return obj -> g.apply((CreateEnvironmentEc2Request) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends Cloud9Request.Builder, SdkPojo, CopyableBuilder { /** *

* The name of the environment to create. *

*

* This name is visible to other AWS IAM users in the same AWS account. *

* * @param name * The name of the environment to create.

*

* This name is visible to other AWS IAM users in the same AWS account. * @return Returns a reference to this object so that method calls can be chained together. */ Builder name(String name); /** *

* The description of the environment to create. *

* * @param description * The description of the environment to create. * @return Returns a reference to this object so that method calls can be chained together. */ Builder description(String 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. *

* * @param clientRequestToken * 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 Returns a reference to this object so that method calls can be chained together. */ Builder clientRequestToken(String clientRequestToken); /** *

* The type of instance to connect to the environment (for example, t2.micro). *

* * @param instanceType * The type of instance to connect to the environment (for example, t2.micro). * @return Returns a reference to this object so that method calls can be chained together. */ Builder instanceType(String instanceType); /** *

* The ID of the subnet in Amazon VPC that AWS Cloud9 will use to communicate with the Amazon EC2 instance. *

* * @param subnetId * The ID of the subnet in Amazon VPC that AWS Cloud9 will use to communicate with the Amazon EC2 * instance. * @return Returns a reference to this object so that method calls can be chained together. */ Builder subnetId(String subnetId); /** *

* The number of minutes until the running instance is shut down after the environment has last been used. *

* * @param automaticStopTimeMinutes * The number of minutes until the running instance is shut down after the environment has last been * used. * @return Returns a reference to this object so that method calls can be chained together. */ Builder automaticStopTimeMinutes(Integer 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. *

* * @param ownerArn * 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 Returns a reference to this object so that method calls can be chained together. */ Builder ownerArn(String ownerArn); /** *

* An array of key-value pairs that will be associated with the new AWS Cloud9 development environment. *

* * @param tags * An array of key-value pairs that will be associated with the new AWS Cloud9 development environment. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Collection tags); /** *

* An array of key-value pairs that will be associated with the new AWS Cloud9 development environment. *

* * @param tags * An array of key-value pairs that will be associated with the new AWS Cloud9 development environment. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Tag... tags); /** *

* An array of key-value pairs that will be associated with the new AWS Cloud9 development environment. *

* This is a convenience that creates an instance of the {@link List.Builder} avoiding the need to create * one manually via {@link List#builder()}. * * When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and its result * is passed to {@link #tags(List)}. * * @param tags * a consumer that will call methods on {@link List.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #tags(List) */ Builder tags(Consumer... tags); /** *

* The connection type used for connecting to an Amazon EC2 environment. *

* * @param connectionType * The connection type used for connecting to an Amazon EC2 environment. * @see ConnectionType * @return Returns a reference to this object so that method calls can be chained together. * @see ConnectionType */ Builder connectionType(String connectionType); /** *

* The connection type used for connecting to an Amazon EC2 environment. *

* * @param connectionType * The connection type used for connecting to an Amazon EC2 environment. * @see ConnectionType * @return Returns a reference to this object so that method calls can be chained together. * @see ConnectionType */ Builder connectionType(ConnectionType connectionType); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends Cloud9Request.BuilderImpl implements Builder { private String name; private String description; private String clientRequestToken; private String instanceType; private String subnetId; private Integer automaticStopTimeMinutes; private String ownerArn; private List tags = DefaultSdkAutoConstructList.getInstance(); private String connectionType; private BuilderImpl() { } private BuilderImpl(CreateEnvironmentEc2Request model) { super(model); name(model.name); description(model.description); clientRequestToken(model.clientRequestToken); instanceType(model.instanceType); subnetId(model.subnetId); automaticStopTimeMinutes(model.automaticStopTimeMinutes); ownerArn(model.ownerArn); tags(model.tags); connectionType(model.connectionType); } public final String getName() { return name; } @Override public final Builder name(String name) { this.name = name; return this; } public final void setName(String name) { this.name = name; } public final String getDescription() { return description; } @Override public final Builder description(String description) { this.description = description; return this; } public final void setDescription(String description) { this.description = description; } public final String getClientRequestToken() { return clientRequestToken; } @Override public final Builder clientRequestToken(String clientRequestToken) { this.clientRequestToken = clientRequestToken; return this; } public final void setClientRequestToken(String clientRequestToken) { this.clientRequestToken = clientRequestToken; } public final String getInstanceType() { return instanceType; } @Override public final Builder instanceType(String instanceType) { this.instanceType = instanceType; return this; } public final void setInstanceType(String instanceType) { this.instanceType = instanceType; } public final String getSubnetId() { return subnetId; } @Override public final Builder subnetId(String subnetId) { this.subnetId = subnetId; return this; } public final void setSubnetId(String subnetId) { this.subnetId = subnetId; } public final Integer getAutomaticStopTimeMinutes() { return automaticStopTimeMinutes; } @Override public final Builder automaticStopTimeMinutes(Integer automaticStopTimeMinutes) { this.automaticStopTimeMinutes = automaticStopTimeMinutes; return this; } public final void setAutomaticStopTimeMinutes(Integer automaticStopTimeMinutes) { this.automaticStopTimeMinutes = automaticStopTimeMinutes; } public final String getOwnerArn() { return ownerArn; } @Override public final Builder ownerArn(String ownerArn) { this.ownerArn = ownerArn; return this; } public final void setOwnerArn(String ownerArn) { this.ownerArn = ownerArn; } public final Collection getTags() { if (tags instanceof SdkAutoConstructList) { return null; } return tags != null ? tags.stream().map(Tag::toBuilder).collect(Collectors.toList()) : null; } @Override public final Builder tags(Collection tags) { this.tags = TagListCopier.copy(tags); return this; } @Override @SafeVarargs public final Builder tags(Tag... tags) { tags(Arrays.asList(tags)); return this; } @Override @SafeVarargs public final Builder tags(Consumer... tags) { tags(Stream.of(tags).map(c -> Tag.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final void setTags(Collection tags) { this.tags = TagListCopier.copyFromBuilder(tags); } public final String getConnectionType() { return connectionType; } @Override public final Builder connectionType(String connectionType) { this.connectionType = connectionType; return this; } @Override public final Builder connectionType(ConnectionType connectionType) { this.connectionType(connectionType == null ? null : connectionType.toString()); return this; } public final void setConnectionType(String connectionType) { this.connectionType = connectionType; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public CreateEnvironmentEc2Request build() { return new CreateEnvironmentEc2Request(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy