
software.amazon.awssdk.services.route53resolver.model.ResolverQueryLogConfigAssociation 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.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.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 AssociateResolverQueryLogConfig, DisassociateResolverQueryLogConfig, GetResolverQueryLogConfigAssociation, or ListResolverQueryLogConfigAssociations, request, a complex type that contains settings for a specified
* association between an Amazon VPC and a query logging configuration.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ResolverQueryLogConfigAssociation implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Id")
.getter(getter(ResolverQueryLogConfigAssociation::id)).setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Id").build()).build();
private static final SdkField RESOLVER_QUERY_LOG_CONFIG_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ResolverQueryLogConfigId").getter(getter(ResolverQueryLogConfigAssociation::resolverQueryLogConfigId))
.setter(setter(Builder::resolverQueryLogConfigId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResolverQueryLogConfigId").build())
.build();
private static final SdkField RESOURCE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ResourceId").getter(getter(ResolverQueryLogConfigAssociation::resourceId))
.setter(setter(Builder::resourceId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceId").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(ResolverQueryLogConfigAssociation::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField ERROR_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Error")
.getter(getter(ResolverQueryLogConfigAssociation::errorAsString)).setter(setter(Builder::error))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Error").build()).build();
private static final SdkField ERROR_MESSAGE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ErrorMessage").getter(getter(ResolverQueryLogConfigAssociation::errorMessage))
.setter(setter(Builder::errorMessage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ErrorMessage").build()).build();
private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CreationTime").getter(getter(ResolverQueryLogConfigAssociation::creationTime))
.setter(setter(Builder::creationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationTime").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ID_FIELD,
RESOLVER_QUERY_LOG_CONFIG_ID_FIELD, RESOURCE_ID_FIELD, STATUS_FIELD, ERROR_FIELD, ERROR_MESSAGE_FIELD,
CREATION_TIME_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private static final long serialVersionUID = 1L;
private final String id;
private final String resolverQueryLogConfigId;
private final String resourceId;
private final String status;
private final String error;
private final String errorMessage;
private final String creationTime;
private ResolverQueryLogConfigAssociation(BuilderImpl builder) {
this.id = builder.id;
this.resolverQueryLogConfigId = builder.resolverQueryLogConfigId;
this.resourceId = builder.resourceId;
this.status = builder.status;
this.error = builder.error;
this.errorMessage = builder.errorMessage;
this.creationTime = builder.creationTime;
}
/**
*
* The ID of the query logging association.
*
*
* @return The ID of the query logging association.
*/
public final String id() {
return id;
}
/**
*
* The ID of the query logging configuration that a VPC is associated with.
*
*
* @return The ID of the query logging configuration that a VPC is associated with.
*/
public final String resolverQueryLogConfigId() {
return resolverQueryLogConfigId;
}
/**
*
* The ID of the Amazon VPC that is associated with the query logging configuration.
*
*
* @return The ID of the Amazon VPC that is associated with the query logging configuration.
*/
public final String resourceId() {
return resourceId;
}
/**
*
* The status of the specified query logging association. Valid values include the following:
*
*
* -
*
* CREATING
: Resolver is creating an association between an Amazon VPC and a query logging
* configuration.
*
*
* -
*
* ACTIVE
: The association between an Amazon VPC and a query logging configuration was successfully
* created. Resolver is logging queries that originate in the specified VPC.
*
*
* -
*
* DELETING
: Resolver is deleting this query logging association.
*
*
* -
*
* FAILED
: Resolver either couldn't create or couldn't delete the query logging association.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ResolverQueryLogConfigAssociationStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the
* service is available from {@link #statusAsString}.
*
*
* @return The status of the specified query logging association. Valid values include the following:
*
* -
*
* CREATING
: Resolver is creating an association between an Amazon VPC and a query logging
* configuration.
*
*
* -
*
* ACTIVE
: The association between an Amazon VPC and a query logging configuration was
* successfully created. Resolver is logging queries that originate in the specified VPC.
*
*
* -
*
* DELETING
: Resolver is deleting this query logging association.
*
*
* -
*
* FAILED
: Resolver either couldn't create or couldn't delete the query logging association.
*
*
* @see ResolverQueryLogConfigAssociationStatus
*/
public final ResolverQueryLogConfigAssociationStatus status() {
return ResolverQueryLogConfigAssociationStatus.fromValue(status);
}
/**
*
* The status of the specified query logging association. Valid values include the following:
*
*
* -
*
* CREATING
: Resolver is creating an association between an Amazon VPC and a query logging
* configuration.
*
*
* -
*
* ACTIVE
: The association between an Amazon VPC and a query logging configuration was successfully
* created. Resolver is logging queries that originate in the specified VPC.
*
*
* -
*
* DELETING
: Resolver is deleting this query logging association.
*
*
* -
*
* FAILED
: Resolver either couldn't create or couldn't delete the query logging association.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ResolverQueryLogConfigAssociationStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the
* service is available from {@link #statusAsString}.
*
*
* @return The status of the specified query logging association. Valid values include the following:
*
* -
*
* CREATING
: Resolver is creating an association between an Amazon VPC and a query logging
* configuration.
*
*
* -
*
* ACTIVE
: The association between an Amazon VPC and a query logging configuration was
* successfully created. Resolver is logging queries that originate in the specified VPC.
*
*
* -
*
* DELETING
: Resolver is deleting this query logging association.
*
*
* -
*
* FAILED
: Resolver either couldn't create or couldn't delete the query logging association.
*
*
* @see ResolverQueryLogConfigAssociationStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* If the value of Status
is FAILED
, the value of Error
indicates the cause:
*
*
* -
*
* DESTINATION_NOT_FOUND
: The specified destination (for example, an Amazon S3 bucket) was deleted.
*
*
* -
*
* ACCESS_DENIED
: Permissions don't allow sending logs to the destination.
*
*
*
*
* If the value of Status
is a value other than FAILED
, Error
is null.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #error} will return
* {@link ResolverQueryLogConfigAssociationError#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #errorAsString}.
*
*
* @return If the value of Status
is FAILED
, the value of Error
indicates the
* cause:
*
* -
*
* DESTINATION_NOT_FOUND
: The specified destination (for example, an Amazon S3 bucket) was
* deleted.
*
*
* -
*
* ACCESS_DENIED
: Permissions don't allow sending logs to the destination.
*
*
*
*
* If the value of Status
is a value other than FAILED
, Error
is
* null.
* @see ResolverQueryLogConfigAssociationError
*/
public final ResolverQueryLogConfigAssociationError error() {
return ResolverQueryLogConfigAssociationError.fromValue(error);
}
/**
*
* If the value of Status
is FAILED
, the value of Error
indicates the cause:
*
*
* -
*
* DESTINATION_NOT_FOUND
: The specified destination (for example, an Amazon S3 bucket) was deleted.
*
*
* -
*
* ACCESS_DENIED
: Permissions don't allow sending logs to the destination.
*
*
*
*
* If the value of Status
is a value other than FAILED
, Error
is null.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #error} will return
* {@link ResolverQueryLogConfigAssociationError#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #errorAsString}.
*
*
* @return If the value of Status
is FAILED
, the value of Error
indicates the
* cause:
*
* -
*
* DESTINATION_NOT_FOUND
: The specified destination (for example, an Amazon S3 bucket) was
* deleted.
*
*
* -
*
* ACCESS_DENIED
: Permissions don't allow sending logs to the destination.
*
*
*
*
* If the value of Status
is a value other than FAILED
, Error
is
* null.
* @see ResolverQueryLogConfigAssociationError
*/
public final String errorAsString() {
return error;
}
/**
*
* Contains additional information about the error. If the value or Error
is null, the value of
* ErrorMessage
also is null.
*
*
* @return Contains additional information about the error. If the value or Error
is null, the value of
* ErrorMessage
also is null.
*/
public final String errorMessage() {
return errorMessage;
}
/**
*
* The date and time that the VPC was associated with the query logging configuration, in Unix time format and
* Coordinated Universal Time (UTC).
*
*
* @return The date and time that the VPC was associated with the query logging configuration, in Unix time format
* and Coordinated Universal Time (UTC).
*/
public final String creationTime() {
return creationTime;
}
@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(resolverQueryLogConfigId());
hashCode = 31 * hashCode + Objects.hashCode(resourceId());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(errorAsString());
hashCode = 31 * hashCode + Objects.hashCode(errorMessage());
hashCode = 31 * hashCode + Objects.hashCode(creationTime());
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 ResolverQueryLogConfigAssociation)) {
return false;
}
ResolverQueryLogConfigAssociation other = (ResolverQueryLogConfigAssociation) obj;
return Objects.equals(id(), other.id()) && Objects.equals(resolverQueryLogConfigId(), other.resolverQueryLogConfigId())
&& Objects.equals(resourceId(), other.resourceId()) && Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(errorAsString(), other.errorAsString()) && Objects.equals(errorMessage(), other.errorMessage())
&& Objects.equals(creationTime(), other.creationTime());
}
/**
* 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("ResolverQueryLogConfigAssociation").add("Id", id())
.add("ResolverQueryLogConfigId", resolverQueryLogConfigId()).add("ResourceId", resourceId())
.add("Status", statusAsString()).add("Error", errorAsString()).add("ErrorMessage", errorMessage())
.add("CreationTime", creationTime()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Id":
return Optional.ofNullable(clazz.cast(id()));
case "ResolverQueryLogConfigId":
return Optional.ofNullable(clazz.cast(resolverQueryLogConfigId()));
case "ResourceId":
return Optional.ofNullable(clazz.cast(resourceId()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "Error":
return Optional.ofNullable(clazz.cast(errorAsString()));
case "ErrorMessage":
return Optional.ofNullable(clazz.cast(errorMessage()));
case "CreationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Map> memberNameToFieldInitializer() {
Map> map = new HashMap<>();
map.put("Id", ID_FIELD);
map.put("ResolverQueryLogConfigId", RESOLVER_QUERY_LOG_CONFIG_ID_FIELD);
map.put("ResourceId", RESOURCE_ID_FIELD);
map.put("Status", STATUS_FIELD);
map.put("Error", ERROR_FIELD);
map.put("ErrorMessage", ERROR_MESSAGE_FIELD);
map.put("CreationTime", CREATION_TIME_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function