listProtections method

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

Lists all Protection objects for the account.

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

Parameter maxResults : The maximum number of Protection 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 ListProtectionsRequest.NextToken value from a previous call to ListProtections. Pass null if this is the first call.

Implementation

Future<ListProtectionsResponse> listProtections({
  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.ListProtections'
  };
  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 ListProtectionsResponse.fromJson(jsonResponse.body);
}