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

software.amazon.awssdk.services.timestreamquery.model.ScheduledQueryRunSummary 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.timestreamquery.model;

import java.io.Serializable;
import java.time.Instant;
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.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;

/**
 * 

* Run summary for the scheduled query *

*/ @Generated("software.amazon.awssdk:codegen") public final class ScheduledQueryRunSummary implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField INVOCATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("InvocationTime").getter(getter(ScheduledQueryRunSummary::invocationTime)) .setter(setter(Builder::invocationTime)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InvocationTime").build()).build(); private static final SdkField TRIGGER_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("TriggerTime").getter(getter(ScheduledQueryRunSummary::triggerTime)).setter(setter(Builder::triggerTime)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TriggerTime").build()).build(); private static final SdkField RUN_STATUS_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("RunStatus").getter(getter(ScheduledQueryRunSummary::runStatusAsString)) .setter(setter(Builder::runStatus)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RunStatus").build()).build(); private static final SdkField EXECUTION_STATS_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("ExecutionStats") .getter(getter(ScheduledQueryRunSummary::executionStats)).setter(setter(Builder::executionStats)) .constructor(ExecutionStats::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExecutionStats").build()).build(); private static final SdkField QUERY_INSIGHTS_RESPONSE_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("QueryInsightsResponse") .getter(getter(ScheduledQueryRunSummary::queryInsightsResponse)).setter(setter(Builder::queryInsightsResponse)) .constructor(ScheduledQueryInsightsResponse::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("QueryInsightsResponse").build()) .build(); private static final SdkField ERROR_REPORT_LOCATION_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("ErrorReportLocation") .getter(getter(ScheduledQueryRunSummary::errorReportLocation)).setter(setter(Builder::errorReportLocation)) .constructor(ErrorReportLocation::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ErrorReportLocation").build()) .build(); private static final SdkField FAILURE_REASON_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("FailureReason").getter(getter(ScheduledQueryRunSummary::failureReason)) .setter(setter(Builder::failureReason)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FailureReason").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(INVOCATION_TIME_FIELD, TRIGGER_TIME_FIELD, RUN_STATUS_FIELD, EXECUTION_STATS_FIELD, QUERY_INSIGHTS_RESPONSE_FIELD, ERROR_REPORT_LOCATION_FIELD, FAILURE_REASON_FIELD)); private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer(); private static final long serialVersionUID = 1L; private final Instant invocationTime; private final Instant triggerTime; private final String runStatus; private final ExecutionStats executionStats; private final ScheduledQueryInsightsResponse queryInsightsResponse; private final ErrorReportLocation errorReportLocation; private final String failureReason; private ScheduledQueryRunSummary(BuilderImpl builder) { this.invocationTime = builder.invocationTime; this.triggerTime = builder.triggerTime; this.runStatus = builder.runStatus; this.executionStats = builder.executionStats; this.queryInsightsResponse = builder.queryInsightsResponse; this.errorReportLocation = builder.errorReportLocation; this.failureReason = builder.failureReason; } /** *

* InvocationTime for this run. This is the time at which the query is scheduled to run. Parameter * @scheduled_runtime can be used in the query to get the value. *

* * @return InvocationTime for this run. This is the time at which the query is scheduled to run. Parameter * @scheduled_runtime can be used in the query to get the value. */ public final Instant invocationTime() { return invocationTime; } /** *

* The actual time when the query was run. *

* * @return The actual time when the query was run. */ public final Instant triggerTime() { return triggerTime; } /** *

* The status of a scheduled query run. *

*

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

* * @return The status of a scheduled query run. * @see ScheduledQueryRunStatus */ public final ScheduledQueryRunStatus runStatus() { return ScheduledQueryRunStatus.fromValue(runStatus); } /** *

* The status of a scheduled query run. *

*

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

* * @return The status of a scheduled query run. * @see ScheduledQueryRunStatus */ public final String runStatusAsString() { return runStatus; } /** *

* Runtime statistics for a scheduled run. *

* * @return Runtime statistics for a scheduled run. */ public final ExecutionStats executionStats() { return executionStats; } /** *

* Provides various insights and metrics related to the run summary of the scheduled query. *

* * @return Provides various insights and metrics related to the run summary of the scheduled query. */ public final ScheduledQueryInsightsResponse queryInsightsResponse() { return queryInsightsResponse; } /** *

* S3 location for error report. *

* * @return S3 location for error report. */ public final ErrorReportLocation errorReportLocation() { return errorReportLocation; } /** *

* Error message for the scheduled query in case of failure. You might have to look at the error report to get more * detailed error reasons. *

* * @return Error message for the scheduled query in case of failure. You might have to look at the error report to * get more detailed error reasons. */ public final String failureReason() { return failureReason; } @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(invocationTime()); hashCode = 31 * hashCode + Objects.hashCode(triggerTime()); hashCode = 31 * hashCode + Objects.hashCode(runStatusAsString()); hashCode = 31 * hashCode + Objects.hashCode(executionStats()); hashCode = 31 * hashCode + Objects.hashCode(queryInsightsResponse()); hashCode = 31 * hashCode + Objects.hashCode(errorReportLocation()); hashCode = 31 * hashCode + Objects.hashCode(failureReason()); 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 ScheduledQueryRunSummary)) { return false; } ScheduledQueryRunSummary other = (ScheduledQueryRunSummary) obj; return Objects.equals(invocationTime(), other.invocationTime()) && Objects.equals(triggerTime(), other.triggerTime()) && Objects.equals(runStatusAsString(), other.runStatusAsString()) && Objects.equals(executionStats(), other.executionStats()) && Objects.equals(queryInsightsResponse(), other.queryInsightsResponse()) && Objects.equals(errorReportLocation(), other.errorReportLocation()) && Objects.equals(failureReason(), other.failureReason()); } /** * 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("ScheduledQueryRunSummary").add("InvocationTime", invocationTime()) .add("TriggerTime", triggerTime()).add("RunStatus", runStatusAsString()).add("ExecutionStats", executionStats()) .add("QueryInsightsResponse", queryInsightsResponse()).add("ErrorReportLocation", errorReportLocation()) .add("FailureReason", failureReason()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "InvocationTime": return Optional.ofNullable(clazz.cast(invocationTime())); case "TriggerTime": return Optional.ofNullable(clazz.cast(triggerTime())); case "RunStatus": return Optional.ofNullable(clazz.cast(runStatusAsString())); case "ExecutionStats": return Optional.ofNullable(clazz.cast(executionStats())); case "QueryInsightsResponse": return Optional.ofNullable(clazz.cast(queryInsightsResponse())); case "ErrorReportLocation": return Optional.ofNullable(clazz.cast(errorReportLocation())); case "FailureReason": return Optional.ofNullable(clazz.cast(failureReason())); 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("InvocationTime", INVOCATION_TIME_FIELD); map.put("TriggerTime", TRIGGER_TIME_FIELD); map.put("RunStatus", RUN_STATUS_FIELD); map.put("ExecutionStats", EXECUTION_STATS_FIELD); map.put("QueryInsightsResponse", QUERY_INSIGHTS_RESPONSE_FIELD); map.put("ErrorReportLocation", ERROR_REPORT_LOCATION_FIELD); map.put("FailureReason", FAILURE_REASON_FIELD); return Collections.unmodifiableMap(map); } private static Function getter(Function g) { return obj -> g.apply((ScheduledQueryRunSummary) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* InvocationTime for this run. This is the time at which the query is scheduled to run. Parameter * @scheduled_runtime can be used in the query to get the value. *

* * @param invocationTime * InvocationTime for this run. This is the time at which the query is scheduled to run. Parameter * @scheduled_runtime can be used in the query to get the value. * @return Returns a reference to this object so that method calls can be chained together. */ Builder invocationTime(Instant invocationTime); /** *

* The actual time when the query was run. *

* * @param triggerTime * The actual time when the query was run. * @return Returns a reference to this object so that method calls can be chained together. */ Builder triggerTime(Instant triggerTime); /** *

* The status of a scheduled query run. *

* * @param runStatus * The status of a scheduled query run. * @see ScheduledQueryRunStatus * @return Returns a reference to this object so that method calls can be chained together. * @see ScheduledQueryRunStatus */ Builder runStatus(String runStatus); /** *

* The status of a scheduled query run. *

* * @param runStatus * The status of a scheduled query run. * @see ScheduledQueryRunStatus * @return Returns a reference to this object so that method calls can be chained together. * @see ScheduledQueryRunStatus */ Builder runStatus(ScheduledQueryRunStatus runStatus); /** *

* Runtime statistics for a scheduled run. *

* * @param executionStats * Runtime statistics for a scheduled run. * @return Returns a reference to this object so that method calls can be chained together. */ Builder executionStats(ExecutionStats executionStats); /** *

* Runtime statistics for a scheduled run. *

* This is a convenience method that creates an instance of the {@link ExecutionStats.Builder} avoiding the need * to create one manually via {@link ExecutionStats#builder()}. * *

* When the {@link Consumer} completes, {@link ExecutionStats.Builder#build()} is called immediately and its * result is passed to {@link #executionStats(ExecutionStats)}. * * @param executionStats * a consumer that will call methods on {@link ExecutionStats.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #executionStats(ExecutionStats) */ default Builder executionStats(Consumer executionStats) { return executionStats(ExecutionStats.builder().applyMutation(executionStats).build()); } /** *

* Provides various insights and metrics related to the run summary of the scheduled query. *

* * @param queryInsightsResponse * Provides various insights and metrics related to the run summary of the scheduled query. * @return Returns a reference to this object so that method calls can be chained together. */ Builder queryInsightsResponse(ScheduledQueryInsightsResponse queryInsightsResponse); /** *

* Provides various insights and metrics related to the run summary of the scheduled query. *

* This is a convenience method that creates an instance of the {@link ScheduledQueryInsightsResponse.Builder} * avoiding the need to create one manually via {@link ScheduledQueryInsightsResponse#builder()}. * *

* When the {@link Consumer} completes, {@link ScheduledQueryInsightsResponse.Builder#build()} is called * immediately and its result is passed to {@link #queryInsightsResponse(ScheduledQueryInsightsResponse)}. * * @param queryInsightsResponse * a consumer that will call methods on {@link ScheduledQueryInsightsResponse.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #queryInsightsResponse(ScheduledQueryInsightsResponse) */ default Builder queryInsightsResponse(Consumer queryInsightsResponse) { return queryInsightsResponse(ScheduledQueryInsightsResponse.builder().applyMutation(queryInsightsResponse).build()); } /** *

* S3 location for error report. *

* * @param errorReportLocation * S3 location for error report. * @return Returns a reference to this object so that method calls can be chained together. */ Builder errorReportLocation(ErrorReportLocation errorReportLocation); /** *

* S3 location for error report. *

* This is a convenience method that creates an instance of the {@link ErrorReportLocation.Builder} avoiding the * need to create one manually via {@link ErrorReportLocation#builder()}. * *

* When the {@link Consumer} completes, {@link ErrorReportLocation.Builder#build()} is called immediately and * its result is passed to {@link #errorReportLocation(ErrorReportLocation)}. * * @param errorReportLocation * a consumer that will call methods on {@link ErrorReportLocation.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #errorReportLocation(ErrorReportLocation) */ default Builder errorReportLocation(Consumer errorReportLocation) { return errorReportLocation(ErrorReportLocation.builder().applyMutation(errorReportLocation).build()); } /** *

* Error message for the scheduled query in case of failure. You might have to look at the error report to get * more detailed error reasons. *

* * @param failureReason * Error message for the scheduled query in case of failure. You might have to look at the error report * to get more detailed error reasons. * @return Returns a reference to this object so that method calls can be chained together. */ Builder failureReason(String failureReason); } static final class BuilderImpl implements Builder { private Instant invocationTime; private Instant triggerTime; private String runStatus; private ExecutionStats executionStats; private ScheduledQueryInsightsResponse queryInsightsResponse; private ErrorReportLocation errorReportLocation; private String failureReason; private BuilderImpl() { } private BuilderImpl(ScheduledQueryRunSummary model) { invocationTime(model.invocationTime); triggerTime(model.triggerTime); runStatus(model.runStatus); executionStats(model.executionStats); queryInsightsResponse(model.queryInsightsResponse); errorReportLocation(model.errorReportLocation); failureReason(model.failureReason); } public final Instant getInvocationTime() { return invocationTime; } public final void setInvocationTime(Instant invocationTime) { this.invocationTime = invocationTime; } @Override public final Builder invocationTime(Instant invocationTime) { this.invocationTime = invocationTime; return this; } public final Instant getTriggerTime() { return triggerTime; } public final void setTriggerTime(Instant triggerTime) { this.triggerTime = triggerTime; } @Override public final Builder triggerTime(Instant triggerTime) { this.triggerTime = triggerTime; return this; } public final String getRunStatus() { return runStatus; } public final void setRunStatus(String runStatus) { this.runStatus = runStatus; } @Override public final Builder runStatus(String runStatus) { this.runStatus = runStatus; return this; } @Override public final Builder runStatus(ScheduledQueryRunStatus runStatus) { this.runStatus(runStatus == null ? null : runStatus.toString()); return this; } public final ExecutionStats.Builder getExecutionStats() { return executionStats != null ? executionStats.toBuilder() : null; } public final void setExecutionStats(ExecutionStats.BuilderImpl executionStats) { this.executionStats = executionStats != null ? executionStats.build() : null; } @Override public final Builder executionStats(ExecutionStats executionStats) { this.executionStats = executionStats; return this; } public final ScheduledQueryInsightsResponse.Builder getQueryInsightsResponse() { return queryInsightsResponse != null ? queryInsightsResponse.toBuilder() : null; } public final void setQueryInsightsResponse(ScheduledQueryInsightsResponse.BuilderImpl queryInsightsResponse) { this.queryInsightsResponse = queryInsightsResponse != null ? queryInsightsResponse.build() : null; } @Override public final Builder queryInsightsResponse(ScheduledQueryInsightsResponse queryInsightsResponse) { this.queryInsightsResponse = queryInsightsResponse; return this; } public final ErrorReportLocation.Builder getErrorReportLocation() { return errorReportLocation != null ? errorReportLocation.toBuilder() : null; } public final void setErrorReportLocation(ErrorReportLocation.BuilderImpl errorReportLocation) { this.errorReportLocation = errorReportLocation != null ? errorReportLocation.build() : null; } @Override public final Builder errorReportLocation(ErrorReportLocation errorReportLocation) { this.errorReportLocation = errorReportLocation; return this; } public final String getFailureReason() { return failureReason; } public final void setFailureReason(String failureReason) { this.failureReason = failureReason; } @Override public final Builder failureReason(String failureReason) { this.failureReason = failureReason; return this; } @Override public ScheduledQueryRunSummary build() { return new ScheduledQueryRunSummary(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy