
software.amazon.awssdk.services.datasync.model.DescribeTaskExecutionResponse 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.datasync.model;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collection;
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 java.util.stream.Collectors;
import java.util.stream.Stream;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* DescribeTaskExecutionResponse
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class DescribeTaskExecutionResponse extends DataSyncResponse implements
ToCopyableBuilder {
private static final SdkField TASK_EXECUTION_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TaskExecutionArn").getter(getter(DescribeTaskExecutionResponse::taskExecutionArn))
.setter(setter(Builder::taskExecutionArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TaskExecutionArn").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(DescribeTaskExecutionResponse::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField OPTIONS_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("Options").getter(getter(DescribeTaskExecutionResponse::options)).setter(setter(Builder::options))
.constructor(Options::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Options").build()).build();
private static final SdkField> EXCLUDES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Excludes")
.getter(getter(DescribeTaskExecutionResponse::excludes))
.setter(setter(Builder::excludes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Excludes").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(FilterRule::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> INCLUDES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Includes")
.getter(getter(DescribeTaskExecutionResponse::includes))
.setter(setter(Builder::includes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Includes").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(FilterRule::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField START_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("StartTime").getter(getter(DescribeTaskExecutionResponse::startTime)).setter(setter(Builder::startTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StartTime").build()).build();
private static final SdkField ESTIMATED_FILES_TO_TRANSFER_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("EstimatedFilesToTransfer").getter(getter(DescribeTaskExecutionResponse::estimatedFilesToTransfer))
.setter(setter(Builder::estimatedFilesToTransfer))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EstimatedFilesToTransfer").build())
.build();
private static final SdkField ESTIMATED_BYTES_TO_TRANSFER_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("EstimatedBytesToTransfer").getter(getter(DescribeTaskExecutionResponse::estimatedBytesToTransfer))
.setter(setter(Builder::estimatedBytesToTransfer))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EstimatedBytesToTransfer").build())
.build();
private static final SdkField FILES_TRANSFERRED_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("FilesTransferred").getter(getter(DescribeTaskExecutionResponse::filesTransferred))
.setter(setter(Builder::filesTransferred))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FilesTransferred").build()).build();
private static final SdkField BYTES_WRITTEN_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("BytesWritten").getter(getter(DescribeTaskExecutionResponse::bytesWritten))
.setter(setter(Builder::bytesWritten))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BytesWritten").build()).build();
private static final SdkField BYTES_TRANSFERRED_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("BytesTransferred").getter(getter(DescribeTaskExecutionResponse::bytesTransferred))
.setter(setter(Builder::bytesTransferred))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BytesTransferred").build()).build();
private static final SdkField RESULT_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("Result")
.getter(getter(DescribeTaskExecutionResponse::result)).setter(setter(Builder::result))
.constructor(TaskExecutionResultDetail::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Result").build()).build();
private static final SdkField BYTES_COMPRESSED_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("BytesCompressed").getter(getter(DescribeTaskExecutionResponse::bytesCompressed))
.setter(setter(Builder::bytesCompressed))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BytesCompressed").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TASK_EXECUTION_ARN_FIELD,
STATUS_FIELD, OPTIONS_FIELD, EXCLUDES_FIELD, INCLUDES_FIELD, START_TIME_FIELD, ESTIMATED_FILES_TO_TRANSFER_FIELD,
ESTIMATED_BYTES_TO_TRANSFER_FIELD, FILES_TRANSFERRED_FIELD, BYTES_WRITTEN_FIELD, BYTES_TRANSFERRED_FIELD,
RESULT_FIELD, BYTES_COMPRESSED_FIELD));
private final String taskExecutionArn;
private final String status;
private final Options options;
private final List excludes;
private final List includes;
private final Instant startTime;
private final Long estimatedFilesToTransfer;
private final Long estimatedBytesToTransfer;
private final Long filesTransferred;
private final Long bytesWritten;
private final Long bytesTransferred;
private final TaskExecutionResultDetail result;
private final Long bytesCompressed;
private DescribeTaskExecutionResponse(BuilderImpl builder) {
super(builder);
this.taskExecutionArn = builder.taskExecutionArn;
this.status = builder.status;
this.options = builder.options;
this.excludes = builder.excludes;
this.includes = builder.includes;
this.startTime = builder.startTime;
this.estimatedFilesToTransfer = builder.estimatedFilesToTransfer;
this.estimatedBytesToTransfer = builder.estimatedBytesToTransfer;
this.filesTransferred = builder.filesTransferred;
this.bytesWritten = builder.bytesWritten;
this.bytesTransferred = builder.bytesTransferred;
this.result = builder.result;
this.bytesCompressed = builder.bytesCompressed;
}
/**
*
* The Amazon Resource Name (ARN) of the task execution that was described. TaskExecutionArn
is
* hierarchical and includes TaskArn
for the task that was executed.
*
*
* For example, a TaskExecution
value with the ARN
* arn:aws:datasync:us-east-1:111222333444:task/task-0208075f79cedf4a2/execution/exec-08ef1e88ec491019b
* executed the task with the ARN arn:aws:datasync:us-east-1:111222333444:task/task-0208075f79cedf4a2
.
*
*
* @return The Amazon Resource Name (ARN) of the task execution that was described. TaskExecutionArn
is
* hierarchical and includes TaskArn
for the task that was executed.
*
* For example, a TaskExecution
value with the ARN
* arn:aws:datasync:us-east-1:111222333444:task/task-0208075f79cedf4a2/execution/exec-08ef1e88ec491019b
* executed the task with the ARN
* arn:aws:datasync:us-east-1:111222333444:task/task-0208075f79cedf4a2
.
*/
public final String taskExecutionArn() {
return taskExecutionArn;
}
/**
*
* The status of the task execution.
*
*
* For detailed information about task execution statuses, see Understanding Task Statuses in the DataSync User
* Guide.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link TaskExecutionStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #statusAsString}.
*
*
* @return The status of the task execution.
*
* For detailed information about task execution statuses, see Understanding Task Statuses in the
* DataSync User Guide.
* @see TaskExecutionStatus
*/
public final TaskExecutionStatus status() {
return TaskExecutionStatus.fromValue(status);
}
/**
*
* The status of the task execution.
*
*
* For detailed information about task execution statuses, see Understanding Task Statuses in the DataSync User
* Guide.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link TaskExecutionStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #statusAsString}.
*
*
* @return The status of the task execution.
*
* For detailed information about task execution statuses, see Understanding Task Statuses in the
* DataSync User Guide.
* @see TaskExecutionStatus
*/
public final String statusAsString() {
return status;
}
/**
* Returns the value of the Options property for this object.
*
* @return The value of the Options property for this object.
*/
public final Options options() {
return options;
}
/**
* For responses, this returns true if the service returned a value for the Excludes property. This DOES NOT check
* that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is
* useful because the SDK will never return a null collection or map, but you may need to differentiate between the
* service returning nothing (or null) and the service returning an empty collection or map. For requests, this
* returns true if a value for the property was specified in the request builder, and false if a value was not
* specified.
*/
public final boolean hasExcludes() {
return excludes != null && !(excludes instanceof SdkAutoConstructList);
}
/**
*
* A list of filter rules that determines which files to exclude from a task. The list should contain a single
* filter string that consists of the patterns to exclude. The patterns are delimited by "|" (that is, a pipe), for
* example: "/folder1|/folder2"
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasExcludes} method.
*
*
* @return A list of filter rules that determines which files to exclude from a task. The list should contain a
* single filter string that consists of the patterns to exclude. The patterns are delimited by "|" (that
* is, a pipe), for example: "/folder1|/folder2"
*/
public final List excludes() {
return excludes;
}
/**
* For responses, this returns true if the service returned a value for the Includes property. This DOES NOT check
* that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is
* useful because the SDK will never return a null collection or map, but you may need to differentiate between the
* service returning nothing (or null) and the service returning an empty collection or map. For requests, this
* returns true if a value for the property was specified in the request builder, and false if a value was not
* specified.
*/
public final boolean hasIncludes() {
return includes != null && !(includes instanceof SdkAutoConstructList);
}
/**
*
* A list of filter rules that determines which files to include when running a task. The list should contain a
* single filter string that consists of the patterns to include. The patterns are delimited by "|" (that is, a
* pipe), for example: "/folder1|/folder2"
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasIncludes} method.
*
*
* @return A list of filter rules that determines which files to include when running a task. The list should
* contain a single filter string that consists of the patterns to include. The patterns are delimited by
* "|" (that is, a pipe), for example: "/folder1|/folder2"
*/
public final List includes() {
return includes;
}
/**
*
* The time that the task execution was started.
*
*
* @return The time that the task execution was started.
*/
public final Instant startTime() {
return startTime;
}
/**
*
* The expected number of files that is to be transferred over the network. This value is calculated during the
* PREPARING phase, before the TRANSFERRING phase. This value is the expected number of files to be transferred.
* It's calculated based on comparing the content of the source and destination locations and finding the delta that
* needs to be transferred.
*
*
* @return The expected number of files that is to be transferred over the network. This value is calculated during
* the PREPARING phase, before the TRANSFERRING phase. This value is the expected number of files to be
* transferred. It's calculated based on comparing the content of the source and destination locations and
* finding the delta that needs to be transferred.
*/
public final Long estimatedFilesToTransfer() {
return estimatedFilesToTransfer;
}
/**
*
* The estimated physical number of bytes that is to be transferred over the network.
*
*
* @return The estimated physical number of bytes that is to be transferred over the network.
*/
public final Long estimatedBytesToTransfer() {
return estimatedBytesToTransfer;
}
/**
*
* The actual number of files that was transferred over the network. This value is calculated and updated on an
* ongoing basis during the TRANSFERRING phase. It's updated periodically when each file is read from the source and
* sent over the network.
*
*
* If failures occur during a transfer, this value can be less than EstimatedFilesToTransfer
. This
* value can also be greater than EstimatedFilesTransferred
in some cases. This element is
* implementation-specific for some location types, so don't use it as an indicator for a correct file number or to
* monitor your task execution.
*
*
* @return The actual number of files that was transferred over the network. This value is calculated and updated on
* an ongoing basis during the TRANSFERRING phase. It's updated periodically when each file is read from the
* source and sent over the network.
*
* If failures occur during a transfer, this value can be less than EstimatedFilesToTransfer
.
* This value can also be greater than EstimatedFilesTransferred
in some cases. This element is
* implementation-specific for some location types, so don't use it as an indicator for a correct file
* number or to monitor your task execution.
*/
public final Long filesTransferred() {
return filesTransferred;
}
/**
*
* The number of logical bytes written to the destination Amazon Web Services storage resource.
*
*
* @return The number of logical bytes written to the destination Amazon Web Services storage resource.
*/
public final Long bytesWritten() {
return bytesWritten;
}
/**
*
* The physical number of bytes transferred over the network.
*
*
* @return The physical number of bytes transferred over the network.
*/
public final Long bytesTransferred() {
return bytesTransferred;
}
/**
*
* The result of the task execution.
*
*
* @return The result of the task execution.
*/
public final TaskExecutionResultDetail result() {
return result;
}
/**
*
* The physical number of bytes transferred over the network after compression was applied. In most cases, this
* number is less than BytesTransferred
.
*
*
* @return The physical number of bytes transferred over the network after compression was applied. In most cases,
* this number is less than BytesTransferred
.
*/
public final Long bytesCompressed() {
return bytesCompressed;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(taskExecutionArn());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(options());
hashCode = 31 * hashCode + Objects.hashCode(hasExcludes() ? excludes() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasIncludes() ? includes() : null);
hashCode = 31 * hashCode + Objects.hashCode(startTime());
hashCode = 31 * hashCode + Objects.hashCode(estimatedFilesToTransfer());
hashCode = 31 * hashCode + Objects.hashCode(estimatedBytesToTransfer());
hashCode = 31 * hashCode + Objects.hashCode(filesTransferred());
hashCode = 31 * hashCode + Objects.hashCode(bytesWritten());
hashCode = 31 * hashCode + Objects.hashCode(bytesTransferred());
hashCode = 31 * hashCode + Objects.hashCode(result());
hashCode = 31 * hashCode + Objects.hashCode(bytesCompressed());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof DescribeTaskExecutionResponse)) {
return false;
}
DescribeTaskExecutionResponse other = (DescribeTaskExecutionResponse) obj;
return Objects.equals(taskExecutionArn(), other.taskExecutionArn())
&& Objects.equals(statusAsString(), other.statusAsString()) && Objects.equals(options(), other.options())
&& hasExcludes() == other.hasExcludes() && Objects.equals(excludes(), other.excludes())
&& hasIncludes() == other.hasIncludes() && Objects.equals(includes(), other.includes())
&& Objects.equals(startTime(), other.startTime())
&& Objects.equals(estimatedFilesToTransfer(), other.estimatedFilesToTransfer())
&& Objects.equals(estimatedBytesToTransfer(), other.estimatedBytesToTransfer())
&& Objects.equals(filesTransferred(), other.filesTransferred())
&& Objects.equals(bytesWritten(), other.bytesWritten())
&& Objects.equals(bytesTransferred(), other.bytesTransferred()) && Objects.equals(result(), other.result())
&& Objects.equals(bytesCompressed(), other.bytesCompressed());
}
/**
* 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("DescribeTaskExecutionResponse").add("TaskExecutionArn", taskExecutionArn())
.add("Status", statusAsString()).add("Options", options()).add("Excludes", hasExcludes() ? excludes() : null)
.add("Includes", hasIncludes() ? includes() : null).add("StartTime", startTime())
.add("EstimatedFilesToTransfer", estimatedFilesToTransfer())
.add("EstimatedBytesToTransfer", estimatedBytesToTransfer()).add("FilesTransferred", filesTransferred())
.add("BytesWritten", bytesWritten()).add("BytesTransferred", bytesTransferred()).add("Result", result())
.add("BytesCompressed", bytesCompressed()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "TaskExecutionArn":
return Optional.ofNullable(clazz.cast(taskExecutionArn()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "Options":
return Optional.ofNullable(clazz.cast(options()));
case "Excludes":
return Optional.ofNullable(clazz.cast(excludes()));
case "Includes":
return Optional.ofNullable(clazz.cast(includes()));
case "StartTime":
return Optional.ofNullable(clazz.cast(startTime()));
case "EstimatedFilesToTransfer":
return Optional.ofNullable(clazz.cast(estimatedFilesToTransfer()));
case "EstimatedBytesToTransfer":
return Optional.ofNullable(clazz.cast(estimatedBytesToTransfer()));
case "FilesTransferred":
return Optional.ofNullable(clazz.cast(filesTransferred()));
case "BytesWritten":
return Optional.ofNullable(clazz.cast(bytesWritten()));
case "BytesTransferred":
return Optional.ofNullable(clazz.cast(bytesTransferred()));
case "Result":
return Optional.ofNullable(clazz.cast(result()));
case "BytesCompressed":
return Optional.ofNullable(clazz.cast(bytesCompressed()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function