
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 extends Builder> 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