tagResource method

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

Tags a resource using the resource's ARN and desired tags.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerErrorException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter resourceArn : The ARN of the resource to apply tags to.

Parameter tags : Each tag consists of a tag key and a tag value. Tag keys and values are both required, but tag values can be empty strings.

Implementation

Future<void> tagResource({
  required String resourceArn,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/2023-10-12/tags/${Uri.encodeComponent(resourceArn)}',
    exceptionFnMap: _exceptionFns,
  );
}