{-# 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.Route53Resolver.Types.FirewallRule
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Route53Resolver.Types.FirewallRule where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Route53Resolver.Types.Action
import Amazonka.Route53Resolver.Types.BlockOverrideDnsType
import Amazonka.Route53Resolver.Types.BlockResponse

-- | A single firewall rule in a rule group.
--
-- /See:/ 'newFirewallRule' smart constructor.
data FirewallRule = FirewallRule'
  { -- | The date and time that the rule was created, in Unix time format and
    -- Coordinated Universal Time (UTC).
    FirewallRule -> Maybe Text
creationTime :: Prelude.Maybe Prelude.Text,
    -- | The DNS record\'s type. This determines the format of the record value
    -- that you provided in @BlockOverrideDomain@. Used for the rule action
    -- @BLOCK@ with a @BlockResponse@ setting of @OVERRIDE@.
    FirewallRule -> Maybe BlockOverrideDnsType
blockOverrideDnsType :: Prelude.Maybe BlockOverrideDnsType,
    -- | The unique identifier of the firewall rule group of the rule.
    FirewallRule -> Maybe Text
firewallRuleGroupId :: Prelude.Maybe Prelude.Text,
    -- | The priority of the rule in the rule group. This value must be unique
    -- within the rule group. DNS Firewall processes the rules in a rule group
    -- by order of priority, starting from the lowest setting.
    FirewallRule -> Maybe Int
priority :: Prelude.Maybe Prelude.Int,
    -- | The way that you want DNS Firewall to block the request. Used for the
    -- rule action setting @BLOCK@.
    --
    -- -   @NODATA@ - Respond indicating that the query was successful, but no
    --     response is available for it.
    --
    -- -   @NXDOMAIN@ - Respond indicating that the domain name that\'s in the
    --     query doesn\'t exist.
    --
    -- -   @OVERRIDE@ - Provide a custom override in the response. This option
    --     requires custom handling details in the rule\'s @BlockOverride*@
    --     settings.
    FirewallRule -> Maybe BlockResponse
blockResponse :: Prelude.Maybe BlockResponse,
    -- | A unique string defined by you to identify the request. This allows you
    -- to retry failed requests without the risk of executing the operation
    -- twice. This can be any unique string, for example, a timestamp.
    FirewallRule -> Maybe Text
creatorRequestId :: Prelude.Maybe Prelude.Text,
    -- | The date and time that the rule was last modified, in Unix time format
    -- and Coordinated Universal Time (UTC).
    FirewallRule -> Maybe Text
modificationTime :: Prelude.Maybe Prelude.Text,
    -- | The action that DNS Firewall should take on a DNS query when it matches
    -- one of the domains in the rule\'s domain list:
    --
    -- -   @ALLOW@ - Permit the request to go through.
    --
    -- -   @ALERT@ - Permit the request to go through but send an alert to the
    --     logs.
    --
    -- -   @BLOCK@ - Disallow the request. If this is specified, additional
    --     handling details are provided in the rule\'s @BlockResponse@
    --     setting.
    FirewallRule -> Maybe Action
action :: Prelude.Maybe Action,
    -- | The recommended amount of time, in seconds, for the DNS resolver or web
    -- browser to cache the provided override record. Used for the rule action
    -- @BLOCK@ with a @BlockResponse@ setting of @OVERRIDE@.
    FirewallRule -> Maybe Int
blockOverrideTtl :: Prelude.Maybe Prelude.Int,
    -- | The name of the rule.
    FirewallRule -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The custom DNS record to send back in response to the query. Used for
    -- the rule action @BLOCK@ with a @BlockResponse@ setting of @OVERRIDE@.
    FirewallRule -> Maybe Text
blockOverrideDomain :: Prelude.Maybe Prelude.Text,
    -- | The ID of the domain list that\'s used in the rule.
    FirewallRule -> Maybe Text
firewallDomainListId :: Prelude.Maybe Prelude.Text
  }
  deriving (FirewallRule -> FirewallRule -> Bool
(FirewallRule -> FirewallRule -> Bool)
-> (FirewallRule -> FirewallRule -> Bool) -> Eq FirewallRule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FirewallRule -> FirewallRule -> Bool
$c/= :: FirewallRule -> FirewallRule -> Bool
== :: FirewallRule -> FirewallRule -> Bool
$c== :: FirewallRule -> FirewallRule -> Bool
Prelude.Eq, ReadPrec [FirewallRule]
ReadPrec FirewallRule
Int -> ReadS FirewallRule
ReadS [FirewallRule]
(Int -> ReadS FirewallRule)
-> ReadS [FirewallRule]
-> ReadPrec FirewallRule
-> ReadPrec [FirewallRule]
-> Read FirewallRule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FirewallRule]
$creadListPrec :: ReadPrec [FirewallRule]
readPrec :: ReadPrec FirewallRule
$creadPrec :: ReadPrec FirewallRule
readList :: ReadS [FirewallRule]
$creadList :: ReadS [FirewallRule]
readsPrec :: Int -> ReadS FirewallRule
$creadsPrec :: Int -> ReadS FirewallRule
Prelude.Read, Int -> FirewallRule -> ShowS
[FirewallRule] -> ShowS
FirewallRule -> String
(Int -> FirewallRule -> ShowS)
-> (FirewallRule -> String)
-> ([FirewallRule] -> ShowS)
-> Show FirewallRule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FirewallRule] -> ShowS
$cshowList :: [FirewallRule] -> ShowS
show :: FirewallRule -> String
$cshow :: FirewallRule -> String
showsPrec :: Int -> FirewallRule -> ShowS
$cshowsPrec :: Int -> FirewallRule -> ShowS
Prelude.Show, (forall x. FirewallRule -> Rep FirewallRule x)
-> (forall x. Rep FirewallRule x -> FirewallRule)
-> Generic FirewallRule
forall x. Rep FirewallRule x -> FirewallRule
forall x. FirewallRule -> Rep FirewallRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FirewallRule x -> FirewallRule
$cfrom :: forall x. FirewallRule -> Rep FirewallRule x
Prelude.Generic)

-- |
-- Create a value of 'FirewallRule' 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:
--
-- 'creationTime', 'firewallRule_creationTime' - The date and time that the rule was created, in Unix time format and
-- Coordinated Universal Time (UTC).
--
-- 'blockOverrideDnsType', 'firewallRule_blockOverrideDnsType' - The DNS record\'s type. This determines the format of the record value
-- that you provided in @BlockOverrideDomain@. Used for the rule action
-- @BLOCK@ with a @BlockResponse@ setting of @OVERRIDE@.
--
-- 'firewallRuleGroupId', 'firewallRule_firewallRuleGroupId' - The unique identifier of the firewall rule group of the rule.
--
-- 'priority', 'firewallRule_priority' - The priority of the rule in the rule group. This value must be unique
-- within the rule group. DNS Firewall processes the rules in a rule group
-- by order of priority, starting from the lowest setting.
--
-- 'blockResponse', 'firewallRule_blockResponse' - The way that you want DNS Firewall to block the request. Used for the
-- rule action setting @BLOCK@.
--
-- -   @NODATA@ - Respond indicating that the query was successful, but no
--     response is available for it.
--
-- -   @NXDOMAIN@ - Respond indicating that the domain name that\'s in the
--     query doesn\'t exist.
--
-- -   @OVERRIDE@ - Provide a custom override in the response. This option
--     requires custom handling details in the rule\'s @BlockOverride*@
--     settings.
--
-- 'creatorRequestId', 'firewallRule_creatorRequestId' - A unique string defined by you to identify the request. This allows you
-- to retry failed requests without the risk of executing the operation
-- twice. This can be any unique string, for example, a timestamp.
--
-- 'modificationTime', 'firewallRule_modificationTime' - The date and time that the rule was last modified, in Unix time format
-- and Coordinated Universal Time (UTC).
--
-- 'action', 'firewallRule_action' - The action that DNS Firewall should take on a DNS query when it matches
-- one of the domains in the rule\'s domain list:
--
-- -   @ALLOW@ - Permit the request to go through.
--
-- -   @ALERT@ - Permit the request to go through but send an alert to the
--     logs.
--
-- -   @BLOCK@ - Disallow the request. If this is specified, additional
--     handling details are provided in the rule\'s @BlockResponse@
--     setting.
--
-- 'blockOverrideTtl', 'firewallRule_blockOverrideTtl' - The recommended amount of time, in seconds, for the DNS resolver or web
-- browser to cache the provided override record. Used for the rule action
-- @BLOCK@ with a @BlockResponse@ setting of @OVERRIDE@.
--
-- 'name', 'firewallRule_name' - The name of the rule.
--
-- 'blockOverrideDomain', 'firewallRule_blockOverrideDomain' - The custom DNS record to send back in response to the query. Used for
-- the rule action @BLOCK@ with a @BlockResponse@ setting of @OVERRIDE@.
--
-- 'firewallDomainListId', 'firewallRule_firewallDomainListId' - The ID of the domain list that\'s used in the rule.
newFirewallRule ::
  FirewallRule
newFirewallRule :: FirewallRule
newFirewallRule =
  FirewallRule' :: Maybe Text
-> Maybe BlockOverrideDnsType
-> Maybe Text
-> Maybe Int
-> Maybe BlockResponse
-> Maybe Text
-> Maybe Text
-> Maybe Action
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> FirewallRule
FirewallRule'
    { $sel:creationTime:FirewallRule' :: Maybe Text
creationTime = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:blockOverrideDnsType:FirewallRule' :: Maybe BlockOverrideDnsType
blockOverrideDnsType = Maybe BlockOverrideDnsType
forall a. Maybe a
Prelude.Nothing,
      $sel:firewallRuleGroupId:FirewallRule' :: Maybe Text
firewallRuleGroupId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:priority:FirewallRule' :: Maybe Int
priority = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:blockResponse:FirewallRule' :: Maybe BlockResponse
blockResponse = Maybe BlockResponse
forall a. Maybe a
Prelude.Nothing,
      $sel:creatorRequestId:FirewallRule' :: Maybe Text
creatorRequestId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:modificationTime:FirewallRule' :: Maybe Text
modificationTime = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:action:FirewallRule' :: Maybe Action
action = Maybe Action
forall a. Maybe a
Prelude.Nothing,
      $sel:blockOverrideTtl:FirewallRule' :: Maybe Int
blockOverrideTtl = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:name:FirewallRule' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:blockOverrideDomain:FirewallRule' :: Maybe Text
blockOverrideDomain = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:firewallDomainListId:FirewallRule' :: Maybe Text
firewallDomainListId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The date and time that the rule was created, in Unix time format and
-- Coordinated Universal Time (UTC).
firewallRule_creationTime :: Lens.Lens' FirewallRule (Prelude.Maybe Prelude.Text)
firewallRule_creationTime :: (Maybe Text -> f (Maybe Text)) -> FirewallRule -> f FirewallRule
firewallRule_creationTime = (FirewallRule -> Maybe Text)
-> (FirewallRule -> Maybe Text -> FirewallRule)
-> Lens FirewallRule FirewallRule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FirewallRule' {Maybe Text
creationTime :: Maybe Text
$sel:creationTime:FirewallRule' :: FirewallRule -> Maybe Text
creationTime} -> Maybe Text
creationTime) (\s :: FirewallRule
s@FirewallRule' {} Maybe Text
a -> FirewallRule
s {$sel:creationTime:FirewallRule' :: Maybe Text
creationTime = Maybe Text
a} :: FirewallRule)

-- | The DNS record\'s type. This determines the format of the record value
-- that you provided in @BlockOverrideDomain@. Used for the rule action
-- @BLOCK@ with a @BlockResponse@ setting of @OVERRIDE@.
firewallRule_blockOverrideDnsType :: Lens.Lens' FirewallRule (Prelude.Maybe BlockOverrideDnsType)
firewallRule_blockOverrideDnsType :: (Maybe BlockOverrideDnsType -> f (Maybe BlockOverrideDnsType))
-> FirewallRule -> f FirewallRule
firewallRule_blockOverrideDnsType = (FirewallRule -> Maybe BlockOverrideDnsType)
-> (FirewallRule -> Maybe BlockOverrideDnsType -> FirewallRule)
-> Lens
     FirewallRule
     FirewallRule
     (Maybe BlockOverrideDnsType)
     (Maybe BlockOverrideDnsType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FirewallRule' {Maybe BlockOverrideDnsType
blockOverrideDnsType :: Maybe BlockOverrideDnsType
$sel:blockOverrideDnsType:FirewallRule' :: FirewallRule -> Maybe BlockOverrideDnsType
blockOverrideDnsType} -> Maybe BlockOverrideDnsType
blockOverrideDnsType) (\s :: FirewallRule
s@FirewallRule' {} Maybe BlockOverrideDnsType
a -> FirewallRule
s {$sel:blockOverrideDnsType:FirewallRule' :: Maybe BlockOverrideDnsType
blockOverrideDnsType = Maybe BlockOverrideDnsType
a} :: FirewallRule)

-- | The unique identifier of the firewall rule group of the rule.
firewallRule_firewallRuleGroupId :: Lens.Lens' FirewallRule (Prelude.Maybe Prelude.Text)
firewallRule_firewallRuleGroupId :: (Maybe Text -> f (Maybe Text)) -> FirewallRule -> f FirewallRule
firewallRule_firewallRuleGroupId = (FirewallRule -> Maybe Text)
-> (FirewallRule -> Maybe Text -> FirewallRule)
-> Lens FirewallRule FirewallRule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FirewallRule' {Maybe Text
firewallRuleGroupId :: Maybe Text
$sel:firewallRuleGroupId:FirewallRule' :: FirewallRule -> Maybe Text
firewallRuleGroupId} -> Maybe Text
firewallRuleGroupId) (\s :: FirewallRule
s@FirewallRule' {} Maybe Text
a -> FirewallRule
s {$sel:firewallRuleGroupId:FirewallRule' :: Maybe Text
firewallRuleGroupId = Maybe Text
a} :: FirewallRule)

-- | The priority of the rule in the rule group. This value must be unique
-- within the rule group. DNS Firewall processes the rules in a rule group
-- by order of priority, starting from the lowest setting.
firewallRule_priority :: Lens.Lens' FirewallRule (Prelude.Maybe Prelude.Int)
firewallRule_priority :: (Maybe Int -> f (Maybe Int)) -> FirewallRule -> f FirewallRule
firewallRule_priority = (FirewallRule -> Maybe Int)
-> (FirewallRule -> Maybe Int -> FirewallRule)
-> Lens FirewallRule FirewallRule (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FirewallRule' {Maybe Int
priority :: Maybe Int
$sel:priority:FirewallRule' :: FirewallRule -> Maybe Int
priority} -> Maybe Int
priority) (\s :: FirewallRule
s@FirewallRule' {} Maybe Int
a -> FirewallRule
s {$sel:priority:FirewallRule' :: Maybe Int
priority = Maybe Int
a} :: FirewallRule)

-- | The way that you want DNS Firewall to block the request. Used for the
-- rule action setting @BLOCK@.
--
-- -   @NODATA@ - Respond indicating that the query was successful, but no
--     response is available for it.
--
-- -   @NXDOMAIN@ - Respond indicating that the domain name that\'s in the
--     query doesn\'t exist.
--
-- -   @OVERRIDE@ - Provide a custom override in the response. This option
--     requires custom handling details in the rule\'s @BlockOverride*@
--     settings.
firewallRule_blockResponse :: Lens.Lens' FirewallRule (Prelude.Maybe BlockResponse)
firewallRule_blockResponse :: (Maybe BlockResponse -> f (Maybe BlockResponse))
-> FirewallRule -> f FirewallRule
firewallRule_blockResponse = (FirewallRule -> Maybe BlockResponse)
-> (FirewallRule -> Maybe BlockResponse -> FirewallRule)
-> Lens
     FirewallRule
     FirewallRule
     (Maybe BlockResponse)
     (Maybe BlockResponse)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FirewallRule' {Maybe BlockResponse
blockResponse :: Maybe BlockResponse
$sel:blockResponse:FirewallRule' :: FirewallRule -> Maybe BlockResponse
blockResponse} -> Maybe BlockResponse
blockResponse) (\s :: FirewallRule
s@FirewallRule' {} Maybe BlockResponse
a -> FirewallRule
s {$sel:blockResponse:FirewallRule' :: Maybe BlockResponse
blockResponse = Maybe BlockResponse
a} :: FirewallRule)

-- | A unique string defined by you to identify the request. This allows you
-- to retry failed requests without the risk of executing the operation
-- twice. This can be any unique string, for example, a timestamp.
firewallRule_creatorRequestId :: Lens.Lens' FirewallRule (Prelude.Maybe Prelude.Text)
firewallRule_creatorRequestId :: (Maybe Text -> f (Maybe Text)) -> FirewallRule -> f FirewallRule
firewallRule_creatorRequestId = (FirewallRule -> Maybe Text)
-> (FirewallRule -> Maybe Text -> FirewallRule)
-> Lens FirewallRule FirewallRule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FirewallRule' {Maybe Text
creatorRequestId :: Maybe Text
$sel:creatorRequestId:FirewallRule' :: FirewallRule -> Maybe Text
creatorRequestId} -> Maybe Text
creatorRequestId) (\s :: FirewallRule
s@FirewallRule' {} Maybe Text
a -> FirewallRule
s {$sel:creatorRequestId:FirewallRule' :: Maybe Text
creatorRequestId = Maybe Text
a} :: FirewallRule)

-- | The date and time that the rule was last modified, in Unix time format
-- and Coordinated Universal Time (UTC).
firewallRule_modificationTime :: Lens.Lens' FirewallRule (Prelude.Maybe Prelude.Text)
firewallRule_modificationTime :: (Maybe Text -> f (Maybe Text)) -> FirewallRule -> f FirewallRule
firewallRule_modificationTime = (FirewallRule -> Maybe Text)
-> (FirewallRule -> Maybe Text -> FirewallRule)
-> Lens FirewallRule FirewallRule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FirewallRule' {Maybe Text
modificationTime :: Maybe Text
$sel:modificationTime:FirewallRule' :: FirewallRule -> Maybe Text
modificationTime} -> Maybe Text
modificationTime) (\s :: FirewallRule
s@FirewallRule' {} Maybe Text
a -> FirewallRule
s {$sel:modificationTime:FirewallRule' :: Maybe Text
modificationTime = Maybe Text
a} :: FirewallRule)

-- | The action that DNS Firewall should take on a DNS query when it matches
-- one of the domains in the rule\'s domain list:
--
-- -   @ALLOW@ - Permit the request to go through.
--
-- -   @ALERT@ - Permit the request to go through but send an alert to the
--     logs.
--
-- -   @BLOCK@ - Disallow the request. If this is specified, additional
--     handling details are provided in the rule\'s @BlockResponse@
--     setting.
firewallRule_action :: Lens.Lens' FirewallRule (Prelude.Maybe Action)
firewallRule_action :: (Maybe Action -> f (Maybe Action))
-> FirewallRule -> f FirewallRule
firewallRule_action = (FirewallRule -> Maybe Action)
-> (FirewallRule -> Maybe Action -> FirewallRule)
-> Lens FirewallRule FirewallRule (Maybe Action) (Maybe Action)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FirewallRule' {Maybe Action
action :: Maybe Action
$sel:action:FirewallRule' :: FirewallRule -> Maybe Action
action} -> Maybe Action
action) (\s :: FirewallRule
s@FirewallRule' {} Maybe Action
a -> FirewallRule
s {$sel:action:FirewallRule' :: Maybe Action
action = Maybe Action
a} :: FirewallRule)

-- | The recommended amount of time, in seconds, for the DNS resolver or web
-- browser to cache the provided override record. Used for the rule action
-- @BLOCK@ with a @BlockResponse@ setting of @OVERRIDE@.
firewallRule_blockOverrideTtl :: Lens.Lens' FirewallRule (Prelude.Maybe Prelude.Int)
firewallRule_blockOverrideTtl :: (Maybe Int -> f (Maybe Int)) -> FirewallRule -> f FirewallRule
firewallRule_blockOverrideTtl = (FirewallRule -> Maybe Int)
-> (FirewallRule -> Maybe Int -> FirewallRule)
-> Lens FirewallRule FirewallRule (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FirewallRule' {Maybe Int
blockOverrideTtl :: Maybe Int
$sel:blockOverrideTtl:FirewallRule' :: FirewallRule -> Maybe Int
blockOverrideTtl} -> Maybe Int
blockOverrideTtl) (\s :: FirewallRule
s@FirewallRule' {} Maybe Int
a -> FirewallRule
s {$sel:blockOverrideTtl:FirewallRule' :: Maybe Int
blockOverrideTtl = Maybe Int
a} :: FirewallRule)

-- | The name of the rule.
firewallRule_name :: Lens.Lens' FirewallRule (Prelude.Maybe Prelude.Text)
firewallRule_name :: (Maybe Text -> f (Maybe Text)) -> FirewallRule -> f FirewallRule
firewallRule_name = (FirewallRule -> Maybe Text)
-> (FirewallRule -> Maybe Text -> FirewallRule)
-> Lens FirewallRule FirewallRule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FirewallRule' {Maybe Text
name :: Maybe Text
$sel:name:FirewallRule' :: FirewallRule -> Maybe Text
name} -> Maybe Text
name) (\s :: FirewallRule
s@FirewallRule' {} Maybe Text
a -> FirewallRule
s {$sel:name:FirewallRule' :: Maybe Text
name = Maybe Text
a} :: FirewallRule)

-- | The custom DNS record to send back in response to the query. Used for
-- the rule action @BLOCK@ with a @BlockResponse@ setting of @OVERRIDE@.
firewallRule_blockOverrideDomain :: Lens.Lens' FirewallRule (Prelude.Maybe Prelude.Text)
firewallRule_blockOverrideDomain :: (Maybe Text -> f (Maybe Text)) -> FirewallRule -> f FirewallRule
firewallRule_blockOverrideDomain = (FirewallRule -> Maybe Text)
-> (FirewallRule -> Maybe Text -> FirewallRule)
-> Lens FirewallRule FirewallRule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FirewallRule' {Maybe Text
blockOverrideDomain :: Maybe Text
$sel:blockOverrideDomain:FirewallRule' :: FirewallRule -> Maybe Text
blockOverrideDomain} -> Maybe Text
blockOverrideDomain) (\s :: FirewallRule
s@FirewallRule' {} Maybe Text
a -> FirewallRule
s {$sel:blockOverrideDomain:FirewallRule' :: Maybe Text
blockOverrideDomain = Maybe Text
a} :: FirewallRule)

-- | The ID of the domain list that\'s used in the rule.
firewallRule_firewallDomainListId :: Lens.Lens' FirewallRule (Prelude.Maybe Prelude.Text)
firewallRule_firewallDomainListId :: (Maybe Text -> f (Maybe Text)) -> FirewallRule -> f FirewallRule
firewallRule_firewallDomainListId = (FirewallRule -> Maybe Text)
-> (FirewallRule -> Maybe Text -> FirewallRule)
-> Lens FirewallRule FirewallRule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FirewallRule' {Maybe Text
firewallDomainListId :: Maybe Text
$sel:firewallDomainListId:FirewallRule' :: FirewallRule -> Maybe Text
firewallDomainListId} -> Maybe Text
firewallDomainListId) (\s :: FirewallRule
s@FirewallRule' {} Maybe Text
a -> FirewallRule
s {$sel:firewallDomainListId:FirewallRule' :: Maybe Text
firewallDomainListId = Maybe Text
a} :: FirewallRule)

instance Core.FromJSON FirewallRule where
  parseJSON :: Value -> Parser FirewallRule
parseJSON =
    String
-> (Object -> Parser FirewallRule) -> Value -> Parser FirewallRule
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"FirewallRule"
      ( \Object
x ->
          Maybe Text
-> Maybe BlockOverrideDnsType
-> Maybe Text
-> Maybe Int
-> Maybe BlockResponse
-> Maybe Text
-> Maybe Text
-> Maybe Action
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> FirewallRule
FirewallRule'
            (Maybe Text
 -> Maybe BlockOverrideDnsType
 -> Maybe Text
 -> Maybe Int
 -> Maybe BlockResponse
 -> Maybe Text
 -> Maybe Text
 -> Maybe Action
 -> Maybe Int
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> FirewallRule)
-> Parser (Maybe Text)
-> Parser
     (Maybe BlockOverrideDnsType
      -> Maybe Text
      -> Maybe Int
      -> Maybe BlockResponse
      -> Maybe Text
      -> Maybe Text
      -> Maybe Action
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> FirewallRule)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreationTime")
            Parser
  (Maybe BlockOverrideDnsType
   -> Maybe Text
   -> Maybe Int
   -> Maybe BlockResponse
   -> Maybe Text
   -> Maybe Text
   -> Maybe Action
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> FirewallRule)
-> Parser (Maybe BlockOverrideDnsType)
-> Parser
     (Maybe Text
      -> Maybe Int
      -> Maybe BlockResponse
      -> Maybe Text
      -> Maybe Text
      -> Maybe Action
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> FirewallRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe BlockOverrideDnsType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"BlockOverrideDnsType")
            Parser
  (Maybe Text
   -> Maybe Int
   -> Maybe BlockResponse
   -> Maybe Text
   -> Maybe Text
   -> Maybe Action
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> FirewallRule)
-> Parser (Maybe Text)
-> Parser
     (Maybe Int
      -> Maybe BlockResponse
      -> Maybe Text
      -> Maybe Text
      -> Maybe Action
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> FirewallRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"FirewallRuleGroupId")
            Parser
  (Maybe Int
   -> Maybe BlockResponse
   -> Maybe Text
   -> Maybe Text
   -> Maybe Action
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> FirewallRule)
-> Parser (Maybe Int)
-> Parser
     (Maybe BlockResponse
      -> Maybe Text
      -> Maybe Text
      -> Maybe Action
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> FirewallRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Priority")
            Parser
  (Maybe BlockResponse
   -> Maybe Text
   -> Maybe Text
   -> Maybe Action
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> FirewallRule)
-> Parser (Maybe BlockResponse)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Action
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> FirewallRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe BlockResponse)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"BlockResponse")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Action
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> FirewallRule)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Action
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> FirewallRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreatorRequestId")
            Parser
  (Maybe Text
   -> Maybe Action
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> FirewallRule)
-> Parser (Maybe Text)
-> Parser
     (Maybe Action
      -> Maybe Int
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> FirewallRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ModificationTime")
            Parser
  (Maybe Action
   -> Maybe Int
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> FirewallRule)
-> Parser (Maybe Action)
-> Parser
     (Maybe Int
      -> Maybe Text -> Maybe Text -> Maybe Text -> FirewallRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Action)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Action")
            Parser
  (Maybe Int
   -> Maybe Text -> Maybe Text -> Maybe Text -> FirewallRule)
-> Parser (Maybe Int)
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> FirewallRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"BlockOverrideTtl")
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> FirewallRule)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> FirewallRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Name")
            Parser (Maybe Text -> Maybe Text -> FirewallRule)
-> Parser (Maybe Text) -> Parser (Maybe Text -> FirewallRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"BlockOverrideDomain")
            Parser (Maybe Text -> FirewallRule)
-> Parser (Maybe Text) -> Parser FirewallRule
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"FirewallDomainListId")
      )

instance Prelude.Hashable FirewallRule

instance Prelude.NFData FirewallRule