software.amazon.awssdk.services.ec2.model.AdvertiseByoipCidrRequest Maven / Gradle / Ivy
Show all versions of ec2 Show documentation
/*
* 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.HashMap;
import java.util.List;
import java.util.Map;
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 AdvertiseByoipCidrRequest extends Ec2Request implements
ToCopyableBuilder {
private static final SdkField CIDR_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("Cidr")
.getter(getter(AdvertiseByoipCidrRequest::cidr))
.setter(setter(Builder::cidr))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Cidr")
.unmarshallLocationName("Cidr").build()).build();
private static final SdkField ASN_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("Asn")
.getter(getter(AdvertiseByoipCidrRequest::asn))
.setter(setter(Builder::asn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Asn").unmarshallLocationName("Asn")
.build()).build();
private static final SdkField DRY_RUN_FIELD = SdkField
. builder(MarshallingType.BOOLEAN)
.memberName("DryRun")
.getter(getter(AdvertiseByoipCidrRequest::dryRun))
.setter(setter(Builder::dryRun))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DryRun")
.unmarshallLocationName("DryRun").build()).build();
private static final SdkField NETWORK_BORDER_GROUP_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("NetworkBorderGroup")
.getter(getter(AdvertiseByoipCidrRequest::networkBorderGroup))
.setter(setter(Builder::networkBorderGroup))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NetworkBorderGroup")
.unmarshallLocationName("NetworkBorderGroup").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CIDR_FIELD, ASN_FIELD,
DRY_RUN_FIELD, NETWORK_BORDER_GROUP_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("Cidr", CIDR_FIELD);
put("Asn", ASN_FIELD);
put("DryRun", DRY_RUN_FIELD);
put("NetworkBorderGroup", NETWORK_BORDER_GROUP_FIELD);
}
});
private final String cidr;
private final String asn;
private final Boolean dryRun;
private final String networkBorderGroup;
private AdvertiseByoipCidrRequest(BuilderImpl builder) {
super(builder);
this.cidr = builder.cidr;
this.asn = builder.asn;
this.dryRun = builder.dryRun;
this.networkBorderGroup = builder.networkBorderGroup;
}
/**
*
* The address range, in CIDR notation. This must be the exact range that you provisioned. You can't advertise only
* a portion of the provisioned range.
*
*
* @return The address range, in CIDR notation. This must be the exact range that you provisioned. You can't
* advertise only a portion of the provisioned range.
*/
public final String cidr() {
return cidr;
}
/**
*
* The public 2-byte or 4-byte ASN that you want to advertise.
*
*
* @return The public 2-byte or 4-byte ASN that you want to advertise.
*/
public final String asn() {
return asn;
}
/**
*
* Checks whether you have the required permissions for the action, without actually making the request, and
* provides an error response. If you have the required permissions, the error response is
* DryRunOperation
. Otherwise, it is UnauthorizedOperation
.
*
*
* @return Checks whether you have the required permissions for the action, without actually making the request, and
* provides an error response. If you have the required permissions, the error response is
* DryRunOperation
. Otherwise, it is UnauthorizedOperation
.
*/
public final Boolean dryRun() {
return dryRun;
}
/**
*
* If you have Local Zones
* enabled, you can choose a network border group for Local Zones when you provision and advertise a BYOIPv4 CIDR.
* Choose the network border group carefully as the EIP and the Amazon Web Services resource it is associated with
* must reside in the same network border group.
*
*
* You can provision BYOIP address ranges to and advertise them in the following Local Zone network border groups:
*
*
* -
*
* us-east-1-dfw-2
*
*
* -
*
* us-west-2-lax-1
*
*
* -
*
* us-west-2-phx-2
*
*
*
*
*
* You cannot provision or advertise BYOIPv6 address ranges in Local Zones at this time.
*
*
*
* @return If you have Local
* Zones enabled, you can choose a network border group for Local Zones when you provision and advertise
* a BYOIPv4 CIDR. Choose the network border group carefully as the EIP and the Amazon Web Services resource
* it is associated with must reside in the same network border group.
*
* You can provision BYOIP address ranges to and advertise them in the following Local Zone network border
* groups:
*
*
* -
*
* us-east-1-dfw-2
*
*
* -
*
* us-west-2-lax-1
*
*
* -
*
* us-west-2-phx-2
*
*
*
*
*
* You cannot provision or advertise BYOIPv6 address ranges in Local Zones at this time.
*
*/
public final String networkBorderGroup() {
return networkBorderGroup;
}
@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 final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(cidr());
hashCode = 31 * hashCode + Objects.hashCode(asn());
hashCode = 31 * hashCode + Objects.hashCode(dryRun());
hashCode = 31 * hashCode + Objects.hashCode(networkBorderGroup());
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 AdvertiseByoipCidrRequest)) {
return false;
}
AdvertiseByoipCidrRequest other = (AdvertiseByoipCidrRequest) obj;
return Objects.equals(cidr(), other.cidr()) && Objects.equals(asn(), other.asn())
&& Objects.equals(dryRun(), other.dryRun()) && Objects.equals(networkBorderGroup(), other.networkBorderGroup());
}
/**
* 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("AdvertiseByoipCidrRequest").add("Cidr", cidr()).add("Asn", asn()).add("DryRun", dryRun())
.add("NetworkBorderGroup", networkBorderGroup()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Cidr":
return Optional.ofNullable(clazz.cast(cidr()));
case "Asn":
return Optional.ofNullable(clazz.cast(asn()));
case "DryRun":
return Optional.ofNullable(clazz.cast(dryRun()));
case "NetworkBorderGroup":
return Optional.ofNullable(clazz.cast(networkBorderGroup()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Function