
software.amazon.awssdk.services.route53resolver.model.ResolverRuleAssociation 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.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
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;
/**
*
* In the response to an AssociateResolverRule, DisassociateResolverRule, or ListResolverRuleAssociations request, provides information about an association between a Resolver rule and a
* VPC. The association determines which DNS queries that originate in the VPC are forwarded to your network.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ResolverRuleAssociation implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Id")
.getter(getter(ResolverRuleAssociation::id)).setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Id").build()).build();
private static final SdkField RESOLVER_RULE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ResolverRuleId").getter(getter(ResolverRuleAssociation::resolverRuleId))
.setter(setter(Builder::resolverRuleId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResolverRuleId").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name")
.getter(getter(ResolverRuleAssociation::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();
private static final SdkField VPC_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("VPCId")
.getter(getter(ResolverRuleAssociation::vpcId)).setter(setter(Builder::vpcId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VPCId").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(ResolverRuleAssociation::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(ResolverRuleAssociation::statusMessage))
.setter(setter(Builder::statusMessage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StatusMessage").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ID_FIELD,
RESOLVER_RULE_ID_FIELD, NAME_FIELD, VPC_ID_FIELD, STATUS_FIELD, STATUS_MESSAGE_FIELD));
private static final long serialVersionUID = 1L;
private final String id;
private final String resolverRuleId;
private final String name;
private final String vpcId;
private final String status;
private final String statusMessage;
private ResolverRuleAssociation(BuilderImpl builder) {
this.id = builder.id;
this.resolverRuleId = builder.resolverRuleId;
this.name = builder.name;
this.vpcId = builder.vpcId;
this.status = builder.status;
this.statusMessage = builder.statusMessage;
}
/**
*
* The ID of the association between a Resolver rule and a VPC. Resolver assigns this value when you submit an
* AssociateResolverRule request.
*
*
* @return The ID of the association between a Resolver rule and a VPC. Resolver assigns this value when you submit
* an AssociateResolverRule request.
*/
public final String id() {
return id;
}
/**
*
* The ID of the Resolver rule that you associated with the VPC that is specified by VPCId
.
*
*
* @return The ID of the Resolver rule that you associated with the VPC that is specified by VPCId
.
*/
public final String resolverRuleId() {
return resolverRuleId;
}
/**
*
* The name of an association between a Resolver rule and a VPC.
*
*
* @return The name of an association between a Resolver rule and a VPC.
*/
public final String name() {
return name;
}
/**
*
* The ID of the VPC that you associated the Resolver rule with.
*
*
* @return The ID of the VPC that you associated the Resolver rule with.
*/
public final String vpcId() {
return vpcId;
}
/**
*
* A code that specifies the current status of the association between a Resolver rule and a VPC.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ResolverRuleAssociationStatus#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 association between a Resolver rule and a VPC.
* @see ResolverRuleAssociationStatus
*/
public final ResolverRuleAssociationStatus status() {
return ResolverRuleAssociationStatus.fromValue(status);
}
/**
*
* A code that specifies the current status of the association between a Resolver rule and a VPC.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ResolverRuleAssociationStatus#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 association between a Resolver rule and a VPC.
* @see ResolverRuleAssociationStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* A detailed description of the status of the association between a Resolver rule and a VPC.
*
*
* @return A detailed description of the status of the association between a Resolver rule and a VPC.
*/
public final String statusMessage() {
return statusMessage;
}
@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(resolverRuleId());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(vpcId());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(statusMessage());
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 ResolverRuleAssociation)) {
return false;
}
ResolverRuleAssociation other = (ResolverRuleAssociation) obj;
return Objects.equals(id(), other.id()) && Objects.equals(resolverRuleId(), other.resolverRuleId())
&& Objects.equals(name(), other.name()) && Objects.equals(vpcId(), other.vpcId())
&& Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(statusMessage(), other.statusMessage());
}
/**
* 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("ResolverRuleAssociation").add("Id", id()).add("ResolverRuleId", resolverRuleId())
.add("Name", name()).add("VPCId", vpcId()).add("Status", statusAsString()).add("StatusMessage", statusMessage())
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Id":
return Optional.ofNullable(clazz.cast(id()));
case "ResolverRuleId":
return Optional.ofNullable(clazz.cast(resolverRuleId()));
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "VPCId":
return Optional.ofNullable(clazz.cast(vpcId()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "StatusMessage":
return Optional.ofNullable(clazz.cast(statusMessage()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function