Skip to content

submit_task_state_change async

submit_task_state_change(
    *,
    config_overrides: Optional[AsyncECSClientConfig] = None,
    cluster: Optional[String] = None,
    task: Optional[String] = None,
    status: Optional[String] = None,
    reason: Optional[String] = None,
    containers: Optional[ContainerStateChanges] = None,
    attachments: Optional[AttachmentStateChanges] = None,
    managed_agents: Optional[ManagedAgentStateChanges] = None,
    pull_started_at: Optional[Timestamp] = None,
    pull_stopped_at: Optional[Timestamp] = None,
    execution_stopped_at: Optional[Timestamp] = None,
) -> SubmitTaskStateChangeResponse

This action is only used by the Amazon ECS agent, and it is not intended for use outside of the agent.

Sent to acknowledge that a task changed states.

Parameters:

  • cluster (Optional[String], default: None ) –

    The short name or full Amazon Resource Name (ARN) of the cluster that hosts the task.

  • task (Optional[String], default: None ) –

    The task ID or full ARN of the task in the state change request.

  • status (Optional[String], default: None ) –

    The status of the state change request.

  • reason (Optional[String], default: None ) –

    The reason for the state change request.

  • containers (Optional[ContainerStateChanges], default: None ) –

    Any containers that's associated with the state change request.

  • attachments (Optional[AttachmentStateChanges], default: None ) –

    Any attachments associated with the state change request.

  • managed_agents (Optional[ManagedAgentStateChanges], default: None ) –

    The details for the managed agent that's associated with the task.

  • pull_started_at (Optional[Timestamp], default: None ) –

    The Unix timestamp for the time when the container image pull started.

  • pull_stopped_at (Optional[Timestamp], default: None ) –

    The Unix timestamp for the time when the container image pull completed.

  • execution_stopped_at (Optional[Timestamp], default: None ) –

    The Unix timestamp for the time when the task execution stopped.

Raises:

  • AccessDeniedException –

    You don't have authorization to perform the requested action.

  • ClientException –

    These errors are usually caused by a client action. This client action might be using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Or, it might be specifying an identifier that isn't valid.

  • ClusterNotFoundException –

    The specified cluster wasn't found. You can view your available clusters with ListClusters. Amazon ECS clusters are Region specific.

  • InvalidParameterException –

    The specified parameter isn't valid. Review the available parameters for the API request.

    For more information about service event errors, see Amazon ECS service event messages.

  • ServerException –

    These errors are usually caused by a server issue.

  • UnknownServiceError –

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

Source code in docs_src/capo_ecs/_services/async_ecs.py
async def submit_task_state_change(
    self,
    *,
    config_overrides: Optional[AsyncECSClientConfig] = None,
    cluster: Optional["capo_ecs.types.string.String"] = None,
    task: Optional["capo_ecs.types.string.String"] = None,
    status: Optional["capo_ecs.types.string.String"] = None,
    reason: Optional["capo_ecs.types.string.String"] = None,
    containers: Optional[
        "capo_ecs.types.container_state_changes.ContainerStateChanges"
    ] = None,
    attachments: Optional[
        "capo_ecs.types.attachment_state_changes.AttachmentStateChanges"
    ] = None,
    managed_agents: Optional[
        "capo_ecs.types.managed_agent_state_changes.ManagedAgentStateChanges"
    ] = None,
    pull_started_at: Optional["capo_ecs.types.timestamp.Timestamp"] = None,
    pull_stopped_at: Optional["capo_ecs.types.timestamp.Timestamp"] = None,
    execution_stopped_at: Optional["capo_ecs.types.timestamp.Timestamp"] = None,
) -> (
    "capo_ecs.types.submit_task_state_change_response.SubmitTaskStateChangeResponse"
):
    """<note> <p>This action is only used by the Amazon ECS agent, and it is not intended for use outside of the agent.</p> </note> <p>Sent to acknowledge that a task changed states.</p>

    Args:
        cluster: <p>The short name or full Amazon Resource Name (ARN) of the cluster that hosts the task.</p>
        task: <p>The task ID or full ARN of the task in the state change request.</p>
        status: <p>The status of the state change request.</p>
        reason: <p>The reason for the state change request.</p>
        containers: <p>Any containers that's associated with the state change request.</p>
        attachments: <p>Any attachments associated with the state change request.</p>
        managed_agents: <p>The details for the managed agent that's associated with the task.</p>
        pull_started_at: <p>The Unix timestamp for the time when the container image pull started.</p>
        pull_stopped_at: <p>The Unix timestamp for the time when the container image pull completed.</p>
        execution_stopped_at: <p>The Unix timestamp for the time when the task execution stopped.</p>

    Raises:
        capo_ecs.errors.access_denied_exception.AccessDeniedException: <p>You don't have authorization to perform the requested action.</p>
        capo_ecs.errors.client_exception.ClientException: <p>These errors are usually caused by a client action. This client action might be using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Or, it might be specifying an identifier that isn't valid.</p>
        capo_ecs.errors.cluster_not_found_exception.ClusterNotFoundException: <p>The specified cluster wasn't found. You can view your available clusters with <a href="https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ListClusters.html">ListClusters</a>. Amazon ECS clusters are Region specific.</p>
        capo_ecs.errors.invalid_parameter_exception.InvalidParameterException: <p>The specified parameter isn't valid. Review the available parameters for the API request.</p> <p>For more information about service event errors, see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-event-messages-list.html">Amazon ECS service event messages</a>. </p>
        capo_ecs.errors.server_exception.ServerException: <p>These errors are usually caused by a server issue.</p>
        capo_ecs.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ecs.types.submit_task_state_change_request.SubmitTaskStateChangeRequest]",
    ) -> AsyncOperationResponse[
        "capo_ecs.types.submit_task_state_change_response.SubmitTaskStateChangeResponse"
    ]:
        import capo_ecs._operations.amazon_ec2_container_service_v20141113.submit_task_state_change

        (
            output,
            http_response,
        ) = await capo_ecs._operations.amazon_ec2_container_service_v20141113.submit_task_state_change.async_submit_task_state_change(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("SubmitTaskStateChange")
    )
    input_: capo_ecs.types.submit_task_state_change_request.SubmitTaskStateChangeRequest = {}
    if cluster is not None:
        input_["cluster"] = cluster
    if task is not None:
        input_["task"] = task
    if status is not None:
        input_["status"] = status
    if reason is not None:
        input_["reason"] = reason
    if containers is not None:
        input_["containers"] = containers
    if attachments is not None:
        input_["attachments"] = attachments
    if managed_agents is not None:
        input_["managed_agents"] = managed_agents
    if pull_started_at is not None:
        input_["pull_started_at"] = pull_started_at
    if pull_stopped_at is not None:
        input_["pull_stopped_at"] = pull_stopped_at
    if execution_stopped_at is not None:
        input_["execution_stopped_at"] = execution_stopped_at

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