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

software.amazon.awssdk.services.ecs.model.AwsVpcConfiguration Maven / Gradle / Ivy

Go to download

The AWS Java SDK for the Amazon EC2 Container Service holds the client classes that are used for communicating with the Amazon EC2 Container Service

There is a newer version: 2.30.1
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.ecs.model;

import java.io.Serializable;
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.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.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;

/**
 * 

* An object representing the networking details for a task or service. *

*/ @Generated("software.amazon.awssdk:codegen") public final class AwsVpcConfiguration implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField> SUBNETS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("subnets") .getter(getter(AwsVpcConfiguration::subnets)) .setter(setter(Builder::subnets)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("subnets").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField> SECURITY_GROUPS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("securityGroups") .getter(getter(AwsVpcConfiguration::securityGroups)) .setter(setter(Builder::securityGroups)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("securityGroups").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField ASSIGN_PUBLIC_IP_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("assignPublicIp").getter(getter(AwsVpcConfiguration::assignPublicIpAsString)) .setter(setter(Builder::assignPublicIp)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("assignPublicIp").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(SUBNETS_FIELD, SECURITY_GROUPS_FIELD, ASSIGN_PUBLIC_IP_FIELD)); private static final long serialVersionUID = 1L; private final List subnets; private final List securityGroups; private final String assignPublicIp; private AwsVpcConfiguration(BuilderImpl builder) { this.subnets = builder.subnets; this.securityGroups = builder.securityGroups; this.assignPublicIp = builder.assignPublicIp; } /** * Returns true if the Subnets 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 hasSubnets() { return subnets != null && !(subnets instanceof SdkAutoConstructList); } /** *

* The IDs of the subnets associated with the task or service. There is a limit of 16 subnets that can be specified * per AwsVpcConfiguration. *

* *

* All specified subnets must be from the same VPC. *

*
*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* You can use {@link #hasSubnets()} to see if a value was sent in this field. *

* * @return The IDs of the subnets associated with the task or service. There is a limit of 16 subnets that can be * specified per AwsVpcConfiguration.

*

* All specified subnets must be from the same VPC. *

*/ public final List subnets() { return subnets; } /** * Returns true if the SecurityGroups 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 hasSecurityGroups() { return securityGroups != null && !(securityGroups instanceof SdkAutoConstructList); } /** *

* The IDs of the security groups associated with the task or service. If you do not specify a security group, the * default security group for the VPC is used. There is a limit of 5 security groups that can be specified per * AwsVpcConfiguration. *

* *

* All specified security groups must be from the same VPC. *

*
*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* You can use {@link #hasSecurityGroups()} to see if a value was sent in this field. *

* * @return The IDs of the security groups associated with the task or service. If you do not specify a security * group, the default security group for the VPC is used. There is a limit of 5 security groups that can be * specified per AwsVpcConfiguration.

*

* All specified security groups must be from the same VPC. *

*/ public final List securityGroups() { return securityGroups; } /** *

* Whether the task's elastic network interface receives a public IP address. The default value is * DISABLED. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #assignPublicIp} * will return {@link AssignPublicIp#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #assignPublicIpAsString}. *

* * @return Whether the task's elastic network interface receives a public IP address. The default value is * DISABLED. * @see AssignPublicIp */ public final AssignPublicIp assignPublicIp() { return AssignPublicIp.fromValue(assignPublicIp); } /** *

* Whether the task's elastic network interface receives a public IP address. The default value is * DISABLED. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #assignPublicIp} * will return {@link AssignPublicIp#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #assignPublicIpAsString}. *

* * @return Whether the task's elastic network interface receives a public IP address. The default value is * DISABLED. * @see AssignPublicIp */ public final String assignPublicIpAsString() { return assignPublicIp; } @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 + Objects.hashCode(hasSubnets() ? subnets() : null); hashCode = 31 * hashCode + Objects.hashCode(hasSecurityGroups() ? securityGroups() : null); hashCode = 31 * hashCode + Objects.hashCode(assignPublicIpAsString()); 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 AwsVpcConfiguration)) { return false; } AwsVpcConfiguration other = (AwsVpcConfiguration) obj; return hasSubnets() == other.hasSubnets() && Objects.equals(subnets(), other.subnets()) && hasSecurityGroups() == other.hasSecurityGroups() && Objects.equals(securityGroups(), other.securityGroups()) && Objects.equals(assignPublicIpAsString(), other.assignPublicIpAsString()); } /** * 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("AwsVpcConfiguration").add("Subnets", hasSubnets() ? subnets() : null) .add("SecurityGroups", hasSecurityGroups() ? securityGroups() : null) .add("AssignPublicIp", assignPublicIpAsString()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "subnets": return Optional.ofNullable(clazz.cast(subnets())); case "securityGroups": return Optional.ofNullable(clazz.cast(securityGroups())); case "assignPublicIp": return Optional.ofNullable(clazz.cast(assignPublicIpAsString())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((AwsVpcConfiguration) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The IDs of the subnets associated with the task or service. There is a limit of 16 subnets that can be * specified per AwsVpcConfiguration. *

* *

* All specified subnets must be from the same VPC. *

*
* * @param subnets * The IDs of the subnets associated with the task or service. There is a limit of 16 subnets that can be * specified per AwsVpcConfiguration.

*

* All specified subnets must be from the same VPC. *

* @return Returns a reference to this object so that method calls can be chained together. */ Builder subnets(Collection subnets); /** *

* The IDs of the subnets associated with the task or service. There is a limit of 16 subnets that can be * specified per AwsVpcConfiguration. *

* *

* All specified subnets must be from the same VPC. *

*
* * @param subnets * The IDs of the subnets associated with the task or service. There is a limit of 16 subnets that can be * specified per AwsVpcConfiguration.

*

* All specified subnets must be from the same VPC. *

* @return Returns a reference to this object so that method calls can be chained together. */ Builder subnets(String... subnets); /** *

* The IDs of the security groups associated with the task or service. If you do not specify a security group, * the default security group for the VPC is used. There is a limit of 5 security groups that can be specified * per AwsVpcConfiguration. *

* *

* All specified security groups must be from the same VPC. *

*
* * @param securityGroups * The IDs of the security groups associated with the task or service. If you do not specify a security * group, the default security group for the VPC is used. There is a limit of 5 security groups that can * be specified per AwsVpcConfiguration.

*

* All specified security groups must be from the same VPC. *

* @return Returns a reference to this object so that method calls can be chained together. */ Builder securityGroups(Collection securityGroups); /** *

* The IDs of the security groups associated with the task or service. If you do not specify a security group, * the default security group for the VPC is used. There is a limit of 5 security groups that can be specified * per AwsVpcConfiguration. *

* *

* All specified security groups must be from the same VPC. *

*
* * @param securityGroups * The IDs of the security groups associated with the task or service. If you do not specify a security * group, the default security group for the VPC is used. There is a limit of 5 security groups that can * be specified per AwsVpcConfiguration.

*

* All specified security groups must be from the same VPC. *

* @return Returns a reference to this object so that method calls can be chained together. */ Builder securityGroups(String... securityGroups); /** *

* Whether the task's elastic network interface receives a public IP address. The default value is * DISABLED. *

* * @param assignPublicIp * Whether the task's elastic network interface receives a public IP address. The default value is * DISABLED. * @see AssignPublicIp * @return Returns a reference to this object so that method calls can be chained together. * @see AssignPublicIp */ Builder assignPublicIp(String assignPublicIp); /** *

* Whether the task's elastic network interface receives a public IP address. The default value is * DISABLED. *

* * @param assignPublicIp * Whether the task's elastic network interface receives a public IP address. The default value is * DISABLED. * @see AssignPublicIp * @return Returns a reference to this object so that method calls can be chained together. * @see AssignPublicIp */ Builder assignPublicIp(AssignPublicIp assignPublicIp); } static final class BuilderImpl implements Builder { private List subnets = DefaultSdkAutoConstructList.getInstance(); private List securityGroups = DefaultSdkAutoConstructList.getInstance(); private String assignPublicIp; private BuilderImpl() { } private BuilderImpl(AwsVpcConfiguration model) { subnets(model.subnets); securityGroups(model.securityGroups); assignPublicIp(model.assignPublicIp); } public final Collection getSubnets() { if (subnets instanceof SdkAutoConstructList) { return null; } return subnets; } @Override public final Builder subnets(Collection subnets) { this.subnets = StringListCopier.copy(subnets); return this; } @Override @SafeVarargs public final Builder subnets(String... subnets) { subnets(Arrays.asList(subnets)); return this; } public final void setSubnets(Collection subnets) { this.subnets = StringListCopier.copy(subnets); } public final Collection getSecurityGroups() { if (securityGroups instanceof SdkAutoConstructList) { return null; } return securityGroups; } @Override public final Builder securityGroups(Collection securityGroups) { this.securityGroups = StringListCopier.copy(securityGroups); return this; } @Override @SafeVarargs public final Builder securityGroups(String... securityGroups) { securityGroups(Arrays.asList(securityGroups)); return this; } public final void setSecurityGroups(Collection securityGroups) { this.securityGroups = StringListCopier.copy(securityGroups); } public final String getAssignPublicIp() { return assignPublicIp; } @Override public final Builder assignPublicIp(String assignPublicIp) { this.assignPublicIp = assignPublicIp; return this; } @Override public final Builder assignPublicIp(AssignPublicIp assignPublicIp) { this.assignPublicIp(assignPublicIp == null ? null : assignPublicIp.toString()); return this; } public final void setAssignPublicIp(String assignPublicIp) { this.assignPublicIp = assignPublicIp; } @Override public AwsVpcConfiguration build() { return new AwsVpcConfiguration(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy