Skip to content

batch_enable_standards async

batch_enable_standards(
    *,
    config_overrides: Optional[AsyncSecurityHubClientConfig] = None,
    standards_subscription_requests: Optional[StandardsSubscriptionRequests] = None,
) -> BatchEnableStandardsResponse

Enables the standards specified by the provided StandardsArn. To obtain the ARN for a standard, use the DescribeStandards operation.

For more information, see the Security Standards section of the Security Hub CSPM User Guide.

Parameters:

Raises:

  • AccessDeniedException –

    You don't have permission to perform the action specified in the request.

  • InternalException –

    Internal server error.

  • InvalidAccessException –

    The account doesn't have permission to perform this action.

  • InvalidInputException –

    The request was rejected because you supplied an invalid or out-of-range value for an input parameter.

  • LimitExceededException –

    The request was rejected because it attempted to create resources beyond the current Amazon Web Services account or throttling limits. The error code describes the limit exceeded.

  • UnknownServiceError –

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

Examples:

To enable security standards The following example enables the security standard specified by the StandardArn. You can use this operation to enable one or more Security Hub standards.

>>> await client.batch_enable_standards(standards_subscription_requests=[{'StandardsArn': 'arn:aws:securityhub:us-west-1::standards/pci-dss/v/3.2.1'}])
Source code in docs_src/capo_securityhub/_services/async_security_hub.py
async def batch_enable_standards(
    self,
    *,
    config_overrides: Optional[AsyncSecurityHubClientConfig] = None,
    standards_subscription_requests: Optional[
        "capo_securityhub.types.standards_subscription_requests.StandardsSubscriptionRequests"
    ] = None,
) -> "capo_securityhub.types.batch_enable_standards_response.BatchEnableStandardsResponse":
    """<p>Enables the standards specified by the provided <code>StandardsArn</code>. To obtain the ARN for a standard, use the <code>DescribeStandards</code> operation.</p> <p>For more information, see the <a href="https://docs.aws.amazon.com/securityhub/latest/userguide/securityhub-standards.html">Security Standards</a> section of the <i>Security Hub CSPM User Guide</i>.</p>

    Args:
        standards_subscription_requests: <p>The list of standards checks to enable.</p>

    Raises:
        capo_securityhub.errors.access_denied_exception.AccessDeniedException: <p>You don't have permission to perform the action specified in the request.</p>
        capo_securityhub.errors.internal_exception.InternalException: <p>Internal server error.</p>
        capo_securityhub.errors.invalid_access_exception.InvalidAccessException: <p>The account doesn't have permission to perform this action.</p>
        capo_securityhub.errors.invalid_input_exception.InvalidInputException: <p>The request was rejected because you supplied an invalid or out-of-range value for an input parameter.</p>
        capo_securityhub.errors.limit_exceeded_exception.LimitExceededException: <p>The request was rejected because it attempted to create resources beyond the current Amazon Web Services account or throttling limits. The error code describes the limit exceeded.</p>
        capo_securityhub.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To enable security standards
        The following example enables the security standard specified by the StandardArn. You can use this operation to enable one or more Security Hub standards.

        >>> await client.batch_enable_standards(standards_subscription_requests=[{'StandardsArn': 'arn:aws:securityhub:us-west-1::standards/pci-dss/v/3.2.1'}])
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_securityhub.types.batch_enable_standards_request.BatchEnableStandardsRequest]",
    ) -> AsyncOperationResponse[
        "capo_securityhub.types.batch_enable_standards_response.BatchEnableStandardsResponse"
    ]:
        import capo_securityhub._operations.security_hub_api_service.batch_enable_standards

        (
            output,
            http_response,
        ) = await capo_securityhub._operations.security_hub_api_service.batch_enable_standards.async_batch_enable_standards(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("BatchEnableStandards")
    )
    input_: capo_securityhub.types.batch_enable_standards_request.BatchEnableStandardsRequest = {}
    if standards_subscription_requests is not None:
        input_["standards_subscription_requests"] = standards_subscription_requests

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