
software.amazon.awssdk.services.timestreamwrite.model.BatchLoadTaskDescription Maven / Gradle / Ivy
Show all versions of timestreamwrite 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.timestreamwrite.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;
/**
*
* Details about a batch load task.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class BatchLoadTaskDescription implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField TASK_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("TaskId")
.getter(getter(BatchLoadTaskDescription::taskId)).setter(setter(Builder::taskId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TaskId").build()).build();
private static final SdkField ERROR_MESSAGE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ErrorMessage").getter(getter(BatchLoadTaskDescription::errorMessage))
.setter(setter(Builder::errorMessage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ErrorMessage").build()).build();
private static final SdkField DATA_SOURCE_CONFIGURATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("DataSourceConfiguration")
.getter(getter(BatchLoadTaskDescription::dataSourceConfiguration)).setter(setter(Builder::dataSourceConfiguration))
.constructor(DataSourceConfiguration::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DataSourceConfiguration").build())
.build();
private static final SdkField PROGRESS_REPORT_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ProgressReport")
.getter(getter(BatchLoadTaskDescription::progressReport)).setter(setter(Builder::progressReport))
.constructor(BatchLoadProgressReport::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ProgressReport").build()).build();
private static final SdkField REPORT_CONFIGURATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ReportConfiguration")
.getter(getter(BatchLoadTaskDescription::reportConfiguration)).setter(setter(Builder::reportConfiguration))
.constructor(ReportConfiguration::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReportConfiguration").build())
.build();
private static final SdkField DATA_MODEL_CONFIGURATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("DataModelConfiguration")
.getter(getter(BatchLoadTaskDescription::dataModelConfiguration)).setter(setter(Builder::dataModelConfiguration))
.constructor(DataModelConfiguration::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DataModelConfiguration").build())
.build();
private static final SdkField TARGET_DATABASE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TargetDatabaseName").getter(getter(BatchLoadTaskDescription::targetDatabaseName))
.setter(setter(Builder::targetDatabaseName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TargetDatabaseName").build())
.build();
private static final SdkField TARGET_TABLE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TargetTableName").getter(getter(BatchLoadTaskDescription::targetTableName))
.setter(setter(Builder::targetTableName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TargetTableName").build()).build();
private static final SdkField TASK_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TaskStatus").getter(getter(BatchLoadTaskDescription::taskStatusAsString))
.setter(setter(Builder::taskStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TaskStatus").build()).build();
private static final SdkField RECORD_VERSION_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("RecordVersion").getter(getter(BatchLoadTaskDescription::recordVersion))
.setter(setter(Builder::recordVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RecordVersion").build()).build();
private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreationTime").getter(getter(BatchLoadTaskDescription::creationTime))
.setter(setter(Builder::creationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationTime").build()).build();
private static final SdkField LAST_UPDATED_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("LastUpdatedTime").getter(getter(BatchLoadTaskDescription::lastUpdatedTime))
.setter(setter(Builder::lastUpdatedTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastUpdatedTime").build()).build();
private static final SdkField RESUMABLE_UNTIL_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("ResumableUntil").getter(getter(BatchLoadTaskDescription::resumableUntil))
.setter(setter(Builder::resumableUntil))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResumableUntil").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TASK_ID_FIELD,
ERROR_MESSAGE_FIELD, DATA_SOURCE_CONFIGURATION_FIELD, PROGRESS_REPORT_FIELD, REPORT_CONFIGURATION_FIELD,
DATA_MODEL_CONFIGURATION_FIELD, TARGET_DATABASE_NAME_FIELD, TARGET_TABLE_NAME_FIELD, TASK_STATUS_FIELD,
RECORD_VERSION_FIELD, CREATION_TIME_FIELD, LAST_UPDATED_TIME_FIELD, RESUMABLE_UNTIL_FIELD));
private static final long serialVersionUID = 1L;
private final String taskId;
private final String errorMessage;
private final DataSourceConfiguration dataSourceConfiguration;
private final BatchLoadProgressReport progressReport;
private final ReportConfiguration reportConfiguration;
private final DataModelConfiguration dataModelConfiguration;
private final String targetDatabaseName;
private final String targetTableName;
private final String taskStatus;
private final Long recordVersion;
private final Instant creationTime;
private final Instant lastUpdatedTime;
private final Instant resumableUntil;
private BatchLoadTaskDescription(BuilderImpl builder) {
this.taskId = builder.taskId;
this.errorMessage = builder.errorMessage;
this.dataSourceConfiguration = builder.dataSourceConfiguration;
this.progressReport = builder.progressReport;
this.reportConfiguration = builder.reportConfiguration;
this.dataModelConfiguration = builder.dataModelConfiguration;
this.targetDatabaseName = builder.targetDatabaseName;
this.targetTableName = builder.targetTableName;
this.taskStatus = builder.taskStatus;
this.recordVersion = builder.recordVersion;
this.creationTime = builder.creationTime;
this.lastUpdatedTime = builder.lastUpdatedTime;
this.resumableUntil = builder.resumableUntil;
}
/**
*
* The ID of the batch load task.
*
*
* @return The ID of the batch load task.
*/
public final String taskId() {
return taskId;
}
/**
*
*
* @return
*/
public final String errorMessage() {
return errorMessage;
}
/**
*
* Configuration details about the data source for a batch load task.
*
*
* @return Configuration details about the data source for a batch load task.
*/
public final DataSourceConfiguration dataSourceConfiguration() {
return dataSourceConfiguration;
}
/**
*
*
* @return
*/
public final BatchLoadProgressReport progressReport() {
return progressReport;
}
/**
*
* Report configuration for a batch load task. This contains details about where error reports are stored.
*
*
* @return Report configuration for a batch load task. This contains details about where error reports are stored.
*/
public final ReportConfiguration reportConfiguration() {
return reportConfiguration;
}
/**
*
* Data model configuration for a batch load task. This contains details about where a data model for a batch load
* task is stored.
*
*
* @return Data model configuration for a batch load task. This contains details about where a data model for a
* batch load task is stored.
*/
public final DataModelConfiguration dataModelConfiguration() {
return dataModelConfiguration;
}
/**
*
*
* @return
*/
public final String targetDatabaseName() {
return targetDatabaseName;
}
/**
*
*
* @return
*/
public final String targetTableName() {
return targetTableName;
}
/**
*
* Status of the batch load task.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #taskStatus} will
* return {@link BatchLoadStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #taskStatusAsString}.
*
*
* @return Status of the batch load task.
* @see BatchLoadStatus
*/
public final BatchLoadStatus taskStatus() {
return BatchLoadStatus.fromValue(taskStatus);
}
/**
*
* Status of the batch load task.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #taskStatus} will
* return {@link BatchLoadStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #taskStatusAsString}.
*
*
* @return Status of the batch load task.
* @see BatchLoadStatus
*/
public final String taskStatusAsString() {
return taskStatus;
}
/**
*
*
* @return
*/
public final Long recordVersion() {
return recordVersion;
}
/**
*
* The time when the Timestream batch load task was created.
*
*
* @return The time when the Timestream batch load task was created.
*/
public final Instant creationTime() {
return creationTime;
}
/**
*
* The time when the Timestream batch load task was last updated.
*
*
* @return The time when the Timestream batch load task was last updated.
*/
public final Instant lastUpdatedTime() {
return lastUpdatedTime;
}
/**
*
*
*
* @return
*/
public final Instant resumableUntil() {
return resumableUntil;
}
@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(taskId());
hashCode = 31 * hashCode + Objects.hashCode(errorMessage());
hashCode = 31 * hashCode + Objects.hashCode(dataSourceConfiguration());
hashCode = 31 * hashCode + Objects.hashCode(progressReport());
hashCode = 31 * hashCode + Objects.hashCode(reportConfiguration());
hashCode = 31 * hashCode + Objects.hashCode(dataModelConfiguration());
hashCode = 31 * hashCode + Objects.hashCode(targetDatabaseName());
hashCode = 31 * hashCode + Objects.hashCode(targetTableName());
hashCode = 31 * hashCode + Objects.hashCode(taskStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(recordVersion());
hashCode = 31 * hashCode + Objects.hashCode(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(lastUpdatedTime());
hashCode = 31 * hashCode + Objects.hashCode(resumableUntil());
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 BatchLoadTaskDescription)) {
return false;
}
BatchLoadTaskDescription other = (BatchLoadTaskDescription) obj;
return Objects.equals(taskId(), other.taskId()) && Objects.equals(errorMessage(), other.errorMessage())
&& Objects.equals(dataSourceConfiguration(), other.dataSourceConfiguration())
&& Objects.equals(progressReport(), other.progressReport())
&& Objects.equals(reportConfiguration(), other.reportConfiguration())
&& Objects.equals(dataModelConfiguration(), other.dataModelConfiguration())
&& Objects.equals(targetDatabaseName(), other.targetDatabaseName())
&& Objects.equals(targetTableName(), other.targetTableName())
&& Objects.equals(taskStatusAsString(), other.taskStatusAsString())
&& Objects.equals(recordVersion(), other.recordVersion()) && Objects.equals(creationTime(), other.creationTime())
&& Objects.equals(lastUpdatedTime(), other.lastUpdatedTime())
&& Objects.equals(resumableUntil(), other.resumableUntil());
}
/**
* 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("BatchLoadTaskDescription").add("TaskId", taskId()).add("ErrorMessage", errorMessage())
.add("DataSourceConfiguration", dataSourceConfiguration()).add("ProgressReport", progressReport())
.add("ReportConfiguration", reportConfiguration()).add("DataModelConfiguration", dataModelConfiguration())
.add("TargetDatabaseName", targetDatabaseName()).add("TargetTableName", targetTableName())
.add("TaskStatus", taskStatusAsString()).add("RecordVersion", recordVersion())
.add("CreationTime", creationTime()).add("LastUpdatedTime", lastUpdatedTime())
.add("ResumableUntil", resumableUntil()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "TaskId":
return Optional.ofNullable(clazz.cast(taskId()));
case "ErrorMessage":
return Optional.ofNullable(clazz.cast(errorMessage()));
case "DataSourceConfiguration":
return Optional.ofNullable(clazz.cast(dataSourceConfiguration()));
case "ProgressReport":
return Optional.ofNullable(clazz.cast(progressReport()));
case "ReportConfiguration":
return Optional.ofNullable(clazz.cast(reportConfiguration()));
case "DataModelConfiguration":
return Optional.ofNullable(clazz.cast(dataModelConfiguration()));
case "TargetDatabaseName":
return Optional.ofNullable(clazz.cast(targetDatabaseName()));
case "TargetTableName":
return Optional.ofNullable(clazz.cast(targetTableName()));
case "TaskStatus":
return Optional.ofNullable(clazz.cast(taskStatusAsString()));
case "RecordVersion":
return Optional.ofNullable(clazz.cast(recordVersion()));
case "CreationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "LastUpdatedTime":
return Optional.ofNullable(clazz.cast(lastUpdatedTime()));
case "ResumableUntil":
return Optional.ofNullable(clazz.cast(resumableUntil()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function