{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.NetworkFirewall.Types.FirewallPolicy
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.NetworkFirewall.Types.FirewallPolicy where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.NetworkFirewall.Types.CustomAction
import Amazonka.NetworkFirewall.Types.StatefulEngineOptions
import Amazonka.NetworkFirewall.Types.StatefulRuleGroupReference
import Amazonka.NetworkFirewall.Types.StatelessRuleGroupReference
import qualified Amazonka.Prelude as Prelude

-- | The firewall policy defines the behavior of a firewall using a
-- collection of stateless and stateful rule groups and other settings. You
-- can use one firewall policy for multiple firewalls.
--
-- This, along with FirewallPolicyResponse, define the policy. You can
-- retrieve all objects for a firewall policy by calling
-- DescribeFirewallPolicy.
--
-- /See:/ 'newFirewallPolicy' smart constructor.
data FirewallPolicy = FirewallPolicy'
  { -- | The default actions to take on a packet that doesn\'t match any stateful
    -- rules. The stateful default action is optional, and is only valid when
    -- using the strict rule order.
    --
    -- Valid values of the stateful default action:
    --
    -- -   aws:drop_strict
    --
    -- -   aws:drop_established
    --
    -- -   aws:alert_strict
    --
    -- -   aws:alert_established
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/network-firewall/latest/developerguide/suricata-rule-evaluation-order.html#suricata-strict-rule-evaluation-order.html Strict evaluation order>
    -- in the /Network Firewall Developer Guide/.
    FirewallPolicy -> Maybe [Text]
statefulDefaultActions :: Prelude.Maybe [Prelude.Text],
    -- | Additional options governing how Network Firewall handles stateful
    -- rules. The stateful rule groups that you use in your policy must have
    -- stateful rule options settings that are compatible with these settings.
    FirewallPolicy -> Maybe StatefulEngineOptions
statefulEngineOptions :: Prelude.Maybe StatefulEngineOptions,
    -- | References to the stateful rule groups that are used in the policy.
    -- These define the inspection criteria in stateful rules.
    FirewallPolicy -> Maybe [StatefulRuleGroupReference]
statefulRuleGroupReferences :: Prelude.Maybe [StatefulRuleGroupReference],
    -- | The custom action definitions that are available for use in the firewall
    -- policy\'s @StatelessDefaultActions@ setting. You name each custom action
    -- that you define, and then you can use it by name in your default actions
    -- specifications.
    FirewallPolicy -> Maybe [CustomAction]
statelessCustomActions :: Prelude.Maybe [CustomAction],
    -- | References to the stateless rule groups that are used in the policy.
    -- These define the matching criteria in stateless rules.
    FirewallPolicy -> Maybe [StatelessRuleGroupReference]
statelessRuleGroupReferences :: Prelude.Maybe [StatelessRuleGroupReference],
    -- | The actions to take on a packet if it doesn\'t match any of the
    -- stateless rules in the policy. If you want non-matching packets to be
    -- forwarded for stateful inspection, specify @aws:forward_to_sfe@.
    --
    -- You must specify one of the standard actions: @aws:pass@, @aws:drop@, or
    -- @aws:forward_to_sfe@. In addition, you can specify custom actions that
    -- are compatible with your standard section choice.
    --
    -- For example, you could specify @[\"aws:pass\"]@ or you could specify
    -- @[\"aws:pass\", “customActionName”]@. For information about
    -- compatibility, see the custom action descriptions under CustomAction.
    FirewallPolicy -> [Text]
statelessDefaultActions :: [Prelude.Text],
    -- | The actions to take on a fragmented UDP packet if it doesn\'t match any
    -- of the stateless rules in the policy. Network Firewall only manages UDP
    -- packet fragments and silently drops packet fragments for other
    -- protocols. If you want non-matching fragmented UDP packets to be
    -- forwarded for stateful inspection, specify @aws:forward_to_sfe@.
    --
    -- You must specify one of the standard actions: @aws:pass@, @aws:drop@, or
    -- @aws:forward_to_sfe@. In addition, you can specify custom actions that
    -- are compatible with your standard section choice.
    --
    -- For example, you could specify @[\"aws:pass\"]@ or you could specify
    -- @[\"aws:pass\", “customActionName”]@. For information about
    -- compatibility, see the custom action descriptions under CustomAction.
    FirewallPolicy -> [Text]
statelessFragmentDefaultActions :: [Prelude.Text]
  }
  deriving (FirewallPolicy -> FirewallPolicy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FirewallPolicy -> FirewallPolicy -> Bool
$c/= :: FirewallPolicy -> FirewallPolicy -> Bool
== :: FirewallPolicy -> FirewallPolicy -> Bool
$c== :: FirewallPolicy -> FirewallPolicy -> Bool
Prelude.Eq, ReadPrec [FirewallPolicy]
ReadPrec FirewallPolicy
Int -> ReadS FirewallPolicy
ReadS [FirewallPolicy]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FirewallPolicy]
$creadListPrec :: ReadPrec [FirewallPolicy]
readPrec :: ReadPrec FirewallPolicy
$creadPrec :: ReadPrec FirewallPolicy
readList :: ReadS [FirewallPolicy]
$creadList :: ReadS [FirewallPolicy]
readsPrec :: Int -> ReadS FirewallPolicy
$creadsPrec :: Int -> ReadS FirewallPolicy
Prelude.Read, Int -> FirewallPolicy -> ShowS
[FirewallPolicy] -> ShowS
FirewallPolicy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FirewallPolicy] -> ShowS
$cshowList :: [FirewallPolicy] -> ShowS
show :: FirewallPolicy -> String
$cshow :: FirewallPolicy -> String
showsPrec :: Int -> FirewallPolicy -> ShowS
$cshowsPrec :: Int -> FirewallPolicy -> ShowS
Prelude.Show, forall x. Rep FirewallPolicy x -> FirewallPolicy
forall x. FirewallPolicy -> Rep FirewallPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FirewallPolicy x -> FirewallPolicy
$cfrom :: forall x. FirewallPolicy -> Rep FirewallPolicy x
Prelude.Generic)

-- |
-- Create a value of 'FirewallPolicy' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'statefulDefaultActions', 'firewallPolicy_statefulDefaultActions' - The default actions to take on a packet that doesn\'t match any stateful
-- rules. The stateful default action is optional, and is only valid when
-- using the strict rule order.
--
-- Valid values of the stateful default action:
--
-- -   aws:drop_strict
--
-- -   aws:drop_established
--
-- -   aws:alert_strict
--
-- -   aws:alert_established
--
-- For more information, see
-- <https://docs.aws.amazon.com/network-firewall/latest/developerguide/suricata-rule-evaluation-order.html#suricata-strict-rule-evaluation-order.html Strict evaluation order>
-- in the /Network Firewall Developer Guide/.
--
-- 'statefulEngineOptions', 'firewallPolicy_statefulEngineOptions' - Additional options governing how Network Firewall handles stateful
-- rules. The stateful rule groups that you use in your policy must have
-- stateful rule options settings that are compatible with these settings.
--
-- 'statefulRuleGroupReferences', 'firewallPolicy_statefulRuleGroupReferences' - References to the stateful rule groups that are used in the policy.
-- These define the inspection criteria in stateful rules.
--
-- 'statelessCustomActions', 'firewallPolicy_statelessCustomActions' - The custom action definitions that are available for use in the firewall
-- policy\'s @StatelessDefaultActions@ setting. You name each custom action
-- that you define, and then you can use it by name in your default actions
-- specifications.
--
-- 'statelessRuleGroupReferences', 'firewallPolicy_statelessRuleGroupReferences' - References to the stateless rule groups that are used in the policy.
-- These define the matching criteria in stateless rules.
--
-- 'statelessDefaultActions', 'firewallPolicy_statelessDefaultActions' - The actions to take on a packet if it doesn\'t match any of the
-- stateless rules in the policy. If you want non-matching packets to be
-- forwarded for stateful inspection, specify @aws:forward_to_sfe@.
--
-- You must specify one of the standard actions: @aws:pass@, @aws:drop@, or
-- @aws:forward_to_sfe@. In addition, you can specify custom actions that
-- are compatible with your standard section choice.
--
-- For example, you could specify @[\"aws:pass\"]@ or you could specify
-- @[\"aws:pass\", “customActionName”]@. For information about
-- compatibility, see the custom action descriptions under CustomAction.
--
-- 'statelessFragmentDefaultActions', 'firewallPolicy_statelessFragmentDefaultActions' - The actions to take on a fragmented UDP packet if it doesn\'t match any
-- of the stateless rules in the policy. Network Firewall only manages UDP
-- packet fragments and silently drops packet fragments for other
-- protocols. If you want non-matching fragmented UDP packets to be
-- forwarded for stateful inspection, specify @aws:forward_to_sfe@.
--
-- You must specify one of the standard actions: @aws:pass@, @aws:drop@, or
-- @aws:forward_to_sfe@. In addition, you can specify custom actions that
-- are compatible with your standard section choice.
--
-- For example, you could specify @[\"aws:pass\"]@ or you could specify
-- @[\"aws:pass\", “customActionName”]@. For information about
-- compatibility, see the custom action descriptions under CustomAction.
newFirewallPolicy ::
  FirewallPolicy
newFirewallPolicy :: FirewallPolicy
newFirewallPolicy =
  FirewallPolicy'
    { $sel:statefulDefaultActions:FirewallPolicy' :: Maybe [Text]
statefulDefaultActions =
        forall a. Maybe a
Prelude.Nothing,
      $sel:statefulEngineOptions:FirewallPolicy' :: Maybe StatefulEngineOptions
statefulEngineOptions = forall a. Maybe a
Prelude.Nothing,
      $sel:statefulRuleGroupReferences:FirewallPolicy' :: Maybe [StatefulRuleGroupReference]
statefulRuleGroupReferences = forall a. Maybe a
Prelude.Nothing,
      $sel:statelessCustomActions:FirewallPolicy' :: Maybe [CustomAction]
statelessCustomActions = forall a. Maybe a
Prelude.Nothing,
      $sel:statelessRuleGroupReferences:FirewallPolicy' :: Maybe [StatelessRuleGroupReference]
statelessRuleGroupReferences = forall a. Maybe a
Prelude.Nothing,
      $sel:statelessDefaultActions:FirewallPolicy' :: [Text]
statelessDefaultActions = forall a. Monoid a => a
Prelude.mempty,
      $sel:statelessFragmentDefaultActions:FirewallPolicy' :: [Text]
statelessFragmentDefaultActions = forall a. Monoid a => a
Prelude.mempty
    }

-- | The default actions to take on a packet that doesn\'t match any stateful
-- rules. The stateful default action is optional, and is only valid when
-- using the strict rule order.
--
-- Valid values of the stateful default action:
--
-- -   aws:drop_strict
--
-- -   aws:drop_established
--
-- -   aws:alert_strict
--
-- -   aws:alert_established
--
-- For more information, see
-- <https://docs.aws.amazon.com/network-firewall/latest/developerguide/suricata-rule-evaluation-order.html#suricata-strict-rule-evaluation-order.html Strict evaluation order>
-- in the /Network Firewall Developer Guide/.
firewallPolicy_statefulDefaultActions :: Lens.Lens' FirewallPolicy (Prelude.Maybe [Prelude.Text])
firewallPolicy_statefulDefaultActions :: Lens' FirewallPolicy (Maybe [Text])
firewallPolicy_statefulDefaultActions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FirewallPolicy' {Maybe [Text]
statefulDefaultActions :: Maybe [Text]
$sel:statefulDefaultActions:FirewallPolicy' :: FirewallPolicy -> Maybe [Text]
statefulDefaultActions} -> Maybe [Text]
statefulDefaultActions) (\s :: FirewallPolicy
s@FirewallPolicy' {} Maybe [Text]
a -> FirewallPolicy
s {$sel:statefulDefaultActions:FirewallPolicy' :: Maybe [Text]
statefulDefaultActions = Maybe [Text]
a} :: FirewallPolicy) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Additional options governing how Network Firewall handles stateful
-- rules. The stateful rule groups that you use in your policy must have
-- stateful rule options settings that are compatible with these settings.
firewallPolicy_statefulEngineOptions :: Lens.Lens' FirewallPolicy (Prelude.Maybe StatefulEngineOptions)
firewallPolicy_statefulEngineOptions :: Lens' FirewallPolicy (Maybe StatefulEngineOptions)
firewallPolicy_statefulEngineOptions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FirewallPolicy' {Maybe StatefulEngineOptions
statefulEngineOptions :: Maybe StatefulEngineOptions
$sel:statefulEngineOptions:FirewallPolicy' :: FirewallPolicy -> Maybe StatefulEngineOptions
statefulEngineOptions} -> Maybe StatefulEngineOptions
statefulEngineOptions) (\s :: FirewallPolicy
s@FirewallPolicy' {} Maybe StatefulEngineOptions
a -> FirewallPolicy
s {$sel:statefulEngineOptions:FirewallPolicy' :: Maybe StatefulEngineOptions
statefulEngineOptions = Maybe StatefulEngineOptions
a} :: FirewallPolicy)

-- | References to the stateful rule groups that are used in the policy.
-- These define the inspection criteria in stateful rules.
firewallPolicy_statefulRuleGroupReferences :: Lens.Lens' FirewallPolicy (Prelude.Maybe [StatefulRuleGroupReference])
firewallPolicy_statefulRuleGroupReferences :: Lens' FirewallPolicy (Maybe [StatefulRuleGroupReference])
firewallPolicy_statefulRuleGroupReferences = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FirewallPolicy' {Maybe [StatefulRuleGroupReference]
statefulRuleGroupReferences :: Maybe [StatefulRuleGroupReference]
$sel:statefulRuleGroupReferences:FirewallPolicy' :: FirewallPolicy -> Maybe [StatefulRuleGroupReference]
statefulRuleGroupReferences} -> Maybe [StatefulRuleGroupReference]
statefulRuleGroupReferences) (\s :: FirewallPolicy
s@FirewallPolicy' {} Maybe [StatefulRuleGroupReference]
a -> FirewallPolicy
s {$sel:statefulRuleGroupReferences:FirewallPolicy' :: Maybe [StatefulRuleGroupReference]
statefulRuleGroupReferences = Maybe [StatefulRuleGroupReference]
a} :: FirewallPolicy) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The custom action definitions that are available for use in the firewall
-- policy\'s @StatelessDefaultActions@ setting. You name each custom action
-- that you define, and then you can use it by name in your default actions
-- specifications.
firewallPolicy_statelessCustomActions :: Lens.Lens' FirewallPolicy (Prelude.Maybe [CustomAction])
firewallPolicy_statelessCustomActions :: Lens' FirewallPolicy (Maybe [CustomAction])
firewallPolicy_statelessCustomActions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FirewallPolicy' {Maybe [CustomAction]
statelessCustomActions :: Maybe [CustomAction]
$sel:statelessCustomActions:FirewallPolicy' :: FirewallPolicy -> Maybe [CustomAction]
statelessCustomActions} -> Maybe [CustomAction]
statelessCustomActions) (\s :: FirewallPolicy
s@FirewallPolicy' {} Maybe [CustomAction]
a -> FirewallPolicy
s {$sel:statelessCustomActions:FirewallPolicy' :: Maybe [CustomAction]
statelessCustomActions = Maybe [CustomAction]
a} :: FirewallPolicy) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | References to the stateless rule groups that are used in the policy.
-- These define the matching criteria in stateless rules.
firewallPolicy_statelessRuleGroupReferences :: Lens.Lens' FirewallPolicy (Prelude.Maybe [StatelessRuleGroupReference])
firewallPolicy_statelessRuleGroupReferences :: Lens' FirewallPolicy (Maybe [StatelessRuleGroupReference])
firewallPolicy_statelessRuleGroupReferences = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FirewallPolicy' {Maybe [StatelessRuleGroupReference]
statelessRuleGroupReferences :: Maybe [StatelessRuleGroupReference]
$sel:statelessRuleGroupReferences:FirewallPolicy' :: FirewallPolicy -> Maybe [StatelessRuleGroupReference]
statelessRuleGroupReferences} -> Maybe [StatelessRuleGroupReference]
statelessRuleGroupReferences) (\s :: FirewallPolicy
s@FirewallPolicy' {} Maybe [StatelessRuleGroupReference]
a -> FirewallPolicy
s {$sel:statelessRuleGroupReferences:FirewallPolicy' :: Maybe [StatelessRuleGroupReference]
statelessRuleGroupReferences = Maybe [StatelessRuleGroupReference]
a} :: FirewallPolicy) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The actions to take on a packet if it doesn\'t match any of the
-- stateless rules in the policy. If you want non-matching packets to be
-- forwarded for stateful inspection, specify @aws:forward_to_sfe@.
--
-- You must specify one of the standard actions: @aws:pass@, @aws:drop@, or
-- @aws:forward_to_sfe@. In addition, you can specify custom actions that
-- are compatible with your standard section choice.
--
-- For example, you could specify @[\"aws:pass\"]@ or you could specify
-- @[\"aws:pass\", “customActionName”]@. For information about
-- compatibility, see the custom action descriptions under CustomAction.
firewallPolicy_statelessDefaultActions :: Lens.Lens' FirewallPolicy [Prelude.Text]
firewallPolicy_statelessDefaultActions :: Lens' FirewallPolicy [Text]
firewallPolicy_statelessDefaultActions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FirewallPolicy' {[Text]
statelessDefaultActions :: [Text]
$sel:statelessDefaultActions:FirewallPolicy' :: FirewallPolicy -> [Text]
statelessDefaultActions} -> [Text]
statelessDefaultActions) (\s :: FirewallPolicy
s@FirewallPolicy' {} [Text]
a -> FirewallPolicy
s {$sel:statelessDefaultActions:FirewallPolicy' :: [Text]
statelessDefaultActions = [Text]
a} :: FirewallPolicy) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The actions to take on a fragmented UDP packet if it doesn\'t match any
-- of the stateless rules in the policy. Network Firewall only manages UDP
-- packet fragments and silently drops packet fragments for other
-- protocols. If you want non-matching fragmented UDP packets to be
-- forwarded for stateful inspection, specify @aws:forward_to_sfe@.
--
-- You must specify one of the standard actions: @aws:pass@, @aws:drop@, or
-- @aws:forward_to_sfe@. In addition, you can specify custom actions that
-- are compatible with your standard section choice.
--
-- For example, you could specify @[\"aws:pass\"]@ or you could specify
-- @[\"aws:pass\", “customActionName”]@. For information about
-- compatibility, see the custom action descriptions under CustomAction.
firewallPolicy_statelessFragmentDefaultActions :: Lens.Lens' FirewallPolicy [Prelude.Text]
firewallPolicy_statelessFragmentDefaultActions :: Lens' FirewallPolicy [Text]
firewallPolicy_statelessFragmentDefaultActions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FirewallPolicy' {[Text]
statelessFragmentDefaultActions :: [Text]
$sel:statelessFragmentDefaultActions:FirewallPolicy' :: FirewallPolicy -> [Text]
statelessFragmentDefaultActions} -> [Text]
statelessFragmentDefaultActions) (\s :: FirewallPolicy
s@FirewallPolicy' {} [Text]
a -> FirewallPolicy
s {$sel:statelessFragmentDefaultActions:FirewallPolicy' :: [Text]
statelessFragmentDefaultActions = [Text]
a} :: FirewallPolicy) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON FirewallPolicy where
  parseJSON :: Value -> Parser FirewallPolicy
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FirewallPolicy"
      ( \Object
x ->
          Maybe [Text]
-> Maybe StatefulEngineOptions
-> Maybe [StatefulRuleGroupReference]
-> Maybe [CustomAction]
-> Maybe [StatelessRuleGroupReference]
-> [Text]
-> [Text]
-> FirewallPolicy
FirewallPolicy'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"StatefulDefaultActions"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"StatefulEngineOptions")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"StatefulRuleGroupReferences"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"StatelessCustomActions"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"StatelessRuleGroupReferences"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"StatelessDefaultActions"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"StatelessFragmentDefaultActions"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable FirewallPolicy where
  hashWithSalt :: Int -> FirewallPolicy -> Int
hashWithSalt Int
_salt FirewallPolicy' {[Text]
Maybe [Text]
Maybe [CustomAction]
Maybe [StatefulRuleGroupReference]
Maybe [StatelessRuleGroupReference]
Maybe StatefulEngineOptions
statelessFragmentDefaultActions :: [Text]
statelessDefaultActions :: [Text]
statelessRuleGroupReferences :: Maybe [StatelessRuleGroupReference]
statelessCustomActions :: Maybe [CustomAction]
statefulRuleGroupReferences :: Maybe [StatefulRuleGroupReference]
statefulEngineOptions :: Maybe StatefulEngineOptions
statefulDefaultActions :: Maybe [Text]
$sel:statelessFragmentDefaultActions:FirewallPolicy' :: FirewallPolicy -> [Text]
$sel:statelessDefaultActions:FirewallPolicy' :: FirewallPolicy -> [Text]
$sel:statelessRuleGroupReferences:FirewallPolicy' :: FirewallPolicy -> Maybe [StatelessRuleGroupReference]
$sel:statelessCustomActions:FirewallPolicy' :: FirewallPolicy -> Maybe [CustomAction]
$sel:statefulRuleGroupReferences:FirewallPolicy' :: FirewallPolicy -> Maybe [StatefulRuleGroupReference]
$sel:statefulEngineOptions:FirewallPolicy' :: FirewallPolicy -> Maybe StatefulEngineOptions
$sel:statefulDefaultActions:FirewallPolicy' :: FirewallPolicy -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
statefulDefaultActions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe StatefulEngineOptions
statefulEngineOptions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [StatefulRuleGroupReference]
statefulRuleGroupReferences
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [CustomAction]
statelessCustomActions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [StatelessRuleGroupReference]
statelessRuleGroupReferences
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
statelessDefaultActions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
statelessFragmentDefaultActions

instance Prelude.NFData FirewallPolicy where
  rnf :: FirewallPolicy -> ()
rnf FirewallPolicy' {[Text]
Maybe [Text]
Maybe [CustomAction]
Maybe [StatefulRuleGroupReference]
Maybe [StatelessRuleGroupReference]
Maybe StatefulEngineOptions
statelessFragmentDefaultActions :: [Text]
statelessDefaultActions :: [Text]
statelessRuleGroupReferences :: Maybe [StatelessRuleGroupReference]
statelessCustomActions :: Maybe [CustomAction]
statefulRuleGroupReferences :: Maybe [StatefulRuleGroupReference]
statefulEngineOptions :: Maybe StatefulEngineOptions
statefulDefaultActions :: Maybe [Text]
$sel:statelessFragmentDefaultActions:FirewallPolicy' :: FirewallPolicy -> [Text]
$sel:statelessDefaultActions:FirewallPolicy' :: FirewallPolicy -> [Text]
$sel:statelessRuleGroupReferences:FirewallPolicy' :: FirewallPolicy -> Maybe [StatelessRuleGroupReference]
$sel:statelessCustomActions:FirewallPolicy' :: FirewallPolicy -> Maybe [CustomAction]
$sel:statefulRuleGroupReferences:FirewallPolicy' :: FirewallPolicy -> Maybe [StatefulRuleGroupReference]
$sel:statefulEngineOptions:FirewallPolicy' :: FirewallPolicy -> Maybe StatefulEngineOptions
$sel:statefulDefaultActions:FirewallPolicy' :: FirewallPolicy -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
statefulDefaultActions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe StatefulEngineOptions
statefulEngineOptions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [StatefulRuleGroupReference]
statefulRuleGroupReferences
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [CustomAction]
statelessCustomActions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [StatelessRuleGroupReference]
statelessRuleGroupReferences
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Text]
statelessDefaultActions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Text]
statelessFragmentDefaultActions

instance Data.ToJSON FirewallPolicy where
  toJSON :: FirewallPolicy -> Value
toJSON FirewallPolicy' {[Text]
Maybe [Text]
Maybe [CustomAction]
Maybe [StatefulRuleGroupReference]
Maybe [StatelessRuleGroupReference]
Maybe StatefulEngineOptions
statelessFragmentDefaultActions :: [Text]
statelessDefaultActions :: [Text]
statelessRuleGroupReferences :: Maybe [StatelessRuleGroupReference]
statelessCustomActions :: Maybe [CustomAction]
statefulRuleGroupReferences :: Maybe [StatefulRuleGroupReference]
statefulEngineOptions :: Maybe StatefulEngineOptions
statefulDefaultActions :: Maybe [Text]
$sel:statelessFragmentDefaultActions:FirewallPolicy' :: FirewallPolicy -> [Text]
$sel:statelessDefaultActions:FirewallPolicy' :: FirewallPolicy -> [Text]
$sel:statelessRuleGroupReferences:FirewallPolicy' :: FirewallPolicy -> Maybe [StatelessRuleGroupReference]
$sel:statelessCustomActions:FirewallPolicy' :: FirewallPolicy -> Maybe [CustomAction]
$sel:statefulRuleGroupReferences:FirewallPolicy' :: FirewallPolicy -> Maybe [StatefulRuleGroupReference]
$sel:statefulEngineOptions:FirewallPolicy' :: FirewallPolicy -> Maybe StatefulEngineOptions
$sel:statefulDefaultActions:FirewallPolicy' :: FirewallPolicy -> Maybe [Text]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"StatefulDefaultActions" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
statefulDefaultActions,
            (Key
"StatefulEngineOptions" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe StatefulEngineOptions
statefulEngineOptions,
            (Key
"StatefulRuleGroupReferences" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [StatefulRuleGroupReference]
statefulRuleGroupReferences,
            (Key
"StatelessCustomActions" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [CustomAction]
statelessCustomActions,
            (Key
"StatelessRuleGroupReferences" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [StatelessRuleGroupReference]
statelessRuleGroupReferences,
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"StatelessDefaultActions"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Text]
statelessDefaultActions
              ),
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"StatelessFragmentDefaultActions"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Text]
statelessFragmentDefaultActions
              )
          ]
      )