listTagsForResource method

Future<ListTagsForResourceResponse> listTagsForResource({
  1. required String resourceArn,
  2. int? maxResults,
  3. String? nextToken,
})

Lists the tags that you associated with the specified resource.

May throw ResourceNotFoundException. May throw InvalidParameterException. May throw InvalidNextTokenException. May throw InvalidRequestException. May throw InternalServiceErrorException. May throw ThrottlingException.

Parameter resourceArn : The Amazon Resource Name (ARN) for the resource that you want to list tags for.

Parameter maxResults : The maximum number of tags that you want to return in the response to a ListTagsForResource request. If you don't specify a value for MaxResults, Resolver returns up to 100 tags.

Parameter nextToken : For the first ListTagsForResource request, omit this value.

If you have more than MaxResults tags, you can submit another ListTagsForResource request to get the next group of tags for the resource. In the next request, specify the value of NextToken from the previous response.

Implementation

Future<ListTagsForResourceResponse> listTagsForResource({
  required String resourceArn,
  int? maxResults,
  String? nextToken,
}) async {
  ArgumentError.checkNotNull(resourceArn, 'resourceArn');
  _s.validateStringLength(
    'resourceArn',
    resourceArn,
    1,
    255,
    isRequired: true,
  );
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Route53Resolver.ListTagsForResource'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ResourceArn': resourceArn,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return ListTagsForResourceResponse.fromJson(jsonResponse.body);
}