listAttacks method
Returns all ongoing DDoS attacks or all DDoS attacks during a specified time period.
May throw InternalErrorException. May throw InvalidParameterException. May throw InvalidOperationException.
Parameter endTime :
The end of the time period for the attacks. This is a
timestamp type. The sample request above indicates a
number type because the default used by WAF is Unix time in
seconds. However any valid timestamp
format is allowed.
Parameter maxResults :
The maximum number of AttackSummary 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 ListAttacksRequest.NextMarker value from a previous call
to ListAttacksRequest. Pass null if this is the first call.
Parameter resourceArns :
The ARN (Amazon Resource Name) of the resource that was attacked. If this
is left blank, all applicable resources for this account will be included.
Parameter startTime :
The start of the time period for the attacks. This is a
timestamp type. The sample request above indicates a
number type because the default used by WAF is Unix time in
seconds. However any valid timestamp
format is allowed.
Implementation
Future<ListAttacksResponse> listAttacks({
TimeRange? endTime,
int? maxResults,
String? nextToken,
List<String>? resourceArns,
TimeRange? startTime,
}) 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.ListAttacks'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
if (endTime != null) 'EndTime': endTime,
if (maxResults != null) 'MaxResults': maxResults,
if (nextToken != null) 'NextToken': nextToken,
if (resourceArns != null) 'ResourceArns': resourceArns,
if (startTime != null) 'StartTime': startTime,
},
);
return ListAttacksResponse.fromJson(jsonResponse.body);
}