createFirewallPolicy method

Future<CreateFirewallPolicyResponse> createFirewallPolicy({
  1. required FirewallPolicy firewallPolicy,
  2. required String firewallPolicyName,
  3. String? description,
  4. bool? dryRun,
  5. EncryptionConfiguration? encryptionConfiguration,
  6. List<Tag>? tags,
})

Creates the firewall policy for the firewall according to the specifications.

An Network Firewall firewall policy defines the behavior of a firewall, in a collection of stateless and stateful rule groups and other settings. You can use one firewall policy for multiple firewalls.

May throw InsufficientCapacityException. May throw InternalServerError. May throw InvalidRequestException. May throw LimitExceededException. May throw ThrottlingException.

Parameter firewallPolicy : The rule groups and policy actions to use in the firewall policy.

Parameter firewallPolicyName : The descriptive name of the firewall policy. You can't change the name of a firewall policy after you create it.

Parameter description : A description of the firewall policy.

Parameter dryRun : Indicates whether you want Network Firewall to just check the validity of the request, rather than run the request.

If set to TRUE, Network Firewall checks whether the request can run successfully, but doesn't actually make the requested changes. The call returns the value that the request would return if you ran it with dry run set to FALSE, but doesn't make additions or changes to your resources. This option allows you to make sure that you have the required permissions to run the request and that your request parameters are valid.

If set to FALSE, Network Firewall makes the requested changes to your resources.

Parameter encryptionConfiguration : A complex type that contains settings for encryption of your firewall policy resources.

Parameter tags : The key:value pairs to associate with the resource.

Implementation

Future<CreateFirewallPolicyResponse> createFirewallPolicy({
  required FirewallPolicy firewallPolicy,
  required String firewallPolicyName,
  String? description,
  bool? dryRun,
  EncryptionConfiguration? encryptionConfiguration,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'NetworkFirewall_20201112.CreateFirewallPolicy'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'FirewallPolicy': firewallPolicy,
      'FirewallPolicyName': firewallPolicyName,
      if (description != null) 'Description': description,
      if (dryRun != null) 'DryRun': dryRun,
      if (encryptionConfiguration != null)
        'EncryptionConfiguration': encryptionConfiguration,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateFirewallPolicyResponse.fromJson(jsonResponse.body);
}