software.amazon.awssdk.services.transfer.model.DescribedExecution 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.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;
/**
*
* The details for an execution object.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class DescribedExecution implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField EXECUTION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ExecutionId").getter(getter(DescribedExecution::executionId)).setter(setter(Builder::executionId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExecutionId").build()).build();
private static final SdkField INITIAL_FILE_LOCATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("InitialFileLocation")
.getter(getter(DescribedExecution::initialFileLocation)).setter(setter(Builder::initialFileLocation))
.constructor(FileLocation::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InitialFileLocation").build())
.build();
private static final SdkField SERVICE_METADATA_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ServiceMetadata")
.getter(getter(DescribedExecution::serviceMetadata)).setter(setter(Builder::serviceMetadata))
.constructor(ServiceMetadata::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ServiceMetadata").build()).build();
private static final SdkField EXECUTION_ROLE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ExecutionRole").getter(getter(DescribedExecution::executionRole)).setter(setter(Builder::executionRole))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExecutionRole").build()).build();
private static final SdkField LOGGING_CONFIGURATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("LoggingConfiguration")
.getter(getter(DescribedExecution::loggingConfiguration)).setter(setter(Builder::loggingConfiguration))
.constructor(LoggingConfiguration::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LoggingConfiguration").build())
.build();
private static final SdkField POSIX_PROFILE_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("PosixProfile").getter(getter(DescribedExecution::posixProfile)).setter(setter(Builder::posixProfile))
.constructor(PosixProfile::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PosixProfile").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(DescribedExecution::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField RESULTS_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("Results").getter(getter(DescribedExecution::results)).setter(setter(Builder::results))
.constructor(ExecutionResults::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Results").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(EXECUTION_ID_FIELD,
INITIAL_FILE_LOCATION_FIELD, SERVICE_METADATA_FIELD, EXECUTION_ROLE_FIELD, LOGGING_CONFIGURATION_FIELD,
POSIX_PROFILE_FIELD, STATUS_FIELD, RESULTS_FIELD));
private static final long serialVersionUID = 1L;
private final String executionId;
private final FileLocation initialFileLocation;
private final ServiceMetadata serviceMetadata;
private final String executionRole;
private final LoggingConfiguration loggingConfiguration;
private final PosixProfile posixProfile;
private final String status;
private final ExecutionResults results;
private DescribedExecution(BuilderImpl builder) {
this.executionId = builder.executionId;
this.initialFileLocation = builder.initialFileLocation;
this.serviceMetadata = builder.serviceMetadata;
this.executionRole = builder.executionRole;
this.loggingConfiguration = builder.loggingConfiguration;
this.posixProfile = builder.posixProfile;
this.status = builder.status;
this.results = builder.results;
}
/**
*
* A unique identifier for the execution of a workflow.
*
*
* @return A unique identifier for the execution of a workflow.
*/
public final String executionId() {
return executionId;
}
/**
*
* A structure that describes the Amazon S3 or EFS file location. This is the file location when the execution
* begins: if the file is being copied, this is the initial (as opposed to destination) file location.
*
*
* @return A structure that describes the Amazon S3 or EFS file location. This is the file location when the
* execution begins: if the file is being copied, this is the initial (as opposed to destination) file
* location.
*/
public final FileLocation initialFileLocation() {
return initialFileLocation;
}
/**
*
* A container object for the session details that are associated with a workflow.
*
*
* @return A container object for the session details that are associated with a workflow.
*/
public final ServiceMetadata serviceMetadata() {
return serviceMetadata;
}
/**
*
* The IAM role associated with the execution.
*
*
* @return The IAM role associated with the execution.
*/
public final String executionRole() {
return executionRole;
}
/**
*
* The IAM logging role associated with the execution.
*
*
* @return The IAM logging role associated with the execution.
*/
public final LoggingConfiguration loggingConfiguration() {
return loggingConfiguration;
}
/**
* Returns the value of the PosixProfile property for this object.
*
* @return The value of the PosixProfile property for this object.
*/
public final PosixProfile posixProfile() {
return posixProfile;
}
/**
*
* The status is one of the execution. Can be in progress, completed, exception encountered, or handling the
* exception.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ExecutionStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status is one of the execution. Can be in progress, completed, exception encountered, or handling the
* exception.
* @see ExecutionStatus
*/
public final ExecutionStatus status() {
return ExecutionStatus.fromValue(status);
}
/**
*
* The status is one of the execution. Can be in progress, completed, exception encountered, or handling the
* exception.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ExecutionStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status is one of the execution. Can be in progress, completed, exception encountered, or handling the
* exception.
* @see ExecutionStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* A structure that describes the execution results. This includes a list of the steps along with the details of
* each step, error type and message (if any), and the OnExceptionSteps
structure.
*
*
* @return A structure that describes the execution results. This includes a list of the steps along with the
* details of each step, error type and message (if any), and the OnExceptionSteps
structure.
*/
public final ExecutionResults results() {
return results;
}
@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(executionId());
hashCode = 31 * hashCode + Objects.hashCode(initialFileLocation());
hashCode = 31 * hashCode + Objects.hashCode(serviceMetadata());
hashCode = 31 * hashCode + Objects.hashCode(executionRole());
hashCode = 31 * hashCode + Objects.hashCode(loggingConfiguration());
hashCode = 31 * hashCode + Objects.hashCode(posixProfile());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(results());
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 DescribedExecution)) {
return false;
}
DescribedExecution other = (DescribedExecution) obj;
return Objects.equals(executionId(), other.executionId())
&& Objects.equals(initialFileLocation(), other.initialFileLocation())
&& Objects.equals(serviceMetadata(), other.serviceMetadata())
&& Objects.equals(executionRole(), other.executionRole())
&& Objects.equals(loggingConfiguration(), other.loggingConfiguration())
&& Objects.equals(posixProfile(), other.posixProfile())
&& Objects.equals(statusAsString(), other.statusAsString()) && Objects.equals(results(), other.results());
}
/**
* 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("DescribedExecution").add("ExecutionId", executionId())
.add("InitialFileLocation", initialFileLocation()).add("ServiceMetadata", serviceMetadata())
.add("ExecutionRole", executionRole()).add("LoggingConfiguration", loggingConfiguration())
.add("PosixProfile", posixProfile()).add("Status", statusAsString()).add("Results", results()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ExecutionId":
return Optional.ofNullable(clazz.cast(executionId()));
case "InitialFileLocation":
return Optional.ofNullable(clazz.cast(initialFileLocation()));
case "ServiceMetadata":
return Optional.ofNullable(clazz.cast(serviceMetadata()));
case "ExecutionRole":
return Optional.ofNullable(clazz.cast(executionRole()));
case "LoggingConfiguration":
return Optional.ofNullable(clazz.cast(loggingConfiguration()));
case "PosixProfile":
return Optional.ofNullable(clazz.cast(posixProfile()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "Results":
return Optional.ofNullable(clazz.cast(results()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function