addTagsToResource method

Future<void> addTagsToResource({
  1. required String resourceId,
  2. required List<Tag> tags,
})

Adds or overwrites one or more tags for the specified directory. Each directory can have a maximum of 50 tags. Each tag consists of a key and optional value. Tag keys must be unique to each resource.

May throw EntityDoesNotExistException. May throw InvalidParameterException. May throw TagLimitExceededException. May throw ClientException. May throw ServiceException.

Parameter resourceId : Identifier (ID) for the directory to which to add the tag.

Parameter tags : The tags to be assigned to the directory.

Implementation

Future<void> addTagsToResource({
  required String resourceId,
  required List<Tag> tags,
}) async {
  ArgumentError.checkNotNull(resourceId, 'resourceId');
  ArgumentError.checkNotNull(tags, 'tags');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'DirectoryService_20150416.AddTagsToResource'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ResourceId': resourceId,
      'Tags': tags,
    },
  );
}