Skip to content

register_activity_type async

register_activity_type(
    domain: DomainName,
    name: Name,
    version: Version,
    *,
    config_overrides: Optional[AsyncSWFClientConfig] = None,
    description: Optional[Description] = None,
    default_task_start_to_close_timeout: Optional[DurationInSecondsOptional] = None,
    default_task_heartbeat_timeout: Optional[DurationInSecondsOptional] = None,
    default_task_list: Optional[TaskList] = None,
    default_task_priority: Optional[TaskPriority] = None,
    default_task_schedule_to_start_timeout: Optional[DurationInSecondsOptional] = None,
    default_task_schedule_to_close_timeout: Optional[DurationInSecondsOptional] = None,
) -> None

Registers a new activity type along with its configuration settings in the specified domain.

A TypeAlreadyExists fault is returned if the type already exists in the domain. You cannot change any configuration settings of the type after its registration, 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 this activity is to be registered.

  • name (Name) –

    The name of the activity type within the domain.

    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 activity type.

    The activity type consists of the name and version, the combination of which must be unique within the domain.

    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 ) –

    A textual description of the activity type.

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

    If set, specifies the default maximum duration that a worker can take to process tasks of this activity type. This default can be overridden when scheduling an activity task using the ScheduleActivityTask Decision.

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

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

    If set, specifies the default maximum time before which a worker processing a task of this type must report progress by calling RecordActivityTaskHeartbeat. If the timeout is exceeded, the activity task is automatically timed out. This default can be overridden when scheduling an activity task using the ScheduleActivityTask Decision. If the activity worker subsequently attempts to record a heartbeat or returns a result, the activity worker receives an UnknownResource fault. In this case, Amazon SWF no longer considers the activity task to be valid; the activity worker should clean up the activity task.

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

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

    If set, specifies the default task list to use for scheduling tasks of this activity type. This default task list is used if a task list isn't provided when a task is scheduled through the ScheduleActivityTask Decision.

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

    The default task priority to assign to the activity 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 in the Amazon SWF Developer Guide..

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

    If set, specifies the default maximum duration that a task of this activity type can wait before being assigned to a worker. This default can be overridden when scheduling an activity task using the ScheduleActivityTask Decision.

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

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

    If set, specifies the default maximum duration for a task of this activity type. This default can be overridden when scheduling an activity task using the ScheduleActivityTask Decision.

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

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/async_swf.py
async def register_activity_type(
    self,
    domain: "capo_swf.types.domain_name.DomainName",
    name: "capo_swf.types.name.Name",
    version: "capo_swf.types.version.Version",
    *,
    config_overrides: Optional[AsyncSWFClientConfig] = 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_task_heartbeat_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_task_schedule_to_start_timeout: Optional[
        "capo_swf.types.duration_in_seconds_optional.DurationInSecondsOptional"
    ] = None,
    default_task_schedule_to_close_timeout: Optional[
        "capo_swf.types.duration_in_seconds_optional.DurationInSecondsOptional"
    ] = None,
) -> None:
    r"""<p>Registers a new <i>activity type</i> along with its configuration settings in the specified domain.</p> <important> <p>A <code>TypeAlreadyExists</code> fault is returned if the type already exists in the domain. You cannot change any configuration settings of the type after its registration, 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 this activity is to be registered.</p>
        name: <p>The name of the activity type within the domain.</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 activity type.</p> <note> <p>The activity type consists of the name and version, the combination of which must be unique within the domain.</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>A textual description of the activity type.</p>
        default_task_start_to_close_timeout: <p>If set, specifies the default maximum duration that a worker can take to process tasks of this activity type. This default can be overridden when scheduling an activity task using the <code>ScheduleActivityTask</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_task_heartbeat_timeout: <p>If set, specifies the default maximum time before which a worker processing a task of this type must report progress by calling <a>RecordActivityTaskHeartbeat</a>. If the timeout is exceeded, the activity task is automatically timed out. This default can be overridden when scheduling an activity task using the <code>ScheduleActivityTask</code> <a>Decision</a>. If the activity worker subsequently attempts to record a heartbeat or returns a result, the activity worker receives an <code>UnknownResource</code> fault. In this case, Amazon SWF no longer considers the activity task to be valid; the activity worker should clean up the activity task.</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_task_list: <p>If set, specifies the default task list to use for scheduling tasks of this activity type. This default task list is used if a task list isn't provided when a task is scheduled through the <code>ScheduleActivityTask</code> <a>Decision</a>.</p>
        default_task_priority: <p>The default task priority to assign to the activity 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>in the <i>Amazon SWF Developer Guide</i>.</i>.</p>
        default_task_schedule_to_start_timeout: <p>If set, specifies the default maximum duration that a task of this activity type can wait before being assigned to a worker. This default can be overridden when scheduling an activity task using the <code>ScheduleActivityTask</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_task_schedule_to_close_timeout: <p>If set, specifies the default maximum duration for a task of this activity type. This default can be overridden when scheduling an activity task using the <code>ScheduleActivityTask</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>

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

    async def _handler(
        req: "AsyncOperationRequest[capo_swf.types.register_activity_type_input.RegisterActivityTypeInput]",
    ) -> AsyncOperationResponse[None]:
        import capo_swf._operations.simple_workflow_service.register_activity_type

        (
            output,
            http_response,
        ) = await capo_swf._operations.simple_workflow_service.register_activity_type.async_register_activity_type(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("RegisterActivityType")
    )
    input_: capo_swf.types.register_activity_type_input.RegisterActivityTypeInput = {
        "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_task_heartbeat_timeout is not None:
        input_["default_task_heartbeat_timeout"] = default_task_heartbeat_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_task_schedule_to_start_timeout is not None:
        input_["default_task_schedule_to_start_timeout"] = (
            default_task_schedule_to_start_timeout
        )
    if default_task_schedule_to_close_timeout is not None:
        input_["default_task_schedule_to_close_timeout"] = (
            default_task_schedule_to_close_timeout
        )

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output