
software.amazon.awssdk.services.sfn.model.DescribeExecutionResponse Maven / Gradle / Ivy
/*
* Copyright 2014-2019 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.sfn.model;
import java.time.Instant;
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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class DescribeExecutionResponse extends SfnResponse implements
ToCopyableBuilder {
private static final SdkField EXECUTION_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(DescribeExecutionResponse::executionArn)).setter(setter(Builder::executionArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("executionArn").build()).build();
private static final SdkField STATE_MACHINE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(DescribeExecutionResponse::stateMachineArn)).setter(setter(Builder::stateMachineArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("stateMachineArn").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(DescribeExecutionResponse::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("name").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(DescribeExecutionResponse::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build();
private static final SdkField START_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(DescribeExecutionResponse::startDate)).setter(setter(Builder::startDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("startDate").build()).build();
private static final SdkField STOP_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(DescribeExecutionResponse::stopDate)).setter(setter(Builder::stopDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("stopDate").build()).build();
private static final SdkField INPUT_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(DescribeExecutionResponse::input)).setter(setter(Builder::input))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("input").build()).build();
private static final SdkField OUTPUT_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(DescribeExecutionResponse::output)).setter(setter(Builder::output))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("output").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(EXECUTION_ARN_FIELD,
STATE_MACHINE_ARN_FIELD, NAME_FIELD, STATUS_FIELD, START_DATE_FIELD, STOP_DATE_FIELD, INPUT_FIELD, OUTPUT_FIELD));
private final String executionArn;
private final String stateMachineArn;
private final String name;
private final String status;
private final Instant startDate;
private final Instant stopDate;
private final String input;
private final String output;
private DescribeExecutionResponse(BuilderImpl builder) {
super(builder);
this.executionArn = builder.executionArn;
this.stateMachineArn = builder.stateMachineArn;
this.name = builder.name;
this.status = builder.status;
this.startDate = builder.startDate;
this.stopDate = builder.stopDate;
this.input = builder.input;
this.output = builder.output;
}
/**
*
* The Amazon Resource Name (ARN) that identifies the execution.
*
*
* @return The Amazon Resource Name (ARN) that identifies the execution.
*/
public String executionArn() {
return executionArn;
}
/**
*
* The Amazon Resource Name (ARN) of the executed stated machine.
*
*
* @return The Amazon Resource Name (ARN) of the executed stated machine.
*/
public String stateMachineArn() {
return stateMachineArn;
}
/**
*
* The name of the execution.
*
*
* A name must not contain:
*
*
* -
*
* whitespace
*
*
* -
*
* brackets < > { } [ ]
*
*
* -
*
* wildcard characters ? *
*
*
* -
*
* special characters " # % \ ^ | ~ ` $ & , ; : /
*
*
* -
*
* control characters (U+0000-001F
, U+007F-009F
)
*
*
*
*
* @return The name of the execution.
*
* A name must not contain:
*
*
* -
*
* whitespace
*
*
* -
*
* brackets < > { } [ ]
*
*
* -
*
* wildcard characters ? *
*
*
* -
*
* special characters " # % \ ^ | ~ ` $ & , ; : /
*
*
* -
*
* control characters (U+0000-001F
, U+007F-009F
)
*
*
*/
public String name() {
return name;
}
/**
*
* The current status of the execution.
*
*
* 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 current status of the execution.
* @see ExecutionStatus
*/
public ExecutionStatus status() {
return ExecutionStatus.fromValue(status);
}
/**
*
* The current status of the execution.
*
*
* 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 current status of the execution.
* @see ExecutionStatus
*/
public String statusAsString() {
return status;
}
/**
*
* The date the execution is started.
*
*
* @return The date the execution is started.
*/
public Instant startDate() {
return startDate;
}
/**
*
* If the execution has already ended, the date the execution stopped.
*
*
* @return If the execution has already ended, the date the execution stopped.
*/
public Instant stopDate() {
return stopDate;
}
/**
*
* The string that contains the JSON input data of the execution.
*
*
* @return The string that contains the JSON input data of the execution.
*/
public String input() {
return input;
}
/**
*
* The JSON output data of the execution.
*
*
*
* This field is set only if the execution succeeds. If the execution fails, this field is null.
*
*
*
* @return The JSON output data of the execution.
*
* This field is set only if the execution succeeds. If the execution fails, this field is null.
*
*/
public String output() {
return output;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(executionArn());
hashCode = 31 * hashCode + Objects.hashCode(stateMachineArn());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(startDate());
hashCode = 31 * hashCode + Objects.hashCode(stopDate());
hashCode = 31 * hashCode + Objects.hashCode(input());
hashCode = 31 * hashCode + Objects.hashCode(output());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof DescribeExecutionResponse)) {
return false;
}
DescribeExecutionResponse other = (DescribeExecutionResponse) obj;
return Objects.equals(executionArn(), other.executionArn()) && Objects.equals(stateMachineArn(), other.stateMachineArn())
&& Objects.equals(name(), other.name()) && Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(startDate(), other.startDate()) && Objects.equals(stopDate(), other.stopDate())
&& Objects.equals(input(), other.input()) && Objects.equals(output(), other.output());
}
@Override
public String toString() {
return ToString.builder("DescribeExecutionResponse").add("ExecutionArn", executionArn())
.add("StateMachineArn", stateMachineArn()).add("Name", name()).add("Status", statusAsString())
.add("StartDate", startDate()).add("StopDate", stopDate()).add("Input", input()).add("Output", output()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "executionArn":
return Optional.ofNullable(clazz.cast(executionArn()));
case "stateMachineArn":
return Optional.ofNullable(clazz.cast(stateMachineArn()));
case "name":
return Optional.ofNullable(clazz.cast(name()));
case "status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "startDate":
return Optional.ofNullable(clazz.cast(startDate()));
case "stopDate":
return Optional.ofNullable(clazz.cast(stopDate()));
case "input":
return Optional.ofNullable(clazz.cast(input()));
case "output":
return Optional.ofNullable(clazz.cast(output()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function