getProtectionStatus method

Future<GetProtectionStatusResponse> getProtectionStatus({
  1. required String policyId,
  2. DateTime? endTime,
  3. int? maxResults,
  4. String? memberAccountId,
  5. String? nextToken,
  6. DateTime? startTime,
})

If you created a Shield Advanced policy, returns policy-level attack summary information in the event of a potential DDoS attack. Other policy types are currently unsupported.

May throw InvalidInputException. May throw ResourceNotFoundException. May throw InternalErrorException.

Parameter policyId : The ID of the policy for which you want to get the attack information.

Parameter endTime : The end of the time period to query for the attacks. This is a timestamp type. The request syntax listing indicates a number type because the default used by AWS Firewall Manager is Unix time in seconds. However, any valid timestamp format is allowed.

Parameter maxResults : Specifies the number of objects that you want AWS Firewall Manager to return for this request. If you have more objects than the number that you specify for MaxResults, the response includes a NextToken value that you can use to get another batch of objects.

Parameter memberAccountId : The AWS account that is in scope of the policy that you want to get the details for.

Parameter nextToken : If you specify a value for MaxResults and you have more objects than the number that you specify for MaxResults, AWS Firewall Manager returns a NextToken value in the response, which you can use to retrieve another group of objects. For the second and subsequent GetProtectionStatus requests, specify the value of NextToken from the previous response to get information about another batch of objects.

Parameter startTime : The start of the time period to query for the attacks. This is a timestamp type. The request syntax listing indicates a number type because the default used by AWS Firewall Manager is Unix time in seconds. However, any valid timestamp format is allowed.

Implementation

Future<GetProtectionStatusResponse> getProtectionStatus({
  required String policyId,
  DateTime? endTime,
  int? maxResults,
  String? memberAccountId,
  String? nextToken,
  DateTime? startTime,
}) async {
  ArgumentError.checkNotNull(policyId, 'policyId');
  _s.validateStringLength(
    'policyId',
    policyId,
    36,
    36,
    isRequired: true,
  );
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  _s.validateStringLength(
    'memberAccountId',
    memberAccountId,
    1,
    1024,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    1,
    4096,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSFMS_20180101.GetProtectionStatus'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'PolicyId': policyId,
      if (endTime != null) 'EndTime': unixTimestampToJson(endTime),
      if (maxResults != null) 'MaxResults': maxResults,
      if (memberAccountId != null) 'MemberAccountId': memberAccountId,
      if (nextToken != null) 'NextToken': nextToken,
      if (startTime != null) 'StartTime': unixTimestampToJson(startTime),
    },
  );

  return GetProtectionStatusResponse.fromJson(jsonResponse.body);
}