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 AWS Firewall Manager policy and AWS account.

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

Parameter memberAccount : The AWS account ID that you want the details for.

Parameter policyId : The ID of the AWS Firewall Manager policy that you want the details for. This currently only supports security group content audit policies.

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

Parameter resourceType : The resource type. This is in the format shown in the AWS Resource Types Reference. Supported resource types are: 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 {
  ArgumentError.checkNotNull(memberAccount, 'memberAccount');
  _s.validateStringLength(
    'memberAccount',
    memberAccount,
    1,
    1024,
    isRequired: true,
  );
  ArgumentError.checkNotNull(policyId, 'policyId');
  _s.validateStringLength(
    'policyId',
    policyId,
    36,
    36,
    isRequired: true,
  );
  ArgumentError.checkNotNull(resourceId, 'resourceId');
  _s.validateStringLength(
    'resourceId',
    resourceId,
    1,
    1024,
    isRequired: true,
  );
  ArgumentError.checkNotNull(resourceType, 'resourceType');
  _s.validateStringLength(
    'resourceType',
    resourceType,
    1,
    128,
    isRequired: true,
  );
  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);
}