Skip to content

batch_get_task async

batch_get_task(
    environment_arn: EnvironmentArn,
    project: ProjectName,
    keys: TaskKeyList,
    *,
    config_overrides: Optional[AsyncAssuranceClientConfig] = None,
) -> BatchGetTaskOutput

Retrieves multiple tasks in a single request. Use it instead of calling GetTask for each task. If the operation can't return a task, it lists the task in errors and still succeeds.

Parameters:

  • environment_arn (EnvironmentArn) –

    The ARN of this governance environment.

  • project (ProjectName) –

    The name of the project.

  • keys (TaskKeyList) –

    The tasks to retrieve, 1 to 100 per request. Keys must be unique within a request.

Raises:

Examples:

Get multiple tasks Retrieves several payments-prod PCI-DSS remediation tasks in one request instead of calling GetTask for each.

>>> await client.batch_get_task(environment_arn='arn:aws:assurance:us-east-1:111122223333:environment/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111', project='payments-prod', keys=[{'framework': 'AWS:PCI-DSS', 'frameworkVersion': '4', 'controlId': '8.2.1', 'taskId': 'a1b2c3d4-5678-90ab-cdef-EXAMPLE66666'}, {'framework': 'AWS:PCI-DSS', 'frameworkVersion': '4', 'controlId': '8.2.1', 'taskId': 'a1b2c3d4-5678-90ab-cdef-EXAMPLE88888'}])
Source code in docs_src/capo_assurance/_services/async_assurance.py
async def batch_get_task(
    self,
    environment_arn: "capo_assurance.types.environment_arn.EnvironmentArn",
    project: "capo_assurance.types.project_name.ProjectName",
    keys: "capo_assurance.types.task_key_list.TaskKeyList",
    *,
    config_overrides: Optional[AsyncAssuranceClientConfig] = None,
) -> "capo_assurance.types.batch_get_task_output.BatchGetTaskOutput":
    """<p>Retrieves multiple tasks in a single request. Use it instead of calling <code>GetTask</code> for each task. If the operation can't return a task, it lists the task in <code>errors</code> and still succeeds.</p>

    Args:
        environment_arn: <p>The ARN of this governance environment.</p>
        project: <p>The name of the project.</p>
        keys: <p>The tasks to retrieve, 1 to 100 per request. Keys must be unique within a request.</p>

    Raises:
        capo_assurance.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action. This error occurs when the request is unauthenticated, or is authenticated but lacks permission to invoke the operation.</p>
        capo_assurance.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred.</p>
        capo_assurance.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource was not found.</p>
        capo_assurance.errors.throttling_exception.ThrottlingException: <p>The request was throttled.</p>
        capo_assurance.errors.validation_exception.ValidationException: <p>The request failed validation.</p>
        capo_assurance.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Get multiple tasks
        Retrieves several payments-prod PCI-DSS remediation tasks in one request instead of calling GetTask for each.

        >>> await client.batch_get_task(environment_arn='arn:aws:assurance:us-east-1:111122223333:environment/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111', project='payments-prod', keys=[{'framework': 'AWS:PCI-DSS', 'frameworkVersion': '4', 'controlId': '8.2.1', 'taskId': 'a1b2c3d4-5678-90ab-cdef-EXAMPLE66666'}, {'framework': 'AWS:PCI-DSS', 'frameworkVersion': '4', 'controlId': '8.2.1', 'taskId': 'a1b2c3d4-5678-90ab-cdef-EXAMPLE88888'}])
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_assurance.types.batch_get_task_input.BatchGetTaskInput]",
    ) -> AsyncOperationResponse[
        "capo_assurance.types.batch_get_task_output.BatchGetTaskOutput"
    ]:
        import capo_assurance._operations.assurance.batch_get_task

        (
            output,
            http_response,
        ) = await capo_assurance._operations.assurance.batch_get_task.async_batch_get_task(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_assurance.types.batch_get_task_output.BatchGetTaskOutput",
    ) -> dict[str, Any]:
        import capo_assurance.types.batch_get_task_output

        return capo_assurance.types.batch_get_task_output.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("BatchGetTask", redact_output=_redact_output),
    )
    input_: capo_assurance.types.batch_get_task_input.BatchGetTaskInput = {
        "environment_arn": environment_arn,
        "project": project,
        "keys": keys,
    }

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