software.amazon.awssdk.services.route53.model.GeoProximityLocation Maven / Gradle / Ivy
Show all versions of route53 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.route53.model;
import java.io.Serializable;
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.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;
/**
*
* (Resource record sets only): A complex type that lets you specify where your resources are located. Only one of
* LocalZoneGroup
, Coordinates
, or Amazon Web ServicesRegion
is allowed per
* request at a time.
*
*
* For more information about geoproximity routing, see Geoproximity
* routing in the Amazon Route 53 Developer Guide.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class GeoProximityLocation implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField AWS_REGION_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("AWSRegion")
.getter(getter(GeoProximityLocation::awsRegion))
.setter(setter(Builder::awsRegion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AWSRegion")
.unmarshallLocationName("AWSRegion").build()).build();
private static final SdkField LOCAL_ZONE_GROUP_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("LocalZoneGroup")
.getter(getter(GeoProximityLocation::localZoneGroup))
.setter(setter(Builder::localZoneGroup))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LocalZoneGroup")
.unmarshallLocationName("LocalZoneGroup").build()).build();
private static final SdkField COORDINATES_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.memberName("Coordinates")
.getter(getter(GeoProximityLocation::coordinates))
.setter(setter(Builder::coordinates))
.constructor(Coordinates::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Coordinates")
.unmarshallLocationName("Coordinates").build()).build();
private static final SdkField BIAS_FIELD = SdkField
. builder(MarshallingType.INTEGER)
.memberName("Bias")
.getter(getter(GeoProximityLocation::bias))
.setter(setter(Builder::bias))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Bias")
.unmarshallLocationName("Bias").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(AWS_REGION_FIELD,
LOCAL_ZONE_GROUP_FIELD, COORDINATES_FIELD, BIAS_FIELD));
private static final long serialVersionUID = 1L;
private final String awsRegion;
private final String localZoneGroup;
private final Coordinates coordinates;
private final Integer bias;
private GeoProximityLocation(BuilderImpl builder) {
this.awsRegion = builder.awsRegion;
this.localZoneGroup = builder.localZoneGroup;
this.coordinates = builder.coordinates;
this.bias = builder.bias;
}
/**
*
* The Amazon Web Services Region the resource you are directing DNS traffic to, is in.
*
*
* @return The Amazon Web Services Region the resource you are directing DNS traffic to, is in.
*/
public final String awsRegion() {
return awsRegion;
}
/**
*
* Specifies an Amazon Web Services Local Zone Group.
*
*
* A local Zone Group is usually the Local Zone code without the ending character. For example, if the Local Zone is
* us-east-1-bue-1a
the Local Zone Group is us-east-1-bue-1
.
*
*
* You can identify the Local Zones Group for a specific Local Zone by using the describe-availability-zones CLI command:
*
*
* This command returns: "GroupName": "us-west-2-den-1"
, specifying that the Local Zone
* us-west-2-den-1a
belongs to the Local Zone Group us-west-2-den-1
.
*
*
* @return Specifies an Amazon Web Services Local Zone Group.
*
* A local Zone Group is usually the Local Zone code without the ending character. For example, if the Local
* Zone is us-east-1-bue-1a
the Local Zone Group is us-east-1-bue-1
.
*
*
* You can identify the Local Zones Group for a specific Local Zone by using the describe-availability-zones CLI command:
*
*
* This command returns: "GroupName": "us-west-2-den-1"
, specifying that the Local Zone
* us-west-2-den-1a
belongs to the Local Zone Group us-west-2-den-1
.
*/
public final String localZoneGroup() {
return localZoneGroup;
}
/**
*
* Contains the longitude and latitude for a geographic region.
*
*
* @return Contains the longitude and latitude for a geographic region.
*/
public final Coordinates coordinates() {
return coordinates;
}
/**
*
* The bias increases or decreases the size of the geographic region from which Route 53 routes traffic to a
* resource.
*
*
* To use Bias
to change the size of the geographic region, specify the applicable value for the bias:
*
*
* -
*
* To expand the size of the geographic region from which Route 53 routes traffic to a resource, specify a positive
* integer from 1 to 99 for the bias. Route 53 shrinks the size of adjacent regions.
*
*
* -
*
* To shrink the size of the geographic region from which Route 53 routes traffic to a resource, specify a negative
* bias of -1 to -99. Route 53 expands the size of adjacent regions.
*
*
*
*
* @return The bias increases or decreases the size of the geographic region from which Route 53 routes traffic to a
* resource.
*
* To use Bias
to change the size of the geographic region, specify the applicable value for
* the bias:
*
*
* -
*
* To expand the size of the geographic region from which Route 53 routes traffic to a resource, specify a
* positive integer from 1 to 99 for the bias. Route 53 shrinks the size of adjacent regions.
*
*
* -
*
* To shrink the size of the geographic region from which Route 53 routes traffic to a resource, specify a
* negative bias of -1 to -99. Route 53 expands the size of adjacent regions.
*
*
*/
public final Integer bias() {
return bias;
}
@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 + Objects.hashCode(awsRegion());
hashCode = 31 * hashCode + Objects.hashCode(localZoneGroup());
hashCode = 31 * hashCode + Objects.hashCode(coordinates());
hashCode = 31 * hashCode + Objects.hashCode(bias());
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 GeoProximityLocation)) {
return false;
}
GeoProximityLocation other = (GeoProximityLocation) obj;
return Objects.equals(awsRegion(), other.awsRegion()) && Objects.equals(localZoneGroup(), other.localZoneGroup())
&& Objects.equals(coordinates(), other.coordinates()) && Objects.equals(bias(), other.bias());
}
/**
* 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("GeoProximityLocation").add("AWSRegion", awsRegion()).add("LocalZoneGroup", localZoneGroup())
.add("Coordinates", coordinates()).add("Bias", bias()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AWSRegion":
return Optional.ofNullable(clazz.cast(awsRegion()));
case "LocalZoneGroup":
return Optional.ofNullable(clazz.cast(localZoneGroup()));
case "Coordinates":
return Optional.ofNullable(clazz.cast(coordinates()));
case "Bias":
return Optional.ofNullable(clazz.cast(bias()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function