All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.athena.model.AthenaError Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon Athena module holds the client classes that are used for communicating with Amazon Athena Service

There is a newer version: 2.29.16
Show newest version
/*
 * 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.athena.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;

/**
 * 

* Provides information about an Athena query error. The AthenaError feature provides standardized error * information to help you understand failed queries and take steps after a query failure occurs. * AthenaError includes an ErrorCategory field that specifies whether the cause of the failed * query is due to system error, user error, or other error. *

*/ @Generated("software.amazon.awssdk:codegen") public final class AthenaError implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField ERROR_CATEGORY_FIELD = SdkField. builder(MarshallingType.INTEGER) .memberName("ErrorCategory").getter(getter(AthenaError::errorCategory)).setter(setter(Builder::errorCategory)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ErrorCategory").build()).build(); private static final SdkField ERROR_TYPE_FIELD = SdkField. builder(MarshallingType.INTEGER) .memberName("ErrorType").getter(getter(AthenaError::errorType)).setter(setter(Builder::errorType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ErrorType").build()).build(); private static final SdkField RETRYABLE_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("Retryable").getter(getter(AthenaError::retryable)).setter(setter(Builder::retryable)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Retryable").build()).build(); private static final SdkField ERROR_MESSAGE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ErrorMessage").getter(getter(AthenaError::errorMessage)).setter(setter(Builder::errorMessage)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ErrorMessage").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ERROR_CATEGORY_FIELD, ERROR_TYPE_FIELD, RETRYABLE_FIELD, ERROR_MESSAGE_FIELD)); private static final Map> SDK_NAME_TO_FIELD = Collections .unmodifiableMap(new HashMap>() { { put("ErrorCategory", ERROR_CATEGORY_FIELD); put("ErrorType", ERROR_TYPE_FIELD); put("Retryable", RETRYABLE_FIELD); put("ErrorMessage", ERROR_MESSAGE_FIELD); } }); private static final long serialVersionUID = 1L; private final Integer errorCategory; private final Integer errorType; private final Boolean retryable; private final String errorMessage; private AthenaError(BuilderImpl builder) { this.errorCategory = builder.errorCategory; this.errorType = builder.errorType; this.retryable = builder.retryable; this.errorMessage = builder.errorMessage; } /** *

* An integer value that specifies the category of a query failure error. The following list shows the category for * each integer value. *

*

* 1 - System *

*

* 2 - User *

*

* 3 - Other *

* * @return An integer value that specifies the category of a query failure error. The following list shows the * category for each integer value.

*

* 1 - System *

*

* 2 - User *

*

* 3 - Other */ public final Integer errorCategory() { return errorCategory; } /** *

* An integer value that provides specific information about an Athena query error. For the meaning of specific * values, see the Error Type Reference in the Amazon Athena User Guide. *

* * @return An integer value that provides specific information about an Athena query error. For the meaning of * specific values, see the Error Type Reference in the Amazon Athena User Guide. */ public final Integer errorType() { return errorType; } /** *

* True if the query might succeed if resubmitted. *

* * @return True if the query might succeed if resubmitted. */ public final Boolean retryable() { return retryable; } /** *

* Contains a short description of the error that occurred. *

* * @return Contains a short description of the error that occurred. */ public final String errorMessage() { return errorMessage; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(errorCategory()); hashCode = 31 * hashCode + Objects.hashCode(errorType()); hashCode = 31 * hashCode + Objects.hashCode(retryable()); hashCode = 31 * hashCode + Objects.hashCode(errorMessage()); 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 AthenaError)) { return false; } AthenaError other = (AthenaError) obj; return Objects.equals(errorCategory(), other.errorCategory()) && Objects.equals(errorType(), other.errorType()) && Objects.equals(retryable(), other.retryable()) && Objects.equals(errorMessage(), other.errorMessage()); } /** * 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("AthenaError").add("ErrorCategory", errorCategory()).add("ErrorType", errorType()) .add("Retryable", retryable()).add("ErrorMessage", errorMessage()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "ErrorCategory": return Optional.ofNullable(clazz.cast(errorCategory())); case "ErrorType": return Optional.ofNullable(clazz.cast(errorType())); case "Retryable": return Optional.ofNullable(clazz.cast(retryable())); case "ErrorMessage": return Optional.ofNullable(clazz.cast(errorMessage())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } @Override public final Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } private static Function getter(Function g) { return obj -> g.apply((AthenaError) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* An integer value that specifies the category of a query failure error. The following list shows the category * for each integer value. *

*

* 1 - System *

*

* 2 - User *

*

* 3 - Other *

* * @param errorCategory * An integer value that specifies the category of a query failure error. The following list shows the * category for each integer value.

*

* 1 - System *

*

* 2 - User *

*

* 3 - Other * @return Returns a reference to this object so that method calls can be chained together. */ Builder errorCategory(Integer errorCategory); /** *

* An integer value that provides specific information about an Athena query error. For the meaning of specific * values, see the Error Type Reference in the Amazon Athena User Guide. *

* * @param errorType * An integer value that provides specific information about an Athena query error. For the meaning of * specific values, see the Error Type Reference in the Amazon Athena User Guide. * @return Returns a reference to this object so that method calls can be chained together. */ Builder errorType(Integer errorType); /** *

* True if the query might succeed if resubmitted. *

* * @param retryable * True if the query might succeed if resubmitted. * @return Returns a reference to this object so that method calls can be chained together. */ Builder retryable(Boolean retryable); /** *

* Contains a short description of the error that occurred. *

* * @param errorMessage * Contains a short description of the error that occurred. * @return Returns a reference to this object so that method calls can be chained together. */ Builder errorMessage(String errorMessage); } static final class BuilderImpl implements Builder { private Integer errorCategory; private Integer errorType; private Boolean retryable; private String errorMessage; private BuilderImpl() { } private BuilderImpl(AthenaError model) { errorCategory(model.errorCategory); errorType(model.errorType); retryable(model.retryable); errorMessage(model.errorMessage); } public final Integer getErrorCategory() { return errorCategory; } public final void setErrorCategory(Integer errorCategory) { this.errorCategory = errorCategory; } @Override public final Builder errorCategory(Integer errorCategory) { this.errorCategory = errorCategory; return this; } public final Integer getErrorType() { return errorType; } public final void setErrorType(Integer errorType) { this.errorType = errorType; } @Override public final Builder errorType(Integer errorType) { this.errorType = errorType; return this; } public final Boolean getRetryable() { return retryable; } public final void setRetryable(Boolean retryable) { this.retryable = retryable; } @Override public final Builder retryable(Boolean retryable) { this.retryable = retryable; return this; } public final String getErrorMessage() { return errorMessage; } public final void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; } @Override public final Builder errorMessage(String errorMessage) { this.errorMessage = errorMessage; return this; } @Override public AthenaError build() { return new AthenaError(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy