{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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_action,
    updateFirewallRule_blockOverrideDnsType,
    updateFirewallRule_blockOverrideDomain,
    updateFirewallRule_blockOverrideTtl,
    updateFirewallRule_blockResponse,
    updateFirewallRule_name,
    updateFirewallRule_priority,
    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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 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 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 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 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 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 name of the rule.
    UpdateFirewallRule -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | 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 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
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]
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
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. 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:
--
-- '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@.
--
-- '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@.
--
-- '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@.
--
-- '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@.
--
-- '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.
--
-- 'name', 'updateFirewallRule_name' - The name of the rule.
--
-- '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.
--
-- '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'
      { $sel:action:UpdateFirewallRule' :: Maybe Action
action = forall a. Maybe a
Prelude.Nothing,
        $sel:blockOverrideDnsType:UpdateFirewallRule' :: Maybe BlockOverrideDnsType
blockOverrideDnsType = forall a. Maybe a
Prelude.Nothing,
        $sel:blockOverrideDomain:UpdateFirewallRule' :: Maybe Text
blockOverrideDomain = forall a. Maybe a
Prelude.Nothing,
        $sel:blockOverrideTtl:UpdateFirewallRule' :: Maybe Natural
blockOverrideTtl = forall a. Maybe a
Prelude.Nothing,
        $sel:blockResponse:UpdateFirewallRule' :: Maybe BlockResponse
blockResponse = forall a. Maybe a
Prelude.Nothing,
        $sel:name:UpdateFirewallRule' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
        $sel:priority:UpdateFirewallRule' :: Maybe Int
priority = forall a. Maybe a
Prelude.Nothing,
        $sel:firewallRuleGroupId:UpdateFirewallRule' :: Text
firewallRuleGroupId = Text
pFirewallRuleGroupId_,
        $sel:firewallDomainListId:UpdateFirewallRule' :: Text
firewallDomainListId = Text
pFirewallDomainListId_
      }

-- | 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 :: Lens' UpdateFirewallRule (Maybe Action)
updateFirewallRule_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 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 :: Lens' UpdateFirewallRule (Maybe BlockOverrideDnsType)
updateFirewallRule_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 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 :: Lens' UpdateFirewallRule (Maybe Text)
updateFirewallRule_blockOverrideDomain = 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 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 :: Lens' UpdateFirewallRule (Maybe Natural)
updateFirewallRule_blockOverrideTtl = 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 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 :: Lens' UpdateFirewallRule (Maybe BlockResponse)
updateFirewallRule_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 name of the rule.
updateFirewallRule_name :: Lens.Lens' UpdateFirewallRule (Prelude.Maybe Prelude.Text)
updateFirewallRule_name :: Lens' UpdateFirewallRule (Maybe Text)
updateFirewallRule_name = 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 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 :: Lens' UpdateFirewallRule (Maybe Int)
updateFirewallRule_priority = 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 unique identifier of the firewall rule group for the rule.
updateFirewallRule_firewallRuleGroupId :: Lens.Lens' UpdateFirewallRule Prelude.Text
updateFirewallRule_firewallRuleGroupId :: Lens' UpdateFirewallRule Text
updateFirewallRule_firewallRuleGroupId = 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 :: Lens' UpdateFirewallRule Text
updateFirewallRule_firewallDomainListId = 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 :: (Service -> Service)
-> UpdateFirewallRule -> Request UpdateFirewallRule
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateFirewallRule
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateFirewallRule)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe FirewallRule -> Int -> UpdateFirewallRuleResponse
UpdateFirewallRuleResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"FirewallRule")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable UpdateFirewallRule where
  hashWithSalt :: Int -> UpdateFirewallRule -> Int
hashWithSalt Int
_salt UpdateFirewallRule' {Maybe Int
Maybe Natural
Maybe Text
Maybe Action
Maybe BlockOverrideDnsType
Maybe BlockResponse
Text
firewallDomainListId :: Text
firewallRuleGroupId :: Text
priority :: Maybe Int
name :: Maybe Text
blockResponse :: Maybe BlockResponse
blockOverrideTtl :: Maybe Natural
blockOverrideDomain :: Maybe Text
blockOverrideDnsType :: Maybe BlockOverrideDnsType
action :: Maybe Action
$sel:firewallDomainListId:UpdateFirewallRule' :: UpdateFirewallRule -> Text
$sel:firewallRuleGroupId:UpdateFirewallRule' :: UpdateFirewallRule -> Text
$sel:priority:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe Int
$sel:name:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe Text
$sel:blockResponse:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe BlockResponse
$sel:blockOverrideTtl:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe Natural
$sel:blockOverrideDomain:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe Text
$sel:blockOverrideDnsType:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe BlockOverrideDnsType
$sel:action:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe Action
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Action
action
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe BlockOverrideDnsType
blockOverrideDnsType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
blockOverrideDomain
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
blockOverrideTtl
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe BlockResponse
blockResponse
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
priority
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
firewallRuleGroupId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
firewallDomainListId

instance Prelude.NFData UpdateFirewallRule where
  rnf :: UpdateFirewallRule -> ()
rnf UpdateFirewallRule' {Maybe Int
Maybe Natural
Maybe Text
Maybe Action
Maybe BlockOverrideDnsType
Maybe BlockResponse
Text
firewallDomainListId :: Text
firewallRuleGroupId :: Text
priority :: Maybe Int
name :: Maybe Text
blockResponse :: Maybe BlockResponse
blockOverrideTtl :: Maybe Natural
blockOverrideDomain :: Maybe Text
blockOverrideDnsType :: Maybe BlockOverrideDnsType
action :: Maybe Action
$sel:firewallDomainListId:UpdateFirewallRule' :: UpdateFirewallRule -> Text
$sel:firewallRuleGroupId:UpdateFirewallRule' :: UpdateFirewallRule -> Text
$sel:priority:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe Int
$sel:name:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe Text
$sel:blockResponse:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe BlockResponse
$sel:blockOverrideTtl:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe Natural
$sel:blockOverrideDomain:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe Text
$sel:blockOverrideDnsType:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe BlockOverrideDnsType
$sel:action:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe Action
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Action
action
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe BlockOverrideDnsType
blockOverrideDnsType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
blockOverrideDomain
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
blockOverrideTtl
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe BlockResponse
blockResponse
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
priority
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
firewallRuleGroupId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
firewallDomainListId

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

instance Data.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
priority :: Maybe Int
name :: Maybe Text
blockResponse :: Maybe BlockResponse
blockOverrideTtl :: Maybe Natural
blockOverrideDomain :: Maybe Text
blockOverrideDnsType :: Maybe BlockOverrideDnsType
action :: Maybe Action
$sel:firewallDomainListId:UpdateFirewallRule' :: UpdateFirewallRule -> Text
$sel:firewallRuleGroupId:UpdateFirewallRule' :: UpdateFirewallRule -> Text
$sel:priority:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe Int
$sel:name:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe Text
$sel:blockResponse:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe BlockResponse
$sel:blockOverrideTtl:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe Natural
$sel:blockOverrideDomain:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe Text
$sel:blockOverrideDnsType:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe BlockOverrideDnsType
$sel:action:UpdateFirewallRule' :: UpdateFirewallRule -> Maybe Action
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Action" 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 Action
action,
            (Key
"BlockOverrideDnsType" 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 BlockOverrideDnsType
blockOverrideDnsType,
            (Key
"BlockOverrideDomain" 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
blockOverrideDomain,
            (Key
"BlockOverrideTtl" 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 Natural
blockOverrideTtl,
            (Key
"BlockResponse" 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 BlockResponse
blockResponse,
            (Key
"Name" 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
name,
            (Key
"Priority" 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 Int
priority,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"FirewallRuleGroupId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
firewallRuleGroupId),
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"FirewallDomainListId"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
firewallDomainListId
              )
          ]
      )

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

instance Data.ToQuery UpdateFirewallRule where
  toQuery :: UpdateFirewallRule -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
    { $sel:firewallRule:UpdateFirewallRuleResponse' :: Maybe FirewallRule
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 :: Lens' UpdateFirewallRuleResponse (Maybe FirewallRule)
updateFirewallRuleResponse_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 :: Lens' UpdateFirewallRuleResponse Int
updateFirewallRuleResponse_httpStatus = 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 where
  rnf :: UpdateFirewallRuleResponse -> ()
rnf UpdateFirewallRuleResponse' {Int
Maybe FirewallRule
httpStatus :: Int
firewallRule :: Maybe FirewallRule
$sel:httpStatus:UpdateFirewallRuleResponse' :: UpdateFirewallRuleResponse -> Int
$sel:firewallRule:UpdateFirewallRuleResponse' :: UpdateFirewallRuleResponse -> Maybe FirewallRule
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe FirewallRule
firewallRule
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus