tagResource method
Associates the specified tags to a resource with the specified
resourceArn
. If existing tags on a resource are not specified
in the request parameters, they are not changed. When a resource is
deleted, the tags associated with that resource are also deleted.
May throw ArgumentException. May throw NotFoundException. May throw TagOperationException. May throw TooManyTagsException. May throw TagPolicyException.
Parameter resourceARN
:
The Amazon Resource Name (ARN) of the resource or resources to which to
add tags. You can associate tags with the following Device Farm resources:
PROJECT
, RUN
, NETWORK_PROFILE
,
INSTANCE_PROFILE
, DEVICE_INSTANCE
,
SESSION
, DEVICE_POOL
, DEVICE
, and
VPCE_CONFIGURATION
.
Parameter tags
:
The tags to add to the resource. A tag is an array of key-value pairs. Tag
keys can have a maximum character length of 128 characters. Tag values can
have a maximum length of 256 characters.
Implementation
Future<void> tagResource({
required String resourceARN,
required List<Tag> tags,
}) async {
ArgumentError.checkNotNull(resourceARN, 'resourceARN');
_s.validateStringLength(
'resourceARN',
resourceARN,
32,
1011,
isRequired: true,
);
ArgumentError.checkNotNull(tags, 'tags');
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'DeviceFarm_20150623.TagResource'
};
await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'ResourceARN': resourceARN,
'Tags': tags,
},
);
}