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

software.amazon.awssdk.services.swf.model.WorkflowExecutionConfiguration 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

There is a newer version: 2.28.3
Show 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.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 configuration settings for a workflow execution including timeout values, tasklist etc. These configuration * settings are determined from the defaults specified when registering the workflow type and those specified when * starting the workflow execution. *

*/ @Generated("software.amazon.awssdk:codegen") public final class WorkflowExecutionConfiguration implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField TASK_START_TO_CLOSE_TIMEOUT_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("taskStartToCloseTimeout").getter(getter(WorkflowExecutionConfiguration::taskStartToCloseTimeout)) .setter(setter(Builder::taskStartToCloseTimeout)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("taskStartToCloseTimeout").build()) .build(); private static final SdkField EXECUTION_START_TO_CLOSE_TIMEOUT_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("executionStartToCloseTimeout") .getter(getter(WorkflowExecutionConfiguration::executionStartToCloseTimeout)) .setter(setter(Builder::executionStartToCloseTimeout)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("executionStartToCloseTimeout") .build()).build(); private static final SdkField TASK_LIST_FIELD = SdkField. builder(MarshallingType.SDK_POJO) .memberName("taskList").getter(getter(WorkflowExecutionConfiguration::taskList)).setter(setter(Builder::taskList)) .constructor(TaskList::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("taskList").build()).build(); private static final SdkField TASK_PRIORITY_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("taskPriority").getter(getter(WorkflowExecutionConfiguration::taskPriority)) .setter(setter(Builder::taskPriority)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("taskPriority").build()).build(); private static final SdkField CHILD_POLICY_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("childPolicy").getter(getter(WorkflowExecutionConfiguration::childPolicyAsString)) .setter(setter(Builder::childPolicy)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("childPolicy").build()).build(); private static final SdkField LAMBDA_ROLE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("lambdaRole").getter(getter(WorkflowExecutionConfiguration::lambdaRole)) .setter(setter(Builder::lambdaRole)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lambdaRole").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList( TASK_START_TO_CLOSE_TIMEOUT_FIELD, EXECUTION_START_TO_CLOSE_TIMEOUT_FIELD, TASK_LIST_FIELD, TASK_PRIORITY_FIELD, CHILD_POLICY_FIELD, LAMBDA_ROLE_FIELD)); private static final long serialVersionUID = 1L; private final String taskStartToCloseTimeout; private final String executionStartToCloseTimeout; private final TaskList taskList; private final String taskPriority; private final String childPolicy; private final String lambdaRole; private WorkflowExecutionConfiguration(BuilderImpl builder) { this.taskStartToCloseTimeout = builder.taskStartToCloseTimeout; this.executionStartToCloseTimeout = builder.executionStartToCloseTimeout; this.taskList = builder.taskList; this.taskPriority = builder.taskPriority; this.childPolicy = builder.childPolicy; this.lambdaRole = builder.lambdaRole; } /** *

* The maximum duration allowed for decision tasks for this workflow execution. *

*

* The duration is specified in seconds, an integer greater than or equal to 0. You can use * NONE to specify unlimited duration. *

* * @return The maximum duration allowed for decision tasks for this workflow execution.

*

* The duration is specified in seconds, an integer greater than or equal to 0. You can use * NONE to specify unlimited duration. */ public final String taskStartToCloseTimeout() { return taskStartToCloseTimeout; } /** *

* The total duration for this workflow execution. *

*

* The duration is specified in seconds, an integer greater than or equal to 0. You can use * NONE to specify unlimited duration. *

* * @return The total duration for this workflow execution.

*

* The duration is specified in seconds, an integer greater than or equal to 0. You can use * NONE to specify unlimited duration. */ public final String executionStartToCloseTimeout() { return executionStartToCloseTimeout; } /** *

* The task list used for the decision tasks generated for this workflow execution. *

* * @return The task list used for the decision tasks generated for this workflow execution. */ public final TaskList taskList() { return taskList; } /** *

* The priority assigned to decision tasks for this workflow execution. Valid values are integers that range from * Java's Integer.MIN_VALUE (-2147483648) to Integer.MAX_VALUE (2147483647). Higher * numbers indicate higher priority. *

*

* For more information about setting task priority, see Setting Task * Priority in the Amazon SWF Developer Guide. *

* * @return The priority assigned to decision tasks for this workflow execution. Valid values are integers that range * from Java's Integer.MIN_VALUE (-2147483648) to Integer.MAX_VALUE (2147483647). * Higher numbers indicate higher priority.

*

* For more information about setting task priority, see Setting Task * Priority in the Amazon SWF Developer Guide. */ public final String taskPriority() { return taskPriority; } /** *

* The policy to use for the child workflow executions if this workflow execution is terminated, by calling the * TerminateWorkflowExecution action explicitly or due to an expired timeout. *

*

* 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 to use for the child workflow executions if this workflow execution is terminated, by calling * the TerminateWorkflowExecution action explicitly or due to an expired timeout.

*

* 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 to use for the child workflow executions if this workflow execution is terminated, by calling the * TerminateWorkflowExecution action explicitly or due to an expired timeout. *

    *

    * 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 to use for the child workflow executions if this workflow execution is terminated, by calling * the TerminateWorkflowExecution action explicitly or due to an expired timeout.

    *

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

      * The IAM role attached to the child workflow execution. *

      * * @return The IAM role attached to the child workflow execution. */ public final String lambdaRole() { return lambdaRole; } @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(taskStartToCloseTimeout()); hashCode = 31 * hashCode + Objects.hashCode(executionStartToCloseTimeout()); hashCode = 31 * hashCode + Objects.hashCode(taskList()); hashCode = 31 * hashCode + Objects.hashCode(taskPriority()); hashCode = 31 * hashCode + Objects.hashCode(childPolicyAsString()); hashCode = 31 * hashCode + Objects.hashCode(lambdaRole()); 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 WorkflowExecutionConfiguration)) { return false; } WorkflowExecutionConfiguration other = (WorkflowExecutionConfiguration) obj; return Objects.equals(taskStartToCloseTimeout(), other.taskStartToCloseTimeout()) && Objects.equals(executionStartToCloseTimeout(), other.executionStartToCloseTimeout()) && Objects.equals(taskList(), other.taskList()) && Objects.equals(taskPriority(), other.taskPriority()) && Objects.equals(childPolicyAsString(), other.childPolicyAsString()) && Objects.equals(lambdaRole(), other.lambdaRole()); } /** * 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("WorkflowExecutionConfiguration").add("TaskStartToCloseTimeout", taskStartToCloseTimeout()) .add("ExecutionStartToCloseTimeout", executionStartToCloseTimeout()).add("TaskList", taskList()) .add("TaskPriority", taskPriority()).add("ChildPolicy", childPolicyAsString()).add("LambdaRole", lambdaRole()) .build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "taskStartToCloseTimeout": return Optional.ofNullable(clazz.cast(taskStartToCloseTimeout())); case "executionStartToCloseTimeout": return Optional.ofNullable(clazz.cast(executionStartToCloseTimeout())); case "taskList": return Optional.ofNullable(clazz.cast(taskList())); case "taskPriority": return Optional.ofNullable(clazz.cast(taskPriority())); case "childPolicy": return Optional.ofNullable(clazz.cast(childPolicyAsString())); case "lambdaRole": return Optional.ofNullable(clazz.cast(lambdaRole())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((WorkflowExecutionConfiguration) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

      * The maximum duration allowed for decision tasks for this workflow execution. *

      *

      * The duration is specified in seconds, an integer greater than or equal to 0. You can use * NONE to specify unlimited duration. *

      * * @param taskStartToCloseTimeout * The maximum duration allowed for decision tasks for this workflow execution.

      *

      * The duration is specified in seconds, an integer greater than or equal to 0. You can use * NONE to specify unlimited duration. * @return Returns a reference to this object so that method calls can be chained together. */ Builder taskStartToCloseTimeout(String taskStartToCloseTimeout); /** *

      * The total duration for this workflow execution. *

      *

      * The duration is specified in seconds, an integer greater than or equal to 0. You can use * NONE to specify unlimited duration. *

      * * @param executionStartToCloseTimeout * The total duration for this workflow execution.

      *

      * The duration is specified in seconds, an integer greater than or equal to 0. You can use * NONE to specify unlimited duration. * @return Returns a reference to this object so that method calls can be chained together. */ Builder executionStartToCloseTimeout(String executionStartToCloseTimeout); /** *

      * The task list used for the decision tasks generated for this workflow execution. *

      * * @param taskList * The task list used for the decision tasks generated for this workflow execution. * @return Returns a reference to this object so that method calls can be chained together. */ Builder taskList(TaskList taskList); /** *

      * The task list used for the decision tasks generated for this workflow execution. *

      * This is a convenience method that creates an instance of the {@link TaskList.Builder} avoiding the need to * create one manually via {@link TaskList#builder()}. * *

      * When the {@link Consumer} completes, {@link TaskList.Builder#build()} is called immediately and its result is * passed to {@link #taskList(TaskList)}. * * @param taskList * a consumer that will call methods on {@link TaskList.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #taskList(TaskList) */ default Builder taskList(Consumer taskList) { return taskList(TaskList.builder().applyMutation(taskList).build()); } /** *

      * The priority assigned to decision tasks for this workflow execution. Valid values are integers that range * from Java's Integer.MIN_VALUE (-2147483648) to Integer.MAX_VALUE (2147483647). * Higher numbers indicate higher priority. *

      *

      * For more information about setting task priority, see Setting Task * Priority in the Amazon SWF Developer Guide. *

      * * @param taskPriority * The priority assigned to decision tasks for this workflow execution. Valid values are integers that * range from Java's Integer.MIN_VALUE (-2147483648) to Integer.MAX_VALUE * (2147483647). Higher numbers indicate higher priority.

      *

      * For more information about setting task priority, see Setting * Task Priority in the Amazon SWF Developer Guide. * @return Returns a reference to this object so that method calls can be chained together. */ Builder taskPriority(String taskPriority); /** *

      * The policy to use for the child workflow executions if this workflow execution is terminated, by calling the * TerminateWorkflowExecution action explicitly or due to an expired timeout. *

      *

      * 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 to use for the child workflow executions if this workflow execution is terminated, by * calling the TerminateWorkflowExecution action explicitly or due to an expired timeout.

      *

      * 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 to use for the child workflow executions if this workflow execution is terminated, by calling the * TerminateWorkflowExecution action explicitly or due to an expired timeout. *

        *

        * 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 to use for the child workflow executions if this workflow execution is terminated, by * calling the TerminateWorkflowExecution action explicitly or due to an expired timeout.

        *

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

          * The IAM role attached to the child workflow execution. *

          * * @param lambdaRole * The IAM role attached to the child workflow execution. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lambdaRole(String lambdaRole); } static final class BuilderImpl implements Builder { private String taskStartToCloseTimeout; private String executionStartToCloseTimeout; private TaskList taskList; private String taskPriority; private String childPolicy; private String lambdaRole; private BuilderImpl() { } private BuilderImpl(WorkflowExecutionConfiguration model) { taskStartToCloseTimeout(model.taskStartToCloseTimeout); executionStartToCloseTimeout(model.executionStartToCloseTimeout); taskList(model.taskList); taskPriority(model.taskPriority); childPolicy(model.childPolicy); lambdaRole(model.lambdaRole); } public final String getTaskStartToCloseTimeout() { return taskStartToCloseTimeout; } public final void setTaskStartToCloseTimeout(String taskStartToCloseTimeout) { this.taskStartToCloseTimeout = taskStartToCloseTimeout; } @Override public final Builder taskStartToCloseTimeout(String taskStartToCloseTimeout) { this.taskStartToCloseTimeout = taskStartToCloseTimeout; return this; } public final String getExecutionStartToCloseTimeout() { return executionStartToCloseTimeout; } public final void setExecutionStartToCloseTimeout(String executionStartToCloseTimeout) { this.executionStartToCloseTimeout = executionStartToCloseTimeout; } @Override public final Builder executionStartToCloseTimeout(String executionStartToCloseTimeout) { this.executionStartToCloseTimeout = executionStartToCloseTimeout; return this; } public final TaskList.Builder getTaskList() { return taskList != null ? taskList.toBuilder() : null; } public final void setTaskList(TaskList.BuilderImpl taskList) { this.taskList = taskList != null ? taskList.build() : null; } @Override public final Builder taskList(TaskList taskList) { this.taskList = taskList; return this; } public final String getTaskPriority() { return taskPriority; } public final void setTaskPriority(String taskPriority) { this.taskPriority = taskPriority; } @Override public final Builder taskPriority(String taskPriority) { this.taskPriority = taskPriority; 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 getLambdaRole() { return lambdaRole; } public final void setLambdaRole(String lambdaRole) { this.lambdaRole = lambdaRole; } @Override public final Builder lambdaRole(String lambdaRole) { this.lambdaRole = lambdaRole; return this; } @Override public WorkflowExecutionConfiguration build() { return new WorkflowExecutionConfiguration(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy