untagResource method

Future<void> untagResource({
  1. required String resourceARN,
  2. required List<String> tagKeys,
})

Removes one or more tags from the specified resource. Currently, alarms, dashboards, metric streams and Contributor Insights rules support tagging.

May throw ConcurrentModificationException. May throw ConflictException. May throw InternalServiceFault. May throw InvalidParameterValueException. May throw ResourceNotFoundException.

Parameter resourceARN : The ARN of the CloudWatch resource that you're removing tags from.

The ARN format of an alarm is arn:aws:cloudwatch:Region:account-id:alarm:alarm-name

The ARN format of a Contributor Insights rule is arn:aws:cloudwatch:Region:account-id:insight-rule/insight-rule-name

The ARN format of a dashboard is arn:aws:cloudwatch::account-id:dashboard/dashboard-name

The ARN format of a metric stream is arn:aws:cloudwatch:Region:account-id:metric-stream/metric-stream-name

For more information about ARN format, see Resource Types Defined by Amazon CloudWatch in the Amazon Web Services General Reference.

Parameter tagKeys : The list of tag keys to remove from the resource.

Implementation

Future<void> untagResource({
  required String resourceARN,
  required List<String> tagKeys,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'GraniteServiceVersion20100801.UntagResource'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ResourceARN': resourceARN,
      'TagKeys': tagKeys,
    },
  );
}