Skip to content

delete_resource_policy

delete_resource_policy(
    policy_name: PolicyName,
    *,
    config_overrides: Optional[XRayClientConfig] = None,
    policy_revision_id: Optional[PolicyRevisionId] = None,
) -> DeleteResourcePolicyResult

Deletes a resource policy from the target Amazon Web Services account.

Parameters:

  • policy_name (PolicyName) –

    The name of the resource policy to delete.

  • policy_revision_id (Optional[PolicyRevisionId], default: None ) –

    Specifies a specific policy revision to delete. Provide a PolicyRevisionId to ensure an atomic delete operation. If the provided revision id does not match the latest policy revision id, an InvalidPolicyRevisionIdException exception is returned.

Raises:

  • InvalidPolicyRevisionIdException –

    A policy revision id was provided which does not match the latest policy revision. This exception is also if a policy revision id of 0 is provided via PutResourcePolicy and a policy with the same name already exists.

  • InvalidRequestException –

    The request is missing required parameters or has invalid parameters.

  • ThrottledException –

    The request exceeds the maximum number of requests per second.

  • UnknownServiceError –

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

Source code in docs_src/capo_xray/_services/x_ray.py
def delete_resource_policy(
    self,
    policy_name: "capo_xray.types.policy_name.PolicyName",
    *,
    config_overrides: Optional[XRayClientConfig] = None,
    policy_revision_id: Optional[
        "capo_xray.types.policy_revision_id.PolicyRevisionId"
    ] = None,
) -> "capo_xray.types.delete_resource_policy_result.DeleteResourcePolicyResult":
    """<p>Deletes a resource policy from the target Amazon Web Services account.</p>

    Args:
        policy_name: <p>The name of the resource policy to delete.</p>
        policy_revision_id: <p>Specifies a specific policy revision to delete. Provide a <code>PolicyRevisionId</code> to ensure an atomic delete operation. If the provided revision id does not match the latest policy revision id, an <code>InvalidPolicyRevisionIdException</code> exception is returned. </p>

    Raises:
        capo_xray.errors.invalid_policy_revision_id_exception.InvalidPolicyRevisionIdException: <p>A policy revision id was provided which does not match the latest policy revision. This exception is also if a policy revision id of 0 is provided via <code>PutResourcePolicy</code> and a policy with the same name already exists.</p>
        capo_xray.errors.invalid_request_exception.InvalidRequestException: <p>The request is missing required parameters or has invalid parameters.</p>
        capo_xray.errors.throttled_exception.ThrottledException: <p>The request exceeds the maximum number of requests per second.</p>
        capo_xray.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_xray.types.delete_resource_policy_request.DeleteResourcePolicyRequest]",
    ) -> OperationResponse[
        "capo_xray.types.delete_resource_policy_result.DeleteResourcePolicyResult"
    ]:
        import capo_xray._operations.awsx_ray.delete_resource_policy

        output, http_response = (
            capo_xray._operations.awsx_ray.delete_resource_policy.delete_resource_policy(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteResourcePolicy")
    )
    input_: capo_xray.types.delete_resource_policy_request.DeleteResourcePolicyRequest = {
        "policy_name": policy_name
    }
    if policy_revision_id is not None:
        input_["policy_revision_id"] = policy_revision_id

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