
software.amazon.awssdk.services.datasync.model.TaskExecutionResultDetail 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.io.Serializable;
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.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;
/**
*
* Describes the detailed result of a TaskExecution
operation. This result includes the time in
* milliseconds spent in each phase, the status of the task execution, and the errors encountered.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class TaskExecutionResultDetail implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField PREPARE_DURATION_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("PrepareDuration").getter(getter(TaskExecutionResultDetail::prepareDuration))
.setter(setter(Builder::prepareDuration))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PrepareDuration").build()).build();
private static final SdkField PREPARE_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("PrepareStatus").getter(getter(TaskExecutionResultDetail::prepareStatusAsString))
.setter(setter(Builder::prepareStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PrepareStatus").build()).build();
private static final SdkField TOTAL_DURATION_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("TotalDuration").getter(getter(TaskExecutionResultDetail::totalDuration))
.setter(setter(Builder::totalDuration))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TotalDuration").build()).build();
private static final SdkField TRANSFER_DURATION_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("TransferDuration").getter(getter(TaskExecutionResultDetail::transferDuration))
.setter(setter(Builder::transferDuration))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TransferDuration").build()).build();
private static final SdkField TRANSFER_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TransferStatus").getter(getter(TaskExecutionResultDetail::transferStatusAsString))
.setter(setter(Builder::transferStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TransferStatus").build()).build();
private static final SdkField VERIFY_DURATION_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("VerifyDuration").getter(getter(TaskExecutionResultDetail::verifyDuration))
.setter(setter(Builder::verifyDuration))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VerifyDuration").build()).build();
private static final SdkField VERIFY_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("VerifyStatus").getter(getter(TaskExecutionResultDetail::verifyStatusAsString))
.setter(setter(Builder::verifyStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VerifyStatus").build()).build();
private static final SdkField ERROR_CODE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ErrorCode").getter(getter(TaskExecutionResultDetail::errorCode)).setter(setter(Builder::errorCode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ErrorCode").build()).build();
private static final SdkField ERROR_DETAIL_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ErrorDetail").getter(getter(TaskExecutionResultDetail::errorDetail))
.setter(setter(Builder::errorDetail))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ErrorDetail").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(PREPARE_DURATION_FIELD,
PREPARE_STATUS_FIELD, TOTAL_DURATION_FIELD, TRANSFER_DURATION_FIELD, TRANSFER_STATUS_FIELD, VERIFY_DURATION_FIELD,
VERIFY_STATUS_FIELD, ERROR_CODE_FIELD, ERROR_DETAIL_FIELD));
private static final long serialVersionUID = 1L;
private final Long prepareDuration;
private final String prepareStatus;
private final Long totalDuration;
private final Long transferDuration;
private final String transferStatus;
private final Long verifyDuration;
private final String verifyStatus;
private final String errorCode;
private final String errorDetail;
private TaskExecutionResultDetail(BuilderImpl builder) {
this.prepareDuration = builder.prepareDuration;
this.prepareStatus = builder.prepareStatus;
this.totalDuration = builder.totalDuration;
this.transferDuration = builder.transferDuration;
this.transferStatus = builder.transferStatus;
this.verifyDuration = builder.verifyDuration;
this.verifyStatus = builder.verifyStatus;
this.errorCode = builder.errorCode;
this.errorDetail = builder.errorDetail;
}
/**
*
* The total time in milliseconds that DataSync spent in the PREPARING phase.
*
*
* @return The total time in milliseconds that DataSync spent in the PREPARING phase.
*/
public final Long prepareDuration() {
return prepareDuration;
}
/**
*
* The status of the PREPARING phase.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #prepareStatus}
* will return {@link PhaseStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #prepareStatusAsString}.
*
*
* @return The status of the PREPARING phase.
* @see PhaseStatus
*/
public final PhaseStatus prepareStatus() {
return PhaseStatus.fromValue(prepareStatus);
}
/**
*
* The status of the PREPARING phase.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #prepareStatus}
* will return {@link PhaseStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #prepareStatusAsString}.
*
*
* @return The status of the PREPARING phase.
* @see PhaseStatus
*/
public final String prepareStatusAsString() {
return prepareStatus;
}
/**
*
* The total time in milliseconds that DataSync took to transfer the file from the source to the destination
* location.
*
*
* @return The total time in milliseconds that DataSync took to transfer the file from the source to the destination
* location.
*/
public final Long totalDuration() {
return totalDuration;
}
/**
*
* The total time in milliseconds that DataSync spent in the TRANSFERRING phase.
*
*
* @return The total time in milliseconds that DataSync spent in the TRANSFERRING phase.
*/
public final Long transferDuration() {
return transferDuration;
}
/**
*
* The status of the TRANSFERRING phase.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #transferStatus}
* will return {@link PhaseStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #transferStatusAsString}.
*
*
* @return The status of the TRANSFERRING phase.
* @see PhaseStatus
*/
public final PhaseStatus transferStatus() {
return PhaseStatus.fromValue(transferStatus);
}
/**
*
* The status of the TRANSFERRING phase.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #transferStatus}
* will return {@link PhaseStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #transferStatusAsString}.
*
*
* @return The status of the TRANSFERRING phase.
* @see PhaseStatus
*/
public final String transferStatusAsString() {
return transferStatus;
}
/**
*
* The total time in milliseconds that DataSync spent in the VERIFYING phase.
*
*
* @return The total time in milliseconds that DataSync spent in the VERIFYING phase.
*/
public final Long verifyDuration() {
return verifyDuration;
}
/**
*
* The status of the VERIFYING phase.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #verifyStatus} will
* return {@link PhaseStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #verifyStatusAsString}.
*
*
* @return The status of the VERIFYING phase.
* @see PhaseStatus
*/
public final PhaseStatus verifyStatus() {
return PhaseStatus.fromValue(verifyStatus);
}
/**
*
* The status of the VERIFYING phase.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #verifyStatus} will
* return {@link PhaseStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #verifyStatusAsString}.
*
*
* @return The status of the VERIFYING phase.
* @see PhaseStatus
*/
public final String verifyStatusAsString() {
return verifyStatus;
}
/**
*
* Errors that DataSync encountered during execution of the task. You can use this error code to help troubleshoot
* issues.
*
*
* @return Errors that DataSync encountered during execution of the task. You can use this error code to help
* troubleshoot issues.
*/
public final String errorCode() {
return errorCode;
}
/**
*
* Detailed description of an error that was encountered during the task execution. You can use this information to
* help troubleshoot issues.
*
*
* @return Detailed description of an error that was encountered during the task execution. You can use this
* information to help troubleshoot issues.
*/
public final String errorDetail() {
return errorDetail;
}
@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(prepareDuration());
hashCode = 31 * hashCode + Objects.hashCode(prepareStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(totalDuration());
hashCode = 31 * hashCode + Objects.hashCode(transferDuration());
hashCode = 31 * hashCode + Objects.hashCode(transferStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(verifyDuration());
hashCode = 31 * hashCode + Objects.hashCode(verifyStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(errorCode());
hashCode = 31 * hashCode + Objects.hashCode(errorDetail());
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 TaskExecutionResultDetail)) {
return false;
}
TaskExecutionResultDetail other = (TaskExecutionResultDetail) obj;
return Objects.equals(prepareDuration(), other.prepareDuration())
&& Objects.equals(prepareStatusAsString(), other.prepareStatusAsString())
&& Objects.equals(totalDuration(), other.totalDuration())
&& Objects.equals(transferDuration(), other.transferDuration())
&& Objects.equals(transferStatusAsString(), other.transferStatusAsString())
&& Objects.equals(verifyDuration(), other.verifyDuration())
&& Objects.equals(verifyStatusAsString(), other.verifyStatusAsString())
&& Objects.equals(errorCode(), other.errorCode()) && Objects.equals(errorDetail(), other.errorDetail());
}
/**
* 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("TaskExecutionResultDetail").add("PrepareDuration", prepareDuration())
.add("PrepareStatus", prepareStatusAsString()).add("TotalDuration", totalDuration())
.add("TransferDuration", transferDuration()).add("TransferStatus", transferStatusAsString())
.add("VerifyDuration", verifyDuration()).add("VerifyStatus", verifyStatusAsString())
.add("ErrorCode", errorCode()).add("ErrorDetail", errorDetail()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "PrepareDuration":
return Optional.ofNullable(clazz.cast(prepareDuration()));
case "PrepareStatus":
return Optional.ofNullable(clazz.cast(prepareStatusAsString()));
case "TotalDuration":
return Optional.ofNullable(clazz.cast(totalDuration()));
case "TransferDuration":
return Optional.ofNullable(clazz.cast(transferDuration()));
case "TransferStatus":
return Optional.ofNullable(clazz.cast(transferStatusAsString()));
case "VerifyDuration":
return Optional.ofNullable(clazz.cast(verifyDuration()));
case "VerifyStatus":
return Optional.ofNullable(clazz.cast(verifyStatusAsString()));
case "ErrorCode":
return Optional.ofNullable(clazz.cast(errorCode()));
case "ErrorDetail":
return Optional.ofNullable(clazz.cast(errorDetail()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function