untagResources method

Future<UntagResourcesOutput> untagResources({
  1. required List<String> resourceARNList,
  2. required List<String> tagKeys,
})

Removes the specified tags from the specified resources. When you specify a tag key, the action removes both that key and its associated value. The operation succeeds even if you attempt to remove tags from a resource that were already removed. Note the following:

  • To remove tags from a resource, you need the necessary permissions for the service that the resource belongs to as well as permissions for removing tags. For more information, see this list.
  • You can only tag resources that are located in the specified Region for the AWS account.

May throw InvalidParameterException. May throw ThrottledException. May throw InternalServiceException.

Parameter resourceARNList : A list of ARNs. An ARN (Amazon Resource Name) uniquely identifies a resource. For more information, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.

Parameter tagKeys : A list of the tag keys that you want to remove from the specified resources.

Implementation

Future<UntagResourcesOutput> untagResources({
  required List<String> resourceARNList,
  required List<String> tagKeys,
}) async {
  ArgumentError.checkNotNull(resourceARNList, 'resourceARNList');
  ArgumentError.checkNotNull(tagKeys, 'tagKeys');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'ResourceGroupsTaggingAPI_20170126.UntagResources'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ResourceARNList': resourceARNList,
      'TagKeys': tagKeys,
    },
  );

  return UntagResourcesOutput.fromJson(jsonResponse.body);
}