untagResource method
Deletes the specified set of tag keys and their values from the specified Amazon Lightsail resource.
The untag resource
operation supports tag-based access
control via request tags and resource tags applied to the resource
identified by resource name
. For more information, see the Lightsail
Dev Guide.
May throw ServiceException. May throw InvalidInputException. May throw NotFoundException. May throw OperationFailureException. May throw AccessDeniedException. May throw AccountSetupInProgressException. May throw UnauthenticatedException.
Parameter resourceName
:
The name of the resource from which you are removing a tag.
Parameter tagKeys
:
The tag keys to delete from the specified resource.
Parameter resourceArn
:
The Amazon Resource Name (ARN) of the resource from which you want to
remove a tag.
Implementation
Future<UntagResourceResult> untagResource({
required String resourceName,
required List<String> tagKeys,
String? resourceArn,
}) async {
ArgumentError.checkNotNull(resourceName, 'resourceName');
ArgumentError.checkNotNull(tagKeys, 'tagKeys');
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'Lightsail_20161128.UntagResource'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'resourceName': resourceName,
'tagKeys': tagKeys,
if (resourceArn != null) 'resourceArn': resourceArn,
},
);
return UntagResourceResult.fromJson(jsonResponse.body);
}