createFirewall method

Future<CreateFirewallResponse> createFirewall({
  1. required String firewallName,
  2. required String firewallPolicyArn,
  3. bool? availabilityZoneChangeProtection,
  4. List<AvailabilityZoneMapping>? availabilityZoneMappings,
  5. bool? deleteProtection,
  6. String? description,
  7. List<EnabledAnalysisType>? enabledAnalysisTypes,
  8. EncryptionConfiguration? encryptionConfiguration,
  9. bool? firewallPolicyChangeProtection,
  10. bool? subnetChangeProtection,
  11. List<SubnetMapping>? subnetMappings,
  12. List<Tag>? tags,
  13. String? transitGatewayId,
  14. String? vpcId,
})

Creates an Network Firewall Firewall and accompanying FirewallStatus for a VPC.

The firewall defines the configuration settings for an Network Firewall firewall. The settings that you can define at creation include the firewall policy, the subnets in your VPC to use for the firewall endpoints, and any tags that are attached to the firewall Amazon Web Services resource.

After you create a firewall, you can provide additional settings, like the logging configuration.

To update the settings for a firewall, you use the operations that apply to the settings themselves, for example UpdateLoggingConfiguration, AssociateSubnets, and UpdateFirewallDeleteProtection.

To manage a firewall's tags, use the standard Amazon Web Services resource tagging operations, ListTagsForResource, TagResource, and UntagResource.

To retrieve information about firewalls, use ListFirewalls and DescribeFirewall.

To generate a report on the last 30 days of traffic monitored by a firewall, use StartAnalysisReport.

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

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

Parameter firewallPolicyArn : The Amazon Resource Name (ARN) of the FirewallPolicy that you want to use for the firewall.

Parameter availabilityZoneChangeProtection : Optional. A setting indicating whether the firewall is protected against changes to its Availability Zone configuration. When set to TRUE, you cannot add or remove Availability Zones without first disabling this protection using UpdateAvailabilityZoneChangeProtection.

Default value: FALSE

Parameter availabilityZoneMappings : Required. The Availability Zones where you want to create firewall endpoints for a transit gateway-attached firewall. You must specify at least one Availability Zone. Consider enabling the firewall in every Availability Zone where you have workloads to maintain Availability Zone isolation.

You can modify Availability Zones later using AssociateAvailabilityZones or DisassociateAvailabilityZones, but this may briefly disrupt traffic. The AvailabilityZoneChangeProtection setting controls whether you can make these modifications.

Parameter deleteProtection : A flag indicating whether it is possible to delete the firewall. A setting of TRUE indicates that the firewall is protected against deletion. Use this setting to protect against accidentally deleting a firewall that is in use. When you create a firewall, the operation initializes this flag to TRUE.

Parameter description : A description of the firewall.

Parameter enabledAnalysisTypes : An optional setting indicating the specific traffic analysis types to enable on the firewall.

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

Parameter firewallPolicyChangeProtection : A setting indicating whether the firewall is protected against a change to the firewall policy association. Use this setting to protect against accidentally modifying the firewall policy for a firewall that is in use. When you create a firewall, the operation initializes this setting to TRUE.

Parameter subnetChangeProtection : A setting indicating whether the firewall is protected against changes to the subnet associations. Use this setting to protect against accidentally modifying the subnet associations for a firewall that is in use. When you create a firewall, the operation initializes this setting to TRUE.

Parameter subnetMappings : The public subnets to use for your Network Firewall firewalls. Each subnet must belong to a different Availability Zone in the VPC. Network Firewall creates a firewall endpoint in each subnet.

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

Parameter transitGatewayId : Required when creating a transit gateway-attached firewall. The unique identifier of the transit gateway to attach to this firewall. You can provide either a transit gateway from your account or one that has been shared with you through Resource Access Manager. For information about creating firewalls, see CreateFirewall. For specific guidance about transit gateway-attached firewalls, see Considerations for transit gateway-attached firewalls in the Network Firewall Developer Guide.

Parameter vpcId : The unique identifier of the VPC where Network Firewall should create the firewall.

You can't change this setting after you create the firewall.

Implementation

Future<CreateFirewallResponse> createFirewall({
  required String firewallName,
  required String firewallPolicyArn,
  bool? availabilityZoneChangeProtection,
  List<AvailabilityZoneMapping>? availabilityZoneMappings,
  bool? deleteProtection,
  String? description,
  List<EnabledAnalysisType>? enabledAnalysisTypes,
  EncryptionConfiguration? encryptionConfiguration,
  bool? firewallPolicyChangeProtection,
  bool? subnetChangeProtection,
  List<SubnetMapping>? subnetMappings,
  List<Tag>? tags,
  String? transitGatewayId,
  String? vpcId,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'NetworkFirewall_20201112.CreateFirewall'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'FirewallName': firewallName,
      'FirewallPolicyArn': firewallPolicyArn,
      if (availabilityZoneChangeProtection != null)
        'AvailabilityZoneChangeProtection': availabilityZoneChangeProtection,
      if (availabilityZoneMappings != null)
        'AvailabilityZoneMappings': availabilityZoneMappings,
      if (deleteProtection != null) 'DeleteProtection': deleteProtection,
      if (description != null) 'Description': description,
      if (enabledAnalysisTypes != null)
        'EnabledAnalysisTypes':
            enabledAnalysisTypes.map((e) => e.value).toList(),
      if (encryptionConfiguration != null)
        'EncryptionConfiguration': encryptionConfiguration,
      if (firewallPolicyChangeProtection != null)
        'FirewallPolicyChangeProtection': firewallPolicyChangeProtection,
      if (subnetChangeProtection != null)
        'SubnetChangeProtection': subnetChangeProtection,
      if (subnetMappings != null) 'SubnetMappings': subnetMappings,
      if (tags != null) 'Tags': tags,
      if (transitGatewayId != null) 'TransitGatewayId': transitGatewayId,
      if (vpcId != null) 'VpcId': vpcId,
    },
  );

  return CreateFirewallResponse.fromJson(jsonResponse.body);
}