getViolationDetails method

Future<GetViolationDetailsResponse> getViolationDetails({
  1. required String memberAccount,
  2. required String policyId,
  3. required String resourceId,
  4. required String resourceType,
})

Retrieves violations for a resource based on the specified Firewall Manager policy and Amazon Web Services account.

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

Parameter memberAccount : The Amazon Web Services account ID that you want the details for.

Parameter policyId : The ID of the Firewall Manager policy that you want the details for. You can get violation details for the following policy types:

  • WAF
  • DNS Firewall
  • Imported Network Firewall
  • Network Firewall
  • Security group content audit
  • Network ACL
  • Third-party firewall

Parameter resourceId : The ID of the resource that has violations.

Parameter resourceType : The resource type. This is in the format shown in the Amazon Web Services Resource Types Reference. Supported resource types are: AWS::WAFv2::WebACL, AWS::EC2::Instance, AWS::EC2::NetworkInterface, AWS::EC2::SecurityGroup, AWS::NetworkFirewall::FirewallPolicy, and AWS::EC2::Subnet.

Implementation

Future<GetViolationDetailsResponse> getViolationDetails({
  required String memberAccount,
  required String policyId,
  required String resourceId,
  required String resourceType,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSFMS_20180101.GetViolationDetails'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'MemberAccount': memberAccount,
      'PolicyId': policyId,
      'ResourceId': resourceId,
      'ResourceType': resourceType,
    },
  );

  return GetViolationDetailsResponse.fromJson(jsonResponse.body);
}