{-# 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.UpdateFirewallPolicy
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Updates the properties of the specified firewall policy.
module Amazonka.NetworkFirewall.UpdateFirewallPolicy
  ( -- * Creating a Request
    UpdateFirewallPolicy (..),
    newUpdateFirewallPolicy,

    -- * Request Lenses
    updateFirewallPolicy_description,
    updateFirewallPolicy_dryRun,
    updateFirewallPolicy_encryptionConfiguration,
    updateFirewallPolicy_firewallPolicyArn,
    updateFirewallPolicy_firewallPolicyName,
    updateFirewallPolicy_updateToken,
    updateFirewallPolicy_firewallPolicy,

    -- * Destructuring the Response
    UpdateFirewallPolicyResponse (..),
    newUpdateFirewallPolicyResponse,

    -- * Response Lenses
    updateFirewallPolicyResponse_httpStatus,
    updateFirewallPolicyResponse_updateToken,
    updateFirewallPolicyResponse_firewallPolicyResponse,
  )
where

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

-- | /See:/ 'newUpdateFirewallPolicy' smart constructor.
data UpdateFirewallPolicy = UpdateFirewallPolicy'
  { -- | A description of the firewall policy.
    UpdateFirewallPolicy -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Indicates whether you want Network Firewall to just check the validity
    -- of the request, rather than run the request.
    --
    -- If set to @TRUE@, Network Firewall checks whether the request can run
    -- successfully, but doesn\'t actually make the requested changes. The call
    -- returns the value that the request would return if you ran it with dry
    -- run set to @FALSE@, but doesn\'t make additions or changes to your
    -- resources. This option allows you to make sure that you have the
    -- required permissions to run the request and that your request parameters
    -- are valid.
    --
    -- If set to @FALSE@, Network Firewall makes the requested changes to your
    -- resources.
    UpdateFirewallPolicy -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
    -- | A complex type that contains settings for encryption of your firewall
    -- policy resources.
    UpdateFirewallPolicy -> Maybe EncryptionConfiguration
encryptionConfiguration :: Prelude.Maybe EncryptionConfiguration,
    -- | The Amazon Resource Name (ARN) of the firewall policy.
    --
    -- You must specify the ARN or the name, and you can specify both.
    UpdateFirewallPolicy -> Maybe Text
firewallPolicyArn :: Prelude.Maybe Prelude.Text,
    -- | The descriptive name of the firewall policy. You can\'t change the name
    -- of a firewall policy after you create it.
    --
    -- You must specify the ARN or the name, and you can specify both.
    UpdateFirewallPolicy -> Maybe Text
firewallPolicyName :: Prelude.Maybe Prelude.Text,
    -- | A token used for optimistic locking. Network Firewall returns a token to
    -- your requests that access the firewall policy. The token marks the state
    -- of the policy resource at the time of the request.
    --
    -- To make changes to the policy, you provide the token in your request.
    -- Network Firewall uses the token to ensure that the policy hasn\'t
    -- changed since you last retrieved it. If it has changed, the operation
    -- fails with an @InvalidTokenException@. If this happens, retrieve the
    -- firewall policy again to get a current copy of it with current token.
    -- Reapply your changes as needed, then try the operation again using the
    -- new token.
    UpdateFirewallPolicy -> Text
updateToken :: Prelude.Text,
    -- | The updated firewall policy to use for the firewall.
    UpdateFirewallPolicy -> FirewallPolicy
firewallPolicy :: FirewallPolicy
  }
  deriving (UpdateFirewallPolicy -> UpdateFirewallPolicy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateFirewallPolicy -> UpdateFirewallPolicy -> Bool
$c/= :: UpdateFirewallPolicy -> UpdateFirewallPolicy -> Bool
== :: UpdateFirewallPolicy -> UpdateFirewallPolicy -> Bool
$c== :: UpdateFirewallPolicy -> UpdateFirewallPolicy -> Bool
Prelude.Eq, ReadPrec [UpdateFirewallPolicy]
ReadPrec UpdateFirewallPolicy
Int -> ReadS UpdateFirewallPolicy
ReadS [UpdateFirewallPolicy]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateFirewallPolicy]
$creadListPrec :: ReadPrec [UpdateFirewallPolicy]
readPrec :: ReadPrec UpdateFirewallPolicy
$creadPrec :: ReadPrec UpdateFirewallPolicy
readList :: ReadS [UpdateFirewallPolicy]
$creadList :: ReadS [UpdateFirewallPolicy]
readsPrec :: Int -> ReadS UpdateFirewallPolicy
$creadsPrec :: Int -> ReadS UpdateFirewallPolicy
Prelude.Read, Int -> UpdateFirewallPolicy -> ShowS
[UpdateFirewallPolicy] -> ShowS
UpdateFirewallPolicy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateFirewallPolicy] -> ShowS
$cshowList :: [UpdateFirewallPolicy] -> ShowS
show :: UpdateFirewallPolicy -> String
$cshow :: UpdateFirewallPolicy -> String
showsPrec :: Int -> UpdateFirewallPolicy -> ShowS
$cshowsPrec :: Int -> UpdateFirewallPolicy -> ShowS
Prelude.Show, forall x. Rep UpdateFirewallPolicy x -> UpdateFirewallPolicy
forall x. UpdateFirewallPolicy -> Rep UpdateFirewallPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateFirewallPolicy x -> UpdateFirewallPolicy
$cfrom :: forall x. UpdateFirewallPolicy -> Rep UpdateFirewallPolicy x
Prelude.Generic)

-- |
-- Create a value of 'UpdateFirewallPolicy' 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:
--
-- 'description', 'updateFirewallPolicy_description' - A description of the firewall policy.
--
-- 'dryRun', 'updateFirewallPolicy_dryRun' - Indicates whether you want Network Firewall to just check the validity
-- of the request, rather than run the request.
--
-- If set to @TRUE@, Network Firewall checks whether the request can run
-- successfully, but doesn\'t actually make the requested changes. The call
-- returns the value that the request would return if you ran it with dry
-- run set to @FALSE@, but doesn\'t make additions or changes to your
-- resources. This option allows you to make sure that you have the
-- required permissions to run the request and that your request parameters
-- are valid.
--
-- If set to @FALSE@, Network Firewall makes the requested changes to your
-- resources.
--
-- 'encryptionConfiguration', 'updateFirewallPolicy_encryptionConfiguration' - A complex type that contains settings for encryption of your firewall
-- policy resources.
--
-- 'firewallPolicyArn', 'updateFirewallPolicy_firewallPolicyArn' - The Amazon Resource Name (ARN) of the firewall policy.
--
-- You must specify the ARN or the name, and you can specify both.
--
-- 'firewallPolicyName', 'updateFirewallPolicy_firewallPolicyName' - The descriptive name of the firewall policy. You can\'t change the name
-- of a firewall policy after you create it.
--
-- You must specify the ARN or the name, and you can specify both.
--
-- 'updateToken', 'updateFirewallPolicy_updateToken' - A token used for optimistic locking. Network Firewall returns a token to
-- your requests that access the firewall policy. The token marks the state
-- of the policy resource at the time of the request.
--
-- To make changes to the policy, you provide the token in your request.
-- Network Firewall uses the token to ensure that the policy hasn\'t
-- changed since you last retrieved it. If it has changed, the operation
-- fails with an @InvalidTokenException@. If this happens, retrieve the
-- firewall policy again to get a current copy of it with current token.
-- Reapply your changes as needed, then try the operation again using the
-- new token.
--
-- 'firewallPolicy', 'updateFirewallPolicy_firewallPolicy' - The updated firewall policy to use for the firewall.
newUpdateFirewallPolicy ::
  -- | 'updateToken'
  Prelude.Text ->
  -- | 'firewallPolicy'
  FirewallPolicy ->
  UpdateFirewallPolicy
newUpdateFirewallPolicy :: Text -> FirewallPolicy -> UpdateFirewallPolicy
newUpdateFirewallPolicy
  Text
pUpdateToken_
  FirewallPolicy
pFirewallPolicy_ =
    UpdateFirewallPolicy'
      { $sel:description:UpdateFirewallPolicy' :: Maybe Text
description =
          forall a. Maybe a
Prelude.Nothing,
        $sel:dryRun:UpdateFirewallPolicy' :: Maybe Bool
dryRun = forall a. Maybe a
Prelude.Nothing,
        $sel:encryptionConfiguration:UpdateFirewallPolicy' :: Maybe EncryptionConfiguration
encryptionConfiguration = forall a. Maybe a
Prelude.Nothing,
        $sel:firewallPolicyArn:UpdateFirewallPolicy' :: Maybe Text
firewallPolicyArn = forall a. Maybe a
Prelude.Nothing,
        $sel:firewallPolicyName:UpdateFirewallPolicy' :: Maybe Text
firewallPolicyName = forall a. Maybe a
Prelude.Nothing,
        $sel:updateToken:UpdateFirewallPolicy' :: Text
updateToken = Text
pUpdateToken_,
        $sel:firewallPolicy:UpdateFirewallPolicy' :: FirewallPolicy
firewallPolicy = FirewallPolicy
pFirewallPolicy_
      }

-- | A description of the firewall policy.
updateFirewallPolicy_description :: Lens.Lens' UpdateFirewallPolicy (Prelude.Maybe Prelude.Text)
updateFirewallPolicy_description :: Lens' UpdateFirewallPolicy (Maybe Text)
updateFirewallPolicy_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFirewallPolicy' {Maybe Text
description :: Maybe Text
$sel:description:UpdateFirewallPolicy' :: UpdateFirewallPolicy -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateFirewallPolicy
s@UpdateFirewallPolicy' {} Maybe Text
a -> UpdateFirewallPolicy
s {$sel:description:UpdateFirewallPolicy' :: Maybe Text
description = Maybe Text
a} :: UpdateFirewallPolicy)

-- | Indicates whether you want Network Firewall to just check the validity
-- of the request, rather than run the request.
--
-- If set to @TRUE@, Network Firewall checks whether the request can run
-- successfully, but doesn\'t actually make the requested changes. The call
-- returns the value that the request would return if you ran it with dry
-- run set to @FALSE@, but doesn\'t make additions or changes to your
-- resources. This option allows you to make sure that you have the
-- required permissions to run the request and that your request parameters
-- are valid.
--
-- If set to @FALSE@, Network Firewall makes the requested changes to your
-- resources.
updateFirewallPolicy_dryRun :: Lens.Lens' UpdateFirewallPolicy (Prelude.Maybe Prelude.Bool)
updateFirewallPolicy_dryRun :: Lens' UpdateFirewallPolicy (Maybe Bool)
updateFirewallPolicy_dryRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFirewallPolicy' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:UpdateFirewallPolicy' :: UpdateFirewallPolicy -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: UpdateFirewallPolicy
s@UpdateFirewallPolicy' {} Maybe Bool
a -> UpdateFirewallPolicy
s {$sel:dryRun:UpdateFirewallPolicy' :: Maybe Bool
dryRun = Maybe Bool
a} :: UpdateFirewallPolicy)

-- | A complex type that contains settings for encryption of your firewall
-- policy resources.
updateFirewallPolicy_encryptionConfiguration :: Lens.Lens' UpdateFirewallPolicy (Prelude.Maybe EncryptionConfiguration)
updateFirewallPolicy_encryptionConfiguration :: Lens' UpdateFirewallPolicy (Maybe EncryptionConfiguration)
updateFirewallPolicy_encryptionConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFirewallPolicy' {Maybe EncryptionConfiguration
encryptionConfiguration :: Maybe EncryptionConfiguration
$sel:encryptionConfiguration:UpdateFirewallPolicy' :: UpdateFirewallPolicy -> Maybe EncryptionConfiguration
encryptionConfiguration} -> Maybe EncryptionConfiguration
encryptionConfiguration) (\s :: UpdateFirewallPolicy
s@UpdateFirewallPolicy' {} Maybe EncryptionConfiguration
a -> UpdateFirewallPolicy
s {$sel:encryptionConfiguration:UpdateFirewallPolicy' :: Maybe EncryptionConfiguration
encryptionConfiguration = Maybe EncryptionConfiguration
a} :: UpdateFirewallPolicy)

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

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

-- | A token used for optimistic locking. Network Firewall returns a token to
-- your requests that access the firewall policy. The token marks the state
-- of the policy resource at the time of the request.
--
-- To make changes to the policy, you provide the token in your request.
-- Network Firewall uses the token to ensure that the policy hasn\'t
-- changed since you last retrieved it. If it has changed, the operation
-- fails with an @InvalidTokenException@. If this happens, retrieve the
-- firewall policy again to get a current copy of it with current token.
-- Reapply your changes as needed, then try the operation again using the
-- new token.
updateFirewallPolicy_updateToken :: Lens.Lens' UpdateFirewallPolicy Prelude.Text
updateFirewallPolicy_updateToken :: Lens' UpdateFirewallPolicy Text
updateFirewallPolicy_updateToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFirewallPolicy' {Text
updateToken :: Text
$sel:updateToken:UpdateFirewallPolicy' :: UpdateFirewallPolicy -> Text
updateToken} -> Text
updateToken) (\s :: UpdateFirewallPolicy
s@UpdateFirewallPolicy' {} Text
a -> UpdateFirewallPolicy
s {$sel:updateToken:UpdateFirewallPolicy' :: Text
updateToken = Text
a} :: UpdateFirewallPolicy)

-- | The updated firewall policy to use for the firewall.
updateFirewallPolicy_firewallPolicy :: Lens.Lens' UpdateFirewallPolicy FirewallPolicy
updateFirewallPolicy_firewallPolicy :: Lens' UpdateFirewallPolicy FirewallPolicy
updateFirewallPolicy_firewallPolicy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFirewallPolicy' {FirewallPolicy
firewallPolicy :: FirewallPolicy
$sel:firewallPolicy:UpdateFirewallPolicy' :: UpdateFirewallPolicy -> FirewallPolicy
firewallPolicy} -> FirewallPolicy
firewallPolicy) (\s :: UpdateFirewallPolicy
s@UpdateFirewallPolicy' {} FirewallPolicy
a -> UpdateFirewallPolicy
s {$sel:firewallPolicy:UpdateFirewallPolicy' :: FirewallPolicy
firewallPolicy = FirewallPolicy
a} :: UpdateFirewallPolicy)

instance Core.AWSRequest UpdateFirewallPolicy where
  type
    AWSResponse UpdateFirewallPolicy =
      UpdateFirewallPolicyResponse
  request :: (Service -> Service)
-> UpdateFirewallPolicy -> Request UpdateFirewallPolicy
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateFirewallPolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateFirewallPolicy)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int
-> Text -> FirewallPolicyResponse -> UpdateFirewallPolicyResponse
UpdateFirewallPolicyResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"UpdateToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"FirewallPolicyResponse")
      )

instance Prelude.Hashable UpdateFirewallPolicy where
  hashWithSalt :: Int -> UpdateFirewallPolicy -> Int
hashWithSalt Int
_salt UpdateFirewallPolicy' {Maybe Bool
Maybe Text
Maybe EncryptionConfiguration
Text
FirewallPolicy
firewallPolicy :: FirewallPolicy
updateToken :: Text
firewallPolicyName :: Maybe Text
firewallPolicyArn :: Maybe Text
encryptionConfiguration :: Maybe EncryptionConfiguration
dryRun :: Maybe Bool
description :: Maybe Text
$sel:firewallPolicy:UpdateFirewallPolicy' :: UpdateFirewallPolicy -> FirewallPolicy
$sel:updateToken:UpdateFirewallPolicy' :: UpdateFirewallPolicy -> Text
$sel:firewallPolicyName:UpdateFirewallPolicy' :: UpdateFirewallPolicy -> Maybe Text
$sel:firewallPolicyArn:UpdateFirewallPolicy' :: UpdateFirewallPolicy -> Maybe Text
$sel:encryptionConfiguration:UpdateFirewallPolicy' :: UpdateFirewallPolicy -> Maybe EncryptionConfiguration
$sel:dryRun:UpdateFirewallPolicy' :: UpdateFirewallPolicy -> Maybe Bool
$sel:description:UpdateFirewallPolicy' :: UpdateFirewallPolicy -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
dryRun
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EncryptionConfiguration
encryptionConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
firewallPolicyArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
firewallPolicyName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
updateToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` FirewallPolicy
firewallPolicy

instance Prelude.NFData UpdateFirewallPolicy where
  rnf :: UpdateFirewallPolicy -> ()
rnf UpdateFirewallPolicy' {Maybe Bool
Maybe Text
Maybe EncryptionConfiguration
Text
FirewallPolicy
firewallPolicy :: FirewallPolicy
updateToken :: Text
firewallPolicyName :: Maybe Text
firewallPolicyArn :: Maybe Text
encryptionConfiguration :: Maybe EncryptionConfiguration
dryRun :: Maybe Bool
description :: Maybe Text
$sel:firewallPolicy:UpdateFirewallPolicy' :: UpdateFirewallPolicy -> FirewallPolicy
$sel:updateToken:UpdateFirewallPolicy' :: UpdateFirewallPolicy -> Text
$sel:firewallPolicyName:UpdateFirewallPolicy' :: UpdateFirewallPolicy -> Maybe Text
$sel:firewallPolicyArn:UpdateFirewallPolicy' :: UpdateFirewallPolicy -> Maybe Text
$sel:encryptionConfiguration:UpdateFirewallPolicy' :: UpdateFirewallPolicy -> Maybe EncryptionConfiguration
$sel:dryRun:UpdateFirewallPolicy' :: UpdateFirewallPolicy -> Maybe Bool
$sel:description:UpdateFirewallPolicy' :: UpdateFirewallPolicy -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
dryRun
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe EncryptionConfiguration
encryptionConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
firewallPolicyArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
firewallPolicyName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
updateToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf FirewallPolicy
firewallPolicy

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

instance Data.ToJSON UpdateFirewallPolicy where
  toJSON :: UpdateFirewallPolicy -> Value
toJSON UpdateFirewallPolicy' {Maybe Bool
Maybe Text
Maybe EncryptionConfiguration
Text
FirewallPolicy
firewallPolicy :: FirewallPolicy
updateToken :: Text
firewallPolicyName :: Maybe Text
firewallPolicyArn :: Maybe Text
encryptionConfiguration :: Maybe EncryptionConfiguration
dryRun :: Maybe Bool
description :: Maybe Text
$sel:firewallPolicy:UpdateFirewallPolicy' :: UpdateFirewallPolicy -> FirewallPolicy
$sel:updateToken:UpdateFirewallPolicy' :: UpdateFirewallPolicy -> Text
$sel:firewallPolicyName:UpdateFirewallPolicy' :: UpdateFirewallPolicy -> Maybe Text
$sel:firewallPolicyArn:UpdateFirewallPolicy' :: UpdateFirewallPolicy -> Maybe Text
$sel:encryptionConfiguration:UpdateFirewallPolicy' :: UpdateFirewallPolicy -> Maybe EncryptionConfiguration
$sel:dryRun:UpdateFirewallPolicy' :: UpdateFirewallPolicy -> Maybe Bool
$sel:description:UpdateFirewallPolicy' :: UpdateFirewallPolicy -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Description" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            (Key
"DryRun" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
dryRun,
            (Key
"EncryptionConfiguration" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EncryptionConfiguration
encryptionConfiguration,
            (Key
"FirewallPolicyArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
firewallPolicyArn,
            (Key
"FirewallPolicyName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
firewallPolicyName,
            forall a. a -> Maybe a
Prelude.Just (Key
"UpdateToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
updateToken),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"FirewallPolicy" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= FirewallPolicy
firewallPolicy)
          ]
      )

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

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

-- | /See:/ 'newUpdateFirewallPolicyResponse' smart constructor.
data UpdateFirewallPolicyResponse = UpdateFirewallPolicyResponse'
  { -- | The response's http status code.
    UpdateFirewallPolicyResponse -> Int
httpStatus :: Prelude.Int,
    -- | A token used for optimistic locking. Network Firewall returns a token to
    -- your requests that access the firewall policy. The token marks the state
    -- of the policy resource at the time of the request.
    --
    -- To make changes to the policy, you provide the token in your request.
    -- Network Firewall uses the token to ensure that the policy hasn\'t
    -- changed since you last retrieved it. If it has changed, the operation
    -- fails with an @InvalidTokenException@. If this happens, retrieve the
    -- firewall policy again to get a current copy of it with current token.
    -- Reapply your changes as needed, then try the operation again using the
    -- new token.
    UpdateFirewallPolicyResponse -> Text
updateToken :: Prelude.Text,
    -- | The high-level properties of a firewall policy. This, along with the
    -- FirewallPolicy, define the policy. You can retrieve all objects for a
    -- firewall policy by calling DescribeFirewallPolicy.
    UpdateFirewallPolicyResponse -> FirewallPolicyResponse
firewallPolicyResponse :: FirewallPolicyResponse
  }
  deriving (UpdateFirewallPolicyResponse
-> UpdateFirewallPolicyResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateFirewallPolicyResponse
-> UpdateFirewallPolicyResponse -> Bool
$c/= :: UpdateFirewallPolicyResponse
-> UpdateFirewallPolicyResponse -> Bool
== :: UpdateFirewallPolicyResponse
-> UpdateFirewallPolicyResponse -> Bool
$c== :: UpdateFirewallPolicyResponse
-> UpdateFirewallPolicyResponse -> Bool
Prelude.Eq, ReadPrec [UpdateFirewallPolicyResponse]
ReadPrec UpdateFirewallPolicyResponse
Int -> ReadS UpdateFirewallPolicyResponse
ReadS [UpdateFirewallPolicyResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateFirewallPolicyResponse]
$creadListPrec :: ReadPrec [UpdateFirewallPolicyResponse]
readPrec :: ReadPrec UpdateFirewallPolicyResponse
$creadPrec :: ReadPrec UpdateFirewallPolicyResponse
readList :: ReadS [UpdateFirewallPolicyResponse]
$creadList :: ReadS [UpdateFirewallPolicyResponse]
readsPrec :: Int -> ReadS UpdateFirewallPolicyResponse
$creadsPrec :: Int -> ReadS UpdateFirewallPolicyResponse
Prelude.Read, Int -> UpdateFirewallPolicyResponse -> ShowS
[UpdateFirewallPolicyResponse] -> ShowS
UpdateFirewallPolicyResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateFirewallPolicyResponse] -> ShowS
$cshowList :: [UpdateFirewallPolicyResponse] -> ShowS
show :: UpdateFirewallPolicyResponse -> String
$cshow :: UpdateFirewallPolicyResponse -> String
showsPrec :: Int -> UpdateFirewallPolicyResponse -> ShowS
$cshowsPrec :: Int -> UpdateFirewallPolicyResponse -> ShowS
Prelude.Show, forall x.
Rep UpdateFirewallPolicyResponse x -> UpdateFirewallPolicyResponse
forall x.
UpdateFirewallPolicyResponse -> Rep UpdateFirewallPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateFirewallPolicyResponse x -> UpdateFirewallPolicyResponse
$cfrom :: forall x.
UpdateFirewallPolicyResponse -> Rep UpdateFirewallPolicyResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateFirewallPolicyResponse' 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:
--
-- 'httpStatus', 'updateFirewallPolicyResponse_httpStatus' - The response's http status code.
--
-- 'updateToken', 'updateFirewallPolicyResponse_updateToken' - A token used for optimistic locking. Network Firewall returns a token to
-- your requests that access the firewall policy. The token marks the state
-- of the policy resource at the time of the request.
--
-- To make changes to the policy, you provide the token in your request.
-- Network Firewall uses the token to ensure that the policy hasn\'t
-- changed since you last retrieved it. If it has changed, the operation
-- fails with an @InvalidTokenException@. If this happens, retrieve the
-- firewall policy again to get a current copy of it with current token.
-- Reapply your changes as needed, then try the operation again using the
-- new token.
--
-- 'firewallPolicyResponse', 'updateFirewallPolicyResponse_firewallPolicyResponse' - The high-level properties of a firewall policy. This, along with the
-- FirewallPolicy, define the policy. You can retrieve all objects for a
-- firewall policy by calling DescribeFirewallPolicy.
newUpdateFirewallPolicyResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'updateToken'
  Prelude.Text ->
  -- | 'firewallPolicyResponse'
  FirewallPolicyResponse ->
  UpdateFirewallPolicyResponse
newUpdateFirewallPolicyResponse :: Int
-> Text -> FirewallPolicyResponse -> UpdateFirewallPolicyResponse
newUpdateFirewallPolicyResponse
  Int
pHttpStatus_
  Text
pUpdateToken_
  FirewallPolicyResponse
pFirewallPolicyResponse_ =
    UpdateFirewallPolicyResponse'
      { $sel:httpStatus:UpdateFirewallPolicyResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:updateToken:UpdateFirewallPolicyResponse' :: Text
updateToken = Text
pUpdateToken_,
        $sel:firewallPolicyResponse:UpdateFirewallPolicyResponse' :: FirewallPolicyResponse
firewallPolicyResponse =
          FirewallPolicyResponse
pFirewallPolicyResponse_
      }

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

-- | A token used for optimistic locking. Network Firewall returns a token to
-- your requests that access the firewall policy. The token marks the state
-- of the policy resource at the time of the request.
--
-- To make changes to the policy, you provide the token in your request.
-- Network Firewall uses the token to ensure that the policy hasn\'t
-- changed since you last retrieved it. If it has changed, the operation
-- fails with an @InvalidTokenException@. If this happens, retrieve the
-- firewall policy again to get a current copy of it with current token.
-- Reapply your changes as needed, then try the operation again using the
-- new token.
updateFirewallPolicyResponse_updateToken :: Lens.Lens' UpdateFirewallPolicyResponse Prelude.Text
updateFirewallPolicyResponse_updateToken :: Lens' UpdateFirewallPolicyResponse Text
updateFirewallPolicyResponse_updateToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFirewallPolicyResponse' {Text
updateToken :: Text
$sel:updateToken:UpdateFirewallPolicyResponse' :: UpdateFirewallPolicyResponse -> Text
updateToken} -> Text
updateToken) (\s :: UpdateFirewallPolicyResponse
s@UpdateFirewallPolicyResponse' {} Text
a -> UpdateFirewallPolicyResponse
s {$sel:updateToken:UpdateFirewallPolicyResponse' :: Text
updateToken = Text
a} :: UpdateFirewallPolicyResponse)

-- | The high-level properties of a firewall policy. This, along with the
-- FirewallPolicy, define the policy. You can retrieve all objects for a
-- firewall policy by calling DescribeFirewallPolicy.
updateFirewallPolicyResponse_firewallPolicyResponse :: Lens.Lens' UpdateFirewallPolicyResponse FirewallPolicyResponse
updateFirewallPolicyResponse_firewallPolicyResponse :: Lens' UpdateFirewallPolicyResponse FirewallPolicyResponse
updateFirewallPolicyResponse_firewallPolicyResponse = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFirewallPolicyResponse' {FirewallPolicyResponse
firewallPolicyResponse :: FirewallPolicyResponse
$sel:firewallPolicyResponse:UpdateFirewallPolicyResponse' :: UpdateFirewallPolicyResponse -> FirewallPolicyResponse
firewallPolicyResponse} -> FirewallPolicyResponse
firewallPolicyResponse) (\s :: UpdateFirewallPolicyResponse
s@UpdateFirewallPolicyResponse' {} FirewallPolicyResponse
a -> UpdateFirewallPolicyResponse
s {$sel:firewallPolicyResponse:UpdateFirewallPolicyResponse' :: FirewallPolicyResponse
firewallPolicyResponse = FirewallPolicyResponse
a} :: UpdateFirewallPolicyResponse)

instance Prelude.NFData UpdateFirewallPolicyResponse where
  rnf :: UpdateFirewallPolicyResponse -> ()
rnf UpdateFirewallPolicyResponse' {Int
Text
FirewallPolicyResponse
firewallPolicyResponse :: FirewallPolicyResponse
updateToken :: Text
httpStatus :: Int
$sel:firewallPolicyResponse:UpdateFirewallPolicyResponse' :: UpdateFirewallPolicyResponse -> FirewallPolicyResponse
$sel:updateToken:UpdateFirewallPolicyResponse' :: UpdateFirewallPolicyResponse -> Text
$sel:httpStatus:UpdateFirewallPolicyResponse' :: UpdateFirewallPolicyResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
updateToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf FirewallPolicyResponse
firewallPolicyResponse