delete_account_policy(
policy_name: PolicyName,
policy_type: PolicyType,
*,
config_overrides: Optional[CloudWatchLogsClientConfig] = None,
) -> None
Deletes a CloudWatch Logs account policy. This stops the account-wide policy from applying to log groups or data sources in the account. If you delete a data protection policy or subscription filter policy, any log-group level policies of those types remain in effect. This operation supports deletion of data source-based field index policies, including facet configurations, in addition to log group-based policies.
To use this operation, you must be signed on with the correct permissions depending on the type of policy that you are deleting.
-
To delete a data protection policy, you must have the logs:DeleteDataProtectionPolicy and logs:DeleteAccountPolicy permissions.
-
To delete a subscription filter policy, you must have the logs:DeleteSubscriptionFilter and logs:DeleteAccountPolicy permissions.
-
To delete a transformer policy, you must have the logs:DeleteTransformer and logs:DeleteAccountPolicy permissions.
-
To delete a field index policy, you must have the logs:DeleteIndexPolicy and logs:DeleteAccountPolicy permissions.
If you delete a field index policy that included facet configurations, those facets will no longer be available for interactive exploration in the CloudWatch Logs Insights console. However, facet data is retained for up to 30 days.
If you delete a field index policy, the indexing of the log events that happened before you deleted the policy will still be used for up to 30 days to improve CloudWatch Logs Insights queries.
Parameters:
-
policy_name
(PolicyName)
–
The name of the policy to delete.
-
policy_type
(PolicyType)
–
The type of policy to delete.
Raises:
Source code in docs_src/capo_cloudwatch_logs/_services/cloud_watch_logs.py
| def delete_account_policy(
self,
policy_name: "capo_cloudwatch_logs.types.policy_name.PolicyName",
policy_type: "capo_cloudwatch_logs.types.policy_type.PolicyType",
*,
config_overrides: Optional[CloudWatchLogsClientConfig] = None,
) -> None:
"""<p>Deletes a CloudWatch Logs account policy. This stops the account-wide policy from applying to log groups or data sources in the account. If you delete a data protection policy or subscription filter policy, any log-group level policies of those types remain in effect. This operation supports deletion of data source-based field index policies, including facet configurations, in addition to log group-based policies.</p> <p>To use this operation, you must be signed on with the correct permissions depending on the type of policy that you are deleting.</p> <ul> <li> <p>To delete a data protection policy, you must have the <code>logs:DeleteDataProtectionPolicy</code> and <code>logs:DeleteAccountPolicy</code> permissions.</p> </li> <li> <p>To delete a subscription filter policy, you must have the <code>logs:DeleteSubscriptionFilter</code> and <code>logs:DeleteAccountPolicy</code> permissions.</p> </li> <li> <p>To delete a transformer policy, you must have the <code>logs:DeleteTransformer</code> and <code>logs:DeleteAccountPolicy</code> permissions.</p> </li> <li> <p>To delete a field index policy, you must have the <code>logs:DeleteIndexPolicy</code> and <code>logs:DeleteAccountPolicy</code> permissions.</p> <p>If you delete a field index policy that included facet configurations, those facets will no longer be available for interactive exploration in the CloudWatch Logs Insights console. However, facet data is retained for up to 30 days.</p> </li> </ul> <p>If you delete a field index policy, the indexing of the log events that happened before you deleted the policy will still be used for up to 30 days to improve CloudWatch Logs Insights queries.</p>
Args:
policy_name: <p>The name of the policy to delete.</p>
policy_type: <p>The type of policy to delete.</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_account_policy_request.DeleteAccountPolicyRequest]",
) -> OperationResponse[None]:
import capo_cloudwatch_logs._operations.logs_20140328.delete_account_policy
output, http_response = (
capo_cloudwatch_logs._operations.logs_20140328.delete_account_policy.delete_account_policy(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("DeleteAccountPolicy")
)
input_: capo_cloudwatch_logs.types.delete_account_policy_request.DeleteAccountPolicyRequest = {
"policy_name": policy_name,
"policy_type": policy_type,
}
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|