Deletes a resource policy from this account. This revokes the access of the identities in that policy to put log events to this account.
Parameters:
-
policy_name
(Optional[PolicyName], default:
None
)
–
The name of the policy to be revoked. This parameter is required.
-
resource_arn
(Optional[Arn], default:
None
)
–
The ARN of the CloudWatch Logs resource for which the resource policy needs to be deleted
-
expected_revision_id
(Optional[ExpectedRevisionId], default:
None
)
–
The expected revision ID of the resource policy. Required when deleting a resource-scoped policy to prevent concurrent modifications.
Raises:
Source code in docs_src/capo_cloudwatch_logs/_services/cloud_watch_logs.py
| def delete_resource_policy(
self,
*,
config_overrides: Optional[CloudWatchLogsClientConfig] = None,
policy_name: Optional[
"capo_cloudwatch_logs.types.policy_name.PolicyName"
] = None,
resource_arn: Optional["capo_cloudwatch_logs.types.arn.Arn"] = None,
expected_revision_id: Optional[
"capo_cloudwatch_logs.types.expected_revision_id.ExpectedRevisionId"
] = None,
) -> None:
"""<p>Deletes a resource policy from this account. This revokes the access of the identities in that policy to put log events to this account.</p>
Args:
policy_name: <p>The name of the policy to be revoked. This parameter is required.</p>
resource_arn: <p>The ARN of the CloudWatch Logs resource for which the resource policy needs to be deleted</p>
expected_revision_id: <p>The expected revision ID of the resource policy. Required when deleting a resource-scoped policy to prevent concurrent modifications.</p>
Raises:
capo_cloudwatch_logs.errors.invalid_parameter_exception.InvalidParameterException: <p>A parameter is specified incorrectly.</p>
capo_cloudwatch_logs.errors.operation_aborted_exception.OperationAbortedException: <p>Multiple concurrent requests to update the same resource were in conflict.</p>
capo_cloudwatch_logs.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
capo_cloudwatch_logs.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service cannot complete the request.</p>
capo_cloudwatch_logs.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_cloudwatch_logs.types.delete_resource_policy_request.DeleteResourcePolicyRequest]",
) -> OperationResponse[None]:
import capo_cloudwatch_logs._operations.logs_20140328.delete_resource_policy
output, http_response = (
capo_cloudwatch_logs._operations.logs_20140328.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_cloudwatch_logs.types.delete_resource_policy_request.DeleteResourcePolicyRequest = {}
if policy_name is not None:
input_["policy_name"] = policy_name
if resource_arn is not None:
input_["resource_arn"] = resource_arn
if expected_revision_id is not None:
input_["expected_revision_id"] = expected_revision_id
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|