listProtectionGroups method

Future<ListProtectionGroupsResponse> listProtectionGroups({
  1. int? maxResults,
  2. String? nextToken,
})

Retrieves the ProtectionGroup objects for the account.

May throw InternalErrorException. May throw ResourceNotFoundException. May throw InvalidPaginationTokenException.

Parameter maxResults : The maximum number of ProtectionGroup objects to return. If you leave this blank, Shield Advanced returns the first 20 results.

This is a maximum value. Shield Advanced might return the results in smaller batches. That is, the number of objects returned could be less than MaxResults, even if there are still more objects yet to return. If there are more objects to return, Shield Advanced returns a value in NextToken that you can use in your next request, to get the next batch of objects.

Parameter nextToken : The next token value from a previous call to ListProtectionGroups. Pass null if this is the first call.

Implementation

Future<ListProtectionGroupsResponse> listProtectionGroups({
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    0,
    10000,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    1,
    4096,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSShield_20160616.ListProtectionGroups'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return ListProtectionGroupsResponse.fromJson(jsonResponse.body);
}