{-# 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.UpdateFirewallDeleteProtection
-- 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)
--
-- Modifies the flag, @DeleteProtection@, which indicates whether it is
-- possible to delete the firewall. If the flag is set to @TRUE@, the
-- firewall is protected against deletion. This setting helps protect
-- against accidentally deleting a firewall that\'s in use.
module Amazonka.NetworkFirewall.UpdateFirewallDeleteProtection
  ( -- * Creating a Request
    UpdateFirewallDeleteProtection (..),
    newUpdateFirewallDeleteProtection,

    -- * Request Lenses
    updateFirewallDeleteProtection_updateToken,
    updateFirewallDeleteProtection_firewallArn,
    updateFirewallDeleteProtection_firewallName,
    updateFirewallDeleteProtection_deleteProtection,

    -- * Destructuring the Response
    UpdateFirewallDeleteProtectionResponse (..),
    newUpdateFirewallDeleteProtectionResponse,

    -- * Response Lenses
    updateFirewallDeleteProtectionResponse_updateToken,
    updateFirewallDeleteProtectionResponse_firewallArn,
    updateFirewallDeleteProtectionResponse_deleteProtection,
    updateFirewallDeleteProtectionResponse_firewallName,
    updateFirewallDeleteProtectionResponse_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:/ 'newUpdateFirewallDeleteProtection' smart constructor.
data UpdateFirewallDeleteProtection = UpdateFirewallDeleteProtection'
  { -- | 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.
    UpdateFirewallDeleteProtection -> 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.
    UpdateFirewallDeleteProtection -> 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.
    UpdateFirewallDeleteProtection -> Maybe Text
firewallName :: Prelude.Maybe Prelude.Text,
    -- | A flag indicating whether it is possible to delete the firewall. A
    -- setting of @TRUE@ indicates that the firewall is protected against
    -- deletion. Use this setting to protect against accidentally deleting a
    -- firewall that is in use. When you create a firewall, the operation
    -- initializes this flag to @TRUE@.
    UpdateFirewallDeleteProtection -> Bool
deleteProtection :: Prelude.Bool
  }
  deriving (UpdateFirewallDeleteProtection
-> UpdateFirewallDeleteProtection -> Bool
(UpdateFirewallDeleteProtection
 -> UpdateFirewallDeleteProtection -> Bool)
-> (UpdateFirewallDeleteProtection
    -> UpdateFirewallDeleteProtection -> Bool)
-> Eq UpdateFirewallDeleteProtection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateFirewallDeleteProtection
-> UpdateFirewallDeleteProtection -> Bool
$c/= :: UpdateFirewallDeleteProtection
-> UpdateFirewallDeleteProtection -> Bool
== :: UpdateFirewallDeleteProtection
-> UpdateFirewallDeleteProtection -> Bool
$c== :: UpdateFirewallDeleteProtection
-> UpdateFirewallDeleteProtection -> Bool
Prelude.Eq, ReadPrec [UpdateFirewallDeleteProtection]
ReadPrec UpdateFirewallDeleteProtection
Int -> ReadS UpdateFirewallDeleteProtection
ReadS [UpdateFirewallDeleteProtection]
(Int -> ReadS UpdateFirewallDeleteProtection)
-> ReadS [UpdateFirewallDeleteProtection]
-> ReadPrec UpdateFirewallDeleteProtection
-> ReadPrec [UpdateFirewallDeleteProtection]
-> Read UpdateFirewallDeleteProtection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateFirewallDeleteProtection]
$creadListPrec :: ReadPrec [UpdateFirewallDeleteProtection]
readPrec :: ReadPrec UpdateFirewallDeleteProtection
$creadPrec :: ReadPrec UpdateFirewallDeleteProtection
readList :: ReadS [UpdateFirewallDeleteProtection]
$creadList :: ReadS [UpdateFirewallDeleteProtection]
readsPrec :: Int -> ReadS UpdateFirewallDeleteProtection
$creadsPrec :: Int -> ReadS UpdateFirewallDeleteProtection
Prelude.Read, Int -> UpdateFirewallDeleteProtection -> ShowS
[UpdateFirewallDeleteProtection] -> ShowS
UpdateFirewallDeleteProtection -> String
(Int -> UpdateFirewallDeleteProtection -> ShowS)
-> (UpdateFirewallDeleteProtection -> String)
-> ([UpdateFirewallDeleteProtection] -> ShowS)
-> Show UpdateFirewallDeleteProtection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateFirewallDeleteProtection] -> ShowS
$cshowList :: [UpdateFirewallDeleteProtection] -> ShowS
show :: UpdateFirewallDeleteProtection -> String
$cshow :: UpdateFirewallDeleteProtection -> String
showsPrec :: Int -> UpdateFirewallDeleteProtection -> ShowS
$cshowsPrec :: Int -> UpdateFirewallDeleteProtection -> ShowS
Prelude.Show, (forall x.
 UpdateFirewallDeleteProtection
 -> Rep UpdateFirewallDeleteProtection x)
-> (forall x.
    Rep UpdateFirewallDeleteProtection x
    -> UpdateFirewallDeleteProtection)
-> Generic UpdateFirewallDeleteProtection
forall x.
Rep UpdateFirewallDeleteProtection x
-> UpdateFirewallDeleteProtection
forall x.
UpdateFirewallDeleteProtection
-> Rep UpdateFirewallDeleteProtection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateFirewallDeleteProtection x
-> UpdateFirewallDeleteProtection
$cfrom :: forall x.
UpdateFirewallDeleteProtection
-> Rep UpdateFirewallDeleteProtection x
Prelude.Generic)

-- |
-- Create a value of 'UpdateFirewallDeleteProtection' 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', 'updateFirewallDeleteProtection_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', 'updateFirewallDeleteProtection_firewallArn' - The Amazon Resource Name (ARN) of the firewall.
--
-- You must specify the ARN or the name, and you can specify both.
--
-- 'firewallName', 'updateFirewallDeleteProtection_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.
--
-- 'deleteProtection', 'updateFirewallDeleteProtection_deleteProtection' - A flag indicating whether it is possible to delete the firewall. A
-- setting of @TRUE@ indicates that the firewall is protected against
-- deletion. Use this setting to protect against accidentally deleting a
-- firewall that is in use. When you create a firewall, the operation
-- initializes this flag to @TRUE@.
newUpdateFirewallDeleteProtection ::
  -- | 'deleteProtection'
  Prelude.Bool ->
  UpdateFirewallDeleteProtection
newUpdateFirewallDeleteProtection :: Bool -> UpdateFirewallDeleteProtection
newUpdateFirewallDeleteProtection Bool
pDeleteProtection_ =
  UpdateFirewallDeleteProtection' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Bool
-> UpdateFirewallDeleteProtection
UpdateFirewallDeleteProtection'
    { $sel:updateToken:UpdateFirewallDeleteProtection' :: Maybe Text
updateToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:firewallArn:UpdateFirewallDeleteProtection' :: Maybe Text
firewallArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:firewallName:UpdateFirewallDeleteProtection' :: Maybe Text
firewallName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:deleteProtection:UpdateFirewallDeleteProtection' :: Bool
deleteProtection = Bool
pDeleteProtection_
    }

-- | 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.
updateFirewallDeleteProtection_updateToken :: Lens.Lens' UpdateFirewallDeleteProtection (Prelude.Maybe Prelude.Text)
updateFirewallDeleteProtection_updateToken :: (Maybe Text -> f (Maybe Text))
-> UpdateFirewallDeleteProtection
-> f UpdateFirewallDeleteProtection
updateFirewallDeleteProtection_updateToken = (UpdateFirewallDeleteProtection -> Maybe Text)
-> (UpdateFirewallDeleteProtection
    -> Maybe Text -> UpdateFirewallDeleteProtection)
-> Lens
     UpdateFirewallDeleteProtection
     UpdateFirewallDeleteProtection
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFirewallDeleteProtection' {Maybe Text
updateToken :: Maybe Text
$sel:updateToken:UpdateFirewallDeleteProtection' :: UpdateFirewallDeleteProtection -> Maybe Text
updateToken} -> Maybe Text
updateToken) (\s :: UpdateFirewallDeleteProtection
s@UpdateFirewallDeleteProtection' {} Maybe Text
a -> UpdateFirewallDeleteProtection
s {$sel:updateToken:UpdateFirewallDeleteProtection' :: Maybe Text
updateToken = Maybe Text
a} :: UpdateFirewallDeleteProtection)

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

-- | 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.
updateFirewallDeleteProtection_firewallName :: Lens.Lens' UpdateFirewallDeleteProtection (Prelude.Maybe Prelude.Text)
updateFirewallDeleteProtection_firewallName :: (Maybe Text -> f (Maybe Text))
-> UpdateFirewallDeleteProtection
-> f UpdateFirewallDeleteProtection
updateFirewallDeleteProtection_firewallName = (UpdateFirewallDeleteProtection -> Maybe Text)
-> (UpdateFirewallDeleteProtection
    -> Maybe Text -> UpdateFirewallDeleteProtection)
-> Lens
     UpdateFirewallDeleteProtection
     UpdateFirewallDeleteProtection
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFirewallDeleteProtection' {Maybe Text
firewallName :: Maybe Text
$sel:firewallName:UpdateFirewallDeleteProtection' :: UpdateFirewallDeleteProtection -> Maybe Text
firewallName} -> Maybe Text
firewallName) (\s :: UpdateFirewallDeleteProtection
s@UpdateFirewallDeleteProtection' {} Maybe Text
a -> UpdateFirewallDeleteProtection
s {$sel:firewallName:UpdateFirewallDeleteProtection' :: Maybe Text
firewallName = Maybe Text
a} :: UpdateFirewallDeleteProtection)

-- | A flag indicating whether it is possible to delete the firewall. A
-- setting of @TRUE@ indicates that the firewall is protected against
-- deletion. Use this setting to protect against accidentally deleting a
-- firewall that is in use. When you create a firewall, the operation
-- initializes this flag to @TRUE@.
updateFirewallDeleteProtection_deleteProtection :: Lens.Lens' UpdateFirewallDeleteProtection Prelude.Bool
updateFirewallDeleteProtection_deleteProtection :: (Bool -> f Bool)
-> UpdateFirewallDeleteProtection
-> f UpdateFirewallDeleteProtection
updateFirewallDeleteProtection_deleteProtection = (UpdateFirewallDeleteProtection -> Bool)
-> (UpdateFirewallDeleteProtection
    -> Bool -> UpdateFirewallDeleteProtection)
-> Lens
     UpdateFirewallDeleteProtection
     UpdateFirewallDeleteProtection
     Bool
     Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFirewallDeleteProtection' {Bool
deleteProtection :: Bool
$sel:deleteProtection:UpdateFirewallDeleteProtection' :: UpdateFirewallDeleteProtection -> Bool
deleteProtection} -> Bool
deleteProtection) (\s :: UpdateFirewallDeleteProtection
s@UpdateFirewallDeleteProtection' {} Bool
a -> UpdateFirewallDeleteProtection
s {$sel:deleteProtection:UpdateFirewallDeleteProtection' :: Bool
deleteProtection = Bool
a} :: UpdateFirewallDeleteProtection)

instance
  Core.AWSRequest
    UpdateFirewallDeleteProtection
  where
  type
    AWSResponse UpdateFirewallDeleteProtection =
      UpdateFirewallDeleteProtectionResponse
  request :: UpdateFirewallDeleteProtection
-> Request UpdateFirewallDeleteProtection
request = Service
-> UpdateFirewallDeleteProtection
-> Request UpdateFirewallDeleteProtection
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateFirewallDeleteProtection
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse UpdateFirewallDeleteProtection)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateFirewallDeleteProtection))
-> Logger
-> Service
-> Proxy UpdateFirewallDeleteProtection
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse UpdateFirewallDeleteProtection)))
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
-> UpdateFirewallDeleteProtectionResponse
UpdateFirewallDeleteProtectionResponse'
            (Maybe Text
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Text
 -> Int
 -> UpdateFirewallDeleteProtectionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Int
      -> UpdateFirewallDeleteProtectionResponse)
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
   -> UpdateFirewallDeleteProtectionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Bool
      -> Maybe Text -> Int -> UpdateFirewallDeleteProtectionResponse)
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 -> UpdateFirewallDeleteProtectionResponse)
-> Either String (Maybe Bool)
-> Either
     String
     (Maybe Text -> Int -> UpdateFirewallDeleteProtectionResponse)
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
"DeleteProtection")
            Either
  String
  (Maybe Text -> Int -> UpdateFirewallDeleteProtectionResponse)
-> Either String (Maybe Text)
-> Either String (Int -> UpdateFirewallDeleteProtectionResponse)
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 -> UpdateFirewallDeleteProtectionResponse)
-> Either String Int
-> Either String UpdateFirewallDeleteProtectionResponse
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
    UpdateFirewallDeleteProtection

instance
  Prelude.NFData
    UpdateFirewallDeleteProtection

instance
  Core.ToHeaders
    UpdateFirewallDeleteProtection
  where
  toHeaders :: UpdateFirewallDeleteProtection -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> UpdateFirewallDeleteProtection -> 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.UpdateFirewallDeleteProtection" ::
                          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 UpdateFirewallDeleteProtection where
  toJSON :: UpdateFirewallDeleteProtection -> Value
toJSON UpdateFirewallDeleteProtection' {Bool
Maybe Text
deleteProtection :: Bool
firewallName :: Maybe Text
firewallArn :: Maybe Text
updateToken :: Maybe Text
$sel:deleteProtection:UpdateFirewallDeleteProtection' :: UpdateFirewallDeleteProtection -> Bool
$sel:firewallName:UpdateFirewallDeleteProtection' :: UpdateFirewallDeleteProtection -> Maybe Text
$sel:firewallArn:UpdateFirewallDeleteProtection' :: UpdateFirewallDeleteProtection -> Maybe Text
$sel:updateToken:UpdateFirewallDeleteProtection' :: UpdateFirewallDeleteProtection -> 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
"DeleteProtection" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Bool
deleteProtection)
          ]
      )

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

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

-- | /See:/ 'newUpdateFirewallDeleteProtectionResponse' smart constructor.
data UpdateFirewallDeleteProtectionResponse = UpdateFirewallDeleteProtectionResponse'
  { -- | 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.
    UpdateFirewallDeleteProtectionResponse -> Maybe Text
updateToken :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the firewall.
    UpdateFirewallDeleteProtectionResponse -> Maybe Text
firewallArn :: Prelude.Maybe Prelude.Text,
    UpdateFirewallDeleteProtectionResponse -> Maybe Bool
deleteProtection :: Prelude.Maybe Prelude.Bool,
    -- | The descriptive name of the firewall. You can\'t change the name of a
    -- firewall after you create it.
    UpdateFirewallDeleteProtectionResponse -> Maybe Text
firewallName :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    UpdateFirewallDeleteProtectionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpdateFirewallDeleteProtectionResponse
-> UpdateFirewallDeleteProtectionResponse -> Bool
(UpdateFirewallDeleteProtectionResponse
 -> UpdateFirewallDeleteProtectionResponse -> Bool)
-> (UpdateFirewallDeleteProtectionResponse
    -> UpdateFirewallDeleteProtectionResponse -> Bool)
-> Eq UpdateFirewallDeleteProtectionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateFirewallDeleteProtectionResponse
-> UpdateFirewallDeleteProtectionResponse -> Bool
$c/= :: UpdateFirewallDeleteProtectionResponse
-> UpdateFirewallDeleteProtectionResponse -> Bool
== :: UpdateFirewallDeleteProtectionResponse
-> UpdateFirewallDeleteProtectionResponse -> Bool
$c== :: UpdateFirewallDeleteProtectionResponse
-> UpdateFirewallDeleteProtectionResponse -> Bool
Prelude.Eq, ReadPrec [UpdateFirewallDeleteProtectionResponse]
ReadPrec UpdateFirewallDeleteProtectionResponse
Int -> ReadS UpdateFirewallDeleteProtectionResponse
ReadS [UpdateFirewallDeleteProtectionResponse]
(Int -> ReadS UpdateFirewallDeleteProtectionResponse)
-> ReadS [UpdateFirewallDeleteProtectionResponse]
-> ReadPrec UpdateFirewallDeleteProtectionResponse
-> ReadPrec [UpdateFirewallDeleteProtectionResponse]
-> Read UpdateFirewallDeleteProtectionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateFirewallDeleteProtectionResponse]
$creadListPrec :: ReadPrec [UpdateFirewallDeleteProtectionResponse]
readPrec :: ReadPrec UpdateFirewallDeleteProtectionResponse
$creadPrec :: ReadPrec UpdateFirewallDeleteProtectionResponse
readList :: ReadS [UpdateFirewallDeleteProtectionResponse]
$creadList :: ReadS [UpdateFirewallDeleteProtectionResponse]
readsPrec :: Int -> ReadS UpdateFirewallDeleteProtectionResponse
$creadsPrec :: Int -> ReadS UpdateFirewallDeleteProtectionResponse
Prelude.Read, Int -> UpdateFirewallDeleteProtectionResponse -> ShowS
[UpdateFirewallDeleteProtectionResponse] -> ShowS
UpdateFirewallDeleteProtectionResponse -> String
(Int -> UpdateFirewallDeleteProtectionResponse -> ShowS)
-> (UpdateFirewallDeleteProtectionResponse -> String)
-> ([UpdateFirewallDeleteProtectionResponse] -> ShowS)
-> Show UpdateFirewallDeleteProtectionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateFirewallDeleteProtectionResponse] -> ShowS
$cshowList :: [UpdateFirewallDeleteProtectionResponse] -> ShowS
show :: UpdateFirewallDeleteProtectionResponse -> String
$cshow :: UpdateFirewallDeleteProtectionResponse -> String
showsPrec :: Int -> UpdateFirewallDeleteProtectionResponse -> ShowS
$cshowsPrec :: Int -> UpdateFirewallDeleteProtectionResponse -> ShowS
Prelude.Show, (forall x.
 UpdateFirewallDeleteProtectionResponse
 -> Rep UpdateFirewallDeleteProtectionResponse x)
-> (forall x.
    Rep UpdateFirewallDeleteProtectionResponse x
    -> UpdateFirewallDeleteProtectionResponse)
-> Generic UpdateFirewallDeleteProtectionResponse
forall x.
Rep UpdateFirewallDeleteProtectionResponse x
-> UpdateFirewallDeleteProtectionResponse
forall x.
UpdateFirewallDeleteProtectionResponse
-> Rep UpdateFirewallDeleteProtectionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateFirewallDeleteProtectionResponse x
-> UpdateFirewallDeleteProtectionResponse
$cfrom :: forall x.
UpdateFirewallDeleteProtectionResponse
-> Rep UpdateFirewallDeleteProtectionResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateFirewallDeleteProtectionResponse' 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', 'updateFirewallDeleteProtectionResponse_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', 'updateFirewallDeleteProtectionResponse_firewallArn' - The Amazon Resource Name (ARN) of the firewall.
--
-- 'deleteProtection', 'updateFirewallDeleteProtectionResponse_deleteProtection' -
--
-- 'firewallName', 'updateFirewallDeleteProtectionResponse_firewallName' - The descriptive name of the firewall. You can\'t change the name of a
-- firewall after you create it.
--
-- 'httpStatus', 'updateFirewallDeleteProtectionResponse_httpStatus' - The response's http status code.
newUpdateFirewallDeleteProtectionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateFirewallDeleteProtectionResponse
newUpdateFirewallDeleteProtectionResponse :: Int -> UpdateFirewallDeleteProtectionResponse
newUpdateFirewallDeleteProtectionResponse
  Int
pHttpStatus_ =
    UpdateFirewallDeleteProtectionResponse' :: Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Int
-> UpdateFirewallDeleteProtectionResponse
UpdateFirewallDeleteProtectionResponse'
      { $sel:updateToken:UpdateFirewallDeleteProtectionResponse' :: Maybe Text
updateToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:firewallArn:UpdateFirewallDeleteProtectionResponse' :: Maybe Text
firewallArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:deleteProtection:UpdateFirewallDeleteProtectionResponse' :: Maybe Bool
deleteProtection = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:firewallName:UpdateFirewallDeleteProtectionResponse' :: Maybe Text
firewallName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:UpdateFirewallDeleteProtectionResponse' :: 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.
updateFirewallDeleteProtectionResponse_updateToken :: Lens.Lens' UpdateFirewallDeleteProtectionResponse (Prelude.Maybe Prelude.Text)
updateFirewallDeleteProtectionResponse_updateToken :: (Maybe Text -> f (Maybe Text))
-> UpdateFirewallDeleteProtectionResponse
-> f UpdateFirewallDeleteProtectionResponse
updateFirewallDeleteProtectionResponse_updateToken = (UpdateFirewallDeleteProtectionResponse -> Maybe Text)
-> (UpdateFirewallDeleteProtectionResponse
    -> Maybe Text -> UpdateFirewallDeleteProtectionResponse)
-> Lens
     UpdateFirewallDeleteProtectionResponse
     UpdateFirewallDeleteProtectionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFirewallDeleteProtectionResponse' {Maybe Text
updateToken :: Maybe Text
$sel:updateToken:UpdateFirewallDeleteProtectionResponse' :: UpdateFirewallDeleteProtectionResponse -> Maybe Text
updateToken} -> Maybe Text
updateToken) (\s :: UpdateFirewallDeleteProtectionResponse
s@UpdateFirewallDeleteProtectionResponse' {} Maybe Text
a -> UpdateFirewallDeleteProtectionResponse
s {$sel:updateToken:UpdateFirewallDeleteProtectionResponse' :: Maybe Text
updateToken = Maybe Text
a} :: UpdateFirewallDeleteProtectionResponse)

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

-- |
updateFirewallDeleteProtectionResponse_deleteProtection :: Lens.Lens' UpdateFirewallDeleteProtectionResponse (Prelude.Maybe Prelude.Bool)
updateFirewallDeleteProtectionResponse_deleteProtection :: (Maybe Bool -> f (Maybe Bool))
-> UpdateFirewallDeleteProtectionResponse
-> f UpdateFirewallDeleteProtectionResponse
updateFirewallDeleteProtectionResponse_deleteProtection = (UpdateFirewallDeleteProtectionResponse -> Maybe Bool)
-> (UpdateFirewallDeleteProtectionResponse
    -> Maybe Bool -> UpdateFirewallDeleteProtectionResponse)
-> Lens
     UpdateFirewallDeleteProtectionResponse
     UpdateFirewallDeleteProtectionResponse
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFirewallDeleteProtectionResponse' {Maybe Bool
deleteProtection :: Maybe Bool
$sel:deleteProtection:UpdateFirewallDeleteProtectionResponse' :: UpdateFirewallDeleteProtectionResponse -> Maybe Bool
deleteProtection} -> Maybe Bool
deleteProtection) (\s :: UpdateFirewallDeleteProtectionResponse
s@UpdateFirewallDeleteProtectionResponse' {} Maybe Bool
a -> UpdateFirewallDeleteProtectionResponse
s {$sel:deleteProtection:UpdateFirewallDeleteProtectionResponse' :: Maybe Bool
deleteProtection = Maybe Bool
a} :: UpdateFirewallDeleteProtectionResponse)

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

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

instance
  Prelude.NFData
    UpdateFirewallDeleteProtectionResponse