Deletes the resource metrics configuration for an Amazon Web Services resource. After you delete the configuration, Amazon CloudWatch stops collecting detailed metrics for the resource. Metric data that Amazon CloudWatch already collected for the resource is not deleted.
This operation returns a ResourceNotFoundException if no resource metrics configuration exists for the specified resource ARN. Verify that the resource ARN is correct.
To delete a resource metrics configuration, you must have the cloudwatch:DeleteResourceMetricsConfiguration permission. For information about scoping this permission to specific resources, see Condition keys for resource metrics configuration access in the Amazon CloudWatch User Guide.
Parameters:
-
resource_arn
(Optional[ResourceArn], default:
None
)
–
The Amazon Resource Name (ARN) of the Amazon Web Services resource to delete the resource metrics configuration for.
Raises:
Source code in docs_src/capo_cloudwatch/_services/cloud_watch.py
| def delete_resource_metrics_configuration(
self,
*,
config_overrides: Optional[CloudWatchClientConfig] = None,
resource_arn: Optional["capo_cloudwatch.types.resource_arn.ResourceArn"] = None,
) -> "capo_cloudwatch.types.delete_resource_metrics_configuration_output.DeleteResourceMetricsConfigurationOutput":
"""<p>Deletes the resource metrics configuration for an Amazon Web Services resource. After you delete the configuration, Amazon CloudWatch stops collecting detailed metrics for the resource. Metric data that Amazon CloudWatch already collected for the resource is not deleted.</p> <p>This operation returns a <code>ResourceNotFoundException</code> if no resource metrics configuration exists for the specified resource ARN. Verify that the resource ARN is correct.</p> <p>To delete a resource metrics configuration, you must have the <code>cloudwatch:DeleteResourceMetricsConfiguration</code> permission. For information about scoping this permission to specific resources, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/iam-cw-condition-keys-resource-arn.html">Condition keys for resource metrics configuration access</a> in the <i>Amazon CloudWatch User Guide</i>.</p>
Args:
resource_arn: <p>The Amazon Resource Name (ARN) of the Amazon Web Services resource to delete the resource metrics configuration for.</p>
Raises:
capo_cloudwatch.errors.resource_not_found_exception.ResourceNotFoundException: <p>The named resource does not exist.</p>
capo_cloudwatch.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_cloudwatch.types.delete_resource_metrics_configuration_input.DeleteResourceMetricsConfigurationInput]",
) -> OperationResponse[
"capo_cloudwatch.types.delete_resource_metrics_configuration_output.DeleteResourceMetricsConfigurationOutput"
]:
import capo_cloudwatch._operations.granite_service_version20100801.delete_resource_metrics_configuration
output, http_response = (
capo_cloudwatch._operations.granite_service_version20100801.delete_resource_metrics_configuration.delete_resource_metrics_configuration(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("DeleteResourceMetricsConfiguration")
)
input_: capo_cloudwatch.types.delete_resource_metrics_configuration_input.DeleteResourceMetricsConfigurationInput = {}
if resource_arn is not None:
input_["resource_arn"] = resource_arn
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|