{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.UpdateFirewallRule
-- 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)
--
-- Updates the specified firewall rule.
module Amazonka.Route53Resolver.UpdateFirewallRule
  ( -- * Creating a Request
    UpdateFirewallRule (..),
    newUpdateFirewallRule,

    -- * Request Lenses
    updateFirewallRule_blockOverrideDnsType,
    updateFirewallRule_priority,
    updateFirewallRule_blockResponse,
    updateFirewallRule_action,
    updateFirewallRule_blockOverrideTtl,
    updateFirewallRule_name,
    updateFirewallRule_blockOverrideDomain,
    updateFirewallRule_firewallRuleGroupId,
    updateFirewallRule_firewallDomainListId,

    -- * Destructuring the Response
    UpdateFirewallRuleResponse (..),
    newUpdateFirewallRuleResponse,

    -- * Response Lenses
    updateFirewallRuleResponse_firewallRule,
    updateFirewallRuleResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Route53Resolver.Types

-- | /See:/ 'newUpdateFirewallRule' smart constructor.
data UpdateFirewallRule = UpdateFirewallRule'
  { -- | 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@.
    UpdateFirewallRule -> Maybe BlockOverrideDnsType
blockOverrideDnsType :: Prelude.Maybe BlockOverrideDnsType,
    -- | The setting that determines the processing order of the rule in the rule
    -- group. DNS Firewall processes the rules in a rule group by order of
    -- priority, starting from the lowest setting.
    --
    -- You must specify a unique priority for each rule in a rule group. To
    -- make it easier to insert rules later, leave space between the numbers,
    -- for example, use 100, 200, and so on. You can change the priority
    -- setting for the rules in a rule group at any time.
    UpdateFirewallRule -> 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.
    UpdateFirewallRule -> Maybe BlockResponse
blockResponse :: Prelude.Maybe BlockResponse,
    -- | 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. This option requires additional
    --     details in the rule\'s @BlockResponse@.
    UpdateFirewallRule -> 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@.
    UpdateFirewallRule -> Maybe Natural
blockOverrideTtl :: Prelude.Maybe Prelude.Natural,
    -- | The name of the rule.
    UpdateFirewallRule -> 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@.
    UpdateFirewallRule -> Maybe Text
blockOverrideDomain :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier of the firewall rule group for the rule.
    UpdateFirewallRule -> Text
firewallRuleGroupId :: Prelude.Text,
    -- | The ID of the domain list to use in the rule.
    UpdateFirewallRule -> Text
firewallDomainListId :: Prelude.Text
  }
  deriving (UpdateFirewallRule -> UpdateFirewallRule -> Bool
(UpdateFirewallRule -> UpdateFirewallRule -> Bool)
-> (UpdateFirewallRule -> UpdateFirewallRule -> Bool)
-> Eq UpdateFirewallRule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateFirewallRule -> UpdateFirewallRule -> Bool
$c/= :: UpdateFirewallRule -> UpdateFirewallRule -> Bool
== :: UpdateFirewallRule -> UpdateFirewallRule -> Bool
$c== :: UpdateFirewallRule -> UpdateFirewallRule -> Bool
Prelude.Eq, ReadPrec [UpdateFirewallRule]
ReadPrec UpdateFirewallRule
Int -> ReadS UpdateFirewallRule
ReadS [UpdateFirewallRule]
(Int -> ReadS UpdateFirewallRule)
-> ReadS [UpdateFirewallRule]
-> ReadPrec UpdateFirewallRule
-> ReadPrec [UpdateFirewallRule]
-> Read UpdateFirewallRule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateFirewallRule]
$creadListPrec :: ReadPrec [UpdateFirewallRule]
readPrec :: ReadPrec UpdateFirewallRule
$creadPrec :: ReadPrec UpdateFirewallRule
readList :: ReadS [UpdateFirewallRule]
$creadList :: ReadS [UpdateFirewallRule]
readsPrec :: Int -> ReadS UpdateFirewallRule
$creadsPrec :: Int -> ReadS UpdateFirewallRule
Prelude.Read, Int -> UpdateFirewallRule -> ShowS
[UpdateFirewallRule] -> ShowS
UpdateFirewallRule -> String
(Int -> UpdateFirewallRule -> ShowS)
-> (UpdateFirewallRule -> String)
-> ([UpdateFirewallRule] -> ShowS)
-> Show UpdateFirewallRule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateFirewallRule] -> ShowS
$cshowList :: [UpdateFirewallRule] -> ShowS
show :: UpdateFirewallRule -> String
$cshow :: UpdateFirewallRule -> String
showsPrec :: Int -> UpdateFirewallRule -> ShowS
$cshowsPrec :: Int -> UpdateFirewallRule -> ShowS
Prelude.Show, (forall x. UpdateFirewallRule -> Rep UpdateFirewallRule x)
-> (forall x. Rep UpdateFirewallRule x -> UpdateFirewallRule)
-> Generic UpdateFirewallRule
forall x. Rep UpdateFirewallRule x -> UpdateFirewallRule
forall x. UpdateFirewallRule -> Rep UpdateFirewallRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateFirewallRule x -> UpdateFirewallRule
$cfrom :: forall x. UpdateFirewallRule -> Rep UpdateFirewallRule x
Prelude.Generic)

-- |
-- Create a value of 'UpdateFirewallRule' 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:
--
-- 'blockOverrideDnsType', 'updateFirewallRule_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@.
--
-- 'priority', 'updateFirewallRule_priority' - The setting that determines the processing order of the rule in the rule
-- group. DNS Firewall processes the rules in a rule group by order of
-- priority, starting from the lowest setting.
--
-- You must specify a unique priority for each rule in a rule group. To
-- make it easier to insert rules later, leave space between the numbers,
-- for example, use 100, 200, and so on. You can change the priority
-- setting for the rules in a rule group at any time.
--
-- 'blockResponse', 'updateFirewallRule_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.
--
-- 'action', 'updateFirewallRule_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. This option requires additional
--     details in the rule\'s @BlockResponse@.
--
-- 'blockOverrideTtl', 'updateFirewallRule_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', 'updateFirewallRule_name' - The name of the rule.
--
-- 'blockOverrideDomain', 'updateFirewallRule_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@.
--
-- 'firewallRuleGroupId', 'updateFirewallRule_firewallRuleGroupId' - The unique identifier of the firewall rule group for the rule.
--
-- 'firewallDomainListId', 'updateFirewallRule_firewallDomainListId' - The ID of the domain list to use in the rule.
newUpdateFirewallRule ::
  -- | 'firewallRuleGroupId'
  Prelude.Text ->
  -- | 'firewallDomainListId'
  Prelude.Text ->
  UpdateFirewallRule
newUpdateFirewallRule :: Text -> Text -> UpdateFirewallRule
newUpdateFirewallRule
  Text
pFirewallRuleGroupId_
  Text
pFirewallDomainListId_ =
    UpdateFirewallRule' :: Maybe BlockOverrideDnsType
-> Maybe Int
-> Maybe BlockResponse
-> Maybe Action
-> Maybe Natural
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> UpdateFirewallRule
UpdateFirewallRule'
      { $sel:blockOverrideDnsType:UpdateFirewallRule' :: Maybe BlockOverrideDnsType
blockOverrideDnsType =
          Maybe BlockOverrideDnsType
forall a. Maybe a
Prelude.Nothing,
        $sel:priority:UpdateFirewallRule' :: Maybe Int
priority = Maybe Int
forall a. Maybe a
Prelude.Nothing,
        $sel:blockResponse:UpdateFirewallRule' :: Maybe BlockResponse
blockResponse = Maybe BlockResponse
forall a. Maybe a
Prelude.Nothing,
        $sel:action:UpdateFirewallRule' :: Maybe Action
action = Maybe Action
forall a. Maybe a
Prelude.Nothing,
        $sel:blockOverrideTtl:UpdateFirewallRule' :: Maybe Natural
blockOverrideTtl = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:name:UpdateFirewallRule' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:blockOverrideDomain:UpdateFirewallRule' :: Maybe Text
blockOverrideDomain = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:firewallRuleGroupId:UpdateFirewallRule' :: Text
firewallRuleGroupId = Text
pFirewallRuleGroupId_,
        $sel:firewallDomainListId:UpdateFirewallRule' :: Text
firewallDomainListId = Text
pFirewallDomainListId_
      }

-- | 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@.
updateFirewallRule_blockOverrideDnsType :: Lens.Lens' UpdateFirewallRule (Prelude.Maybe BlockOverrideDnsType)
updateFirewallRule_blockOverrideDnsType :: (Maybe BlockOverrideDnsType -> f (Maybe BlockOverrideDnsType))
-> UpdateFirewallRule -> f UpdateFirewallRule
updateFirewallRule_blockOverrideDnsType = (UpdateFirewallRule -> Maybe BlockOverrideDnsType)
-> (UpdateFirewallRule
    -> Maybe BlockOverrideDnsType -> UpdateFirewallRule)
-> Lens
     UpdateFirewallRule
     UpdateFirewallRule
     (Maybe BlockOverrideDnsType)
     (Maybe BlockOverrideDnsType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFirewallRule' {Maybe BlockOverrideDnsType
blockOverrideDnsType :: Maybe BlockOverrideDnsType
$sel:blockOverrideDnsType:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe BlockOverrideDnsType
blockOverrideDnsType} -> Maybe BlockOverrideDnsType
blockOverrideDnsType) (\s :: UpdateFirewallRule
s@UpdateFirewallRule' {} Maybe BlockOverrideDnsType
a -> UpdateFirewallRule
s {$sel:blockOverrideDnsType:UpdateFirewallRule' :: Maybe BlockOverrideDnsType
blockOverrideDnsType = Maybe BlockOverrideDnsType
a} :: UpdateFirewallRule)

-- | The setting that determines the processing order of the rule in the rule
-- group. DNS Firewall processes the rules in a rule group by order of
-- priority, starting from the lowest setting.
--
-- You must specify a unique priority for each rule in a rule group. To
-- make it easier to insert rules later, leave space between the numbers,
-- for example, use 100, 200, and so on. You can change the priority
-- setting for the rules in a rule group at any time.
updateFirewallRule_priority :: Lens.Lens' UpdateFirewallRule (Prelude.Maybe Prelude.Int)
updateFirewallRule_priority :: (Maybe Int -> f (Maybe Int))
-> UpdateFirewallRule -> f UpdateFirewallRule
updateFirewallRule_priority = (UpdateFirewallRule -> Maybe Int)
-> (UpdateFirewallRule -> Maybe Int -> UpdateFirewallRule)
-> Lens
     UpdateFirewallRule UpdateFirewallRule (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFirewallRule' {Maybe Int
priority :: Maybe Int
$sel:priority:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe Int
priority} -> Maybe Int
priority) (\s :: UpdateFirewallRule
s@UpdateFirewallRule' {} Maybe Int
a -> UpdateFirewallRule
s {$sel:priority:UpdateFirewallRule' :: Maybe Int
priority = Maybe Int
a} :: UpdateFirewallRule)

-- | 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.
updateFirewallRule_blockResponse :: Lens.Lens' UpdateFirewallRule (Prelude.Maybe BlockResponse)
updateFirewallRule_blockResponse :: (Maybe BlockResponse -> f (Maybe BlockResponse))
-> UpdateFirewallRule -> f UpdateFirewallRule
updateFirewallRule_blockResponse = (UpdateFirewallRule -> Maybe BlockResponse)
-> (UpdateFirewallRule
    -> Maybe BlockResponse -> UpdateFirewallRule)
-> Lens
     UpdateFirewallRule
     UpdateFirewallRule
     (Maybe BlockResponse)
     (Maybe BlockResponse)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFirewallRule' {Maybe BlockResponse
blockResponse :: Maybe BlockResponse
$sel:blockResponse:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe BlockResponse
blockResponse} -> Maybe BlockResponse
blockResponse) (\s :: UpdateFirewallRule
s@UpdateFirewallRule' {} Maybe BlockResponse
a -> UpdateFirewallRule
s {$sel:blockResponse:UpdateFirewallRule' :: Maybe BlockResponse
blockResponse = Maybe BlockResponse
a} :: UpdateFirewallRule)

-- | 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. This option requires additional
--     details in the rule\'s @BlockResponse@.
updateFirewallRule_action :: Lens.Lens' UpdateFirewallRule (Prelude.Maybe Action)
updateFirewallRule_action :: (Maybe Action -> f (Maybe Action))
-> UpdateFirewallRule -> f UpdateFirewallRule
updateFirewallRule_action = (UpdateFirewallRule -> Maybe Action)
-> (UpdateFirewallRule -> Maybe Action -> UpdateFirewallRule)
-> Lens
     UpdateFirewallRule UpdateFirewallRule (Maybe Action) (Maybe Action)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFirewallRule' {Maybe Action
action :: Maybe Action
$sel:action:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe Action
action} -> Maybe Action
action) (\s :: UpdateFirewallRule
s@UpdateFirewallRule' {} Maybe Action
a -> UpdateFirewallRule
s {$sel:action:UpdateFirewallRule' :: Maybe Action
action = Maybe Action
a} :: UpdateFirewallRule)

-- | 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@.
updateFirewallRule_blockOverrideTtl :: Lens.Lens' UpdateFirewallRule (Prelude.Maybe Prelude.Natural)
updateFirewallRule_blockOverrideTtl :: (Maybe Natural -> f (Maybe Natural))
-> UpdateFirewallRule -> f UpdateFirewallRule
updateFirewallRule_blockOverrideTtl = (UpdateFirewallRule -> Maybe Natural)
-> (UpdateFirewallRule -> Maybe Natural -> UpdateFirewallRule)
-> Lens
     UpdateFirewallRule
     UpdateFirewallRule
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFirewallRule' {Maybe Natural
blockOverrideTtl :: Maybe Natural
$sel:blockOverrideTtl:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe Natural
blockOverrideTtl} -> Maybe Natural
blockOverrideTtl) (\s :: UpdateFirewallRule
s@UpdateFirewallRule' {} Maybe Natural
a -> UpdateFirewallRule
s {$sel:blockOverrideTtl:UpdateFirewallRule' :: Maybe Natural
blockOverrideTtl = Maybe Natural
a} :: UpdateFirewallRule)

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

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

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

-- | The ID of the domain list to use in the rule.
updateFirewallRule_firewallDomainListId :: Lens.Lens' UpdateFirewallRule Prelude.Text
updateFirewallRule_firewallDomainListId :: (Text -> f Text) -> UpdateFirewallRule -> f UpdateFirewallRule
updateFirewallRule_firewallDomainListId = (UpdateFirewallRule -> Text)
-> (UpdateFirewallRule -> Text -> UpdateFirewallRule)
-> Lens UpdateFirewallRule UpdateFirewallRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFirewallRule' {Text
firewallDomainListId :: Text
$sel:firewallDomainListId:UpdateFirewallRule' :: UpdateFirewallRule -> Text
firewallDomainListId} -> Text
firewallDomainListId) (\s :: UpdateFirewallRule
s@UpdateFirewallRule' {} Text
a -> UpdateFirewallRule
s {$sel:firewallDomainListId:UpdateFirewallRule' :: Text
firewallDomainListId = Text
a} :: UpdateFirewallRule)

instance Core.AWSRequest UpdateFirewallRule where
  type
    AWSResponse UpdateFirewallRule =
      UpdateFirewallRuleResponse
  request :: UpdateFirewallRule -> Request UpdateFirewallRule
request = Service -> UpdateFirewallRule -> Request UpdateFirewallRule
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateFirewallRule
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateFirewallRule)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateFirewallRule))
-> Logger
-> Service
-> Proxy UpdateFirewallRule
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateFirewallRule)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe FirewallRule -> Int -> UpdateFirewallRuleResponse
UpdateFirewallRuleResponse'
            (Maybe FirewallRule -> Int -> UpdateFirewallRuleResponse)
-> Either String (Maybe FirewallRule)
-> Either String (Int -> UpdateFirewallRuleResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe FirewallRule)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"FirewallRule")
            Either String (Int -> UpdateFirewallRuleResponse)
-> Either String Int -> Either String UpdateFirewallRuleResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable UpdateFirewallRule

instance Prelude.NFData UpdateFirewallRule

instance Core.ToHeaders UpdateFirewallRule where
  toHeaders :: UpdateFirewallRule -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateFirewallRule -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"Route53Resolver.UpdateFirewallRule" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON UpdateFirewallRule where
  toJSON :: UpdateFirewallRule -> Value
toJSON UpdateFirewallRule' {Maybe Int
Maybe Natural
Maybe Text
Maybe Action
Maybe BlockOverrideDnsType
Maybe BlockResponse
Text
firewallDomainListId :: Text
firewallRuleGroupId :: Text
blockOverrideDomain :: Maybe Text
name :: Maybe Text
blockOverrideTtl :: Maybe Natural
action :: Maybe Action
blockResponse :: Maybe BlockResponse
priority :: Maybe Int
blockOverrideDnsType :: Maybe BlockOverrideDnsType
$sel:firewallDomainListId:UpdateFirewallRule' :: UpdateFirewallRule -> Text
$sel:firewallRuleGroupId:UpdateFirewallRule' :: UpdateFirewallRule -> Text
$sel:blockOverrideDomain:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe Text
$sel:name:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe Text
$sel:blockOverrideTtl:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe Natural
$sel:action:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe Action
$sel:blockResponse:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe BlockResponse
$sel:priority:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe Int
$sel:blockOverrideDnsType:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe BlockOverrideDnsType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"BlockOverrideDnsType" Text -> BlockOverrideDnsType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (BlockOverrideDnsType -> Pair)
-> Maybe BlockOverrideDnsType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe BlockOverrideDnsType
blockOverrideDnsType,
            (Text
"Priority" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
priority,
            (Text
"BlockResponse" Text -> BlockResponse -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (BlockResponse -> Pair) -> Maybe BlockResponse -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe BlockResponse
blockResponse,
            (Text
"Action" Text -> Action -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Action -> Pair) -> Maybe Action -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Action
action,
            (Text
"BlockOverrideTtl" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
blockOverrideTtl,
            (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name,
            (Text
"BlockOverrideDomain" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
blockOverrideDomain,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"FirewallRuleGroupId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
firewallRuleGroupId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"FirewallDomainListId"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
firewallDomainListId
              )
          ]
      )

instance Core.ToPath UpdateFirewallRule where
  toPath :: UpdateFirewallRule -> ByteString
toPath = ByteString -> UpdateFirewallRule -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery UpdateFirewallRule where
  toQuery :: UpdateFirewallRule -> QueryString
toQuery = QueryString -> UpdateFirewallRule -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newUpdateFirewallRuleResponse' smart constructor.
data UpdateFirewallRuleResponse = UpdateFirewallRuleResponse'
  { -- | The firewall rule that you just updated.
    UpdateFirewallRuleResponse -> Maybe FirewallRule
firewallRule :: Prelude.Maybe FirewallRule,
    -- | The response's http status code.
    UpdateFirewallRuleResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpdateFirewallRuleResponse -> UpdateFirewallRuleResponse -> Bool
(UpdateFirewallRuleResponse -> UpdateFirewallRuleResponse -> Bool)
-> (UpdateFirewallRuleResponse
    -> UpdateFirewallRuleResponse -> Bool)
-> Eq UpdateFirewallRuleResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateFirewallRuleResponse -> UpdateFirewallRuleResponse -> Bool
$c/= :: UpdateFirewallRuleResponse -> UpdateFirewallRuleResponse -> Bool
== :: UpdateFirewallRuleResponse -> UpdateFirewallRuleResponse -> Bool
$c== :: UpdateFirewallRuleResponse -> UpdateFirewallRuleResponse -> Bool
Prelude.Eq, ReadPrec [UpdateFirewallRuleResponse]
ReadPrec UpdateFirewallRuleResponse
Int -> ReadS UpdateFirewallRuleResponse
ReadS [UpdateFirewallRuleResponse]
(Int -> ReadS UpdateFirewallRuleResponse)
-> ReadS [UpdateFirewallRuleResponse]
-> ReadPrec UpdateFirewallRuleResponse
-> ReadPrec [UpdateFirewallRuleResponse]
-> Read UpdateFirewallRuleResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateFirewallRuleResponse]
$creadListPrec :: ReadPrec [UpdateFirewallRuleResponse]
readPrec :: ReadPrec UpdateFirewallRuleResponse
$creadPrec :: ReadPrec UpdateFirewallRuleResponse
readList :: ReadS [UpdateFirewallRuleResponse]
$creadList :: ReadS [UpdateFirewallRuleResponse]
readsPrec :: Int -> ReadS UpdateFirewallRuleResponse
$creadsPrec :: Int -> ReadS UpdateFirewallRuleResponse
Prelude.Read, Int -> UpdateFirewallRuleResponse -> ShowS
[UpdateFirewallRuleResponse] -> ShowS
UpdateFirewallRuleResponse -> String
(Int -> UpdateFirewallRuleResponse -> ShowS)
-> (UpdateFirewallRuleResponse -> String)
-> ([UpdateFirewallRuleResponse] -> ShowS)
-> Show UpdateFirewallRuleResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateFirewallRuleResponse] -> ShowS
$cshowList :: [UpdateFirewallRuleResponse] -> ShowS
show :: UpdateFirewallRuleResponse -> String
$cshow :: UpdateFirewallRuleResponse -> String
showsPrec :: Int -> UpdateFirewallRuleResponse -> ShowS
$cshowsPrec :: Int -> UpdateFirewallRuleResponse -> ShowS
Prelude.Show, (forall x.
 UpdateFirewallRuleResponse -> Rep UpdateFirewallRuleResponse x)
-> (forall x.
    Rep UpdateFirewallRuleResponse x -> UpdateFirewallRuleResponse)
-> Generic UpdateFirewallRuleResponse
forall x.
Rep UpdateFirewallRuleResponse x -> UpdateFirewallRuleResponse
forall x.
UpdateFirewallRuleResponse -> Rep UpdateFirewallRuleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateFirewallRuleResponse x -> UpdateFirewallRuleResponse
$cfrom :: forall x.
UpdateFirewallRuleResponse -> Rep UpdateFirewallRuleResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateFirewallRuleResponse' 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:
--
-- 'firewallRule', 'updateFirewallRuleResponse_firewallRule' - The firewall rule that you just updated.
--
-- 'httpStatus', 'updateFirewallRuleResponse_httpStatus' - The response's http status code.
newUpdateFirewallRuleResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateFirewallRuleResponse
newUpdateFirewallRuleResponse :: Int -> UpdateFirewallRuleResponse
newUpdateFirewallRuleResponse Int
pHttpStatus_ =
  UpdateFirewallRuleResponse' :: Maybe FirewallRule -> Int -> UpdateFirewallRuleResponse
UpdateFirewallRuleResponse'
    { $sel:firewallRule:UpdateFirewallRuleResponse' :: Maybe FirewallRule
firewallRule =
        Maybe FirewallRule
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateFirewallRuleResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The firewall rule that you just updated.
updateFirewallRuleResponse_firewallRule :: Lens.Lens' UpdateFirewallRuleResponse (Prelude.Maybe FirewallRule)
updateFirewallRuleResponse_firewallRule :: (Maybe FirewallRule -> f (Maybe FirewallRule))
-> UpdateFirewallRuleResponse -> f UpdateFirewallRuleResponse
updateFirewallRuleResponse_firewallRule = (UpdateFirewallRuleResponse -> Maybe FirewallRule)
-> (UpdateFirewallRuleResponse
    -> Maybe FirewallRule -> UpdateFirewallRuleResponse)
-> Lens
     UpdateFirewallRuleResponse
     UpdateFirewallRuleResponse
     (Maybe FirewallRule)
     (Maybe FirewallRule)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFirewallRuleResponse' {Maybe FirewallRule
firewallRule :: Maybe FirewallRule
$sel:firewallRule:UpdateFirewallRuleResponse' :: UpdateFirewallRuleResponse -> Maybe FirewallRule
firewallRule} -> Maybe FirewallRule
firewallRule) (\s :: UpdateFirewallRuleResponse
s@UpdateFirewallRuleResponse' {} Maybe FirewallRule
a -> UpdateFirewallRuleResponse
s {$sel:firewallRule:UpdateFirewallRuleResponse' :: Maybe FirewallRule
firewallRule = Maybe FirewallRule
a} :: UpdateFirewallRuleResponse)

-- | The response's http status code.
updateFirewallRuleResponse_httpStatus :: Lens.Lens' UpdateFirewallRuleResponse Prelude.Int
updateFirewallRuleResponse_httpStatus :: (Int -> f Int)
-> UpdateFirewallRuleResponse -> f UpdateFirewallRuleResponse
updateFirewallRuleResponse_httpStatus = (UpdateFirewallRuleResponse -> Int)
-> (UpdateFirewallRuleResponse
    -> Int -> UpdateFirewallRuleResponse)
-> Lens
     UpdateFirewallRuleResponse UpdateFirewallRuleResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFirewallRuleResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateFirewallRuleResponse' :: UpdateFirewallRuleResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateFirewallRuleResponse
s@UpdateFirewallRuleResponse' {} Int
a -> UpdateFirewallRuleResponse
s {$sel:httpStatus:UpdateFirewallRuleResponse' :: Int
httpStatus = Int
a} :: UpdateFirewallRuleResponse)

instance Prelude.NFData UpdateFirewallRuleResponse