
software.amazon.awssdk.services.ec2.model.ReplaceRouteRequest 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.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.LocationTrait;
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 ReplaceRouteRequest extends Ec2Request implements
ToCopyableBuilder {
private static final SdkField DESTINATION_CIDR_BLOCK_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("DestinationCidrBlock")
.getter(getter(ReplaceRouteRequest::destinationCidrBlock))
.setter(setter(Builder::destinationCidrBlock))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DestinationCidrBlock")
.unmarshallLocationName("destinationCidrBlock").build()).build();
private static final SdkField DESTINATION_IPV6_CIDR_BLOCK_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("DestinationIpv6CidrBlock")
.getter(getter(ReplaceRouteRequest::destinationIpv6CidrBlock))
.setter(setter(Builder::destinationIpv6CidrBlock))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DestinationIpv6CidrBlock")
.unmarshallLocationName("destinationIpv6CidrBlock").build()).build();
private static final SdkField DESTINATION_PREFIX_LIST_ID_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("DestinationPrefixListId")
.getter(getter(ReplaceRouteRequest::destinationPrefixListId))
.setter(setter(Builder::destinationPrefixListId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DestinationPrefixListId")
.unmarshallLocationName("DestinationPrefixListId").build()).build();
private static final SdkField EGRESS_ONLY_INTERNET_GATEWAY_ID_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("EgressOnlyInternetGatewayId")
.getter(getter(ReplaceRouteRequest::egressOnlyInternetGatewayId))
.setter(setter(Builder::egressOnlyInternetGatewayId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EgressOnlyInternetGatewayId")
.unmarshallLocationName("egressOnlyInternetGatewayId").build()).build();
private static final SdkField GATEWAY_ID_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("GatewayId")
.getter(getter(ReplaceRouteRequest::gatewayId))
.setter(setter(Builder::gatewayId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GatewayId")
.unmarshallLocationName("gatewayId").build()).build();
private static final SdkField INSTANCE_ID_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("InstanceId")
.getter(getter(ReplaceRouteRequest::instanceId))
.setter(setter(Builder::instanceId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceId")
.unmarshallLocationName("instanceId").build()).build();
private static final SdkField LOCAL_TARGET_FIELD = SdkField
. builder(MarshallingType.BOOLEAN)
.memberName("LocalTarget")
.getter(getter(ReplaceRouteRequest::localTarget))
.setter(setter(Builder::localTarget))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LocalTarget")
.unmarshallLocationName("LocalTarget").build()).build();
private static final SdkField NAT_GATEWAY_ID_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("NatGatewayId")
.getter(getter(ReplaceRouteRequest::natGatewayId))
.setter(setter(Builder::natGatewayId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NatGatewayId")
.unmarshallLocationName("natGatewayId").build()).build();
private static final SdkField TRANSIT_GATEWAY_ID_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("TransitGatewayId")
.getter(getter(ReplaceRouteRequest::transitGatewayId))
.setter(setter(Builder::transitGatewayId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TransitGatewayId")
.unmarshallLocationName("TransitGatewayId").build()).build();
private static final SdkField LOCAL_GATEWAY_ID_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("LocalGatewayId")
.getter(getter(ReplaceRouteRequest::localGatewayId))
.setter(setter(Builder::localGatewayId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LocalGatewayId")
.unmarshallLocationName("LocalGatewayId").build()).build();
private static final SdkField CARRIER_GATEWAY_ID_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("CarrierGatewayId")
.getter(getter(ReplaceRouteRequest::carrierGatewayId))
.setter(setter(Builder::carrierGatewayId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CarrierGatewayId")
.unmarshallLocationName("CarrierGatewayId").build()).build();
private static final SdkField NETWORK_INTERFACE_ID_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("NetworkInterfaceId")
.getter(getter(ReplaceRouteRequest::networkInterfaceId))
.setter(setter(Builder::networkInterfaceId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NetworkInterfaceId")
.unmarshallLocationName("networkInterfaceId").build()).build();
private static final SdkField ROUTE_TABLE_ID_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("RouteTableId")
.getter(getter(ReplaceRouteRequest::routeTableId))
.setter(setter(Builder::routeTableId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RouteTableId")
.unmarshallLocationName("routeTableId").build()).build();
private static final SdkField VPC_PEERING_CONNECTION_ID_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("VpcPeeringConnectionId")
.getter(getter(ReplaceRouteRequest::vpcPeeringConnectionId))
.setter(setter(Builder::vpcPeeringConnectionId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VpcPeeringConnectionId")
.unmarshallLocationName("vpcPeeringConnectionId").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DESTINATION_CIDR_BLOCK_FIELD,
DESTINATION_IPV6_CIDR_BLOCK_FIELD, DESTINATION_PREFIX_LIST_ID_FIELD, EGRESS_ONLY_INTERNET_GATEWAY_ID_FIELD,
GATEWAY_ID_FIELD, INSTANCE_ID_FIELD, LOCAL_TARGET_FIELD, NAT_GATEWAY_ID_FIELD, TRANSIT_GATEWAY_ID_FIELD,
LOCAL_GATEWAY_ID_FIELD, CARRIER_GATEWAY_ID_FIELD, NETWORK_INTERFACE_ID_FIELD, ROUTE_TABLE_ID_FIELD,
VPC_PEERING_CONNECTION_ID_FIELD));
private final String destinationCidrBlock;
private final String destinationIpv6CidrBlock;
private final String destinationPrefixListId;
private final String egressOnlyInternetGatewayId;
private final String gatewayId;
private final String instanceId;
private final Boolean localTarget;
private final String natGatewayId;
private final String transitGatewayId;
private final String localGatewayId;
private final String carrierGatewayId;
private final String networkInterfaceId;
private final String routeTableId;
private final String vpcPeeringConnectionId;
private ReplaceRouteRequest(BuilderImpl builder) {
super(builder);
this.destinationCidrBlock = builder.destinationCidrBlock;
this.destinationIpv6CidrBlock = builder.destinationIpv6CidrBlock;
this.destinationPrefixListId = builder.destinationPrefixListId;
this.egressOnlyInternetGatewayId = builder.egressOnlyInternetGatewayId;
this.gatewayId = builder.gatewayId;
this.instanceId = builder.instanceId;
this.localTarget = builder.localTarget;
this.natGatewayId = builder.natGatewayId;
this.transitGatewayId = builder.transitGatewayId;
this.localGatewayId = builder.localGatewayId;
this.carrierGatewayId = builder.carrierGatewayId;
this.networkInterfaceId = builder.networkInterfaceId;
this.routeTableId = builder.routeTableId;
this.vpcPeeringConnectionId = builder.vpcPeeringConnectionId;
}
/**
*
* The IPv4 CIDR address block used for the destination match. The value that you provide must match the CIDR of an
* existing route in the table.
*
*
* @return The IPv4 CIDR address block used for the destination match. The value that you provide must match the
* CIDR of an existing route in the table.
*/
public String destinationCidrBlock() {
return destinationCidrBlock;
}
/**
*
* The IPv6 CIDR address block used for the destination match. The value that you provide must match the CIDR of an
* existing route in the table.
*
*
* @return The IPv6 CIDR address block used for the destination match. The value that you provide must match the
* CIDR of an existing route in the table.
*/
public String destinationIpv6CidrBlock() {
return destinationIpv6CidrBlock;
}
/**
*
* The ID of the prefix list for the route.
*
*
* @return The ID of the prefix list for the route.
*/
public String destinationPrefixListId() {
return destinationPrefixListId;
}
/**
*
* [IPv6 traffic only] The ID of an egress-only internet gateway.
*
*
* @return [IPv6 traffic only] The ID of an egress-only internet gateway.
*/
public String egressOnlyInternetGatewayId() {
return egressOnlyInternetGatewayId;
}
/**
*
* The ID of an internet gateway or virtual private gateway.
*
*
* @return The ID of an internet gateway or virtual private gateway.
*/
public String gatewayId() {
return gatewayId;
}
/**
*
* The ID of a NAT instance in your VPC.
*
*
* @return The ID of a NAT instance in your VPC.
*/
public String instanceId() {
return instanceId;
}
/**
*
* Specifies whether to reset the local route to its default target (local
).
*
*
* @return Specifies whether to reset the local route to its default target (local
).
*/
public Boolean localTarget() {
return localTarget;
}
/**
*
* [IPv4 traffic only] The ID of a NAT gateway.
*
*
* @return [IPv4 traffic only] The ID of a NAT gateway.
*/
public String natGatewayId() {
return natGatewayId;
}
/**
*
* The ID of a transit gateway.
*
*
* @return The ID of a transit gateway.
*/
public String transitGatewayId() {
return transitGatewayId;
}
/**
*
* The ID of the local gateway.
*
*
* @return The ID of the local gateway.
*/
public String localGatewayId() {
return localGatewayId;
}
/**
*
* [IPv4 traffic only] The ID of a carrier gateway.
*
*
* @return [IPv4 traffic only] The ID of a carrier gateway.
*/
public String carrierGatewayId() {
return carrierGatewayId;
}
/**
*
* The ID of a network interface.
*
*
* @return The ID of a network interface.
*/
public String networkInterfaceId() {
return networkInterfaceId;
}
/**
*
* The ID of the route table.
*
*
* @return The ID of the route table.
*/
public String routeTableId() {
return routeTableId;
}
/**
*
* The ID of a VPC peering connection.
*
*
* @return The ID of a VPC peering connection.
*/
public String vpcPeeringConnectionId() {
return vpcPeeringConnectionId;
}
@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(destinationCidrBlock());
hashCode = 31 * hashCode + Objects.hashCode(destinationIpv6CidrBlock());
hashCode = 31 * hashCode + Objects.hashCode(destinationPrefixListId());
hashCode = 31 * hashCode + Objects.hashCode(egressOnlyInternetGatewayId());
hashCode = 31 * hashCode + Objects.hashCode(gatewayId());
hashCode = 31 * hashCode + Objects.hashCode(instanceId());
hashCode = 31 * hashCode + Objects.hashCode(localTarget());
hashCode = 31 * hashCode + Objects.hashCode(natGatewayId());
hashCode = 31 * hashCode + Objects.hashCode(transitGatewayId());
hashCode = 31 * hashCode + Objects.hashCode(localGatewayId());
hashCode = 31 * hashCode + Objects.hashCode(carrierGatewayId());
hashCode = 31 * hashCode + Objects.hashCode(networkInterfaceId());
hashCode = 31 * hashCode + Objects.hashCode(routeTableId());
hashCode = 31 * hashCode + Objects.hashCode(vpcPeeringConnectionId());
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 ReplaceRouteRequest)) {
return false;
}
ReplaceRouteRequest other = (ReplaceRouteRequest) obj;
return Objects.equals(destinationCidrBlock(), other.destinationCidrBlock())
&& Objects.equals(destinationIpv6CidrBlock(), other.destinationIpv6CidrBlock())
&& Objects.equals(destinationPrefixListId(), other.destinationPrefixListId())
&& Objects.equals(egressOnlyInternetGatewayId(), other.egressOnlyInternetGatewayId())
&& Objects.equals(gatewayId(), other.gatewayId()) && Objects.equals(instanceId(), other.instanceId())
&& Objects.equals(localTarget(), other.localTarget()) && Objects.equals(natGatewayId(), other.natGatewayId())
&& Objects.equals(transitGatewayId(), other.transitGatewayId())
&& Objects.equals(localGatewayId(), other.localGatewayId())
&& Objects.equals(carrierGatewayId(), other.carrierGatewayId())
&& Objects.equals(networkInterfaceId(), other.networkInterfaceId())
&& Objects.equals(routeTableId(), other.routeTableId())
&& Objects.equals(vpcPeeringConnectionId(), other.vpcPeeringConnectionId());
}
/**
* 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("ReplaceRouteRequest").add("DestinationCidrBlock", destinationCidrBlock())
.add("DestinationIpv6CidrBlock", destinationIpv6CidrBlock())
.add("DestinationPrefixListId", destinationPrefixListId())
.add("EgressOnlyInternetGatewayId", egressOnlyInternetGatewayId()).add("GatewayId", gatewayId())
.add("InstanceId", instanceId()).add("LocalTarget", localTarget()).add("NatGatewayId", natGatewayId())
.add("TransitGatewayId", transitGatewayId()).add("LocalGatewayId", localGatewayId())
.add("CarrierGatewayId", carrierGatewayId()).add("NetworkInterfaceId", networkInterfaceId())
.add("RouteTableId", routeTableId()).add("VpcPeeringConnectionId", vpcPeeringConnectionId()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "DestinationCidrBlock":
return Optional.ofNullable(clazz.cast(destinationCidrBlock()));
case "DestinationIpv6CidrBlock":
return Optional.ofNullable(clazz.cast(destinationIpv6CidrBlock()));
case "DestinationPrefixListId":
return Optional.ofNullable(clazz.cast(destinationPrefixListId()));
case "EgressOnlyInternetGatewayId":
return Optional.ofNullable(clazz.cast(egressOnlyInternetGatewayId()));
case "GatewayId":
return Optional.ofNullable(clazz.cast(gatewayId()));
case "InstanceId":
return Optional.ofNullable(clazz.cast(instanceId()));
case "LocalTarget":
return Optional.ofNullable(clazz.cast(localTarget()));
case "NatGatewayId":
return Optional.ofNullable(clazz.cast(natGatewayId()));
case "TransitGatewayId":
return Optional.ofNullable(clazz.cast(transitGatewayId()));
case "LocalGatewayId":
return Optional.ofNullable(clazz.cast(localGatewayId()));
case "CarrierGatewayId":
return Optional.ofNullable(clazz.cast(carrierGatewayId()));
case "NetworkInterfaceId":
return Optional.ofNullable(clazz.cast(networkInterfaceId()));
case "RouteTableId":
return Optional.ofNullable(clazz.cast(routeTableId()));
case "VpcPeeringConnectionId":
return Optional.ofNullable(clazz.cast(vpcPeeringConnectionId()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function