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

software.amazon.awssdk.services.ec2.model.ModifyTransitGatewayVpcAttachmentRequest Maven / Gradle / Ivy

/*
 * 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.ec2.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 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 ModifyTransitGatewayVpcAttachmentRequest extends Ec2Request implements
        ToCopyableBuilder {
    private static final SdkField TRANSIT_GATEWAY_ATTACHMENT_ID_FIELD = SdkField
            . builder(MarshallingType.STRING)
            .memberName("TransitGatewayAttachmentId")
            .getter(getter(ModifyTransitGatewayVpcAttachmentRequest::transitGatewayAttachmentId))
            .setter(setter(Builder::transitGatewayAttachmentId))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TransitGatewayAttachmentId")
                    .unmarshallLocationName("TransitGatewayAttachmentId").build()).build();

    private static final SdkField> ADD_SUBNET_IDS_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("AddSubnetIds")
            .getter(getter(ModifyTransitGatewayVpcAttachmentRequest::addSubnetIds))
            .setter(setter(Builder::addSubnetIds))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AddSubnetIds")
                    .unmarshallLocationName("AddSubnetIds").build(),
                    ListTrait
                            .builder()
                            .memberLocationName("item")
                            .memberFieldInfo(
                                    SdkField. builder(MarshallingType.STRING)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("Item").unmarshallLocationName("item").build()).build())
                            .build()).build();

    private static final SdkField> REMOVE_SUBNET_IDS_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("RemoveSubnetIds")
            .getter(getter(ModifyTransitGatewayVpcAttachmentRequest::removeSubnetIds))
            .setter(setter(Builder::removeSubnetIds))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RemoveSubnetIds")
                    .unmarshallLocationName("RemoveSubnetIds").build(),
                    ListTrait
                            .builder()
                            .memberLocationName("item")
                            .memberFieldInfo(
                                    SdkField. builder(MarshallingType.STRING)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("Item").unmarshallLocationName("item").build()).build())
                            .build()).build();

    private static final SdkField OPTIONS_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO)
            .memberName("Options")
            .getter(getter(ModifyTransitGatewayVpcAttachmentRequest::options))
            .setter(setter(Builder::options))
            .constructor(ModifyTransitGatewayVpcAttachmentRequestOptions::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Options")
                    .unmarshallLocationName("Options").build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
            TRANSIT_GATEWAY_ATTACHMENT_ID_FIELD, ADD_SUBNET_IDS_FIELD, REMOVE_SUBNET_IDS_FIELD, OPTIONS_FIELD));

    private final String transitGatewayAttachmentId;

    private final List addSubnetIds;

    private final List removeSubnetIds;

    private final ModifyTransitGatewayVpcAttachmentRequestOptions options;

    private ModifyTransitGatewayVpcAttachmentRequest(BuilderImpl builder) {
        super(builder);
        this.transitGatewayAttachmentId = builder.transitGatewayAttachmentId;
        this.addSubnetIds = builder.addSubnetIds;
        this.removeSubnetIds = builder.removeSubnetIds;
        this.options = builder.options;
    }

    /**
     * 

* The ID of the attachment. *

* * @return The ID of the attachment. */ public String transitGatewayAttachmentId() { return transitGatewayAttachmentId; } /** * Returns true if the AddSubnetIds 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 boolean hasAddSubnetIds() { return addSubnetIds != null && !(addSubnetIds instanceof SdkAutoConstructList); } /** *

* The IDs of one or more subnets to add. You can specify at most one subnet per Availability Zone. *

*

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

*

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

* * @return The IDs of one or more subnets to add. You can specify at most one subnet per Availability Zone. */ public List addSubnetIds() { return addSubnetIds; } /** * Returns true if the RemoveSubnetIds 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 boolean hasRemoveSubnetIds() { return removeSubnetIds != null && !(removeSubnetIds instanceof SdkAutoConstructList); } /** *

* The IDs of one or more subnets to remove. *

*

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

*

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

* * @return The IDs of one or more subnets to remove. */ public List removeSubnetIds() { return removeSubnetIds; } /** *

* The new VPC attachment options. *

* *

* You cannot modify the IPv6 options. *

*
* * @return The new VPC attachment options.

*

* You cannot modify the IPv6 options. *

*/ public ModifyTransitGatewayVpcAttachmentRequestOptions options() { return options; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(transitGatewayAttachmentId()); hashCode = 31 * hashCode + Objects.hashCode(addSubnetIds()); hashCode = 31 * hashCode + Objects.hashCode(removeSubnetIds()); hashCode = 31 * hashCode + Objects.hashCode(options()); return hashCode; } @Override public boolean equals(Object obj) { return super.equals(obj) && equalsBySdkFields(obj); } @Override public boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof ModifyTransitGatewayVpcAttachmentRequest)) { return false; } ModifyTransitGatewayVpcAttachmentRequest other = (ModifyTransitGatewayVpcAttachmentRequest) obj; return Objects.equals(transitGatewayAttachmentId(), other.transitGatewayAttachmentId()) && Objects.equals(addSubnetIds(), other.addSubnetIds()) && Objects.equals(removeSubnetIds(), other.removeSubnetIds()) && Objects.equals(options(), other.options()); } /** * 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 String toString() { return ToString.builder("ModifyTransitGatewayVpcAttachmentRequest") .add("TransitGatewayAttachmentId", transitGatewayAttachmentId()).add("AddSubnetIds", addSubnetIds()) .add("RemoveSubnetIds", removeSubnetIds()).add("Options", options()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "TransitGatewayAttachmentId": return Optional.ofNullable(clazz.cast(transitGatewayAttachmentId())); case "AddSubnetIds": return Optional.ofNullable(clazz.cast(addSubnetIds())); case "RemoveSubnetIds": return Optional.ofNullable(clazz.cast(removeSubnetIds())); case "Options": return Optional.ofNullable(clazz.cast(options())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((ModifyTransitGatewayVpcAttachmentRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends Ec2Request.Builder, SdkPojo, CopyableBuilder { /** *

* The ID of the attachment. *

* * @param transitGatewayAttachmentId * The ID of the attachment. * @return Returns a reference to this object so that method calls can be chained together. */ Builder transitGatewayAttachmentId(String transitGatewayAttachmentId); /** *

* The IDs of one or more subnets to add. You can specify at most one subnet per Availability Zone. *

* * @param addSubnetIds * The IDs of one or more subnets to add. You can specify at most one subnet per Availability Zone. * @return Returns a reference to this object so that method calls can be chained together. */ Builder addSubnetIds(Collection addSubnetIds); /** *

* The IDs of one or more subnets to add. You can specify at most one subnet per Availability Zone. *

* * @param addSubnetIds * The IDs of one or more subnets to add. You can specify at most one subnet per Availability Zone. * @return Returns a reference to this object so that method calls can be chained together. */ Builder addSubnetIds(String... addSubnetIds); /** *

* The IDs of one or more subnets to remove. *

* * @param removeSubnetIds * The IDs of one or more subnets to remove. * @return Returns a reference to this object so that method calls can be chained together. */ Builder removeSubnetIds(Collection removeSubnetIds); /** *

* The IDs of one or more subnets to remove. *

* * @param removeSubnetIds * The IDs of one or more subnets to remove. * @return Returns a reference to this object so that method calls can be chained together. */ Builder removeSubnetIds(String... removeSubnetIds); /** *

* The new VPC attachment options. *

* *

* You cannot modify the IPv6 options. *

*
* * @param options * The new VPC attachment options.

*

* You cannot modify the IPv6 options. *

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

* The new VPC attachment options. *

* *

* You cannot modify the IPv6 options. *

*
This is a convenience that creates an instance of the * {@link ModifyTransitGatewayVpcAttachmentRequestOptions.Builder} avoiding the need to create one manually via * {@link ModifyTransitGatewayVpcAttachmentRequestOptions#builder()}. * * When the {@link Consumer} completes, {@link ModifyTransitGatewayVpcAttachmentRequestOptions.Builder#build()} * is called immediately and its result is passed to * {@link #options(ModifyTransitGatewayVpcAttachmentRequestOptions)}. * * @param options * a consumer that will call methods on {@link ModifyTransitGatewayVpcAttachmentRequestOptions.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #options(ModifyTransitGatewayVpcAttachmentRequestOptions) */ default Builder options(Consumer options) { return options(ModifyTransitGatewayVpcAttachmentRequestOptions.builder().applyMutation(options).build()); } @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends Ec2Request.BuilderImpl implements Builder { private String transitGatewayAttachmentId; private List addSubnetIds = DefaultSdkAutoConstructList.getInstance(); private List removeSubnetIds = DefaultSdkAutoConstructList.getInstance(); private ModifyTransitGatewayVpcAttachmentRequestOptions options; private BuilderImpl() { } private BuilderImpl(ModifyTransitGatewayVpcAttachmentRequest model) { super(model); transitGatewayAttachmentId(model.transitGatewayAttachmentId); addSubnetIds(model.addSubnetIds); removeSubnetIds(model.removeSubnetIds); options(model.options); } public final String getTransitGatewayAttachmentId() { return transitGatewayAttachmentId; } @Override public final Builder transitGatewayAttachmentId(String transitGatewayAttachmentId) { this.transitGatewayAttachmentId = transitGatewayAttachmentId; return this; } public final void setTransitGatewayAttachmentId(String transitGatewayAttachmentId) { this.transitGatewayAttachmentId = transitGatewayAttachmentId; } public final Collection getAddSubnetIds() { return addSubnetIds; } @Override public final Builder addSubnetIds(Collection addSubnetIds) { this.addSubnetIds = TransitGatewaySubnetIdListCopier.copy(addSubnetIds); return this; } @Override @SafeVarargs public final Builder addSubnetIds(String... addSubnetIds) { addSubnetIds(Arrays.asList(addSubnetIds)); return this; } public final void setAddSubnetIds(Collection addSubnetIds) { this.addSubnetIds = TransitGatewaySubnetIdListCopier.copy(addSubnetIds); } public final Collection getRemoveSubnetIds() { return removeSubnetIds; } @Override public final Builder removeSubnetIds(Collection removeSubnetIds) { this.removeSubnetIds = TransitGatewaySubnetIdListCopier.copy(removeSubnetIds); return this; } @Override @SafeVarargs public final Builder removeSubnetIds(String... removeSubnetIds) { removeSubnetIds(Arrays.asList(removeSubnetIds)); return this; } public final void setRemoveSubnetIds(Collection removeSubnetIds) { this.removeSubnetIds = TransitGatewaySubnetIdListCopier.copy(removeSubnetIds); } public final ModifyTransitGatewayVpcAttachmentRequestOptions.Builder getOptions() { return options != null ? options.toBuilder() : null; } @Override public final Builder options(ModifyTransitGatewayVpcAttachmentRequestOptions options) { this.options = options; return this; } public final void setOptions(ModifyTransitGatewayVpcAttachmentRequestOptions.BuilderImpl options) { this.options = options != null ? options.build() : null; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public ModifyTransitGatewayVpcAttachmentRequest build() { return new ModifyTransitGatewayVpcAttachmentRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy