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

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 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 getter(Function g) { return obj -> g.apply((TaskExecutionResultDetail) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The total time in milliseconds that DataSync spent in the PREPARING phase. *

* * @param prepareDuration * The total time in milliseconds that DataSync spent in the PREPARING phase. * @return Returns a reference to this object so that method calls can be chained together. */ Builder prepareDuration(Long prepareDuration); /** *

* The status of the PREPARING phase. *

* * @param prepareStatus * The status of the PREPARING phase. * @see PhaseStatus * @return Returns a reference to this object so that method calls can be chained together. * @see PhaseStatus */ Builder prepareStatus(String prepareStatus); /** *

* The status of the PREPARING phase. *

* * @param prepareStatus * The status of the PREPARING phase. * @see PhaseStatus * @return Returns a reference to this object so that method calls can be chained together. * @see PhaseStatus */ Builder prepareStatus(PhaseStatus prepareStatus); /** *

* The total time in milliseconds that DataSync took to transfer the file from the source to the destination * location. *

* * @param totalDuration * The total time in milliseconds that DataSync took to transfer the file from the source to the * destination location. * @return Returns a reference to this object so that method calls can be chained together. */ Builder totalDuration(Long totalDuration); /** *

* The total time in milliseconds that DataSync spent in the TRANSFERRING phase. *

* * @param transferDuration * The total time in milliseconds that DataSync spent in the TRANSFERRING phase. * @return Returns a reference to this object so that method calls can be chained together. */ Builder transferDuration(Long transferDuration); /** *

* The status of the TRANSFERRING phase. *

* * @param transferStatus * The status of the TRANSFERRING phase. * @see PhaseStatus * @return Returns a reference to this object so that method calls can be chained together. * @see PhaseStatus */ Builder transferStatus(String transferStatus); /** *

* The status of the TRANSFERRING phase. *

* * @param transferStatus * The status of the TRANSFERRING phase. * @see PhaseStatus * @return Returns a reference to this object so that method calls can be chained together. * @see PhaseStatus */ Builder transferStatus(PhaseStatus transferStatus); /** *

* The total time in milliseconds that DataSync spent in the VERIFYING phase. *

* * @param verifyDuration * The total time in milliseconds that DataSync spent in the VERIFYING phase. * @return Returns a reference to this object so that method calls can be chained together. */ Builder verifyDuration(Long verifyDuration); /** *

* The status of the VERIFYING phase. *

* * @param verifyStatus * The status of the VERIFYING phase. * @see PhaseStatus * @return Returns a reference to this object so that method calls can be chained together. * @see PhaseStatus */ Builder verifyStatus(String verifyStatus); /** *

* The status of the VERIFYING phase. *

* * @param verifyStatus * The status of the VERIFYING phase. * @see PhaseStatus * @return Returns a reference to this object so that method calls can be chained together. * @see PhaseStatus */ Builder verifyStatus(PhaseStatus verifyStatus); /** *

* Errors that DataSync encountered during execution of the task. You can use this error code to help * troubleshoot issues. *

* * @param errorCode * Errors that DataSync encountered during execution of the task. You can use this error code to help * troubleshoot issues. * @return Returns a reference to this object so that method calls can be chained together. */ Builder errorCode(String errorCode); /** *

* Detailed description of an error that was encountered during the task execution. You can use this information * to help troubleshoot issues. *

* * @param errorDetail * Detailed description of an error that was encountered during the task execution. You can use this * information to help troubleshoot issues. * @return Returns a reference to this object so that method calls can be chained together. */ Builder errorDetail(String errorDetail); } static final class BuilderImpl implements Builder { private Long prepareDuration; private String prepareStatus; private Long totalDuration; private Long transferDuration; private String transferStatus; private Long verifyDuration; private String verifyStatus; private String errorCode; private String errorDetail; private BuilderImpl() { } private BuilderImpl(TaskExecutionResultDetail model) { prepareDuration(model.prepareDuration); prepareStatus(model.prepareStatus); totalDuration(model.totalDuration); transferDuration(model.transferDuration); transferStatus(model.transferStatus); verifyDuration(model.verifyDuration); verifyStatus(model.verifyStatus); errorCode(model.errorCode); errorDetail(model.errorDetail); } public final Long getPrepareDuration() { return prepareDuration; } public final void setPrepareDuration(Long prepareDuration) { this.prepareDuration = prepareDuration; } @Override public final Builder prepareDuration(Long prepareDuration) { this.prepareDuration = prepareDuration; return this; } public final String getPrepareStatus() { return prepareStatus; } public final void setPrepareStatus(String prepareStatus) { this.prepareStatus = prepareStatus; } @Override public final Builder prepareStatus(String prepareStatus) { this.prepareStatus = prepareStatus; return this; } @Override public final Builder prepareStatus(PhaseStatus prepareStatus) { this.prepareStatus(prepareStatus == null ? null : prepareStatus.toString()); return this; } public final Long getTotalDuration() { return totalDuration; } public final void setTotalDuration(Long totalDuration) { this.totalDuration = totalDuration; } @Override public final Builder totalDuration(Long totalDuration) { this.totalDuration = totalDuration; return this; } public final Long getTransferDuration() { return transferDuration; } public final void setTransferDuration(Long transferDuration) { this.transferDuration = transferDuration; } @Override public final Builder transferDuration(Long transferDuration) { this.transferDuration = transferDuration; return this; } public final String getTransferStatus() { return transferStatus; } public final void setTransferStatus(String transferStatus) { this.transferStatus = transferStatus; } @Override public final Builder transferStatus(String transferStatus) { this.transferStatus = transferStatus; return this; } @Override public final Builder transferStatus(PhaseStatus transferStatus) { this.transferStatus(transferStatus == null ? null : transferStatus.toString()); return this; } public final Long getVerifyDuration() { return verifyDuration; } public final void setVerifyDuration(Long verifyDuration) { this.verifyDuration = verifyDuration; } @Override public final Builder verifyDuration(Long verifyDuration) { this.verifyDuration = verifyDuration; return this; } public final String getVerifyStatus() { return verifyStatus; } public final void setVerifyStatus(String verifyStatus) { this.verifyStatus = verifyStatus; } @Override public final Builder verifyStatus(String verifyStatus) { this.verifyStatus = verifyStatus; return this; } @Override public final Builder verifyStatus(PhaseStatus verifyStatus) { this.verifyStatus(verifyStatus == null ? null : verifyStatus.toString()); return this; } public final String getErrorCode() { return errorCode; } public final void setErrorCode(String errorCode) { this.errorCode = errorCode; } @Override public final Builder errorCode(String errorCode) { this.errorCode = errorCode; return this; } public final String getErrorDetail() { return errorDetail; } public final void setErrorDetail(String errorDetail) { this.errorDetail = errorDetail; } @Override public final Builder errorDetail(String errorDetail) { this.errorDetail = errorDetail; return this; } @Override public TaskExecutionResultDetail build() { return new TaskExecutionResultDetail(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy