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

software.amazon.awssdk.services.athena.model.QueryExecutionStatus 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.28.4
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.beans.Transient;
import java.io.Serializable;
import java.time.Instant;
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.Consumer;
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;

/**
 * 

* The completion date, current state, submission time, and state change reason (if applicable) for the query execution. *

*/ @Generated("software.amazon.awssdk:codegen") public final class QueryExecutionStatus implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("State") .getter(getter(QueryExecutionStatus::stateAsString)).setter(setter(Builder::state)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State").build()).build(); private static final SdkField STATE_CHANGE_REASON_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("StateChangeReason").getter(getter(QueryExecutionStatus::stateChangeReason)) .setter(setter(Builder::stateChangeReason)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StateChangeReason").build()).build(); private static final SdkField SUBMISSION_DATE_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("SubmissionDateTime").getter(getter(QueryExecutionStatus::submissionDateTime)) .setter(setter(Builder::submissionDateTime)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SubmissionDateTime").build()) .build(); private static final SdkField COMPLETION_DATE_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("CompletionDateTime").getter(getter(QueryExecutionStatus::completionDateTime)) .setter(setter(Builder::completionDateTime)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CompletionDateTime").build()) .build(); private static final SdkField ATHENA_ERROR_FIELD = SdkField. builder(MarshallingType.SDK_POJO) .memberName("AthenaError").getter(getter(QueryExecutionStatus::athenaError)).setter(setter(Builder::athenaError)) .constructor(AthenaError::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AthenaError").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(STATE_FIELD, STATE_CHANGE_REASON_FIELD, SUBMISSION_DATE_TIME_FIELD, COMPLETION_DATE_TIME_FIELD, ATHENA_ERROR_FIELD)); private static final long serialVersionUID = 1L; private final String state; private final String stateChangeReason; private final Instant submissionDateTime; private final Instant completionDateTime; private final AthenaError athenaError; private QueryExecutionStatus(BuilderImpl builder) { this.state = builder.state; this.stateChangeReason = builder.stateChangeReason; this.submissionDateTime = builder.submissionDateTime; this.completionDateTime = builder.completionDateTime; this.athenaError = builder.athenaError; } /** *

* The state of query execution. QUEUED indicates that the query has been submitted to the service, and * Athena will execute the query as soon as resources are available. RUNNING indicates that the query * is in execution phase. SUCCEEDED indicates that the query completed without errors. * FAILED indicates that the query experienced an error and did not complete processing. * CANCELLED indicates that a user input interrupted query execution. *

* *

* Athena automatically retries your queries in cases of certain transient errors. As a result, you may see the * query state transition from RUNNING or FAILED to QUEUED. *

*
*

* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return * {@link QueryExecutionState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #stateAsString}. *

* * @return The state of query execution. QUEUED indicates that the query has been submitted to the * service, and Athena will execute the query as soon as resources are available. RUNNING * indicates that the query is in execution phase. SUCCEEDED indicates that the query completed * without errors. FAILED indicates that the query experienced an error and did not complete * processing. CANCELLED indicates that a user input interrupted query execution.

*

* Athena automatically retries your queries in cases of certain transient errors. As a result, you may see * the query state transition from RUNNING or FAILED to QUEUED. *

* @see QueryExecutionState */ public final QueryExecutionState state() { return QueryExecutionState.fromValue(state); } /** *

* The state of query execution. QUEUED indicates that the query has been submitted to the service, and * Athena will execute the query as soon as resources are available. RUNNING indicates that the query * is in execution phase. SUCCEEDED indicates that the query completed without errors. * FAILED indicates that the query experienced an error and did not complete processing. * CANCELLED indicates that a user input interrupted query execution. *

* *

* Athena automatically retries your queries in cases of certain transient errors. As a result, you may see the * query state transition from RUNNING or FAILED to QUEUED. *

*
*

* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return * {@link QueryExecutionState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #stateAsString}. *

* * @return The state of query execution. QUEUED indicates that the query has been submitted to the * service, and Athena will execute the query as soon as resources are available. RUNNING * indicates that the query is in execution phase. SUCCEEDED indicates that the query completed * without errors. FAILED indicates that the query experienced an error and did not complete * processing. CANCELLED indicates that a user input interrupted query execution.

*

* Athena automatically retries your queries in cases of certain transient errors. As a result, you may see * the query state transition from RUNNING or FAILED to QUEUED. *

* @see QueryExecutionState */ public final String stateAsString() { return state; } /** *

* Further detail about the status of the query. *

* * @return Further detail about the status of the query. */ public final String stateChangeReason() { return stateChangeReason; } /** *

* The date and time that the query was submitted. *

* * @return The date and time that the query was submitted. */ public final Instant submissionDateTime() { return submissionDateTime; } /** *

* The date and time that the query completed. *

* * @return The date and time that the query completed. */ public final Instant completionDateTime() { return completionDateTime; } /** *

* Provides information about an Athena query error. *

* * @return Provides information about an Athena query error. */ public final AthenaError athenaError() { return athenaError; } @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(stateAsString()); hashCode = 31 * hashCode + Objects.hashCode(stateChangeReason()); hashCode = 31 * hashCode + Objects.hashCode(submissionDateTime()); hashCode = 31 * hashCode + Objects.hashCode(completionDateTime()); hashCode = 31 * hashCode + Objects.hashCode(athenaError()); 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 QueryExecutionStatus)) { return false; } QueryExecutionStatus other = (QueryExecutionStatus) obj; return Objects.equals(stateAsString(), other.stateAsString()) && Objects.equals(stateChangeReason(), other.stateChangeReason()) && Objects.equals(submissionDateTime(), other.submissionDateTime()) && Objects.equals(completionDateTime(), other.completionDateTime()) && Objects.equals(athenaError(), other.athenaError()); } /** * 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("QueryExecutionStatus").add("State", stateAsString()) .add("StateChangeReason", stateChangeReason()).add("SubmissionDateTime", submissionDateTime()) .add("CompletionDateTime", completionDateTime()).add("AthenaError", athenaError()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "State": return Optional.ofNullable(clazz.cast(stateAsString())); case "StateChangeReason": return Optional.ofNullable(clazz.cast(stateChangeReason())); case "SubmissionDateTime": return Optional.ofNullable(clazz.cast(submissionDateTime())); case "CompletionDateTime": return Optional.ofNullable(clazz.cast(completionDateTime())); case "AthenaError": return Optional.ofNullable(clazz.cast(athenaError())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((QueryExecutionStatus) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The state of query execution. QUEUED indicates that the query has been submitted to the service, * and Athena will execute the query as soon as resources are available. RUNNING indicates that the * query is in execution phase. SUCCEEDED indicates that the query completed without errors. * FAILED indicates that the query experienced an error and did not complete processing. * CANCELLED indicates that a user input interrupted query execution. *

* *

* Athena automatically retries your queries in cases of certain transient errors. As a result, you may see the * query state transition from RUNNING or FAILED to QUEUED. *

*
* * @param state * The state of query execution. QUEUED indicates that the query has been submitted to the * service, and Athena will execute the query as soon as resources are available. RUNNING * indicates that the query is in execution phase. SUCCEEDED indicates that the query * completed without errors. FAILED indicates that the query experienced an error and did * not complete processing. CANCELLED indicates that a user input interrupted query * execution.

*

* Athena automatically retries your queries in cases of certain transient errors. As a result, you may * see the query state transition from RUNNING or FAILED to QUEUED * . *

* @see QueryExecutionState * @return Returns a reference to this object so that method calls can be chained together. * @see QueryExecutionState */ Builder state(String state); /** *

* The state of query execution. QUEUED indicates that the query has been submitted to the service, * and Athena will execute the query as soon as resources are available. RUNNING indicates that the * query is in execution phase. SUCCEEDED indicates that the query completed without errors. * FAILED indicates that the query experienced an error and did not complete processing. * CANCELLED indicates that a user input interrupted query execution. *

* *

* Athena automatically retries your queries in cases of certain transient errors. As a result, you may see the * query state transition from RUNNING or FAILED to QUEUED. *

*
* * @param state * The state of query execution. QUEUED indicates that the query has been submitted to the * service, and Athena will execute the query as soon as resources are available. RUNNING * indicates that the query is in execution phase. SUCCEEDED indicates that the query * completed without errors. FAILED indicates that the query experienced an error and did * not complete processing. CANCELLED indicates that a user input interrupted query * execution.

*

* Athena automatically retries your queries in cases of certain transient errors. As a result, you may * see the query state transition from RUNNING or FAILED to QUEUED * . *

* @see QueryExecutionState * @return Returns a reference to this object so that method calls can be chained together. * @see QueryExecutionState */ Builder state(QueryExecutionState state); /** *

* Further detail about the status of the query. *

* * @param stateChangeReason * Further detail about the status of the query. * @return Returns a reference to this object so that method calls can be chained together. */ Builder stateChangeReason(String stateChangeReason); /** *

* The date and time that the query was submitted. *

* * @param submissionDateTime * The date and time that the query was submitted. * @return Returns a reference to this object so that method calls can be chained together. */ Builder submissionDateTime(Instant submissionDateTime); /** *

* The date and time that the query completed. *

* * @param completionDateTime * The date and time that the query completed. * @return Returns a reference to this object so that method calls can be chained together. */ Builder completionDateTime(Instant completionDateTime); /** *

* Provides information about an Athena query error. *

* * @param athenaError * Provides information about an Athena query error. * @return Returns a reference to this object so that method calls can be chained together. */ Builder athenaError(AthenaError athenaError); /** *

* Provides information about an Athena query error. *

* This is a convenience that creates an instance of the {@link AthenaError.Builder} avoiding the need to create * one manually via {@link AthenaError#builder()}. * * When the {@link Consumer} completes, {@link AthenaError.Builder#build()} is called immediately and its result * is passed to {@link #athenaError(AthenaError)}. * * @param athenaError * a consumer that will call methods on {@link AthenaError.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #athenaError(AthenaError) */ default Builder athenaError(Consumer athenaError) { return athenaError(AthenaError.builder().applyMutation(athenaError).build()); } } static final class BuilderImpl implements Builder { private String state; private String stateChangeReason; private Instant submissionDateTime; private Instant completionDateTime; private AthenaError athenaError; private BuilderImpl() { } private BuilderImpl(QueryExecutionStatus model) { state(model.state); stateChangeReason(model.stateChangeReason); submissionDateTime(model.submissionDateTime); completionDateTime(model.completionDateTime); athenaError(model.athenaError); } public final String getState() { return state; } public final void setState(String state) { this.state = state; } @Override @Transient public final Builder state(String state) { this.state = state; return this; } @Override @Transient public final Builder state(QueryExecutionState state) { this.state(state == null ? null : state.toString()); return this; } public final String getStateChangeReason() { return stateChangeReason; } public final void setStateChangeReason(String stateChangeReason) { this.stateChangeReason = stateChangeReason; } @Override @Transient public final Builder stateChangeReason(String stateChangeReason) { this.stateChangeReason = stateChangeReason; return this; } public final Instant getSubmissionDateTime() { return submissionDateTime; } public final void setSubmissionDateTime(Instant submissionDateTime) { this.submissionDateTime = submissionDateTime; } @Override @Transient public final Builder submissionDateTime(Instant submissionDateTime) { this.submissionDateTime = submissionDateTime; return this; } public final Instant getCompletionDateTime() { return completionDateTime; } public final void setCompletionDateTime(Instant completionDateTime) { this.completionDateTime = completionDateTime; } @Override @Transient public final Builder completionDateTime(Instant completionDateTime) { this.completionDateTime = completionDateTime; return this; } public final AthenaError.Builder getAthenaError() { return athenaError != null ? athenaError.toBuilder() : null; } public final void setAthenaError(AthenaError.BuilderImpl athenaError) { this.athenaError = athenaError != null ? athenaError.build() : null; } @Override @Transient public final Builder athenaError(AthenaError athenaError) { this.athenaError = athenaError; return this; } @Override public QueryExecutionStatus build() { return new QueryExecutionStatus(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy