software.amazon.awssdk.services.timestreamquery.model.ScheduledQuery Maven / Gradle / Ivy
Show all versions of timestreamquery Show documentation
/*
* 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.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;
/**
*
* Scheduled Query
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ScheduledQuery implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Arn")
.getter(getter(ScheduledQuery::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Arn").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name")
.getter(getter(ScheduledQuery::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();
private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreationTime").getter(getter(ScheduledQuery::creationTime)).setter(setter(Builder::creationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationTime").build()).build();
private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("State")
.getter(getter(ScheduledQuery::stateAsString)).setter(setter(Builder::state))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State").build()).build();
private static final SdkField PREVIOUS_INVOCATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("PreviousInvocationTime").getter(getter(ScheduledQuery::previousInvocationTime))
.setter(setter(Builder::previousInvocationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PreviousInvocationTime").build())
.build();
private static final SdkField NEXT_INVOCATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("NextInvocationTime").getter(getter(ScheduledQuery::nextInvocationTime))
.setter(setter(Builder::nextInvocationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NextInvocationTime").build())
.build();
private static final SdkField ERROR_REPORT_CONFIGURATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ErrorReportConfiguration")
.getter(getter(ScheduledQuery::errorReportConfiguration)).setter(setter(Builder::errorReportConfiguration))
.constructor(ErrorReportConfiguration::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ErrorReportConfiguration").build())
.build();
private static final SdkField TARGET_DESTINATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("TargetDestination")
.getter(getter(ScheduledQuery::targetDestination)).setter(setter(Builder::targetDestination))
.constructor(TargetDestination::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TargetDestination").build()).build();
private static final SdkField LAST_RUN_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("LastRunStatus").getter(getter(ScheduledQuery::lastRunStatusAsString))
.setter(setter(Builder::lastRunStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastRunStatus").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD, NAME_FIELD,
CREATION_TIME_FIELD, STATE_FIELD, PREVIOUS_INVOCATION_TIME_FIELD, NEXT_INVOCATION_TIME_FIELD,
ERROR_REPORT_CONFIGURATION_FIELD, TARGET_DESTINATION_FIELD, LAST_RUN_STATUS_FIELD));
private static final long serialVersionUID = 1L;
private final String arn;
private final String name;
private final Instant creationTime;
private final String state;
private final Instant previousInvocationTime;
private final Instant nextInvocationTime;
private final ErrorReportConfiguration errorReportConfiguration;
private final TargetDestination targetDestination;
private final String lastRunStatus;
private ScheduledQuery(BuilderImpl builder) {
this.arn = builder.arn;
this.name = builder.name;
this.creationTime = builder.creationTime;
this.state = builder.state;
this.previousInvocationTime = builder.previousInvocationTime;
this.nextInvocationTime = builder.nextInvocationTime;
this.errorReportConfiguration = builder.errorReportConfiguration;
this.targetDestination = builder.targetDestination;
this.lastRunStatus = builder.lastRunStatus;
}
/**
*
* The Amazon Resource Name.
*
*
* @return The Amazon Resource Name.
*/
public final String arn() {
return arn;
}
/**
*
* The name of the scheduled query.
*
*
* @return The name of the scheduled query.
*/
public final String name() {
return name;
}
/**
*
* The creation time of the scheduled query.
*
*
* @return The creation time of the scheduled query.
*/
public final Instant creationTime() {
return creationTime;
}
/**
*
* State of scheduled query.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link ScheduledQueryState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return State of scheduled query.
* @see ScheduledQueryState
*/
public final ScheduledQueryState state() {
return ScheduledQueryState.fromValue(state);
}
/**
*
* State of scheduled query.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link ScheduledQueryState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return State of scheduled query.
* @see ScheduledQueryState
*/
public final String stateAsString() {
return state;
}
/**
*
* The last time the scheduled query was run.
*
*
* @return The last time the scheduled query was run.
*/
public final Instant previousInvocationTime() {
return previousInvocationTime;
}
/**
*
* The next time the scheduled query is to be run.
*
*
* @return The next time the scheduled query is to be run.
*/
public final Instant nextInvocationTime() {
return nextInvocationTime;
}
/**
*
* Configuration for scheduled query error reporting.
*
*
* @return Configuration for scheduled query error reporting.
*/
public final ErrorReportConfiguration errorReportConfiguration() {
return errorReportConfiguration;
}
/**
*
* Target data source where final scheduled query result will be written.
*
*
* @return Target data source where final scheduled query result will be written.
*/
public final TargetDestination targetDestination() {
return targetDestination;
}
/**
*
* Status of the last scheduled query run.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #lastRunStatus}
* will return {@link ScheduledQueryRunStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #lastRunStatusAsString}.
*
*
* @return Status of the last scheduled query run.
* @see ScheduledQueryRunStatus
*/
public final ScheduledQueryRunStatus lastRunStatus() {
return ScheduledQueryRunStatus.fromValue(lastRunStatus);
}
/**
*
* Status of the last scheduled query run.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #lastRunStatus}
* will return {@link ScheduledQueryRunStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #lastRunStatusAsString}.
*
*
* @return Status of the last scheduled query run.
* @see ScheduledQueryRunStatus
*/
public final String lastRunStatusAsString() {
return lastRunStatus;
}
@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(arn());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(stateAsString());
hashCode = 31 * hashCode + Objects.hashCode(previousInvocationTime());
hashCode = 31 * hashCode + Objects.hashCode(nextInvocationTime());
hashCode = 31 * hashCode + Objects.hashCode(errorReportConfiguration());
hashCode = 31 * hashCode + Objects.hashCode(targetDestination());
hashCode = 31 * hashCode + Objects.hashCode(lastRunStatusAsString());
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 ScheduledQuery)) {
return false;
}
ScheduledQuery other = (ScheduledQuery) obj;
return Objects.equals(arn(), other.arn()) && Objects.equals(name(), other.name())
&& Objects.equals(creationTime(), other.creationTime()) && Objects.equals(stateAsString(), other.stateAsString())
&& Objects.equals(previousInvocationTime(), other.previousInvocationTime())
&& Objects.equals(nextInvocationTime(), other.nextInvocationTime())
&& Objects.equals(errorReportConfiguration(), other.errorReportConfiguration())
&& Objects.equals(targetDestination(), other.targetDestination())
&& Objects.equals(lastRunStatusAsString(), other.lastRunStatusAsString());
}
/**
* 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("ScheduledQuery").add("Arn", arn()).add("Name", name()).add("CreationTime", creationTime())
.add("State", stateAsString()).add("PreviousInvocationTime", previousInvocationTime())
.add("NextInvocationTime", nextInvocationTime()).add("ErrorReportConfiguration", errorReportConfiguration())
.add("TargetDestination", targetDestination()).add("LastRunStatus", lastRunStatusAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Arn":
return Optional.ofNullable(clazz.cast(arn()));
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "CreationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "State":
return Optional.ofNullable(clazz.cast(stateAsString()));
case "PreviousInvocationTime":
return Optional.ofNullable(clazz.cast(previousInvocationTime()));
case "NextInvocationTime":
return Optional.ofNullable(clazz.cast(nextInvocationTime()));
case "ErrorReportConfiguration":
return Optional.ofNullable(clazz.cast(errorReportConfiguration()));
case "TargetDestination":
return Optional.ofNullable(clazz.cast(targetDestination()));
case "LastRunStatus":
return Optional.ofNullable(clazz.cast(lastRunStatusAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function