addTags method
Adds or overwrites one or more tags for the specified Amazon SageMaker resource. You can add tags to notebook instances, training jobs, hyperparameter tuning jobs, batch transform jobs, models, labeling jobs, work teams, endpoint configurations, and endpoints.
Each tag consists of a key and an optional value. Tag keys must be unique per resource. For more information about tags, see For more information, see AWS Tagging Strategies.
Parameter resourceArn
:
The Amazon Resource Name (ARN) of the resource that you want to tag.
Parameter tags
:
An array of key-value pairs. You can use tags to categorize your AWS
resources in different ways, for example, by purpose, owner, or
environment. For more information, see Tagging
AWS Resources.
Implementation
Future<AddTagsOutput> addTags({
required String resourceArn,
required List<Tag> tags,
}) async {
ArgumentError.checkNotNull(resourceArn, 'resourceArn');
_s.validateStringLength(
'resourceArn',
resourceArn,
0,
256,
isRequired: true,
);
ArgumentError.checkNotNull(tags, 'tags');
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'SageMaker.AddTags'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'ResourceArn': resourceArn,
'Tags': tags,
},
);
return AddTagsOutput.fromJson(jsonResponse.body);
}