software.amazon.awssdk.services.transfer.model.ExecutionError Maven / Gradle / Ivy
Show all versions of transfer 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.transfer.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;
/**
*
* Specifies the error message and type, for an error that occurs during the execution of the workflow.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ExecutionError implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField TYPE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Type")
.getter(getter(ExecutionError::typeAsString)).setter(setter(Builder::type))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Type").build()).build();
private static final SdkField MESSAGE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Message")
.getter(getter(ExecutionError::message)).setter(setter(Builder::message))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Message").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TYPE_FIELD, MESSAGE_FIELD));
private static final long serialVersionUID = 1L;
private final String type;
private final String message;
private ExecutionError(BuilderImpl builder) {
this.type = builder.type;
this.message = builder.message;
}
/**
*
* Specifies the error type.
*
*
* -
*
* ALREADY_EXISTS
: occurs for a copy step, if the overwrite option is not selected and a file with the
* same name already exists in the target location.
*
*
* -
*
* BAD_REQUEST
: a general bad request: for example, a step that attempts to tag an EFS file returns
* BAD_REQUEST
, as only S3 files can be tagged.
*
*
* -
*
* CUSTOM_STEP_FAILED
: occurs when the custom step provided a callback that indicates failure.
*
*
* -
*
* INTERNAL_SERVER_ERROR
: a catch-all error that can occur for a variety of reasons.
*
*
* -
*
* NOT_FOUND
: occurs when a requested entity, for example a source file for a copy step, does not
* exist.
*
*
* -
*
* PERMISSION_DENIED
: occurs if your policy does not contain the correct permissions to complete one or
* more of the steps in the workflow.
*
*
* -
*
* TIMEOUT
: occurs when the execution times out.
*
*
*
* You can set the TimeoutSeconds
for a custom step, anywhere from 1 second to 1800 seconds (30
* minutes).
*
*
* -
*
* THROTTLED
: occurs if you exceed the new execution refill rate of one workflow per second.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #type} will return
* {@link ExecutionErrorType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #typeAsString}.
*
*
* @return Specifies the error type.
*
* -
*
* ALREADY_EXISTS
: occurs for a copy step, if the overwrite option is not selected and a file
* with the same name already exists in the target location.
*
*
* -
*
* BAD_REQUEST
: a general bad request: for example, a step that attempts to tag an EFS file
* returns BAD_REQUEST
, as only S3 files can be tagged.
*
*
* -
*
* CUSTOM_STEP_FAILED
: occurs when the custom step provided a callback that indicates failure.
*
*
* -
*
* INTERNAL_SERVER_ERROR
: a catch-all error that can occur for a variety of reasons.
*
*
* -
*
* NOT_FOUND
: occurs when a requested entity, for example a source file for a copy step, does
* not exist.
*
*
* -
*
* PERMISSION_DENIED
: occurs if your policy does not contain the correct permissions to
* complete one or more of the steps in the workflow.
*
*
* -
*
* TIMEOUT
: occurs when the execution times out.
*
*
*
* You can set the TimeoutSeconds
for a custom step, anywhere from 1 second to 1800 seconds (30
* minutes).
*
*
* -
*
* THROTTLED
: occurs if you exceed the new execution refill rate of one workflow per second.
*
*
* @see ExecutionErrorType
*/
public final ExecutionErrorType type() {
return ExecutionErrorType.fromValue(type);
}
/**
*
* Specifies the error type.
*
*
* -
*
* ALREADY_EXISTS
: occurs for a copy step, if the overwrite option is not selected and a file with the
* same name already exists in the target location.
*
*
* -
*
* BAD_REQUEST
: a general bad request: for example, a step that attempts to tag an EFS file returns
* BAD_REQUEST
, as only S3 files can be tagged.
*
*
* -
*
* CUSTOM_STEP_FAILED
: occurs when the custom step provided a callback that indicates failure.
*
*
* -
*
* INTERNAL_SERVER_ERROR
: a catch-all error that can occur for a variety of reasons.
*
*
* -
*
* NOT_FOUND
: occurs when a requested entity, for example a source file for a copy step, does not
* exist.
*
*
* -
*
* PERMISSION_DENIED
: occurs if your policy does not contain the correct permissions to complete one or
* more of the steps in the workflow.
*
*
* -
*
* TIMEOUT
: occurs when the execution times out.
*
*
*
* You can set the TimeoutSeconds
for a custom step, anywhere from 1 second to 1800 seconds (30
* minutes).
*
*
* -
*
* THROTTLED
: occurs if you exceed the new execution refill rate of one workflow per second.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #type} will return
* {@link ExecutionErrorType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #typeAsString}.
*
*
* @return Specifies the error type.
*
* -
*
* ALREADY_EXISTS
: occurs for a copy step, if the overwrite option is not selected and a file
* with the same name already exists in the target location.
*
*
* -
*
* BAD_REQUEST
: a general bad request: for example, a step that attempts to tag an EFS file
* returns BAD_REQUEST
, as only S3 files can be tagged.
*
*
* -
*
* CUSTOM_STEP_FAILED
: occurs when the custom step provided a callback that indicates failure.
*
*
* -
*
* INTERNAL_SERVER_ERROR
: a catch-all error that can occur for a variety of reasons.
*
*
* -
*
* NOT_FOUND
: occurs when a requested entity, for example a source file for a copy step, does
* not exist.
*
*
* -
*
* PERMISSION_DENIED
: occurs if your policy does not contain the correct permissions to
* complete one or more of the steps in the workflow.
*
*
* -
*
* TIMEOUT
: occurs when the execution times out.
*
*
*
* You can set the TimeoutSeconds
for a custom step, anywhere from 1 second to 1800 seconds (30
* minutes).
*
*
* -
*
* THROTTLED
: occurs if you exceed the new execution refill rate of one workflow per second.
*
*
* @see ExecutionErrorType
*/
public final String typeAsString() {
return type;
}
/**
*
* Specifies the descriptive message that corresponds to the ErrorType
.
*
*
* @return Specifies the descriptive message that corresponds to the ErrorType
.
*/
public final String message() {
return message;
}
@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(typeAsString());
hashCode = 31 * hashCode + Objects.hashCode(message());
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 ExecutionError)) {
return false;
}
ExecutionError other = (ExecutionError) obj;
return Objects.equals(typeAsString(), other.typeAsString()) && Objects.equals(message(), other.message());
}
/**
* 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("ExecutionError").add("Type", typeAsString()).add("Message", message()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Type":
return Optional.ofNullable(clazz.cast(typeAsString()));
case "Message":
return Optional.ofNullable(clazz.cast(message()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function