{-# 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.UpdateSubnetChangeProtection
-- 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.UpdateSubnetChangeProtection
  ( -- * Creating a Request
    UpdateSubnetChangeProtection (..),
    newUpdateSubnetChangeProtection,

    -- * Request Lenses
    updateSubnetChangeProtection_updateToken,
    updateSubnetChangeProtection_firewallArn,
    updateSubnetChangeProtection_firewallName,
    updateSubnetChangeProtection_subnetChangeProtection,

    -- * Destructuring the Response
    UpdateSubnetChangeProtectionResponse (..),
    newUpdateSubnetChangeProtectionResponse,

    -- * Response Lenses
    updateSubnetChangeProtectionResponse_updateToken,
    updateSubnetChangeProtectionResponse_firewallArn,
    updateSubnetChangeProtectionResponse_subnetChangeProtection,
    updateSubnetChangeProtectionResponse_firewallName,
    updateSubnetChangeProtectionResponse_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:/ 'newUpdateSubnetChangeProtection' smart constructor.
data UpdateSubnetChangeProtection = UpdateSubnetChangeProtection'
  { -- | 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.
    UpdateSubnetChangeProtection -> 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.
    UpdateSubnetChangeProtection -> 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.
    UpdateSubnetChangeProtection -> Maybe Text
firewallName :: Prelude.Maybe Prelude.Text,
    -- | A setting indicating whether the firewall is protected against changes
    -- to the subnet associations. Use this setting to protect against
    -- accidentally modifying the subnet associations for a firewall that is in
    -- use. When you create a firewall, the operation initializes this setting
    -- to @TRUE@.
    UpdateSubnetChangeProtection -> Bool
subnetChangeProtection :: Prelude.Bool
  }
  deriving (UpdateSubnetChangeProtection
-> UpdateSubnetChangeProtection -> Bool
(UpdateSubnetChangeProtection
 -> UpdateSubnetChangeProtection -> Bool)
-> (UpdateSubnetChangeProtection
    -> UpdateSubnetChangeProtection -> Bool)
-> Eq UpdateSubnetChangeProtection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateSubnetChangeProtection
-> UpdateSubnetChangeProtection -> Bool
$c/= :: UpdateSubnetChangeProtection
-> UpdateSubnetChangeProtection -> Bool
== :: UpdateSubnetChangeProtection
-> UpdateSubnetChangeProtection -> Bool
$c== :: UpdateSubnetChangeProtection
-> UpdateSubnetChangeProtection -> Bool
Prelude.Eq, ReadPrec [UpdateSubnetChangeProtection]
ReadPrec UpdateSubnetChangeProtection
Int -> ReadS UpdateSubnetChangeProtection
ReadS [UpdateSubnetChangeProtection]
(Int -> ReadS UpdateSubnetChangeProtection)
-> ReadS [UpdateSubnetChangeProtection]
-> ReadPrec UpdateSubnetChangeProtection
-> ReadPrec [UpdateSubnetChangeProtection]
-> Read UpdateSubnetChangeProtection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateSubnetChangeProtection]
$creadListPrec :: ReadPrec [UpdateSubnetChangeProtection]
readPrec :: ReadPrec UpdateSubnetChangeProtection
$creadPrec :: ReadPrec UpdateSubnetChangeProtection
readList :: ReadS [UpdateSubnetChangeProtection]
$creadList :: ReadS [UpdateSubnetChangeProtection]
readsPrec :: Int -> ReadS UpdateSubnetChangeProtection
$creadsPrec :: Int -> ReadS UpdateSubnetChangeProtection
Prelude.Read, Int -> UpdateSubnetChangeProtection -> ShowS
[UpdateSubnetChangeProtection] -> ShowS
UpdateSubnetChangeProtection -> String
(Int -> UpdateSubnetChangeProtection -> ShowS)
-> (UpdateSubnetChangeProtection -> String)
-> ([UpdateSubnetChangeProtection] -> ShowS)
-> Show UpdateSubnetChangeProtection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateSubnetChangeProtection] -> ShowS
$cshowList :: [UpdateSubnetChangeProtection] -> ShowS
show :: UpdateSubnetChangeProtection -> String
$cshow :: UpdateSubnetChangeProtection -> String
showsPrec :: Int -> UpdateSubnetChangeProtection -> ShowS
$cshowsPrec :: Int -> UpdateSubnetChangeProtection -> ShowS
Prelude.Show, (forall x.
 UpdateSubnetChangeProtection -> Rep UpdateSubnetChangeProtection x)
-> (forall x.
    Rep UpdateSubnetChangeProtection x -> UpdateSubnetChangeProtection)
-> Generic UpdateSubnetChangeProtection
forall x.
Rep UpdateSubnetChangeProtection x -> UpdateSubnetChangeProtection
forall x.
UpdateSubnetChangeProtection -> Rep UpdateSubnetChangeProtection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateSubnetChangeProtection x -> UpdateSubnetChangeProtection
$cfrom :: forall x.
UpdateSubnetChangeProtection -> Rep UpdateSubnetChangeProtection x
Prelude.Generic)

-- |
-- Create a value of 'UpdateSubnetChangeProtection' 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', 'updateSubnetChangeProtection_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', 'updateSubnetChangeProtection_firewallArn' - The Amazon Resource Name (ARN) of the firewall.
--
-- You must specify the ARN or the name, and you can specify both.
--
-- 'firewallName', 'updateSubnetChangeProtection_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.
--
-- 'subnetChangeProtection', 'updateSubnetChangeProtection_subnetChangeProtection' - A setting indicating whether the firewall is protected against changes
-- to the subnet associations. Use this setting to protect against
-- accidentally modifying the subnet associations for a firewall that is in
-- use. When you create a firewall, the operation initializes this setting
-- to @TRUE@.
newUpdateSubnetChangeProtection ::
  -- | 'subnetChangeProtection'
  Prelude.Bool ->
  UpdateSubnetChangeProtection
newUpdateSubnetChangeProtection :: Bool -> UpdateSubnetChangeProtection
newUpdateSubnetChangeProtection
  Bool
pSubnetChangeProtection_ =
    UpdateSubnetChangeProtection' :: Maybe Text
-> Maybe Text -> Maybe Text -> Bool -> UpdateSubnetChangeProtection
UpdateSubnetChangeProtection'
      { $sel:updateToken:UpdateSubnetChangeProtection' :: Maybe Text
updateToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:firewallArn:UpdateSubnetChangeProtection' :: Maybe Text
firewallArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:firewallName:UpdateSubnetChangeProtection' :: Maybe Text
firewallName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:subnetChangeProtection:UpdateSubnetChangeProtection' :: Bool
subnetChangeProtection =
          Bool
pSubnetChangeProtection_
      }

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

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

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

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

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

instance Prelude.NFData UpdateSubnetChangeProtection

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

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

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

-- | /See:/ 'newUpdateSubnetChangeProtectionResponse' smart constructor.
data UpdateSubnetChangeProtectionResponse = UpdateSubnetChangeProtectionResponse'
  { -- | 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.
    UpdateSubnetChangeProtectionResponse -> Maybe Text
updateToken :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the firewall.
    UpdateSubnetChangeProtectionResponse -> Maybe Text
firewallArn :: Prelude.Maybe Prelude.Text,
    -- | A setting indicating whether the firewall is protected against changes
    -- to the subnet associations. Use this setting to protect against
    -- accidentally modifying the subnet associations for a firewall that is in
    -- use. When you create a firewall, the operation initializes this setting
    -- to @TRUE@.
    UpdateSubnetChangeProtectionResponse -> Maybe Bool
subnetChangeProtection :: Prelude.Maybe Prelude.Bool,
    -- | The descriptive name of the firewall. You can\'t change the name of a
    -- firewall after you create it.
    UpdateSubnetChangeProtectionResponse -> Maybe Text
firewallName :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    UpdateSubnetChangeProtectionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpdateSubnetChangeProtectionResponse
-> UpdateSubnetChangeProtectionResponse -> Bool
(UpdateSubnetChangeProtectionResponse
 -> UpdateSubnetChangeProtectionResponse -> Bool)
-> (UpdateSubnetChangeProtectionResponse
    -> UpdateSubnetChangeProtectionResponse -> Bool)
-> Eq UpdateSubnetChangeProtectionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateSubnetChangeProtectionResponse
-> UpdateSubnetChangeProtectionResponse -> Bool
$c/= :: UpdateSubnetChangeProtectionResponse
-> UpdateSubnetChangeProtectionResponse -> Bool
== :: UpdateSubnetChangeProtectionResponse
-> UpdateSubnetChangeProtectionResponse -> Bool
$c== :: UpdateSubnetChangeProtectionResponse
-> UpdateSubnetChangeProtectionResponse -> Bool
Prelude.Eq, ReadPrec [UpdateSubnetChangeProtectionResponse]
ReadPrec UpdateSubnetChangeProtectionResponse
Int -> ReadS UpdateSubnetChangeProtectionResponse
ReadS [UpdateSubnetChangeProtectionResponse]
(Int -> ReadS UpdateSubnetChangeProtectionResponse)
-> ReadS [UpdateSubnetChangeProtectionResponse]
-> ReadPrec UpdateSubnetChangeProtectionResponse
-> ReadPrec [UpdateSubnetChangeProtectionResponse]
-> Read UpdateSubnetChangeProtectionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateSubnetChangeProtectionResponse]
$creadListPrec :: ReadPrec [UpdateSubnetChangeProtectionResponse]
readPrec :: ReadPrec UpdateSubnetChangeProtectionResponse
$creadPrec :: ReadPrec UpdateSubnetChangeProtectionResponse
readList :: ReadS [UpdateSubnetChangeProtectionResponse]
$creadList :: ReadS [UpdateSubnetChangeProtectionResponse]
readsPrec :: Int -> ReadS UpdateSubnetChangeProtectionResponse
$creadsPrec :: Int -> ReadS UpdateSubnetChangeProtectionResponse
Prelude.Read, Int -> UpdateSubnetChangeProtectionResponse -> ShowS
[UpdateSubnetChangeProtectionResponse] -> ShowS
UpdateSubnetChangeProtectionResponse -> String
(Int -> UpdateSubnetChangeProtectionResponse -> ShowS)
-> (UpdateSubnetChangeProtectionResponse -> String)
-> ([UpdateSubnetChangeProtectionResponse] -> ShowS)
-> Show UpdateSubnetChangeProtectionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateSubnetChangeProtectionResponse] -> ShowS
$cshowList :: [UpdateSubnetChangeProtectionResponse] -> ShowS
show :: UpdateSubnetChangeProtectionResponse -> String
$cshow :: UpdateSubnetChangeProtectionResponse -> String
showsPrec :: Int -> UpdateSubnetChangeProtectionResponse -> ShowS
$cshowsPrec :: Int -> UpdateSubnetChangeProtectionResponse -> ShowS
Prelude.Show, (forall x.
 UpdateSubnetChangeProtectionResponse
 -> Rep UpdateSubnetChangeProtectionResponse x)
-> (forall x.
    Rep UpdateSubnetChangeProtectionResponse x
    -> UpdateSubnetChangeProtectionResponse)
-> Generic UpdateSubnetChangeProtectionResponse
forall x.
Rep UpdateSubnetChangeProtectionResponse x
-> UpdateSubnetChangeProtectionResponse
forall x.
UpdateSubnetChangeProtectionResponse
-> Rep UpdateSubnetChangeProtectionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateSubnetChangeProtectionResponse x
-> UpdateSubnetChangeProtectionResponse
$cfrom :: forall x.
UpdateSubnetChangeProtectionResponse
-> Rep UpdateSubnetChangeProtectionResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateSubnetChangeProtectionResponse' 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', 'updateSubnetChangeProtectionResponse_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', 'updateSubnetChangeProtectionResponse_firewallArn' - The Amazon Resource Name (ARN) of the firewall.
--
-- 'subnetChangeProtection', 'updateSubnetChangeProtectionResponse_subnetChangeProtection' - A setting indicating whether the firewall is protected against changes
-- to the subnet associations. Use this setting to protect against
-- accidentally modifying the subnet associations for a firewall that is in
-- use. When you create a firewall, the operation initializes this setting
-- to @TRUE@.
--
-- 'firewallName', 'updateSubnetChangeProtectionResponse_firewallName' - The descriptive name of the firewall. You can\'t change the name of a
-- firewall after you create it.
--
-- 'httpStatus', 'updateSubnetChangeProtectionResponse_httpStatus' - The response's http status code.
newUpdateSubnetChangeProtectionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateSubnetChangeProtectionResponse
newUpdateSubnetChangeProtectionResponse :: Int -> UpdateSubnetChangeProtectionResponse
newUpdateSubnetChangeProtectionResponse Int
pHttpStatus_ =
  UpdateSubnetChangeProtectionResponse' :: Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Int
-> UpdateSubnetChangeProtectionResponse
UpdateSubnetChangeProtectionResponse'
    { $sel:updateToken:UpdateSubnetChangeProtectionResponse' :: Maybe Text
updateToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:firewallArn:UpdateSubnetChangeProtectionResponse' :: Maybe Text
firewallArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:subnetChangeProtection:UpdateSubnetChangeProtectionResponse' :: Maybe Bool
subnetChangeProtection =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:firewallName:UpdateSubnetChangeProtectionResponse' :: Maybe Text
firewallName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateSubnetChangeProtectionResponse' :: 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.
updateSubnetChangeProtectionResponse_updateToken :: Lens.Lens' UpdateSubnetChangeProtectionResponse (Prelude.Maybe Prelude.Text)
updateSubnetChangeProtectionResponse_updateToken :: (Maybe Text -> f (Maybe Text))
-> UpdateSubnetChangeProtectionResponse
-> f UpdateSubnetChangeProtectionResponse
updateSubnetChangeProtectionResponse_updateToken = (UpdateSubnetChangeProtectionResponse -> Maybe Text)
-> (UpdateSubnetChangeProtectionResponse
    -> Maybe Text -> UpdateSubnetChangeProtectionResponse)
-> Lens
     UpdateSubnetChangeProtectionResponse
     UpdateSubnetChangeProtectionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSubnetChangeProtectionResponse' {Maybe Text
updateToken :: Maybe Text
$sel:updateToken:UpdateSubnetChangeProtectionResponse' :: UpdateSubnetChangeProtectionResponse -> Maybe Text
updateToken} -> Maybe Text
updateToken) (\s :: UpdateSubnetChangeProtectionResponse
s@UpdateSubnetChangeProtectionResponse' {} Maybe Text
a -> UpdateSubnetChangeProtectionResponse
s {$sel:updateToken:UpdateSubnetChangeProtectionResponse' :: Maybe Text
updateToken = Maybe Text
a} :: UpdateSubnetChangeProtectionResponse)

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

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

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

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

instance
  Prelude.NFData
    UpdateSubnetChangeProtectionResponse