Skip to content

register_workflow_type

register_workflow_type(
    domain: DomainName,
    name: Name,
    version: Version,
    *,
    config_overrides: Optional[SWFClientConfig] = None,
    description: Optional[Description] = None,
    default_task_start_to_close_timeout: Optional[DurationInSecondsOptional] = None,
    default_execution_start_to_close_timeout: Optional[
        DurationInSecondsOptional
    ] = None,
    default_task_list: Optional[TaskList] = None,
    default_task_priority: Optional[TaskPriority] = None,
    default_child_policy: Optional[ChildPolicy] = None,
    default_lambda_role: Optional[Arn] = None,
) -> None

Registers a new workflow type and its configuration settings in the specified domain.

The retention period for the workflow history is set by the RegisterDomain action.

If the type already exists, then a TypeAlreadyExists fault is returned. You cannot change the configuration settings of a workflow type once it is registered and it must be registered as a new version.

Access Control

You can use IAM policies to control this action's access to Amazon SWF resources as follows:

  • Use a Resource element with the domain name to limit the action to only specified domains.

  • Use an Action element to allow or deny permission to call this action.

  • Constrain the following parameters by using a Condition element with the appropriate keys.

    • defaultTaskList.name: String constraint. The key is swf:defaultTaskList.name.

    • name: String constraint. The key is swf:name.

    • version: String constraint. The key is swf:version.

If the caller doesn't have sufficient permissions to invoke the action, or the parameter values fall outside the specified constraints, the action fails. The associated event attribute's cause parameter is set to OPERATION_NOT_PERMITTED. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF Developer Guide.

Parameters:

  • domain (DomainName) –

    The name of the domain in which to register the workflow type.

  • name (Name) –

    The name of the workflow type.

    The specified string must not contain a : (colon), / (slash), | (vertical bar), or any control characters (\u0000-\u001f | \u007f-\u009f). Also, it must not be the literal string arn.

  • version (Version) –

    The version of the workflow type.

    The workflow type consists of the name and version, the combination of which must be unique within the domain. To get a list of all currently registered workflow types, use the ListWorkflowTypes action.

    The specified string must not contain a : (colon), / (slash), | (vertical bar), or any control characters (\u0000-\u001f | \u007f-\u009f). Also, it must not be the literal string arn.

  • description (Optional[Description], default: None ) –

    Textual description of the workflow type.

  • default_task_start_to_close_timeout (Optional[DurationInSecondsOptional], default: None ) –

    If set, specifies the default maximum duration of decision tasks for this workflow type. This default can be overridden when starting a workflow execution using the StartWorkflowExecution action or the StartChildWorkflowExecution Decision.

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

  • default_execution_start_to_close_timeout (Optional[DurationInSecondsOptional], default: None ) –

    If set, specifies the default maximum duration for executions of this workflow type. You can override this default when starting an execution through the StartWorkflowExecution Action or StartChildWorkflowExecution Decision.

    The duration is specified in seconds; an integer greater than or equal to 0. Unlike some of the other timeout parameters in Amazon SWF, you cannot specify a value of "NONE" for defaultExecutionStartToCloseTimeout; there is a one-year max limit on the time that a workflow execution can run. Exceeding this limit always causes the workflow execution to time out.

  • default_task_list (Optional[TaskList], default: None ) –

    If set, specifies the default task list to use for scheduling decision tasks for executions of this workflow type. This default is used only if a task list isn't provided when starting the execution through the StartWorkflowExecution Action or StartChildWorkflowExecution Decision.

  • default_task_priority (Optional[TaskPriority], default: None ) –

    The default task priority to assign to the workflow type. If not assigned, then 0 is used. 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.

  • default_child_policy (Optional[ChildPolicy], default: None ) –

    If set, specifies the default policy to use for the child workflow executions when a workflow execution of this type is terminated, by calling the TerminateWorkflowExecution action explicitly or due to an expired timeout. This default can be overridden when starting a workflow execution using the StartWorkflowExecution action or the StartChildWorkflowExecution Decision.

    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.

  • default_lambda_role (Optional[Arn], default: None ) –

    The default IAM role attached to this workflow type.

    Executions of this workflow type need IAM roles to invoke Lambda functions. If you don't specify an IAM role when you start this workflow type, the default Lambda role is attached to the execution. For more information, see https://docs.aws.amazon.com/amazonswf/latest/developerguide/lambda-task.html in the Amazon SWF Developer Guide.

Raises:

  • LimitExceededFault –

    Returned by any operation if a system imposed limitation has been reached. To address this fault you should either clean up unused resources or increase the limit by contacting AWS.

  • OperationNotPermittedFault –

    Returned when the caller doesn't have sufficient permissions to invoke the action.

  • TypeAlreadyExistsFault –

    Returned if the type already exists in the specified domain. You may get this fault if you are registering a type that is either already registered or deprecated, or if you undeprecate a type that is currently registered.

  • UnknownResourceFault –

    Returned when the named resource cannot be found with in the scope of this operation (region or domain). This could happen if the named resource was never created or is no longer available for this operation.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_swf/_services/swf.py
def register_workflow_type(
    self,
    domain: "capo_swf.types.domain_name.DomainName",
    name: "capo_swf.types.name.Name",
    version: "capo_swf.types.version.Version",
    *,
    config_overrides: Optional[SWFClientConfig] = None,
    description: Optional["capo_swf.types.description.Description"] = None,
    default_task_start_to_close_timeout: Optional[
        "capo_swf.types.duration_in_seconds_optional.DurationInSecondsOptional"
    ] = None,
    default_execution_start_to_close_timeout: Optional[
        "capo_swf.types.duration_in_seconds_optional.DurationInSecondsOptional"
    ] = None,
    default_task_list: Optional["capo_swf.types.task_list.TaskList"] = None,
    default_task_priority: Optional[
        "capo_swf.types.task_priority.TaskPriority"
    ] = None,
    default_child_policy: Optional[
        "capo_swf.types.child_policy.ChildPolicy"
    ] = None,
    default_lambda_role: Optional["capo_swf.types.arn.Arn"] = None,
) -> None:
    r"""<p>Registers a new <i>workflow type</i> and its configuration settings in the specified domain.</p> <p>The retention period for the workflow history is set by the <a>RegisterDomain</a> action.</p> <important> <p>If the type already exists, then a <code>TypeAlreadyExists</code> fault is returned. You cannot change the configuration settings of a workflow type once it is registered and it must be registered as a new version.</p> </important> <p> <b>Access Control</b> </p> <p>You can use IAM policies to control this action's access to Amazon SWF resources as follows:</p> <ul> <li> <p>Use a <code>Resource</code> element with the domain name to limit the action to only specified domains.</p> </li> <li> <p>Use an <code>Action</code> element to allow or deny permission to call this action.</p> </li> <li> <p>Constrain the following parameters by using a <code>Condition</code> element with the appropriate keys.</p> <ul> <li> <p> <code>defaultTaskList.name</code>: String constraint. The key is <code>swf:defaultTaskList.name</code>.</p> </li> <li> <p> <code>name</code>: String constraint. The key is <code>swf:name</code>.</p> </li> <li> <p> <code>version</code>: String constraint. The key is <code>swf:version</code>.</p> </li> </ul> </li> </ul> <p>If the caller doesn't have sufficient permissions to invoke the action, or the parameter values fall outside the specified constraints, the action fails. The associated event attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>. For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.</p>

    Args:
        domain: <p>The name of the domain in which to register the workflow type.</p>
        name: <p>The name of the workflow type.</p> <p>The specified string must not contain a <code>:</code> (colon), <code>/</code> (slash), <code>|</code> (vertical bar), or any control characters (<code>\u0000-\u001f</code> | <code>\u007f-\u009f</code>). Also, it must <i>not</i> be the literal string <code>arn</code>.</p>
        version: <p>The version of the workflow type.</p> <note> <p>The workflow type consists of the name and version, the combination of which must be unique within the domain. To get a list of all currently registered workflow types, use the <a>ListWorkflowTypes</a> action.</p> </note> <p>The specified string must not contain a <code>:</code> (colon), <code>/</code> (slash), <code>|</code> (vertical bar), or any control characters (<code>\u0000-\u001f</code> | <code>\u007f-\u009f</code>). Also, it must <i>not</i> be the literal string <code>arn</code>.</p>
        description: <p>Textual description of the workflow type.</p>
        default_task_start_to_close_timeout: <p>If set, specifies the default maximum duration of decision tasks for this workflow type. This default can be overridden when starting a workflow execution using the <a>StartWorkflowExecution</a> action or the <code>StartChildWorkflowExecution</code> <a>Decision</a>.</p> <p>The duration is specified in seconds, an integer greater than or equal to <code>0</code>. You can use <code>NONE</code> to specify unlimited duration.</p>
        default_execution_start_to_close_timeout: <p>If set, specifies the default maximum duration for executions of this workflow type. You can override this default when starting an execution through the <a>StartWorkflowExecution</a> Action or <code>StartChildWorkflowExecution</code> <a>Decision</a>.</p> <p>The duration is specified in seconds; an integer greater than or equal to 0. Unlike some of the other timeout parameters in Amazon SWF, you cannot specify a value of "NONE" for <code>defaultExecutionStartToCloseTimeout</code>; there is a one-year max limit on the time that a workflow execution can run. Exceeding this limit always causes the workflow execution to time out.</p>
        default_task_list: <p>If set, specifies the default task list to use for scheduling decision tasks for executions of this workflow type. This default is used only if a task list isn't provided when starting the execution through the <a>StartWorkflowExecution</a> Action or <code>StartChildWorkflowExecution</code> <a>Decision</a>.</p>
        default_task_priority: <p>The default task priority to assign to the workflow type. If not assigned, then <code>0</code> is used. Valid values are integers that range from Java's <code>Integer.MIN_VALUE</code> (-2147483648) to <code>Integer.MAX_VALUE</code> (2147483647). Higher numbers indicate higher priority.</p> <p>For more information about setting task priority, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/programming-priority.html">Setting Task Priority</a> in the <i>Amazon SWF Developer Guide</i>.</p>
        default_child_policy: <p>If set, specifies the default policy to use for the child workflow executions when a workflow execution of this type is terminated, by calling the <a>TerminateWorkflowExecution</a> action explicitly or due to an expired timeout. This default can be overridden when starting a workflow execution using the <a>StartWorkflowExecution</a> action or the <code>StartChildWorkflowExecution</code> <a>Decision</a>.</p> <p>The supported child policies are:</p> <ul> <li> <p> <code>TERMINATE</code> – The child executions are terminated.</p> </li> <li> <p> <code>REQUEST_CANCEL</code> – A request to cancel is attempted for each child execution by recording a <code>WorkflowExecutionCancelRequested</code> event in its history. It is up to the decider to take appropriate actions when it receives an execution history with this event.</p> </li> <li> <p> <code>ABANDON</code> – No action is taken. The child executions continue to run.</p> </li> </ul>
        default_lambda_role: <p>The default IAM role attached to this workflow type.</p> <note> <p>Executions of this workflow type need IAM roles to invoke Lambda functions. If you don't specify an IAM role when you start this workflow type, the default Lambda role is attached to the execution. For more information, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/lambda-task.html">https://docs.aws.amazon.com/amazonswf/latest/developerguide/lambda-task.html</a> in the <i>Amazon SWF Developer Guide</i>.</p> </note>

    Raises:
        capo_swf.errors.limit_exceeded_fault.LimitExceededFault: <p>Returned by any operation if a system imposed limitation has been reached. To address this fault you should either clean up unused resources or increase the limit by contacting AWS.</p>
        capo_swf.errors.operation_not_permitted_fault.OperationNotPermittedFault: <p>Returned when the caller doesn't have sufficient permissions to invoke the action.</p>
        capo_swf.errors.type_already_exists_fault.TypeAlreadyExistsFault: <p>Returned if the type already exists in the specified domain. You may get this fault if you are registering a type that is either already registered or deprecated, or if you undeprecate a type that is currently registered.</p>
        capo_swf.errors.unknown_resource_fault.UnknownResourceFault: <p>Returned when the named resource cannot be found with in the scope of this operation (region or domain). This could happen if the named resource was never created or is no longer available for this operation.</p>
        capo_swf.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_swf.types.register_workflow_type_input.RegisterWorkflowTypeInput]",
    ) -> OperationResponse[None]:
        import capo_swf._operations.simple_workflow_service.register_workflow_type

        output, http_response = (
            capo_swf._operations.simple_workflow_service.register_workflow_type.register_workflow_type(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("RegisterWorkflowType")
    )
    input_: capo_swf.types.register_workflow_type_input.RegisterWorkflowTypeInput = {
        "domain": domain,
        "name": name,
        "version": version,
    }
    if description is not None:
        input_["description"] = description
    if default_task_start_to_close_timeout is not None:
        input_["default_task_start_to_close_timeout"] = (
            default_task_start_to_close_timeout
        )
    if default_execution_start_to_close_timeout is not None:
        input_["default_execution_start_to_close_timeout"] = (
            default_execution_start_to_close_timeout
        )
    if default_task_list is not None:
        input_["default_task_list"] = default_task_list
    if default_task_priority is not None:
        input_["default_task_priority"] = default_task_priority
    if default_child_policy is not None:
        input_["default_child_policy"] = default_child_policy
    if default_lambda_role is not None:
        input_["default_lambda_role"] = default_lambda_role

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output