software.amazon.awssdk.services.swf.model.WorkflowExecutionCancelRequestedEventAttributes 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.HashMap;
import java.util.List;
import java.util.Map;
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;
/**
*
* Provides the details of the WorkflowExecutionCancelRequested
event.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class WorkflowExecutionCancelRequestedEventAttributes
implements
SdkPojo,
Serializable,
ToCopyableBuilder {
private static final SdkField EXTERNAL_WORKFLOW_EXECUTION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("externalWorkflowExecution")
.getter(getter(WorkflowExecutionCancelRequestedEventAttributes::externalWorkflowExecution))
.setter(setter(Builder::externalWorkflowExecution)).constructor(WorkflowExecution::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("externalWorkflowExecution").build())
.build();
private static final SdkField EXTERNAL_INITIATED_EVENT_ID_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("externalInitiatedEventId")
.getter(getter(WorkflowExecutionCancelRequestedEventAttributes::externalInitiatedEventId))
.setter(setter(Builder::externalInitiatedEventId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("externalInitiatedEventId").build())
.build();
private static final SdkField CAUSE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("cause")
.getter(getter(WorkflowExecutionCancelRequestedEventAttributes::causeAsString)).setter(setter(Builder::cause))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("cause").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
EXTERNAL_WORKFLOW_EXECUTION_FIELD, EXTERNAL_INITIATED_EVENT_ID_FIELD, CAUSE_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("externalWorkflowExecution", EXTERNAL_WORKFLOW_EXECUTION_FIELD);
put("externalInitiatedEventId", EXTERNAL_INITIATED_EVENT_ID_FIELD);
put("cause", CAUSE_FIELD);
}
});
private static final long serialVersionUID = 1L;
private final WorkflowExecution externalWorkflowExecution;
private final Long externalInitiatedEventId;
private final String causeValue;
private WorkflowExecutionCancelRequestedEventAttributes(BuilderImpl builder) {
this.externalWorkflowExecution = builder.externalWorkflowExecution;
this.externalInitiatedEventId = builder.externalInitiatedEventId;
this.causeValue = builder.causeValue;
}
/**
*
* The external workflow execution for which the cancellation was requested.
*
*
* @return The external workflow execution for which the cancellation was requested.
*/
public final WorkflowExecution externalWorkflowExecution() {
return externalWorkflowExecution;
}
/**
*
* The ID of the RequestCancelExternalWorkflowExecutionInitiated
event corresponding to the
* RequestCancelExternalWorkflowExecution
decision to cancel this workflow execution.The source event
* with this ID can be found in the history of the source workflow execution. This information can be useful for
* diagnosing problems by tracing back the chain of events leading up to this event.
*
*
* @return The ID of the RequestCancelExternalWorkflowExecutionInitiated
event corresponding to the
* RequestCancelExternalWorkflowExecution
decision to cancel this workflow execution.The source
* event with this ID can be found in the history of the source workflow execution. This information can be
* useful for diagnosing problems by tracing back the chain of events leading up to this event.
*/
public final Long externalInitiatedEventId() {
return externalInitiatedEventId;
}
/**
*
* If set, indicates that the request to cancel the workflow execution was automatically generated, and specifies
* the cause. This happens if the parent workflow execution times out or is terminated, and the child policy is set
* to cancel child executions.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #cause} will return
* {@link WorkflowExecutionCancelRequestedCause#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #causeAsString}.
*
*
* @return If set, indicates that the request to cancel the workflow execution was automatically generated, and
* specifies the cause. This happens if the parent workflow execution times out or is terminated, and the
* child policy is set to cancel child executions.
* @see WorkflowExecutionCancelRequestedCause
*/
public final WorkflowExecutionCancelRequestedCause cause() {
return WorkflowExecutionCancelRequestedCause.fromValue(causeValue);
}
/**
*
* If set, indicates that the request to cancel the workflow execution was automatically generated, and specifies
* the cause. This happens if the parent workflow execution times out or is terminated, and the child policy is set
* to cancel child executions.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #cause} will return
* {@link WorkflowExecutionCancelRequestedCause#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #causeAsString}.
*
*
* @return If set, indicates that the request to cancel the workflow execution was automatically generated, and
* specifies the cause. This happens if the parent workflow execution times out or is terminated, and the
* child policy is set to cancel child executions.
* @see WorkflowExecutionCancelRequestedCause
*/
public final String causeAsString() {
return causeValue;
}
@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(externalWorkflowExecution());
hashCode = 31 * hashCode + Objects.hashCode(externalInitiatedEventId());
hashCode = 31 * hashCode + Objects.hashCode(causeAsString());
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 WorkflowExecutionCancelRequestedEventAttributes)) {
return false;
}
WorkflowExecutionCancelRequestedEventAttributes other = (WorkflowExecutionCancelRequestedEventAttributes) obj;
return Objects.equals(externalWorkflowExecution(), other.externalWorkflowExecution())
&& Objects.equals(externalInitiatedEventId(), other.externalInitiatedEventId())
&& Objects.equals(causeAsString(), other.causeAsString());
}
/**
* 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("WorkflowExecutionCancelRequestedEventAttributes")
.add("ExternalWorkflowExecution", externalWorkflowExecution())
.add("ExternalInitiatedEventId", externalInitiatedEventId()).add("Cause", causeAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "externalWorkflowExecution":
return Optional.ofNullable(clazz.cast(externalWorkflowExecution()));
case "externalInitiatedEventId":
return Optional.ofNullable(clazz.cast(externalInitiatedEventId()));
case "cause":
return Optional.ofNullable(clazz.cast(causeAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Function