tagResource method

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

Associates a set of tags with a specified resource.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter resourceArn : The ARN of the resource with the tags to be listed.

Parameter tags : A set of key-value pairs that are used to manage the resource.

Parameter instanceArn : The ARN of the IAM Identity Center instance under which the operation will be executed. For more information about ARNs, see Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces in the Amazon Web Services General Reference.

Implementation

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