software.amazon.awssdk.services.swf.model.WorkflowExecutionTimedOutEventAttributes Maven / Gradle / Ivy
Show all versions of swf 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.swf.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;
/**
*
* Provides the details of the WorkflowExecutionTimedOut
event.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class WorkflowExecutionTimedOutEventAttributes implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField TIMEOUT_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("timeoutType").getter(getter(WorkflowExecutionTimedOutEventAttributes::timeoutTypeAsString))
.setter(setter(Builder::timeoutType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("timeoutType").build()).build();
private static final SdkField CHILD_POLICY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("childPolicy").getter(getter(WorkflowExecutionTimedOutEventAttributes::childPolicyAsString))
.setter(setter(Builder::childPolicy))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("childPolicy").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TIMEOUT_TYPE_FIELD,
CHILD_POLICY_FIELD));
private static final long serialVersionUID = 1L;
private final String timeoutType;
private final String childPolicy;
private WorkflowExecutionTimedOutEventAttributes(BuilderImpl builder) {
this.timeoutType = builder.timeoutType;
this.childPolicy = builder.childPolicy;
}
/**
*
* The type of timeout that caused this event.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #timeoutType} will
* return {@link WorkflowExecutionTimeoutType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #timeoutTypeAsString}.
*
*
* @return The type of timeout that caused this event.
* @see WorkflowExecutionTimeoutType
*/
public final WorkflowExecutionTimeoutType timeoutType() {
return WorkflowExecutionTimeoutType.fromValue(timeoutType);
}
/**
*
* The type of timeout that caused this event.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #timeoutType} will
* return {@link WorkflowExecutionTimeoutType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #timeoutTypeAsString}.
*
*
* @return The type of timeout that caused this event.
* @see WorkflowExecutionTimeoutType
*/
public final String timeoutTypeAsString() {
return timeoutType;
}
/**
*
* The policy used for the child workflow executions of this workflow execution.
*
*
* The supported child policies are:
*
*
* -
*
* TERMINATE
– The child executions are terminated.
*
*
* -
*
* REQUEST_CANCEL
– A request to cancel is attempted for each child execution by recording a
* WorkflowExecutionCancelRequested
event in its history. It is up to the decider to take appropriate
* actions when it receives an execution history with this event.
*
*
* -
*
* ABANDON
– No action is taken. The child executions continue to run.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #childPolicy} will
* return {@link ChildPolicy#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #childPolicyAsString}.
*
*
* @return The policy used for the child workflow executions of this workflow execution.
*
* The supported child policies are:
*
*
* -
*
* TERMINATE
– The child executions are terminated.
*
*
* -
*
* REQUEST_CANCEL
– A request to cancel is attempted for each child execution by recording a
* WorkflowExecutionCancelRequested
event in its history. It is up to the decider to take
* appropriate actions when it receives an execution history with this event.
*
*
* -
*
* ABANDON
– No action is taken. The child executions continue to run.
*
*
* @see ChildPolicy
*/
public final ChildPolicy childPolicy() {
return ChildPolicy.fromValue(childPolicy);
}
/**
*
* The policy used for the child workflow executions of this workflow execution.
*
*
* The supported child policies are:
*
*
* -
*
* TERMINATE
– The child executions are terminated.
*
*
* -
*
* REQUEST_CANCEL
– A request to cancel is attempted for each child execution by recording a
* WorkflowExecutionCancelRequested
event in its history. It is up to the decider to take appropriate
* actions when it receives an execution history with this event.
*
*
* -
*
* ABANDON
– No action is taken. The child executions continue to run.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #childPolicy} will
* return {@link ChildPolicy#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #childPolicyAsString}.
*
*
* @return The policy used for the child workflow executions of this workflow execution.
*
* The supported child policies are:
*
*
* -
*
* TERMINATE
– The child executions are terminated.
*
*
* -
*
* REQUEST_CANCEL
– A request to cancel is attempted for each child execution by recording a
* WorkflowExecutionCancelRequested
event in its history. It is up to the decider to take
* appropriate actions when it receives an execution history with this event.
*
*
* -
*
* ABANDON
– No action is taken. The child executions continue to run.
*
*
* @see ChildPolicy
*/
public final String childPolicyAsString() {
return childPolicy;
}
@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(timeoutTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(childPolicyAsString());
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 WorkflowExecutionTimedOutEventAttributes)) {
return false;
}
WorkflowExecutionTimedOutEventAttributes other = (WorkflowExecutionTimedOutEventAttributes) obj;
return Objects.equals(timeoutTypeAsString(), other.timeoutTypeAsString())
&& Objects.equals(childPolicyAsString(), other.childPolicyAsString());
}
/**
* 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("WorkflowExecutionTimedOutEventAttributes").add("TimeoutType", timeoutTypeAsString())
.add("ChildPolicy", childPolicyAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "timeoutType":
return Optional.ofNullable(clazz.cast(timeoutTypeAsString()));
case "childPolicy":
return Optional.ofNullable(clazz.cast(childPolicyAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function