
software.amazon.awssdk.services.route53resolver.model.ResolverRule 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.io.Serializable;
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.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;
/**
*
* For queries that originate in your VPC, detailed information about a Resolver rule, which specifies how to route DNS
* queries out of the VPC. The ResolverRule
parameter appears in the response to a CreateResolverRule, DeleteResolverRule, GetResolverRule, ListResolverRules, or UpdateResolverRule request.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ResolverRule implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Id")
.getter(getter(ResolverRule::id)).setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Id").build()).build();
private static final SdkField CREATOR_REQUEST_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CreatorRequestId").getter(getter(ResolverRule::creatorRequestId))
.setter(setter(Builder::creatorRequestId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatorRequestId").build()).build();
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Arn")
.getter(getter(ResolverRule::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Arn").build()).build();
private static final SdkField DOMAIN_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DomainName").getter(getter(ResolverRule::domainName)).setter(setter(Builder::domainName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DomainName").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(ResolverRule::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField STATUS_MESSAGE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StatusMessage").getter(getter(ResolverRule::statusMessage)).setter(setter(Builder::statusMessage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StatusMessage").build()).build();
private static final SdkField RULE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RuleType").getter(getter(ResolverRule::ruleTypeAsString)).setter(setter(Builder::ruleType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RuleType").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name")
.getter(getter(ResolverRule::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();
private static final SdkField> TARGET_IPS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("TargetIps")
.getter(getter(ResolverRule::targetIps))
.setter(setter(Builder::targetIps))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TargetIps").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(TargetAddress::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField RESOLVER_ENDPOINT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ResolverEndpointId").getter(getter(ResolverRule::resolverEndpointId))
.setter(setter(Builder::resolverEndpointId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResolverEndpointId").build())
.build();
private static final SdkField OWNER_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("OwnerId").getter(getter(ResolverRule::ownerId)).setter(setter(Builder::ownerId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OwnerId").build()).build();
private static final SdkField SHARE_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ShareStatus").getter(getter(ResolverRule::shareStatusAsString)).setter(setter(Builder::shareStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ShareStatus").build()).build();
private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CreationTime").getter(getter(ResolverRule::creationTime)).setter(setter(Builder::creationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationTime").build()).build();
private static final SdkField MODIFICATION_TIME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ModificationTime").getter(getter(ResolverRule::modificationTime))
.setter(setter(Builder::modificationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ModificationTime").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ID_FIELD,
CREATOR_REQUEST_ID_FIELD, ARN_FIELD, DOMAIN_NAME_FIELD, STATUS_FIELD, STATUS_MESSAGE_FIELD, RULE_TYPE_FIELD,
NAME_FIELD, TARGET_IPS_FIELD, RESOLVER_ENDPOINT_ID_FIELD, OWNER_ID_FIELD, SHARE_STATUS_FIELD, CREATION_TIME_FIELD,
MODIFICATION_TIME_FIELD));
private static final long serialVersionUID = 1L;
private final String id;
private final String creatorRequestId;
private final String arn;
private final String domainName;
private final String status;
private final String statusMessage;
private final String ruleType;
private final String name;
private final List targetIps;
private final String resolverEndpointId;
private final String ownerId;
private final String shareStatus;
private final String creationTime;
private final String modificationTime;
private ResolverRule(BuilderImpl builder) {
this.id = builder.id;
this.creatorRequestId = builder.creatorRequestId;
this.arn = builder.arn;
this.domainName = builder.domainName;
this.status = builder.status;
this.statusMessage = builder.statusMessage;
this.ruleType = builder.ruleType;
this.name = builder.name;
this.targetIps = builder.targetIps;
this.resolverEndpointId = builder.resolverEndpointId;
this.ownerId = builder.ownerId;
this.shareStatus = builder.shareStatus;
this.creationTime = builder.creationTime;
this.modificationTime = builder.modificationTime;
}
/**
*
* The ID that Resolver assigned to the Resolver rule when you created it.
*
*
* @return The ID that Resolver assigned to the Resolver rule when you created it.
*/
public final String id() {
return id;
}
/**
*
* A unique string that you specified when you created the Resolver rule. CreatorRequestId
identifies
* the request and allows failed requests to be retried without the risk of running the operation twice.
*
*
* @return A unique string that you specified when you created the Resolver rule. CreatorRequestId
* identifies the request and allows failed requests to be retried without the risk of running the operation
* twice.
*/
public final String creatorRequestId() {
return creatorRequestId;
}
/**
*
* The ARN (Amazon Resource Name) for the Resolver rule specified by Id
.
*
*
* @return The ARN (Amazon Resource Name) for the Resolver rule specified by Id
.
*/
public final String arn() {
return arn;
}
/**
*
* DNS queries for this domain name are forwarded to the IP addresses that are specified in TargetIps
.
* If a query matches multiple Resolver rules (example.com and www.example.com), the query is routed using the
* Resolver rule that contains the most specific domain name (www.example.com).
*
*
* @return DNS queries for this domain name are forwarded to the IP addresses that are specified in
* TargetIps
. If a query matches multiple Resolver rules (example.com and www.example.com), the
* query is routed using the Resolver rule that contains the most specific domain name (www.example.com).
*/
public final String domainName() {
return domainName;
}
/**
*
* A code that specifies the current status of the Resolver rule.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ResolverRuleStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return A code that specifies the current status of the Resolver rule.
* @see ResolverRuleStatus
*/
public final ResolverRuleStatus status() {
return ResolverRuleStatus.fromValue(status);
}
/**
*
* A code that specifies the current status of the Resolver rule.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ResolverRuleStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return A code that specifies the current status of the Resolver rule.
* @see ResolverRuleStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* A detailed description of the status of a Resolver rule.
*
*
* @return A detailed description of the status of a Resolver rule.
*/
public final String statusMessage() {
return statusMessage;
}
/**
*
* When you want to forward DNS queries for specified domain name to resolvers on your network, specify
* FORWARD
.
*
*
* When you have a forwarding rule to forward DNS queries for a domain to your network and you want Resolver to
* process queries for a subdomain of that domain, specify SYSTEM
.
*
*
* For example, to forward DNS queries for example.com to resolvers on your network, you create a rule and specify
* FORWARD
for RuleType
. To then have Resolver process queries for apex.example.com, you
* create a rule and specify SYSTEM
for RuleType
.
*
*
* Currently, only Resolver can create rules that have a value of RECURSIVE
for RuleType
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #ruleType} will
* return {@link RuleTypeOption#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #ruleTypeAsString}.
*
*
* @return When you want to forward DNS queries for specified domain name to resolvers on your network, specify
* FORWARD
.
*
* When you have a forwarding rule to forward DNS queries for a domain to your network and you want Resolver
* to process queries for a subdomain of that domain, specify SYSTEM
.
*
*
* For example, to forward DNS queries for example.com to resolvers on your network, you create a rule and
* specify FORWARD
for RuleType
. To then have Resolver process queries for
* apex.example.com, you create a rule and specify SYSTEM
for RuleType
.
*
*
* Currently, only Resolver can create rules that have a value of RECURSIVE
for
* RuleType
.
* @see RuleTypeOption
*/
public final RuleTypeOption ruleType() {
return RuleTypeOption.fromValue(ruleType);
}
/**
*
* When you want to forward DNS queries for specified domain name to resolvers on your network, specify
* FORWARD
.
*
*
* When you have a forwarding rule to forward DNS queries for a domain to your network and you want Resolver to
* process queries for a subdomain of that domain, specify SYSTEM
.
*
*
* For example, to forward DNS queries for example.com to resolvers on your network, you create a rule and specify
* FORWARD
for RuleType
. To then have Resolver process queries for apex.example.com, you
* create a rule and specify SYSTEM
for RuleType
.
*
*
* Currently, only Resolver can create rules that have a value of RECURSIVE
for RuleType
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #ruleType} will
* return {@link RuleTypeOption#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #ruleTypeAsString}.
*
*
* @return When you want to forward DNS queries for specified domain name to resolvers on your network, specify
* FORWARD
.
*
* When you have a forwarding rule to forward DNS queries for a domain to your network and you want Resolver
* to process queries for a subdomain of that domain, specify SYSTEM
.
*
*
* For example, to forward DNS queries for example.com to resolvers on your network, you create a rule and
* specify FORWARD
for RuleType
. To then have Resolver process queries for
* apex.example.com, you create a rule and specify SYSTEM
for RuleType
.
*
*
* Currently, only Resolver can create rules that have a value of RECURSIVE
for
* RuleType
.
* @see RuleTypeOption
*/
public final String ruleTypeAsString() {
return ruleType;
}
/**
*
* The name for the Resolver rule, which you specified when you created the Resolver rule.
*
*
* @return The name for the Resolver rule, which you specified when you created the Resolver rule.
*/
public final String name() {
return name;
}
/**
* For responses, this returns true if the service returned a value for the TargetIps 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 hasTargetIps() {
return targetIps != null && !(targetIps instanceof SdkAutoConstructList);
}
/**
*
* An array that contains the IP addresses and ports that an outbound endpoint forwards DNS queries to. Typically,
* these are the IP addresses of DNS resolvers on your network.
*
*
* 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 #hasTargetIps} method.
*
*
* @return An array that contains the IP addresses and ports that an outbound endpoint forwards DNS queries to.
* Typically, these are the IP addresses of DNS resolvers on your network.
*/
public final List targetIps() {
return targetIps;
}
/**
*
* The ID of the endpoint that the rule is associated with.
*
*
* @return The ID of the endpoint that the rule is associated with.
*/
public final String resolverEndpointId() {
return resolverEndpointId;
}
/**
*
* When a rule is shared with another Amazon Web Services account, the account ID of the account that the rule is
* shared with.
*
*
* @return When a rule is shared with another Amazon Web Services account, the account ID of the account that the
* rule is shared with.
*/
public final String ownerId() {
return ownerId;
}
/**
*
* Whether the rule is shared and, if so, whether the current account is sharing the rule with another account, or
* another account is sharing the rule with the current account.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #shareStatus} will
* return {@link ShareStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #shareStatusAsString}.
*
*
* @return Whether the rule is shared and, if so, whether the current account is sharing the rule with another
* account, or another account is sharing the rule with the current account.
* @see ShareStatus
*/
public final ShareStatus shareStatus() {
return ShareStatus.fromValue(shareStatus);
}
/**
*
* Whether the rule is shared and, if so, whether the current account is sharing the rule with another account, or
* another account is sharing the rule with the current account.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #shareStatus} will
* return {@link ShareStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #shareStatusAsString}.
*
*
* @return Whether the rule is shared and, if so, whether the current account is sharing the rule with another
* account, or another account is sharing the rule with the current account.
* @see ShareStatus
*/
public final String shareStatusAsString() {
return shareStatus;
}
/**
*
* The date and time that the Resolver rule was created, in Unix time format and Coordinated Universal Time (UTC).
*
*
* @return The date and time that the Resolver rule was created, in Unix time format and Coordinated Universal Time
* (UTC).
*/
public final String creationTime() {
return creationTime;
}
/**
*
* The date and time that the Resolver rule was last updated, in Unix time format and Coordinated Universal Time
* (UTC).
*
*
* @return The date and time that the Resolver rule was last updated, in Unix time format and Coordinated Universal
* Time (UTC).
*/
public final String modificationTime() {
return modificationTime;
}
@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(id());
hashCode = 31 * hashCode + Objects.hashCode(creatorRequestId());
hashCode = 31 * hashCode + Objects.hashCode(arn());
hashCode = 31 * hashCode + Objects.hashCode(domainName());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(statusMessage());
hashCode = 31 * hashCode + Objects.hashCode(ruleTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(hasTargetIps() ? targetIps() : null);
hashCode = 31 * hashCode + Objects.hashCode(resolverEndpointId());
hashCode = 31 * hashCode + Objects.hashCode(ownerId());
hashCode = 31 * hashCode + Objects.hashCode(shareStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(modificationTime());
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 ResolverRule)) {
return false;
}
ResolverRule other = (ResolverRule) obj;
return Objects.equals(id(), other.id()) && Objects.equals(creatorRequestId(), other.creatorRequestId())
&& Objects.equals(arn(), other.arn()) && Objects.equals(domainName(), other.domainName())
&& Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(statusMessage(), other.statusMessage())
&& Objects.equals(ruleTypeAsString(), other.ruleTypeAsString()) && Objects.equals(name(), other.name())
&& hasTargetIps() == other.hasTargetIps() && Objects.equals(targetIps(), other.targetIps())
&& Objects.equals(resolverEndpointId(), other.resolverEndpointId()) && Objects.equals(ownerId(), other.ownerId())
&& Objects.equals(shareStatusAsString(), other.shareStatusAsString())
&& Objects.equals(creationTime(), other.creationTime())
&& Objects.equals(modificationTime(), other.modificationTime());
}
/**
* 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("ResolverRule").add("Id", id()).add("CreatorRequestId", creatorRequestId()).add("Arn", arn())
.add("DomainName", domainName()).add("Status", statusAsString()).add("StatusMessage", statusMessage())
.add("RuleType", ruleTypeAsString()).add("Name", name()).add("TargetIps", hasTargetIps() ? targetIps() : null)
.add("ResolverEndpointId", resolverEndpointId()).add("OwnerId", ownerId())
.add("ShareStatus", shareStatusAsString()).add("CreationTime", creationTime())
.add("ModificationTime", modificationTime()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Id":
return Optional.ofNullable(clazz.cast(id()));
case "CreatorRequestId":
return Optional.ofNullable(clazz.cast(creatorRequestId()));
case "Arn":
return Optional.ofNullable(clazz.cast(arn()));
case "DomainName":
return Optional.ofNullable(clazz.cast(domainName()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "StatusMessage":
return Optional.ofNullable(clazz.cast(statusMessage()));
case "RuleType":
return Optional.ofNullable(clazz.cast(ruleTypeAsString()));
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "TargetIps":
return Optional.ofNullable(clazz.cast(targetIps()));
case "ResolverEndpointId":
return Optional.ofNullable(clazz.cast(resolverEndpointId()));
case "OwnerId":
return Optional.ofNullable(clazz.cast(ownerId()));
case "ShareStatus":
return Optional.ofNullable(clazz.cast(shareStatusAsString()));
case "CreationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "ModificationTime":
return Optional.ofNullable(clazz.cast(modificationTime()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function