getTags method

Future<GetTagsResponse> getTags({
  1. required DateInterval timePeriod,
  2. String? nextPageToken,
  3. String? searchString,
  4. String? tagKey,
})

Queries for available tag keys and tag values for a specified period. You can search the tag values for an arbitrary string.

May throw LimitExceededException. May throw BillExpirationException. May throw DataUnavailableException. May throw InvalidNextTokenException. May throw RequestChangedException.

Parameter timePeriod : The start and end dates for retrieving the dimension values. The start date is inclusive, but the end date is exclusive. For example, if start is 2017-01-01 and end is 2017-05-01, then the cost and usage data is retrieved from 2017-01-01 up to and including 2017-04-30 but not including 2017-05-01.

Parameter nextPageToken : The token to retrieve the next set of results. AWS provides the token when the response from a previous call has more results than the maximum page size.

Parameter searchString : The value that you want to search for.

Parameter tagKey : The key of the tag that you want to return values for.

Implementation

Future<GetTagsResponse> getTags({
  required DateInterval timePeriod,
  String? nextPageToken,
  String? searchString,
  String? tagKey,
}) async {
  ArgumentError.checkNotNull(timePeriod, 'timePeriod');
  _s.validateStringLength(
    'nextPageToken',
    nextPageToken,
    0,
    8192,
  );
  _s.validateStringLength(
    'searchString',
    searchString,
    0,
    1024,
  );
  _s.validateStringLength(
    'tagKey',
    tagKey,
    0,
    1024,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSInsightsIndexService.GetTags'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'TimePeriod': timePeriod,
      if (nextPageToken != null) 'NextPageToken': nextPageToken,
      if (searchString != null) 'SearchString': searchString,
      if (tagKey != null) 'TagKey': tagKey,
    },
  );

  return GetTagsResponse.fromJson(jsonResponse.body);
}