tagResource method

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

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. If existing tags are specified, however, then their values will be updated. When a resource is deleted, the tags associated with that resource are deleted as well.

May throw ResourceNotFoundException. May throw TooManyTagsException. May throw ValidationException.

Parameter resourceArn : The Amazon Resource Name (ARN) that identifies the resource for which to list the tags. The following resources are supported:

  • ConfigurationRecorder
  • ConfigRule
  • OrganizationConfigRule
  • ConformancePack
  • OrganizationConformancePack
  • ConfigurationAggregator
  • AggregationAuthorization
  • StoredQuery

Parameter tags : An array of tag object.

Implementation

Future<void> tagResource({
  required String resourceArn,
  required List<Tag> tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'StarlingDoveService.TagResource'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ResourceArn': resourceArn,
      'Tags': tags,
    },
  );
}