addTags method

Future<AddTagsOutput> addTags({
  1. required String resourceId,
  2. required TaggableResourceType resourceType,
  3. required List<Tag> tags,
})

Adds one or more tags to an object, up to a limit of 10. Each tag consists of a key and an optional value. If you add a tag using a key that is already associated with the ML object, AddTags updates the tag's value.

May throw InvalidInputException. May throw InvalidTagException. May throw TagLimitExceededException. May throw ResourceNotFoundException. May throw InternalServerException.

Parameter resourceId : The ID of the ML object to tag. For example, exampleModelId.

Parameter resourceType : The type of the ML object to tag.

Parameter tags : The key-value pairs to use to create tags. If you specify a key without specifying a value, Amazon ML creates a tag with the specified key and a value of null.

Implementation

Future<AddTagsOutput> addTags({
  required String resourceId,
  required TaggableResourceType resourceType,
  required List<Tag> tags,
}) async {
  ArgumentError.checkNotNull(resourceId, 'resourceId');
  _s.validateStringLength(
    'resourceId',
    resourceId,
    1,
    64,
    isRequired: true,
  );
  ArgumentError.checkNotNull(resourceType, 'resourceType');
  ArgumentError.checkNotNull(tags, 'tags');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonML_20141212.AddTags'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ResourceId': resourceId,
      'ResourceType': resourceType.toValue(),
      'Tags': tags,
    },
  );

  return AddTagsOutput.fromJson(jsonResponse.body);
}