Skip to content

enable_security_hub_feature_v2

enable_security_hub_feature_v2(
    feature_name: FeatureName,
    *,
    config_overrides: Optional[SecurityHubClientConfig] = None,
) -> EnableSecurityHubFeatureV2Response

Enables an opt-in feature for the calling account in the current Amazon Web Services Region. The service must be enabled before you can enable a feature. The operation is idempotent. If the feature is already enabled, no changes are made. You cannot enable a feature that is managed by an organization policy.

Parameters:

  • feature_name (FeatureName) –

    The name of the feature to enable.

Raises:

Source code in docs_src/capo_securityhub/_services/security_hub.py
def enable_security_hub_feature_v2(
    self,
    feature_name: "capo_securityhub.types.feature_name.FeatureName",
    *,
    config_overrides: Optional[SecurityHubClientConfig] = None,
) -> "capo_securityhub.types.enable_security_hub_feature_v2_response.EnableSecurityHubFeatureV2Response":
    """<p>Enables an opt-in feature for the calling account in the current Amazon Web Services Region. The service must be enabled before you can enable a feature. The operation is idempotent. If the feature is already enabled, no changes are made. You cannot enable a feature that is managed by an organization policy.</p>

    Args:
        feature_name: <p>The name of the feature 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_server_exception.InternalServerException: <p> The request has failed due to an internal failure of the service. </p>
        capo_securityhub.errors.resource_not_found_exception.ResourceNotFoundException: <p>The request was rejected because we can't find the specified resource.</p>
        capo_securityhub.errors.throttling_exception.ThrottlingException: <p> The limit on the number of requests per second was exceeded. </p>
        capo_securityhub.errors.validation_exception.ValidationException: <p>The request has failed validation because it's missing required fields or has invalid inputs.</p>
        capo_securityhub.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_securityhub.types.enable_security_hub_feature_v2_request.EnableSecurityHubFeatureV2Request]",
    ) -> OperationResponse[
        "capo_securityhub.types.enable_security_hub_feature_v2_response.EnableSecurityHubFeatureV2Response"
    ]:
        import capo_securityhub._operations.security_hub_api_service.enable_security_hub_feature_v2

        output, http_response = (
            capo_securityhub._operations.security_hub_api_service.enable_security_hub_feature_v2.enable_security_hub_feature_v2(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("EnableSecurityHubFeatureV2")
    )
    input_: capo_securityhub.types.enable_security_hub_feature_v2_request.EnableSecurityHubFeatureV2Request = {
        "feature_name": feature_name
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output