listTags method

Future<ListTagsResponse> listTags({
  1. required String resourceId,
  2. int? maxResults,
  3. String? nextToken,
})

Gets a list of tags for the specified AWS CloudHSM cluster.

This is a paginated operation, which means that each response might contain only a subset of all the tags. When the response contains only a subset of tags, it includes a NextToken value. Use this value in a subsequent ListTags request to get more tags. When you receive a response with no NextToken (or an empty or null value), that means there are no more tags to get.

May throw CloudHsmAccessDeniedException. May throw CloudHsmInternalFailureException. May throw CloudHsmInvalidRequestException. May throw CloudHsmResourceNotFoundException. May throw CloudHsmServiceException. May throw CloudHsmTagException.

Parameter resourceId : The cluster identifier (ID) for the cluster whose tags you are getting. To find the cluster ID, use DescribeClusters.

Parameter maxResults : The maximum number of tags to return in the response. When there are more tags than the number you specify, the response contains a NextToken value.

Parameter nextToken : The NextToken value that you received in the previous response. Use this value to get more tags.

Implementation

Future<ListTagsResponse> listTags({
  required String resourceId,
  int? maxResults,
  String? nextToken,
}) async {
  ArgumentError.checkNotNull(resourceId, 'resourceId');
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    0,
    256,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'BaldrApiService.ListTags'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ResourceId': resourceId,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return ListTagsResponse.fromJson(jsonResponse.body);
}