Skip to content

delete_configuration_policy async

delete_configuration_policy(
    identifier: NonEmptyString,
    *,
    config_overrides: Optional[AsyncSecurityHubClientConfig] = None,
) -> DeleteConfigurationPolicyResponse

Deletes a configuration policy. Only the Security Hub CSPM delegated administrator can invoke this operation from the home Region. For the deletion to succeed, you must first disassociate a configuration policy from target accounts, organizational units, or the root by invoking the StartConfigurationPolicyDisassociation operation.

Parameters:

  • identifier (NonEmptyString) –

    The Amazon Resource Name (ARN) or universally unique identifier (UUID) of the configuration policy.

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.

  • ResourceConflictException –

    The resource specified in the request conflicts with an existing resource.

  • ResourceNotFoundException –

    The request was rejected because we can't find the specified resource.

  • UnknownServiceError –

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

Examples:

To delete a configuration policy This operation deletes the specified configuration policy.

>>> await client.delete_configuration_policy(identifier='arn:aws:securityhub:us-east-1:123456789012:configuration-policy/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111')
Source code in docs_src/capo_securityhub/_services/async_security_hub.py
async def delete_configuration_policy(
    self,
    identifier: "capo_securityhub.types.non_empty_string.NonEmptyString",
    *,
    config_overrides: Optional[AsyncSecurityHubClientConfig] = None,
) -> "capo_securityhub.types.delete_configuration_policy_response.DeleteConfigurationPolicyResponse":
    """<p> Deletes a configuration policy. Only the Security Hub CSPM delegated administrator can invoke this operation from the home Region. For the deletion to succeed, you must first disassociate a configuration policy from target accounts, organizational units, or the root by invoking the <code>StartConfigurationPolicyDisassociation</code> operation. </p>

    Args:
        identifier: <p> The Amazon Resource Name (ARN) or universally unique identifier (UUID) of the configuration policy. </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.resource_conflict_exception.ResourceConflictException: <p>The resource specified in the request conflicts with an existing resource.</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.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To delete a configuration policy
        This operation deletes the specified configuration policy.

        >>> await client.delete_configuration_policy(identifier='arn:aws:securityhub:us-east-1:123456789012:configuration-policy/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_securityhub.types.delete_configuration_policy_request.DeleteConfigurationPolicyRequest]",
    ) -> AsyncOperationResponse[
        "capo_securityhub.types.delete_configuration_policy_response.DeleteConfigurationPolicyResponse"
    ]:
        import capo_securityhub._operations.security_hub_api_service.delete_configuration_policy

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteConfigurationPolicy")
    )
    input_: capo_securityhub.types.delete_configuration_policy_request.DeleteConfigurationPolicyRequest = {
        "identifier": identifier
    }

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