Skip to content

enable async

enable(
    resource_types: EnableResourceTypeList,
    *,
    config_overrides: Optional[AsyncInspector2ClientConfig] = None,
    account_ids: Optional[AccountIdSet] = None,
    client_token: Optional[ClientToken] = None,
) -> EnableResponse

Enables Amazon Inspector scans for one or more Amazon Web Services accounts.

Parameters:

  • account_ids (Optional[AccountIdSet], default: None ) –

    A list of account IDs you want to enable Amazon Inspector scans for.

  • resource_types (EnableResourceTypeList) –

    The resource scan types you want to enable.

  • client_token (Optional[ClientToken], default: None ) –

    The idempotency token for the request.

Raises:

  • AccessDeniedException –

    You do not have sufficient access to perform this action.

    For Enable, you receive this error if you attempt to use a feature in an unsupported Amazon Web Services Region.

  • InternalServerException –

    The request has failed due to an internal failure of the Amazon Inspector service.

  • ResourceNotFoundException –

    The operation tried to access an invalid resource. Make sure the resource is specified correctly.

  • ThrottlingException –

    The limit on the number of requests per second was exceeded.

  • ValidationException –

    The request has failed validation due to missing required fields or having invalid inputs.

  • UnknownServiceError –

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

Source code in docs_src/capo_inspector2/_services/async_inspector2.py
async def enable(
    self,
    resource_types: "capo_inspector2.types.enable_resource_type_list.EnableResourceTypeList",
    *,
    config_overrides: Optional[AsyncInspector2ClientConfig] = None,
    account_ids: Optional[
        "capo_inspector2.types.account_id_set.AccountIdSet"
    ] = None,
    client_token: Optional["capo_inspector2.types.client_token.ClientToken"] = None,
) -> "capo_inspector2.types.enable_response.EnableResponse":
    """<p>Enables Amazon Inspector scans for one or more Amazon Web Services accounts.</p>

    Args:
        account_ids: <p>A list of account IDs you want to enable Amazon Inspector scans for.</p>
        resource_types: <p>The resource scan types you want to enable.</p>
        client_token: <p>The idempotency token for the request.</p>

    Raises:
        capo_inspector2.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p> <p> For <code>Enable</code>, you receive this error if you attempt to use a feature in an unsupported Amazon Web Services Region. </p>
        capo_inspector2.errors.internal_server_exception.InternalServerException: <p>The request has failed due to an internal failure of the Amazon Inspector service.</p>
        capo_inspector2.errors.resource_not_found_exception.ResourceNotFoundException: <p>The operation tried to access an invalid resource. Make sure the resource is specified correctly.</p>
        capo_inspector2.errors.throttling_exception.ThrottlingException: <p>The limit on the number of requests per second was exceeded.</p>
        capo_inspector2.errors.validation_exception.ValidationException: <p>The request has failed validation due to missing required fields or having invalid inputs.</p>
        capo_inspector2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_inspector2.types.enable_request.EnableRequest]",
    ) -> AsyncOperationResponse[
        "capo_inspector2.types.enable_response.EnableResponse"
    ]:
        import capo_inspector2._operations.inspector2.enable

        (
            output,
            http_response,
        ) = await capo_inspector2._operations.inspector2.enable.async_enable(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("Enable")
    )
    input_: capo_inspector2.types.enable_request.EnableRequest = {
        "resource_types": resource_types
    }
    if account_ids is not None:
        input_["account_ids"] = account_ids
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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