
software.amazon.awssdk.services.route53resolver.model.UpdateResolverEndpointRequest 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.route53resolver.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 java.util.stream.Collectors;
import java.util.stream.Stream;
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 UpdateResolverEndpointRequest extends Route53ResolverRequest implements
ToCopyableBuilder {
private static final SdkField RESOLVER_ENDPOINT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ResolverEndpointId").getter(getter(UpdateResolverEndpointRequest::resolverEndpointId))
.setter(setter(Builder::resolverEndpointId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResolverEndpointId").build())
.build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name")
.getter(getter(UpdateResolverEndpointRequest::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();
private static final SdkField RESOLVER_ENDPOINT_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ResolverEndpointType").getter(getter(UpdateResolverEndpointRequest::resolverEndpointTypeAsString))
.setter(setter(Builder::resolverEndpointType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResolverEndpointType").build())
.build();
private static final SdkField> UPDATE_IP_ADDRESSES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("UpdateIpAddresses")
.getter(getter(UpdateResolverEndpointRequest::updateIpAddresses))
.setter(setter(Builder::updateIpAddresses))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UpdateIpAddresses").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(UpdateIpAddress::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> PROTOCOLS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Protocols")
.getter(getter(UpdateResolverEndpointRequest::protocolsAsStrings))
.setter(setter(Builder::protocolsWithStrings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Protocols").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(RESOLVER_ENDPOINT_ID_FIELD,
NAME_FIELD, RESOLVER_ENDPOINT_TYPE_FIELD, UPDATE_IP_ADDRESSES_FIELD, PROTOCOLS_FIELD));
private final String resolverEndpointId;
private final String name;
private final String resolverEndpointType;
private final List updateIpAddresses;
private final List protocols;
private UpdateResolverEndpointRequest(BuilderImpl builder) {
super(builder);
this.resolverEndpointId = builder.resolverEndpointId;
this.name = builder.name;
this.resolverEndpointType = builder.resolverEndpointType;
this.updateIpAddresses = builder.updateIpAddresses;
this.protocols = builder.protocols;
}
/**
*
* The ID of the Resolver endpoint that you want to update.
*
*
* @return The ID of the Resolver endpoint that you want to update.
*/
public final String resolverEndpointId() {
return resolverEndpointId;
}
/**
*
* The name of the Resolver endpoint that you want to update.
*
*
* @return The name of the Resolver endpoint that you want to update.
*/
public final String name() {
return name;
}
/**
*
* Specifies the endpoint type for what type of IP address the endpoint uses to forward DNS queries.
*
*
* Updating to IPV6
type isn't currently supported.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #resolverEndpointType} will return {@link ResolverEndpointType#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #resolverEndpointTypeAsString}.
*
*
* @return Specifies the endpoint type for what type of IP address the endpoint uses to forward DNS queries.
*
* Updating to IPV6
type isn't currently supported.
* @see ResolverEndpointType
*/
public final ResolverEndpointType resolverEndpointType() {
return ResolverEndpointType.fromValue(resolverEndpointType);
}
/**
*
* Specifies the endpoint type for what type of IP address the endpoint uses to forward DNS queries.
*
*
* Updating to IPV6
type isn't currently supported.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #resolverEndpointType} will return {@link ResolverEndpointType#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #resolverEndpointTypeAsString}.
*
*
* @return Specifies the endpoint type for what type of IP address the endpoint uses to forward DNS queries.
*
* Updating to IPV6
type isn't currently supported.
* @see ResolverEndpointType
*/
public final String resolverEndpointTypeAsString() {
return resolverEndpointType;
}
/**
* For responses, this returns true if the service returned a value for the UpdateIpAddresses property. This DOES
* NOT check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property).
* This is useful because the SDK will never return a null collection or map, but you may need to differentiate
* between the service returning nothing (or null) and the service returning an empty collection or map. For
* requests, this returns true if a value for the property was specified in the request builder, and false if a
* value was not specified.
*/
public final boolean hasUpdateIpAddresses() {
return updateIpAddresses != null && !(updateIpAddresses instanceof SdkAutoConstructList);
}
/**
*
* Specifies the IPv6 address when you update the Resolver endpoint from IPv4 to dual-stack. If you don't specify an
* IPv6 address, one will be automatically chosen from your subnet.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasUpdateIpAddresses} method.
*
*
* @return Specifies the IPv6 address when you update the Resolver endpoint from IPv4 to dual-stack. If you don't
* specify an IPv6 address, one will be automatically chosen from your subnet.
*/
public final List updateIpAddresses() {
return updateIpAddresses;
}
/**
*
* The protocols you want to use for the endpoint. DoH-FIPS is applicable for inbound endpoints only.
*
*
* For an inbound endpoint you can apply the protocols as follows:
*
*
* -
*
* Do53 and DoH in combination.
*
*
* -
*
* Do53 and DoH-FIPS in combination.
*
*
* -
*
* Do53 alone.
*
*
* -
*
* DoH alone.
*
*
* -
*
* DoH-FIPS alone.
*
*
* -
*
* None, which is treated as Do53.
*
*
*
*
* For an outbound endpoint you can apply the protocols as follows:
*
*
* -
*
* Do53 and DoH in combination.
*
*
* -
*
* Do53 alone.
*
*
* -
*
* DoH alone.
*
*
* -
*
* None, which is treated as Do53.
*
*
*
*
*
* You can't change the protocol of an inbound endpoint directly from only Do53 to only DoH, or DoH-FIPS. This is to
* prevent a sudden disruption to incoming traffic that relies on Do53. To change the protocol from Do53 to DoH, or
* DoH-FIPS, you must first enable both Do53 and DoH, or Do53 and DoH-FIPS, to make sure that all incoming traffic
* has transferred to using the DoH protocol, or DoH-FIPS, and then remove the Do53.
*
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasProtocols} method.
*
*
* @return The protocols you want to use for the endpoint. DoH-FIPS is applicable for inbound endpoints only.
*
* For an inbound endpoint you can apply the protocols as follows:
*
*
* -
*
* Do53 and DoH in combination.
*
*
* -
*
* Do53 and DoH-FIPS in combination.
*
*
* -
*
* Do53 alone.
*
*
* -
*
* DoH alone.
*
*
* -
*
* DoH-FIPS alone.
*
*
* -
*
* None, which is treated as Do53.
*
*
*
*
* For an outbound endpoint you can apply the protocols as follows:
*
*
* -
*
* Do53 and DoH in combination.
*
*
* -
*
* Do53 alone.
*
*
* -
*
* DoH alone.
*
*
* -
*
* None, which is treated as Do53.
*
*
*
*
*
* You can't change the protocol of an inbound endpoint directly from only Do53 to only DoH, or DoH-FIPS.
* This is to prevent a sudden disruption to incoming traffic that relies on Do53. To change the protocol
* from Do53 to DoH, or DoH-FIPS, you must first enable both Do53 and DoH, or Do53 and DoH-FIPS, to make
* sure that all incoming traffic has transferred to using the DoH protocol, or DoH-FIPS, and then remove
* the Do53.
*
*/
public final List protocols() {
return ProtocolListCopier.copyStringToEnum(protocols);
}
/**
* For responses, this returns true if the service returned a value for the Protocols property. This DOES NOT check
* that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is
* useful because the SDK will never return a null collection or map, but you may need to differentiate between the
* service returning nothing (or null) and the service returning an empty collection or map. For requests, this
* returns true if a value for the property was specified in the request builder, and false if a value was not
* specified.
*/
public final boolean hasProtocols() {
return protocols != null && !(protocols instanceof SdkAutoConstructList);
}
/**
*
* The protocols you want to use for the endpoint. DoH-FIPS is applicable for inbound endpoints only.
*
*
* For an inbound endpoint you can apply the protocols as follows:
*
*
* -
*
* Do53 and DoH in combination.
*
*
* -
*
* Do53 and DoH-FIPS in combination.
*
*
* -
*
* Do53 alone.
*
*
* -
*
* DoH alone.
*
*
* -
*
* DoH-FIPS alone.
*
*
* -
*
* None, which is treated as Do53.
*
*
*
*
* For an outbound endpoint you can apply the protocols as follows:
*
*
* -
*
* Do53 and DoH in combination.
*
*
* -
*
* Do53 alone.
*
*
* -
*
* DoH alone.
*
*
* -
*
* None, which is treated as Do53.
*
*
*
*
*
* You can't change the protocol of an inbound endpoint directly from only Do53 to only DoH, or DoH-FIPS. This is to
* prevent a sudden disruption to incoming traffic that relies on Do53. To change the protocol from Do53 to DoH, or
* DoH-FIPS, you must first enable both Do53 and DoH, or Do53 and DoH-FIPS, to make sure that all incoming traffic
* has transferred to using the DoH protocol, or DoH-FIPS, and then remove the Do53.
*
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasProtocols} method.
*
*
* @return The protocols you want to use for the endpoint. DoH-FIPS is applicable for inbound endpoints only.
*
* For an inbound endpoint you can apply the protocols as follows:
*
*
* -
*
* Do53 and DoH in combination.
*
*
* -
*
* Do53 and DoH-FIPS in combination.
*
*
* -
*
* Do53 alone.
*
*
* -
*
* DoH alone.
*
*
* -
*
* DoH-FIPS alone.
*
*
* -
*
* None, which is treated as Do53.
*
*
*
*
* For an outbound endpoint you can apply the protocols as follows:
*
*
* -
*
* Do53 and DoH in combination.
*
*
* -
*
* Do53 alone.
*
*
* -
*
* DoH alone.
*
*
* -
*
* None, which is treated as Do53.
*
*
*
*
*
* You can't change the protocol of an inbound endpoint directly from only Do53 to only DoH, or DoH-FIPS.
* This is to prevent a sudden disruption to incoming traffic that relies on Do53. To change the protocol
* from Do53 to DoH, or DoH-FIPS, you must first enable both Do53 and DoH, or Do53 and DoH-FIPS, to make
* sure that all incoming traffic has transferred to using the DoH protocol, or DoH-FIPS, and then remove
* the Do53.
*
*/
public final List protocolsAsStrings() {
return protocols;
}
@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(resolverEndpointId());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(resolverEndpointTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(hasUpdateIpAddresses() ? updateIpAddresses() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasProtocols() ? protocolsAsStrings() : null);
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 UpdateResolverEndpointRequest)) {
return false;
}
UpdateResolverEndpointRequest other = (UpdateResolverEndpointRequest) obj;
return Objects.equals(resolverEndpointId(), other.resolverEndpointId()) && Objects.equals(name(), other.name())
&& Objects.equals(resolverEndpointTypeAsString(), other.resolverEndpointTypeAsString())
&& hasUpdateIpAddresses() == other.hasUpdateIpAddresses()
&& Objects.equals(updateIpAddresses(), other.updateIpAddresses()) && hasProtocols() == other.hasProtocols()
&& Objects.equals(protocolsAsStrings(), other.protocolsAsStrings());
}
/**
* 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("UpdateResolverEndpointRequest").add("ResolverEndpointId", resolverEndpointId())
.add("Name", name()).add("ResolverEndpointType", resolverEndpointTypeAsString())
.add("UpdateIpAddresses", hasUpdateIpAddresses() ? updateIpAddresses() : null)
.add("Protocols", hasProtocols() ? protocolsAsStrings() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ResolverEndpointId":
return Optional.ofNullable(clazz.cast(resolverEndpointId()));
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "ResolverEndpointType":
return Optional.ofNullable(clazz.cast(resolverEndpointTypeAsString()));
case "UpdateIpAddresses":
return Optional.ofNullable(clazz.cast(updateIpAddresses()));
case "Protocols":
return Optional.ofNullable(clazz.cast(protocolsAsStrings()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function