listTagsForResource method

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

Lists all tags associated with the resource. This is a paginated API. To get the next page results, provide the pagination token from the response as part of your request. A null pagination token fetches the records from the beginning.

May throw ValidationException. May throw ResourceNotFoundException. May throw AccessDeniedException.

Parameter resourceARN : The ARN that specifies the resource whose tags you want to list.

Parameter maxResults : The maximum number of objects to return for the request.

Parameter nextToken : The next token from the previous results.

Implementation

Future<ListTagsForResourceResult> listTagsForResource({
  required String resourceARN,
  int? maxResults,
  String? nextToken,
}) async {
  ArgumentError.checkNotNull(resourceARN, 'resourceARN');
  _s.validateStringLength(
    'resourceARN',
    resourceARN,
    1,
    256,
    isRequired: true,
  );
  _s.validateNumRange(
    'maxResults',
    maxResults,
    50,
    50,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSHawksNestServiceFacade.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 ListTagsForResourceResult.fromJson(jsonResponse.body);
}