{-# 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.NetworkFirewall.UpdateFirewallPolicyChangeProtection
-- 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.NetworkFirewall.UpdateFirewallPolicyChangeProtection
  ( -- * Creating a Request
    UpdateFirewallPolicyChangeProtection (..),
    newUpdateFirewallPolicyChangeProtection,

    -- * Request Lenses
    updateFirewallPolicyChangeProtection_updateToken,
    updateFirewallPolicyChangeProtection_firewallArn,
    updateFirewallPolicyChangeProtection_firewallName,
    updateFirewallPolicyChangeProtection_firewallPolicyChangeProtection,

    -- * Destructuring the Response
    UpdateFirewallPolicyChangeProtectionResponse (..),
    newUpdateFirewallPolicyChangeProtectionResponse,

    -- * Response Lenses
    updateFirewallPolicyChangeProtectionResponse_updateToken,
    updateFirewallPolicyChangeProtectionResponse_firewallArn,
    updateFirewallPolicyChangeProtectionResponse_firewallPolicyChangeProtection,
    updateFirewallPolicyChangeProtectionResponse_firewallName,
    updateFirewallPolicyChangeProtectionResponse_httpStatus,
  )
where

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

-- | /See:/ 'newUpdateFirewallPolicyChangeProtection' smart constructor.
data UpdateFirewallPolicyChangeProtection = UpdateFirewallPolicyChangeProtection'
  { -- | An optional token that you can use for optimistic locking. Network
    -- Firewall returns a token to your requests that access the firewall. The
    -- token marks the state of the firewall resource at the time of the
    -- request.
    --
    -- To make an unconditional change to the firewall, omit the token in your
    -- update request. Without the token, Network Firewall performs your
    -- updates regardless of whether the firewall has changed since you last
    -- retrieved it.
    --
    -- To make a conditional change to the firewall, provide the token in your
    -- update request. Network Firewall uses the token to ensure that the
    -- firewall hasn\'t changed since you last retrieved it. If it has changed,
    -- the operation fails with an @InvalidTokenException@. If this happens,
    -- retrieve the firewall again to get a current copy of it with a new
    -- token. Reapply your changes as needed, then try the operation again
    -- using the new token.
    UpdateFirewallPolicyChangeProtection -> Maybe Text
updateToken :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the firewall.
    --
    -- You must specify the ARN or the name, and you can specify both.
    UpdateFirewallPolicyChangeProtection -> Maybe Text
firewallArn :: Prelude.Maybe Prelude.Text,
    -- | The descriptive name of the firewall. You can\'t change the name of a
    -- firewall after you create it.
    --
    -- You must specify the ARN or the name, and you can specify both.
    UpdateFirewallPolicyChangeProtection -> Maybe Text
firewallName :: Prelude.Maybe Prelude.Text,
    -- | A setting indicating whether the firewall is protected against a change
    -- to the firewall policy association. Use this setting to protect against
    -- accidentally modifying the firewall policy for a firewall that is in
    -- use. When you create a firewall, the operation initializes this setting
    -- to @TRUE@.
    UpdateFirewallPolicyChangeProtection -> Bool
firewallPolicyChangeProtection :: Prelude.Bool
  }
  deriving (UpdateFirewallPolicyChangeProtection
-> UpdateFirewallPolicyChangeProtection -> Bool
(UpdateFirewallPolicyChangeProtection
 -> UpdateFirewallPolicyChangeProtection -> Bool)
-> (UpdateFirewallPolicyChangeProtection
    -> UpdateFirewallPolicyChangeProtection -> Bool)
-> Eq UpdateFirewallPolicyChangeProtection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateFirewallPolicyChangeProtection
-> UpdateFirewallPolicyChangeProtection -> Bool
$c/= :: UpdateFirewallPolicyChangeProtection
-> UpdateFirewallPolicyChangeProtection -> Bool
== :: UpdateFirewallPolicyChangeProtection
-> UpdateFirewallPolicyChangeProtection -> Bool
$c== :: UpdateFirewallPolicyChangeProtection
-> UpdateFirewallPolicyChangeProtection -> Bool
Prelude.Eq, ReadPrec [UpdateFirewallPolicyChangeProtection]
ReadPrec UpdateFirewallPolicyChangeProtection
Int -> ReadS UpdateFirewallPolicyChangeProtection
ReadS [UpdateFirewallPolicyChangeProtection]
(Int -> ReadS UpdateFirewallPolicyChangeProtection)
-> ReadS [UpdateFirewallPolicyChangeProtection]
-> ReadPrec UpdateFirewallPolicyChangeProtection
-> ReadPrec [UpdateFirewallPolicyChangeProtection]
-> Read UpdateFirewallPolicyChangeProtection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateFirewallPolicyChangeProtection]
$creadListPrec :: ReadPrec [UpdateFirewallPolicyChangeProtection]
readPrec :: ReadPrec UpdateFirewallPolicyChangeProtection
$creadPrec :: ReadPrec UpdateFirewallPolicyChangeProtection
readList :: ReadS [UpdateFirewallPolicyChangeProtection]
$creadList :: ReadS [UpdateFirewallPolicyChangeProtection]
readsPrec :: Int -> ReadS UpdateFirewallPolicyChangeProtection
$creadsPrec :: Int -> ReadS UpdateFirewallPolicyChangeProtection
Prelude.Read, Int -> UpdateFirewallPolicyChangeProtection -> ShowS
[UpdateFirewallPolicyChangeProtection] -> ShowS
UpdateFirewallPolicyChangeProtection -> String
(Int -> UpdateFirewallPolicyChangeProtection -> ShowS)
-> (UpdateFirewallPolicyChangeProtection -> String)
-> ([UpdateFirewallPolicyChangeProtection] -> ShowS)
-> Show UpdateFirewallPolicyChangeProtection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateFirewallPolicyChangeProtection] -> ShowS
$cshowList :: [UpdateFirewallPolicyChangeProtection] -> ShowS
show :: UpdateFirewallPolicyChangeProtection -> String
$cshow :: UpdateFirewallPolicyChangeProtection -> String
showsPrec :: Int -> UpdateFirewallPolicyChangeProtection -> ShowS
$cshowsPrec :: Int -> UpdateFirewallPolicyChangeProtection -> ShowS
Prelude.Show, (forall x.
 UpdateFirewallPolicyChangeProtection
 -> Rep UpdateFirewallPolicyChangeProtection x)
-> (forall x.
    Rep UpdateFirewallPolicyChangeProtection x
    -> UpdateFirewallPolicyChangeProtection)
-> Generic UpdateFirewallPolicyChangeProtection
forall x.
Rep UpdateFirewallPolicyChangeProtection x
-> UpdateFirewallPolicyChangeProtection
forall x.
UpdateFirewallPolicyChangeProtection
-> Rep UpdateFirewallPolicyChangeProtection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateFirewallPolicyChangeProtection x
-> UpdateFirewallPolicyChangeProtection
$cfrom :: forall x.
UpdateFirewallPolicyChangeProtection
-> Rep UpdateFirewallPolicyChangeProtection x
Prelude.Generic)

-- |
-- Create a value of 'UpdateFirewallPolicyChangeProtection' 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:
--
-- 'updateToken', 'updateFirewallPolicyChangeProtection_updateToken' - An optional token that you can use for optimistic locking. Network
-- Firewall returns a token to your requests that access the firewall. The
-- token marks the state of the firewall resource at the time of the
-- request.
--
-- To make an unconditional change to the firewall, omit the token in your
-- update request. Without the token, Network Firewall performs your
-- updates regardless of whether the firewall has changed since you last
-- retrieved it.
--
-- To make a conditional change to the firewall, provide the token in your
-- update request. Network Firewall uses the token to ensure that the
-- firewall hasn\'t changed since you last retrieved it. If it has changed,
-- the operation fails with an @InvalidTokenException@. If this happens,
-- retrieve the firewall again to get a current copy of it with a new
-- token. Reapply your changes as needed, then try the operation again
-- using the new token.
--
-- 'firewallArn', 'updateFirewallPolicyChangeProtection_firewallArn' - The Amazon Resource Name (ARN) of the firewall.
--
-- You must specify the ARN or the name, and you can specify both.
--
-- 'firewallName', 'updateFirewallPolicyChangeProtection_firewallName' - The descriptive name of the firewall. You can\'t change the name of a
-- firewall after you create it.
--
-- You must specify the ARN or the name, and you can specify both.
--
-- 'firewallPolicyChangeProtection', 'updateFirewallPolicyChangeProtection_firewallPolicyChangeProtection' - A setting indicating whether the firewall is protected against a change
-- to the firewall policy association. Use this setting to protect against
-- accidentally modifying the firewall policy for a firewall that is in
-- use. When you create a firewall, the operation initializes this setting
-- to @TRUE@.
newUpdateFirewallPolicyChangeProtection ::
  -- | 'firewallPolicyChangeProtection'
  Prelude.Bool ->
  UpdateFirewallPolicyChangeProtection
newUpdateFirewallPolicyChangeProtection :: Bool -> UpdateFirewallPolicyChangeProtection
newUpdateFirewallPolicyChangeProtection
  Bool
pFirewallPolicyChangeProtection_ =
    UpdateFirewallPolicyChangeProtection' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Bool
-> UpdateFirewallPolicyChangeProtection
UpdateFirewallPolicyChangeProtection'
      { $sel:updateToken:UpdateFirewallPolicyChangeProtection' :: Maybe Text
updateToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:firewallArn:UpdateFirewallPolicyChangeProtection' :: Maybe Text
firewallArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:firewallName:UpdateFirewallPolicyChangeProtection' :: Maybe Text
firewallName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:firewallPolicyChangeProtection:UpdateFirewallPolicyChangeProtection' :: Bool
firewallPolicyChangeProtection =
          Bool
pFirewallPolicyChangeProtection_
      }

-- | An optional token that you can use for optimistic locking. Network
-- Firewall returns a token to your requests that access the firewall. The
-- token marks the state of the firewall resource at the time of the
-- request.
--
-- To make an unconditional change to the firewall, omit the token in your
-- update request. Without the token, Network Firewall performs your
-- updates regardless of whether the firewall has changed since you last
-- retrieved it.
--
-- To make a conditional change to the firewall, provide the token in your
-- update request. Network Firewall uses the token to ensure that the
-- firewall hasn\'t changed since you last retrieved it. If it has changed,
-- the operation fails with an @InvalidTokenException@. If this happens,
-- retrieve the firewall again to get a current copy of it with a new
-- token. Reapply your changes as needed, then try the operation again
-- using the new token.
updateFirewallPolicyChangeProtection_updateToken :: Lens.Lens' UpdateFirewallPolicyChangeProtection (Prelude.Maybe Prelude.Text)
updateFirewallPolicyChangeProtection_updateToken :: (Maybe Text -> f (Maybe Text))
-> UpdateFirewallPolicyChangeProtection
-> f UpdateFirewallPolicyChangeProtection
updateFirewallPolicyChangeProtection_updateToken = (UpdateFirewallPolicyChangeProtection -> Maybe Text)
-> (UpdateFirewallPolicyChangeProtection
    -> Maybe Text -> UpdateFirewallPolicyChangeProtection)
-> Lens
     UpdateFirewallPolicyChangeProtection
     UpdateFirewallPolicyChangeProtection
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFirewallPolicyChangeProtection' {Maybe Text
updateToken :: Maybe Text
$sel:updateToken:UpdateFirewallPolicyChangeProtection' :: UpdateFirewallPolicyChangeProtection -> Maybe Text
updateToken} -> Maybe Text
updateToken) (\s :: UpdateFirewallPolicyChangeProtection
s@UpdateFirewallPolicyChangeProtection' {} Maybe Text
a -> UpdateFirewallPolicyChangeProtection
s {$sel:updateToken:UpdateFirewallPolicyChangeProtection' :: Maybe Text
updateToken = Maybe Text
a} :: UpdateFirewallPolicyChangeProtection)

-- | The Amazon Resource Name (ARN) of the firewall.
--
-- You must specify the ARN or the name, and you can specify both.
updateFirewallPolicyChangeProtection_firewallArn :: Lens.Lens' UpdateFirewallPolicyChangeProtection (Prelude.Maybe Prelude.Text)
updateFirewallPolicyChangeProtection_firewallArn :: (Maybe Text -> f (Maybe Text))
-> UpdateFirewallPolicyChangeProtection
-> f UpdateFirewallPolicyChangeProtection
updateFirewallPolicyChangeProtection_firewallArn = (UpdateFirewallPolicyChangeProtection -> Maybe Text)
-> (UpdateFirewallPolicyChangeProtection
    -> Maybe Text -> UpdateFirewallPolicyChangeProtection)
-> Lens
     UpdateFirewallPolicyChangeProtection
     UpdateFirewallPolicyChangeProtection
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFirewallPolicyChangeProtection' {Maybe Text
firewallArn :: Maybe Text
$sel:firewallArn:UpdateFirewallPolicyChangeProtection' :: UpdateFirewallPolicyChangeProtection -> Maybe Text
firewallArn} -> Maybe Text
firewallArn) (\s :: UpdateFirewallPolicyChangeProtection
s@UpdateFirewallPolicyChangeProtection' {} Maybe Text
a -> UpdateFirewallPolicyChangeProtection
s {$sel:firewallArn:UpdateFirewallPolicyChangeProtection' :: Maybe Text
firewallArn = Maybe Text
a} :: UpdateFirewallPolicyChangeProtection)

-- | The descriptive name of the firewall. You can\'t change the name of a
-- firewall after you create it.
--
-- You must specify the ARN or the name, and you can specify both.
updateFirewallPolicyChangeProtection_firewallName :: Lens.Lens' UpdateFirewallPolicyChangeProtection (Prelude.Maybe Prelude.Text)
updateFirewallPolicyChangeProtection_firewallName :: (Maybe Text -> f (Maybe Text))
-> UpdateFirewallPolicyChangeProtection
-> f UpdateFirewallPolicyChangeProtection
updateFirewallPolicyChangeProtection_firewallName = (UpdateFirewallPolicyChangeProtection -> Maybe Text)
-> (UpdateFirewallPolicyChangeProtection
    -> Maybe Text -> UpdateFirewallPolicyChangeProtection)
-> Lens
     UpdateFirewallPolicyChangeProtection
     UpdateFirewallPolicyChangeProtection
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFirewallPolicyChangeProtection' {Maybe Text
firewallName :: Maybe Text
$sel:firewallName:UpdateFirewallPolicyChangeProtection' :: UpdateFirewallPolicyChangeProtection -> Maybe Text
firewallName} -> Maybe Text
firewallName) (\s :: UpdateFirewallPolicyChangeProtection
s@UpdateFirewallPolicyChangeProtection' {} Maybe Text
a -> UpdateFirewallPolicyChangeProtection
s {$sel:firewallName:UpdateFirewallPolicyChangeProtection' :: Maybe Text
firewallName = Maybe Text
a} :: UpdateFirewallPolicyChangeProtection)

-- | A setting indicating whether the firewall is protected against a change
-- to the firewall policy association. Use this setting to protect against
-- accidentally modifying the firewall policy for a firewall that is in
-- use. When you create a firewall, the operation initializes this setting
-- to @TRUE@.
updateFirewallPolicyChangeProtection_firewallPolicyChangeProtection :: Lens.Lens' UpdateFirewallPolicyChangeProtection Prelude.Bool
updateFirewallPolicyChangeProtection_firewallPolicyChangeProtection :: (Bool -> f Bool)
-> UpdateFirewallPolicyChangeProtection
-> f UpdateFirewallPolicyChangeProtection
updateFirewallPolicyChangeProtection_firewallPolicyChangeProtection = (UpdateFirewallPolicyChangeProtection -> Bool)
-> (UpdateFirewallPolicyChangeProtection
    -> Bool -> UpdateFirewallPolicyChangeProtection)
-> Lens
     UpdateFirewallPolicyChangeProtection
     UpdateFirewallPolicyChangeProtection
     Bool
     Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFirewallPolicyChangeProtection' {Bool
firewallPolicyChangeProtection :: Bool
$sel:firewallPolicyChangeProtection:UpdateFirewallPolicyChangeProtection' :: UpdateFirewallPolicyChangeProtection -> Bool
firewallPolicyChangeProtection} -> Bool
firewallPolicyChangeProtection) (\s :: UpdateFirewallPolicyChangeProtection
s@UpdateFirewallPolicyChangeProtection' {} Bool
a -> UpdateFirewallPolicyChangeProtection
s {$sel:firewallPolicyChangeProtection:UpdateFirewallPolicyChangeProtection' :: Bool
firewallPolicyChangeProtection = Bool
a} :: UpdateFirewallPolicyChangeProtection)

instance
  Core.AWSRequest
    UpdateFirewallPolicyChangeProtection
  where
  type
    AWSResponse UpdateFirewallPolicyChangeProtection =
      UpdateFirewallPolicyChangeProtectionResponse
  request :: UpdateFirewallPolicyChangeProtection
-> Request UpdateFirewallPolicyChangeProtection
request = Service
-> UpdateFirewallPolicyChangeProtection
-> Request UpdateFirewallPolicyChangeProtection
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateFirewallPolicyChangeProtection
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse UpdateFirewallPolicyChangeProtection)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either
      String (AWSResponse UpdateFirewallPolicyChangeProtection))
-> Logger
-> Service
-> Proxy UpdateFirewallPolicyChangeProtection
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse UpdateFirewallPolicyChangeProtection)))
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 Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Int
-> UpdateFirewallPolicyChangeProtectionResponse
UpdateFirewallPolicyChangeProtectionResponse'
            (Maybe Text
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Text
 -> Int
 -> UpdateFirewallPolicyChangeProtectionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Int
      -> UpdateFirewallPolicyChangeProtectionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"UpdateToken")
              Either
  String
  (Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Int
   -> UpdateFirewallPolicyChangeProtectionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Bool
      -> Maybe Text
      -> Int
      -> UpdateFirewallPolicyChangeProtectionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"FirewallArn")
              Either
  String
  (Maybe Bool
   -> Maybe Text
   -> Int
   -> UpdateFirewallPolicyChangeProtectionResponse)
-> Either String (Maybe Bool)
-> Either
     String
     (Maybe Text -> Int -> UpdateFirewallPolicyChangeProtectionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"FirewallPolicyChangeProtection")
              Either
  String
  (Maybe Text -> Int -> UpdateFirewallPolicyChangeProtectionResponse)
-> Either String (Maybe Text)
-> Either
     String (Int -> UpdateFirewallPolicyChangeProtectionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"FirewallName")
              Either String (Int -> UpdateFirewallPolicyChangeProtectionResponse)
-> Either String Int
-> Either String UpdateFirewallPolicyChangeProtectionResponse
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
    UpdateFirewallPolicyChangeProtection

instance
  Prelude.NFData
    UpdateFirewallPolicyChangeProtection

instance
  Core.ToHeaders
    UpdateFirewallPolicyChangeProtection
  where
  toHeaders :: UpdateFirewallPolicyChangeProtection -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> UpdateFirewallPolicyChangeProtection -> 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
"NetworkFirewall_20201112.UpdateFirewallPolicyChangeProtection" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance
  Core.ToJSON
    UpdateFirewallPolicyChangeProtection
  where
  toJSON :: UpdateFirewallPolicyChangeProtection -> Value
toJSON UpdateFirewallPolicyChangeProtection' {Bool
Maybe Text
firewallPolicyChangeProtection :: Bool
firewallName :: Maybe Text
firewallArn :: Maybe Text
updateToken :: Maybe Text
$sel:firewallPolicyChangeProtection:UpdateFirewallPolicyChangeProtection' :: UpdateFirewallPolicyChangeProtection -> Bool
$sel:firewallName:UpdateFirewallPolicyChangeProtection' :: UpdateFirewallPolicyChangeProtection -> Maybe Text
$sel:firewallArn:UpdateFirewallPolicyChangeProtection' :: UpdateFirewallPolicyChangeProtection -> Maybe Text
$sel:updateToken:UpdateFirewallPolicyChangeProtection' :: UpdateFirewallPolicyChangeProtection -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"UpdateToken" 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
updateToken,
            (Text
"FirewallArn" 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
firewallArn,
            (Text
"FirewallName" 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
firewallName,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"FirewallPolicyChangeProtection"
                  Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Bool
firewallPolicyChangeProtection
              )
          ]
      )

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

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

-- | /See:/ 'newUpdateFirewallPolicyChangeProtectionResponse' smart constructor.
data UpdateFirewallPolicyChangeProtectionResponse = UpdateFirewallPolicyChangeProtectionResponse'
  { -- | An optional token that you can use for optimistic locking. Network
    -- Firewall returns a token to your requests that access the firewall. The
    -- token marks the state of the firewall resource at the time of the
    -- request.
    --
    -- To make an unconditional change to the firewall, omit the token in your
    -- update request. Without the token, Network Firewall performs your
    -- updates regardless of whether the firewall has changed since you last
    -- retrieved it.
    --
    -- To make a conditional change to the firewall, provide the token in your
    -- update request. Network Firewall uses the token to ensure that the
    -- firewall hasn\'t changed since you last retrieved it. If it has changed,
    -- the operation fails with an @InvalidTokenException@. If this happens,
    -- retrieve the firewall again to get a current copy of it with a new
    -- token. Reapply your changes as needed, then try the operation again
    -- using the new token.
    UpdateFirewallPolicyChangeProtectionResponse -> Maybe Text
updateToken :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the firewall.
    UpdateFirewallPolicyChangeProtectionResponse -> Maybe Text
firewallArn :: Prelude.Maybe Prelude.Text,
    -- | A setting indicating whether the firewall is protected against a change
    -- to the firewall policy association. Use this setting to protect against
    -- accidentally modifying the firewall policy for a firewall that is in
    -- use. When you create a firewall, the operation initializes this setting
    -- to @TRUE@.
    UpdateFirewallPolicyChangeProtectionResponse -> Maybe Bool
firewallPolicyChangeProtection :: Prelude.Maybe Prelude.Bool,
    -- | The descriptive name of the firewall. You can\'t change the name of a
    -- firewall after you create it.
    UpdateFirewallPolicyChangeProtectionResponse -> Maybe Text
firewallName :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    UpdateFirewallPolicyChangeProtectionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpdateFirewallPolicyChangeProtectionResponse
-> UpdateFirewallPolicyChangeProtectionResponse -> Bool
(UpdateFirewallPolicyChangeProtectionResponse
 -> UpdateFirewallPolicyChangeProtectionResponse -> Bool)
-> (UpdateFirewallPolicyChangeProtectionResponse
    -> UpdateFirewallPolicyChangeProtectionResponse -> Bool)
-> Eq UpdateFirewallPolicyChangeProtectionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateFirewallPolicyChangeProtectionResponse
-> UpdateFirewallPolicyChangeProtectionResponse -> Bool
$c/= :: UpdateFirewallPolicyChangeProtectionResponse
-> UpdateFirewallPolicyChangeProtectionResponse -> Bool
== :: UpdateFirewallPolicyChangeProtectionResponse
-> UpdateFirewallPolicyChangeProtectionResponse -> Bool
$c== :: UpdateFirewallPolicyChangeProtectionResponse
-> UpdateFirewallPolicyChangeProtectionResponse -> Bool
Prelude.Eq, ReadPrec [UpdateFirewallPolicyChangeProtectionResponse]
ReadPrec UpdateFirewallPolicyChangeProtectionResponse
Int -> ReadS UpdateFirewallPolicyChangeProtectionResponse
ReadS [UpdateFirewallPolicyChangeProtectionResponse]
(Int -> ReadS UpdateFirewallPolicyChangeProtectionResponse)
-> ReadS [UpdateFirewallPolicyChangeProtectionResponse]
-> ReadPrec UpdateFirewallPolicyChangeProtectionResponse
-> ReadPrec [UpdateFirewallPolicyChangeProtectionResponse]
-> Read UpdateFirewallPolicyChangeProtectionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateFirewallPolicyChangeProtectionResponse]
$creadListPrec :: ReadPrec [UpdateFirewallPolicyChangeProtectionResponse]
readPrec :: ReadPrec UpdateFirewallPolicyChangeProtectionResponse
$creadPrec :: ReadPrec UpdateFirewallPolicyChangeProtectionResponse
readList :: ReadS [UpdateFirewallPolicyChangeProtectionResponse]
$creadList :: ReadS [UpdateFirewallPolicyChangeProtectionResponse]
readsPrec :: Int -> ReadS UpdateFirewallPolicyChangeProtectionResponse
$creadsPrec :: Int -> ReadS UpdateFirewallPolicyChangeProtectionResponse
Prelude.Read, Int -> UpdateFirewallPolicyChangeProtectionResponse -> ShowS
[UpdateFirewallPolicyChangeProtectionResponse] -> ShowS
UpdateFirewallPolicyChangeProtectionResponse -> String
(Int -> UpdateFirewallPolicyChangeProtectionResponse -> ShowS)
-> (UpdateFirewallPolicyChangeProtectionResponse -> String)
-> ([UpdateFirewallPolicyChangeProtectionResponse] -> ShowS)
-> Show UpdateFirewallPolicyChangeProtectionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateFirewallPolicyChangeProtectionResponse] -> ShowS
$cshowList :: [UpdateFirewallPolicyChangeProtectionResponse] -> ShowS
show :: UpdateFirewallPolicyChangeProtectionResponse -> String
$cshow :: UpdateFirewallPolicyChangeProtectionResponse -> String
showsPrec :: Int -> UpdateFirewallPolicyChangeProtectionResponse -> ShowS
$cshowsPrec :: Int -> UpdateFirewallPolicyChangeProtectionResponse -> ShowS
Prelude.Show, (forall x.
 UpdateFirewallPolicyChangeProtectionResponse
 -> Rep UpdateFirewallPolicyChangeProtectionResponse x)
-> (forall x.
    Rep UpdateFirewallPolicyChangeProtectionResponse x
    -> UpdateFirewallPolicyChangeProtectionResponse)
-> Generic UpdateFirewallPolicyChangeProtectionResponse
forall x.
Rep UpdateFirewallPolicyChangeProtectionResponse x
-> UpdateFirewallPolicyChangeProtectionResponse
forall x.
UpdateFirewallPolicyChangeProtectionResponse
-> Rep UpdateFirewallPolicyChangeProtectionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateFirewallPolicyChangeProtectionResponse x
-> UpdateFirewallPolicyChangeProtectionResponse
$cfrom :: forall x.
UpdateFirewallPolicyChangeProtectionResponse
-> Rep UpdateFirewallPolicyChangeProtectionResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateFirewallPolicyChangeProtectionResponse' 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:
--
-- 'updateToken', 'updateFirewallPolicyChangeProtectionResponse_updateToken' - An optional token that you can use for optimistic locking. Network
-- Firewall returns a token to your requests that access the firewall. The
-- token marks the state of the firewall resource at the time of the
-- request.
--
-- To make an unconditional change to the firewall, omit the token in your
-- update request. Without the token, Network Firewall performs your
-- updates regardless of whether the firewall has changed since you last
-- retrieved it.
--
-- To make a conditional change to the firewall, provide the token in your
-- update request. Network Firewall uses the token to ensure that the
-- firewall hasn\'t changed since you last retrieved it. If it has changed,
-- the operation fails with an @InvalidTokenException@. If this happens,
-- retrieve the firewall again to get a current copy of it with a new
-- token. Reapply your changes as needed, then try the operation again
-- using the new token.
--
-- 'firewallArn', 'updateFirewallPolicyChangeProtectionResponse_firewallArn' - The Amazon Resource Name (ARN) of the firewall.
--
-- 'firewallPolicyChangeProtection', 'updateFirewallPolicyChangeProtectionResponse_firewallPolicyChangeProtection' - A setting indicating whether the firewall is protected against a change
-- to the firewall policy association. Use this setting to protect against
-- accidentally modifying the firewall policy for a firewall that is in
-- use. When you create a firewall, the operation initializes this setting
-- to @TRUE@.
--
-- 'firewallName', 'updateFirewallPolicyChangeProtectionResponse_firewallName' - The descriptive name of the firewall. You can\'t change the name of a
-- firewall after you create it.
--
-- 'httpStatus', 'updateFirewallPolicyChangeProtectionResponse_httpStatus' - The response's http status code.
newUpdateFirewallPolicyChangeProtectionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateFirewallPolicyChangeProtectionResponse
newUpdateFirewallPolicyChangeProtectionResponse :: Int -> UpdateFirewallPolicyChangeProtectionResponse
newUpdateFirewallPolicyChangeProtectionResponse
  Int
pHttpStatus_ =
    UpdateFirewallPolicyChangeProtectionResponse' :: Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Int
-> UpdateFirewallPolicyChangeProtectionResponse
UpdateFirewallPolicyChangeProtectionResponse'
      { $sel:updateToken:UpdateFirewallPolicyChangeProtectionResponse' :: Maybe Text
updateToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:firewallArn:UpdateFirewallPolicyChangeProtectionResponse' :: Maybe Text
firewallArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:firewallPolicyChangeProtection:UpdateFirewallPolicyChangeProtectionResponse' :: Maybe Bool
firewallPolicyChangeProtection =
          Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:firewallName:UpdateFirewallPolicyChangeProtectionResponse' :: Maybe Text
firewallName =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:UpdateFirewallPolicyChangeProtectionResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | An optional token that you can use for optimistic locking. Network
-- Firewall returns a token to your requests that access the firewall. The
-- token marks the state of the firewall resource at the time of the
-- request.
--
-- To make an unconditional change to the firewall, omit the token in your
-- update request. Without the token, Network Firewall performs your
-- updates regardless of whether the firewall has changed since you last
-- retrieved it.
--
-- To make a conditional change to the firewall, provide the token in your
-- update request. Network Firewall uses the token to ensure that the
-- firewall hasn\'t changed since you last retrieved it. If it has changed,
-- the operation fails with an @InvalidTokenException@. If this happens,
-- retrieve the firewall again to get a current copy of it with a new
-- token. Reapply your changes as needed, then try the operation again
-- using the new token.
updateFirewallPolicyChangeProtectionResponse_updateToken :: Lens.Lens' UpdateFirewallPolicyChangeProtectionResponse (Prelude.Maybe Prelude.Text)
updateFirewallPolicyChangeProtectionResponse_updateToken :: (Maybe Text -> f (Maybe Text))
-> UpdateFirewallPolicyChangeProtectionResponse
-> f UpdateFirewallPolicyChangeProtectionResponse
updateFirewallPolicyChangeProtectionResponse_updateToken = (UpdateFirewallPolicyChangeProtectionResponse -> Maybe Text)
-> (UpdateFirewallPolicyChangeProtectionResponse
    -> Maybe Text -> UpdateFirewallPolicyChangeProtectionResponse)
-> Lens
     UpdateFirewallPolicyChangeProtectionResponse
     UpdateFirewallPolicyChangeProtectionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFirewallPolicyChangeProtectionResponse' {Maybe Text
updateToken :: Maybe Text
$sel:updateToken:UpdateFirewallPolicyChangeProtectionResponse' :: UpdateFirewallPolicyChangeProtectionResponse -> Maybe Text
updateToken} -> Maybe Text
updateToken) (\s :: UpdateFirewallPolicyChangeProtectionResponse
s@UpdateFirewallPolicyChangeProtectionResponse' {} Maybe Text
a -> UpdateFirewallPolicyChangeProtectionResponse
s {$sel:updateToken:UpdateFirewallPolicyChangeProtectionResponse' :: Maybe Text
updateToken = Maybe Text
a} :: UpdateFirewallPolicyChangeProtectionResponse)

-- | The Amazon Resource Name (ARN) of the firewall.
updateFirewallPolicyChangeProtectionResponse_firewallArn :: Lens.Lens' UpdateFirewallPolicyChangeProtectionResponse (Prelude.Maybe Prelude.Text)
updateFirewallPolicyChangeProtectionResponse_firewallArn :: (Maybe Text -> f (Maybe Text))
-> UpdateFirewallPolicyChangeProtectionResponse
-> f UpdateFirewallPolicyChangeProtectionResponse
updateFirewallPolicyChangeProtectionResponse_firewallArn = (UpdateFirewallPolicyChangeProtectionResponse -> Maybe Text)
-> (UpdateFirewallPolicyChangeProtectionResponse
    -> Maybe Text -> UpdateFirewallPolicyChangeProtectionResponse)
-> Lens
     UpdateFirewallPolicyChangeProtectionResponse
     UpdateFirewallPolicyChangeProtectionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFirewallPolicyChangeProtectionResponse' {Maybe Text
firewallArn :: Maybe Text
$sel:firewallArn:UpdateFirewallPolicyChangeProtectionResponse' :: UpdateFirewallPolicyChangeProtectionResponse -> Maybe Text
firewallArn} -> Maybe Text
firewallArn) (\s :: UpdateFirewallPolicyChangeProtectionResponse
s@UpdateFirewallPolicyChangeProtectionResponse' {} Maybe Text
a -> UpdateFirewallPolicyChangeProtectionResponse
s {$sel:firewallArn:UpdateFirewallPolicyChangeProtectionResponse' :: Maybe Text
firewallArn = Maybe Text
a} :: UpdateFirewallPolicyChangeProtectionResponse)

-- | A setting indicating whether the firewall is protected against a change
-- to the firewall policy association. Use this setting to protect against
-- accidentally modifying the firewall policy for a firewall that is in
-- use. When you create a firewall, the operation initializes this setting
-- to @TRUE@.
updateFirewallPolicyChangeProtectionResponse_firewallPolicyChangeProtection :: Lens.Lens' UpdateFirewallPolicyChangeProtectionResponse (Prelude.Maybe Prelude.Bool)
updateFirewallPolicyChangeProtectionResponse_firewallPolicyChangeProtection :: (Maybe Bool -> f (Maybe Bool))
-> UpdateFirewallPolicyChangeProtectionResponse
-> f UpdateFirewallPolicyChangeProtectionResponse
updateFirewallPolicyChangeProtectionResponse_firewallPolicyChangeProtection = (UpdateFirewallPolicyChangeProtectionResponse -> Maybe Bool)
-> (UpdateFirewallPolicyChangeProtectionResponse
    -> Maybe Bool -> UpdateFirewallPolicyChangeProtectionResponse)
-> Lens
     UpdateFirewallPolicyChangeProtectionResponse
     UpdateFirewallPolicyChangeProtectionResponse
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFirewallPolicyChangeProtectionResponse' {Maybe Bool
firewallPolicyChangeProtection :: Maybe Bool
$sel:firewallPolicyChangeProtection:UpdateFirewallPolicyChangeProtectionResponse' :: UpdateFirewallPolicyChangeProtectionResponse -> Maybe Bool
firewallPolicyChangeProtection} -> Maybe Bool
firewallPolicyChangeProtection) (\s :: UpdateFirewallPolicyChangeProtectionResponse
s@UpdateFirewallPolicyChangeProtectionResponse' {} Maybe Bool
a -> UpdateFirewallPolicyChangeProtectionResponse
s {$sel:firewallPolicyChangeProtection:UpdateFirewallPolicyChangeProtectionResponse' :: Maybe Bool
firewallPolicyChangeProtection = Maybe Bool
a} :: UpdateFirewallPolicyChangeProtectionResponse)

-- | The descriptive name of the firewall. You can\'t change the name of a
-- firewall after you create it.
updateFirewallPolicyChangeProtectionResponse_firewallName :: Lens.Lens' UpdateFirewallPolicyChangeProtectionResponse (Prelude.Maybe Prelude.Text)
updateFirewallPolicyChangeProtectionResponse_firewallName :: (Maybe Text -> f (Maybe Text))
-> UpdateFirewallPolicyChangeProtectionResponse
-> f UpdateFirewallPolicyChangeProtectionResponse
updateFirewallPolicyChangeProtectionResponse_firewallName = (UpdateFirewallPolicyChangeProtectionResponse -> Maybe Text)
-> (UpdateFirewallPolicyChangeProtectionResponse
    -> Maybe Text -> UpdateFirewallPolicyChangeProtectionResponse)
-> Lens
     UpdateFirewallPolicyChangeProtectionResponse
     UpdateFirewallPolicyChangeProtectionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFirewallPolicyChangeProtectionResponse' {Maybe Text
firewallName :: Maybe Text
$sel:firewallName:UpdateFirewallPolicyChangeProtectionResponse' :: UpdateFirewallPolicyChangeProtectionResponse -> Maybe Text
firewallName} -> Maybe Text
firewallName) (\s :: UpdateFirewallPolicyChangeProtectionResponse
s@UpdateFirewallPolicyChangeProtectionResponse' {} Maybe Text
a -> UpdateFirewallPolicyChangeProtectionResponse
s {$sel:firewallName:UpdateFirewallPolicyChangeProtectionResponse' :: Maybe Text
firewallName = Maybe Text
a} :: UpdateFirewallPolicyChangeProtectionResponse)

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

instance
  Prelude.NFData
    UpdateFirewallPolicyChangeProtectionResponse