untagResource method

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

Removes any tags with the specified keys from the specified resource.

You can attach tags to the following resources in AWS Organizations.

  • AWS account
  • Organization root
  • Organizational unit (OU)
  • Policy (any type)
This operation can be called only from the organization's management account.

May throw AccessDeniedException. May throw ConcurrentModificationException. May throw AWSOrganizationsNotInUseException. May throw TargetNotFoundException. May throw ConstraintViolationException. May throw InvalidInputException. May throw ServiceException. May throw TooManyRequestsException.

Parameter resourceId : The ID of the resource to remove a tag from.

You can specify any of the following taggable resources.

  • AWS account – specify the account ID number.
  • Organizational unit – specify the OU ID that begins with ou- and looks similar to: ou-1a2b-34uvwxyz
  • Root – specify the root ID that begins with r- and looks similar to: r-1a2b
  • Policy – specify the policy ID that begins with p- andlooks similar to: p-12abcdefg3

Parameter tagKeys : The list of keys for tags to remove from the specified resource.

Implementation

Future<void> untagResource({
  required String resourceId,
  required List<String> tagKeys,
}) async {
  ArgumentError.checkNotNull(resourceId, 'resourceId');
  _s.validateStringLength(
    'resourceId',
    resourceId,
    0,
    130,
    isRequired: true,
  );
  ArgumentError.checkNotNull(tagKeys, 'tagKeys');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSOrganizationsV20161128.UntagResource'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ResourceId': resourceId,
      'TagKeys': tagKeys,
    },
  );
}