All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.swf.model.WorkflowExecutionTerminatedEventAttributes Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon SWF module holds the client classes that are used for communicating with Amazon Simple Workflow Service

The newest version!
/*
 * 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.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 WorkflowExecutionTerminated event. *

*/ @Generated("software.amazon.awssdk:codegen") public final class WorkflowExecutionTerminatedEventAttributes implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField REASON_FIELD = SdkField. builder(MarshallingType.STRING).memberName("reason") .getter(getter(WorkflowExecutionTerminatedEventAttributes::reason)).setter(setter(Builder::reason)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("reason").build()).build(); private static final SdkField DETAILS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("details") .getter(getter(WorkflowExecutionTerminatedEventAttributes::details)).setter(setter(Builder::details)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("details").build()).build(); private static final SdkField CHILD_POLICY_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("childPolicy").getter(getter(WorkflowExecutionTerminatedEventAttributes::childPolicyAsString)) .setter(setter(Builder::childPolicy)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("childPolicy").build()).build(); private static final SdkField CAUSE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("cause") .getter(getter(WorkflowExecutionTerminatedEventAttributes::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(REASON_FIELD, DETAILS_FIELD, CHILD_POLICY_FIELD, CAUSE_FIELD)); private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer(); private static final long serialVersionUID = 1L; private final String reason; private final String details; private final String childPolicy; private final String causeValue; private WorkflowExecutionTerminatedEventAttributes(BuilderImpl builder) { this.reason = builder.reason; this.details = builder.details; this.childPolicy = builder.childPolicy; this.causeValue = builder.causeValue; } /** *

* The reason provided for the termination. *

* * @return The reason provided for the termination. */ public final String reason() { return reason; } /** *

* The details provided for the termination. *

* * @return The details provided for the termination. */ public final String details() { return details; } /** *

* 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; } /** *

      * If set, indicates that the workflow execution was automatically terminated, and specifies the cause. This happens * if the parent workflow execution times out or is terminated and the child policy is set to terminate child * executions. *

      *

      * If the service returns an enum value that is not available in the current SDK version, {@link #cause} will return * {@link WorkflowExecutionTerminatedCause#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is * available from {@link #causeAsString}. *

      * * @return If set, indicates that the workflow execution was automatically terminated, and specifies the cause. This * happens if the parent workflow execution times out or is terminated and the child policy is set to * terminate child executions. * @see WorkflowExecutionTerminatedCause */ public final WorkflowExecutionTerminatedCause cause() { return WorkflowExecutionTerminatedCause.fromValue(causeValue); } /** *

      * If set, indicates that the workflow execution was automatically terminated, and specifies the cause. This happens * if the parent workflow execution times out or is terminated and the child policy is set to terminate child * executions. *

      *

      * If the service returns an enum value that is not available in the current SDK version, {@link #cause} will return * {@link WorkflowExecutionTerminatedCause#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is * available from {@link #causeAsString}. *

      * * @return If set, indicates that the workflow execution was automatically terminated, and specifies the cause. This * happens if the parent workflow execution times out or is terminated and the child policy is set to * terminate child executions. * @see WorkflowExecutionTerminatedCause */ public final String causeAsString() { return causeValue; } @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(reason()); hashCode = 31 * hashCode + Objects.hashCode(details()); hashCode = 31 * hashCode + Objects.hashCode(childPolicyAsString()); 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 WorkflowExecutionTerminatedEventAttributes)) { return false; } WorkflowExecutionTerminatedEventAttributes other = (WorkflowExecutionTerminatedEventAttributes) obj; return Objects.equals(reason(), other.reason()) && Objects.equals(details(), other.details()) && Objects.equals(childPolicyAsString(), other.childPolicyAsString()) && 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("WorkflowExecutionTerminatedEventAttributes").add("Reason", reason()).add("Details", details()) .add("ChildPolicy", childPolicyAsString()).add("Cause", causeAsString()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "reason": return Optional.ofNullable(clazz.cast(reason())); case "details": return Optional.ofNullable(clazz.cast(details())); case "childPolicy": return Optional.ofNullable(clazz.cast(childPolicyAsString())); 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 Map> memberNameToFieldInitializer() { Map> map = new HashMap<>(); map.put("reason", REASON_FIELD); map.put("details", DETAILS_FIELD); map.put("childPolicy", CHILD_POLICY_FIELD); map.put("cause", CAUSE_FIELD); return Collections.unmodifiableMap(map); } private static Function getter(Function g) { return obj -> g.apply((WorkflowExecutionTerminatedEventAttributes) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

      * The reason provided for the termination. *

      * * @param reason * The reason provided for the termination. * @return Returns a reference to this object so that method calls can be chained together. */ Builder reason(String reason); /** *

      * The details provided for the termination. *

      * * @param details * The details provided for the termination. * @return Returns a reference to this object so that method calls can be chained together. */ Builder details(String details); /** *

      * 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. *

        *
      • *
      * * @param 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. *

        *
      • * @see ChildPolicy * @return Returns a reference to this object so that method calls can be chained together. * @see ChildPolicy */ Builder childPolicy(String 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. *

          *
        • *
        * * @param 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. *

          *
        • * @see ChildPolicy * @return Returns a reference to this object so that method calls can be chained together. * @see ChildPolicy */ Builder childPolicy(ChildPolicy childPolicy); /** *

          * If set, indicates that the workflow execution was automatically terminated, and specifies the cause. This * happens if the parent workflow execution times out or is terminated and the child policy is set to terminate * child executions. *

          * * @param causeValue * If set, indicates that the workflow execution was automatically terminated, and specifies the cause. * This happens if the parent workflow execution times out or is terminated and the child policy is set * to terminate child executions. * @see WorkflowExecutionTerminatedCause * @return Returns a reference to this object so that method calls can be chained together. * @see WorkflowExecutionTerminatedCause */ Builder cause(String causeValue); /** *

          * If set, indicates that the workflow execution was automatically terminated, and specifies the cause. This * happens if the parent workflow execution times out or is terminated and the child policy is set to terminate * child executions. *

          * * @param causeValue * If set, indicates that the workflow execution was automatically terminated, and specifies the cause. * This happens if the parent workflow execution times out or is terminated and the child policy is set * to terminate child executions. * @see WorkflowExecutionTerminatedCause * @return Returns a reference to this object so that method calls can be chained together. * @see WorkflowExecutionTerminatedCause */ Builder cause(WorkflowExecutionTerminatedCause causeValue); } static final class BuilderImpl implements Builder { private String reason; private String details; private String childPolicy; private String causeValue; private BuilderImpl() { } private BuilderImpl(WorkflowExecutionTerminatedEventAttributes model) { reason(model.reason); details(model.details); childPolicy(model.childPolicy); cause(model.causeValue); } public final String getReason() { return reason; } public final void setReason(String reason) { this.reason = reason; } @Override public final Builder reason(String reason) { this.reason = reason; return this; } public final String getDetails() { return details; } public final void setDetails(String details) { this.details = details; } @Override public final Builder details(String details) { this.details = details; return this; } public final String getChildPolicy() { return childPolicy; } public final void setChildPolicy(String childPolicy) { this.childPolicy = childPolicy; } @Override public final Builder childPolicy(String childPolicy) { this.childPolicy = childPolicy; return this; } @Override public final Builder childPolicy(ChildPolicy childPolicy) { this.childPolicy(childPolicy == null ? null : childPolicy.toString()); return this; } public final String getCause() { return causeValue; } public final void setCause(String causeValue) { this.causeValue = causeValue; } @Override public final Builder cause(String causeValue) { this.causeValue = causeValue; return this; } @Override public final Builder cause(WorkflowExecutionTerminatedCause causeValue) { this.cause(causeValue == null ? null : causeValue.toString()); return this; } @Override public WorkflowExecutionTerminatedEventAttributes build() { return new WorkflowExecutionTerminatedEventAttributes(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy