{-# 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.CreateFirewallPolicy
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates the firewall policy for the firewall according to the
-- specifications.
--
-- An Network Firewall firewall policy defines the behavior of a firewall,
-- in a collection of stateless and stateful rule groups and other
-- settings. You can use one firewall policy for multiple firewalls.
module Amazonka.NetworkFirewall.CreateFirewallPolicy
  ( -- * Creating a Request
    CreateFirewallPolicy (..),
    newCreateFirewallPolicy,

    -- * Request Lenses
    createFirewallPolicy_description,
    createFirewallPolicy_dryRun,
    createFirewallPolicy_encryptionConfiguration,
    createFirewallPolicy_tags,
    createFirewallPolicy_firewallPolicyName,
    createFirewallPolicy_firewallPolicy,

    -- * Destructuring the Response
    CreateFirewallPolicyResponse (..),
    newCreateFirewallPolicyResponse,

    -- * Response Lenses
    createFirewallPolicyResponse_httpStatus,
    createFirewallPolicyResponse_updateToken,
    createFirewallPolicyResponse_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:/ 'newCreateFirewallPolicy' smart constructor.
data CreateFirewallPolicy = CreateFirewallPolicy'
  { -- | A description of the firewall policy.
    CreateFirewallPolicy -> 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.
    CreateFirewallPolicy -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
    -- | A complex type that contains settings for encryption of your firewall
    -- policy resources.
    CreateFirewallPolicy -> Maybe EncryptionConfiguration
encryptionConfiguration :: Prelude.Maybe EncryptionConfiguration,
    -- | The key:value pairs to associate with the resource.
    CreateFirewallPolicy -> Maybe (NonEmpty Tag)
tags :: Prelude.Maybe (Prelude.NonEmpty Tag),
    -- | The descriptive name of the firewall policy. You can\'t change the name
    -- of a firewall policy after you create it.
    CreateFirewallPolicy -> Text
firewallPolicyName :: Prelude.Text,
    -- | The rule groups and policy actions to use in the firewall policy.
    CreateFirewallPolicy -> FirewallPolicy
firewallPolicy :: FirewallPolicy
  }
  deriving (CreateFirewallPolicy -> CreateFirewallPolicy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateFirewallPolicy -> CreateFirewallPolicy -> Bool
$c/= :: CreateFirewallPolicy -> CreateFirewallPolicy -> Bool
== :: CreateFirewallPolicy -> CreateFirewallPolicy -> Bool
$c== :: CreateFirewallPolicy -> CreateFirewallPolicy -> Bool
Prelude.Eq, ReadPrec [CreateFirewallPolicy]
ReadPrec CreateFirewallPolicy
Int -> ReadS CreateFirewallPolicy
ReadS [CreateFirewallPolicy]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateFirewallPolicy]
$creadListPrec :: ReadPrec [CreateFirewallPolicy]
readPrec :: ReadPrec CreateFirewallPolicy
$creadPrec :: ReadPrec CreateFirewallPolicy
readList :: ReadS [CreateFirewallPolicy]
$creadList :: ReadS [CreateFirewallPolicy]
readsPrec :: Int -> ReadS CreateFirewallPolicy
$creadsPrec :: Int -> ReadS CreateFirewallPolicy
Prelude.Read, Int -> CreateFirewallPolicy -> ShowS
[CreateFirewallPolicy] -> ShowS
CreateFirewallPolicy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateFirewallPolicy] -> ShowS
$cshowList :: [CreateFirewallPolicy] -> ShowS
show :: CreateFirewallPolicy -> String
$cshow :: CreateFirewallPolicy -> String
showsPrec :: Int -> CreateFirewallPolicy -> ShowS
$cshowsPrec :: Int -> CreateFirewallPolicy -> ShowS
Prelude.Show, forall x. Rep CreateFirewallPolicy x -> CreateFirewallPolicy
forall x. CreateFirewallPolicy -> Rep CreateFirewallPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateFirewallPolicy x -> CreateFirewallPolicy
$cfrom :: forall x. CreateFirewallPolicy -> Rep CreateFirewallPolicy x
Prelude.Generic)

-- |
-- Create a value of 'CreateFirewallPolicy' 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', 'createFirewallPolicy_description' - A description of the firewall policy.
--
-- 'dryRun', 'createFirewallPolicy_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', 'createFirewallPolicy_encryptionConfiguration' - A complex type that contains settings for encryption of your firewall
-- policy resources.
--
-- 'tags', 'createFirewallPolicy_tags' - The key:value pairs to associate with the resource.
--
-- 'firewallPolicyName', 'createFirewallPolicy_firewallPolicyName' - The descriptive name of the firewall policy. You can\'t change the name
-- of a firewall policy after you create it.
--
-- 'firewallPolicy', 'createFirewallPolicy_firewallPolicy' - The rule groups and policy actions to use in the firewall policy.
newCreateFirewallPolicy ::
  -- | 'firewallPolicyName'
  Prelude.Text ->
  -- | 'firewallPolicy'
  FirewallPolicy ->
  CreateFirewallPolicy
newCreateFirewallPolicy :: Text -> FirewallPolicy -> CreateFirewallPolicy
newCreateFirewallPolicy
  Text
pFirewallPolicyName_
  FirewallPolicy
pFirewallPolicy_ =
    CreateFirewallPolicy'
      { $sel:description:CreateFirewallPolicy' :: Maybe Text
description =
          forall a. Maybe a
Prelude.Nothing,
        $sel:dryRun:CreateFirewallPolicy' :: Maybe Bool
dryRun = forall a. Maybe a
Prelude.Nothing,
        $sel:encryptionConfiguration:CreateFirewallPolicy' :: Maybe EncryptionConfiguration
encryptionConfiguration = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateFirewallPolicy' :: Maybe (NonEmpty Tag)
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:firewallPolicyName:CreateFirewallPolicy' :: Text
firewallPolicyName = Text
pFirewallPolicyName_,
        $sel:firewallPolicy:CreateFirewallPolicy' :: FirewallPolicy
firewallPolicy = FirewallPolicy
pFirewallPolicy_
      }

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

-- | 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.
createFirewallPolicy_dryRun :: Lens.Lens' CreateFirewallPolicy (Prelude.Maybe Prelude.Bool)
createFirewallPolicy_dryRun :: Lens' CreateFirewallPolicy (Maybe Bool)
createFirewallPolicy_dryRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFirewallPolicy' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:CreateFirewallPolicy' :: CreateFirewallPolicy -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: CreateFirewallPolicy
s@CreateFirewallPolicy' {} Maybe Bool
a -> CreateFirewallPolicy
s {$sel:dryRun:CreateFirewallPolicy' :: Maybe Bool
dryRun = Maybe Bool
a} :: CreateFirewallPolicy)

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

-- | The key:value pairs to associate with the resource.
createFirewallPolicy_tags :: Lens.Lens' CreateFirewallPolicy (Prelude.Maybe (Prelude.NonEmpty Tag))
createFirewallPolicy_tags :: Lens' CreateFirewallPolicy (Maybe (NonEmpty Tag))
createFirewallPolicy_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFirewallPolicy' {Maybe (NonEmpty Tag)
tags :: Maybe (NonEmpty Tag)
$sel:tags:CreateFirewallPolicy' :: CreateFirewallPolicy -> Maybe (NonEmpty Tag)
tags} -> Maybe (NonEmpty Tag)
tags) (\s :: CreateFirewallPolicy
s@CreateFirewallPolicy' {} Maybe (NonEmpty Tag)
a -> CreateFirewallPolicy
s {$sel:tags:CreateFirewallPolicy' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
a} :: CreateFirewallPolicy) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

-- | The rule groups and policy actions to use in the firewall policy.
createFirewallPolicy_firewallPolicy :: Lens.Lens' CreateFirewallPolicy FirewallPolicy
createFirewallPolicy_firewallPolicy :: Lens' CreateFirewallPolicy FirewallPolicy
createFirewallPolicy_firewallPolicy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFirewallPolicy' {FirewallPolicy
firewallPolicy :: FirewallPolicy
$sel:firewallPolicy:CreateFirewallPolicy' :: CreateFirewallPolicy -> FirewallPolicy
firewallPolicy} -> FirewallPolicy
firewallPolicy) (\s :: CreateFirewallPolicy
s@CreateFirewallPolicy' {} FirewallPolicy
a -> CreateFirewallPolicy
s {$sel:firewallPolicy:CreateFirewallPolicy' :: FirewallPolicy
firewallPolicy = FirewallPolicy
a} :: CreateFirewallPolicy)

instance Core.AWSRequest CreateFirewallPolicy where
  type
    AWSResponse CreateFirewallPolicy =
      CreateFirewallPolicyResponse
  request :: (Service -> Service)
-> CreateFirewallPolicy -> Request CreateFirewallPolicy
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 CreateFirewallPolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateFirewallPolicy)))
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 -> CreateFirewallPolicyResponse
CreateFirewallPolicyResponse'
            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 CreateFirewallPolicy where
  hashWithSalt :: Int -> CreateFirewallPolicy -> Int
hashWithSalt Int
_salt CreateFirewallPolicy' {Maybe Bool
Maybe (NonEmpty Tag)
Maybe Text
Maybe EncryptionConfiguration
Text
FirewallPolicy
firewallPolicy :: FirewallPolicy
firewallPolicyName :: Text
tags :: Maybe (NonEmpty Tag)
encryptionConfiguration :: Maybe EncryptionConfiguration
dryRun :: Maybe Bool
description :: Maybe Text
$sel:firewallPolicy:CreateFirewallPolicy' :: CreateFirewallPolicy -> FirewallPolicy
$sel:firewallPolicyName:CreateFirewallPolicy' :: CreateFirewallPolicy -> Text
$sel:tags:CreateFirewallPolicy' :: CreateFirewallPolicy -> Maybe (NonEmpty Tag)
$sel:encryptionConfiguration:CreateFirewallPolicy' :: CreateFirewallPolicy -> Maybe EncryptionConfiguration
$sel:dryRun:CreateFirewallPolicy' :: CreateFirewallPolicy -> Maybe Bool
$sel:description:CreateFirewallPolicy' :: CreateFirewallPolicy -> 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 (NonEmpty Tag)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
firewallPolicyName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` FirewallPolicy
firewallPolicy

instance Prelude.NFData CreateFirewallPolicy where
  rnf :: CreateFirewallPolicy -> ()
rnf CreateFirewallPolicy' {Maybe Bool
Maybe (NonEmpty Tag)
Maybe Text
Maybe EncryptionConfiguration
Text
FirewallPolicy
firewallPolicy :: FirewallPolicy
firewallPolicyName :: Text
tags :: Maybe (NonEmpty Tag)
encryptionConfiguration :: Maybe EncryptionConfiguration
dryRun :: Maybe Bool
description :: Maybe Text
$sel:firewallPolicy:CreateFirewallPolicy' :: CreateFirewallPolicy -> FirewallPolicy
$sel:firewallPolicyName:CreateFirewallPolicy' :: CreateFirewallPolicy -> Text
$sel:tags:CreateFirewallPolicy' :: CreateFirewallPolicy -> Maybe (NonEmpty Tag)
$sel:encryptionConfiguration:CreateFirewallPolicy' :: CreateFirewallPolicy -> Maybe EncryptionConfiguration
$sel:dryRun:CreateFirewallPolicy' :: CreateFirewallPolicy -> Maybe Bool
$sel:description:CreateFirewallPolicy' :: CreateFirewallPolicy -> 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 (NonEmpty Tag)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
firewallPolicyName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf FirewallPolicy
firewallPolicy

instance Data.ToHeaders CreateFirewallPolicy where
  toHeaders :: CreateFirewallPolicy -> 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.CreateFirewallPolicy" ::
                          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 CreateFirewallPolicy where
  toJSON :: CreateFirewallPolicy -> Value
toJSON CreateFirewallPolicy' {Maybe Bool
Maybe (NonEmpty Tag)
Maybe Text
Maybe EncryptionConfiguration
Text
FirewallPolicy
firewallPolicy :: FirewallPolicy
firewallPolicyName :: Text
tags :: Maybe (NonEmpty Tag)
encryptionConfiguration :: Maybe EncryptionConfiguration
dryRun :: Maybe Bool
description :: Maybe Text
$sel:firewallPolicy:CreateFirewallPolicy' :: CreateFirewallPolicy -> FirewallPolicy
$sel:firewallPolicyName:CreateFirewallPolicy' :: CreateFirewallPolicy -> Text
$sel:tags:CreateFirewallPolicy' :: CreateFirewallPolicy -> Maybe (NonEmpty Tag)
$sel:encryptionConfiguration:CreateFirewallPolicy' :: CreateFirewallPolicy -> Maybe EncryptionConfiguration
$sel:dryRun:CreateFirewallPolicy' :: CreateFirewallPolicy -> Maybe Bool
$sel:description:CreateFirewallPolicy' :: CreateFirewallPolicy -> 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
"Tags" 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 (NonEmpty Tag)
tags,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"FirewallPolicyName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
firewallPolicyName),
            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 CreateFirewallPolicy where
  toPath :: CreateFirewallPolicy -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newCreateFirewallPolicyResponse' smart constructor.
data CreateFirewallPolicyResponse = CreateFirewallPolicyResponse'
  { -- | The response's http status code.
    CreateFirewallPolicyResponse -> 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.
    CreateFirewallPolicyResponse -> 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.
    CreateFirewallPolicyResponse -> FirewallPolicyResponse
firewallPolicyResponse :: FirewallPolicyResponse
  }
  deriving (CreateFirewallPolicyResponse
-> CreateFirewallPolicyResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateFirewallPolicyResponse
-> CreateFirewallPolicyResponse -> Bool
$c/= :: CreateFirewallPolicyResponse
-> CreateFirewallPolicyResponse -> Bool
== :: CreateFirewallPolicyResponse
-> CreateFirewallPolicyResponse -> Bool
$c== :: CreateFirewallPolicyResponse
-> CreateFirewallPolicyResponse -> Bool
Prelude.Eq, ReadPrec [CreateFirewallPolicyResponse]
ReadPrec CreateFirewallPolicyResponse
Int -> ReadS CreateFirewallPolicyResponse
ReadS [CreateFirewallPolicyResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateFirewallPolicyResponse]
$creadListPrec :: ReadPrec [CreateFirewallPolicyResponse]
readPrec :: ReadPrec CreateFirewallPolicyResponse
$creadPrec :: ReadPrec CreateFirewallPolicyResponse
readList :: ReadS [CreateFirewallPolicyResponse]
$creadList :: ReadS [CreateFirewallPolicyResponse]
readsPrec :: Int -> ReadS CreateFirewallPolicyResponse
$creadsPrec :: Int -> ReadS CreateFirewallPolicyResponse
Prelude.Read, Int -> CreateFirewallPolicyResponse -> ShowS
[CreateFirewallPolicyResponse] -> ShowS
CreateFirewallPolicyResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateFirewallPolicyResponse] -> ShowS
$cshowList :: [CreateFirewallPolicyResponse] -> ShowS
show :: CreateFirewallPolicyResponse -> String
$cshow :: CreateFirewallPolicyResponse -> String
showsPrec :: Int -> CreateFirewallPolicyResponse -> ShowS
$cshowsPrec :: Int -> CreateFirewallPolicyResponse -> ShowS
Prelude.Show, forall x.
Rep CreateFirewallPolicyResponse x -> CreateFirewallPolicyResponse
forall x.
CreateFirewallPolicyResponse -> Rep CreateFirewallPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateFirewallPolicyResponse x -> CreateFirewallPolicyResponse
$cfrom :: forall x.
CreateFirewallPolicyResponse -> Rep CreateFirewallPolicyResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateFirewallPolicyResponse' 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', 'createFirewallPolicyResponse_httpStatus' - The response's http status code.
--
-- 'updateToken', 'createFirewallPolicyResponse_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', 'createFirewallPolicyResponse_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.
newCreateFirewallPolicyResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'updateToken'
  Prelude.Text ->
  -- | 'firewallPolicyResponse'
  FirewallPolicyResponse ->
  CreateFirewallPolicyResponse
newCreateFirewallPolicyResponse :: Int
-> Text -> FirewallPolicyResponse -> CreateFirewallPolicyResponse
newCreateFirewallPolicyResponse
  Int
pHttpStatus_
  Text
pUpdateToken_
  FirewallPolicyResponse
pFirewallPolicyResponse_ =
    CreateFirewallPolicyResponse'
      { $sel:httpStatus:CreateFirewallPolicyResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:updateToken:CreateFirewallPolicyResponse' :: Text
updateToken = Text
pUpdateToken_,
        $sel:firewallPolicyResponse:CreateFirewallPolicyResponse' :: FirewallPolicyResponse
firewallPolicyResponse =
          FirewallPolicyResponse
pFirewallPolicyResponse_
      }

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

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

-- | 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.
createFirewallPolicyResponse_firewallPolicyResponse :: Lens.Lens' CreateFirewallPolicyResponse FirewallPolicyResponse
createFirewallPolicyResponse_firewallPolicyResponse :: Lens' CreateFirewallPolicyResponse FirewallPolicyResponse
createFirewallPolicyResponse_firewallPolicyResponse = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFirewallPolicyResponse' {FirewallPolicyResponse
firewallPolicyResponse :: FirewallPolicyResponse
$sel:firewallPolicyResponse:CreateFirewallPolicyResponse' :: CreateFirewallPolicyResponse -> FirewallPolicyResponse
firewallPolicyResponse} -> FirewallPolicyResponse
firewallPolicyResponse) (\s :: CreateFirewallPolicyResponse
s@CreateFirewallPolicyResponse' {} FirewallPolicyResponse
a -> CreateFirewallPolicyResponse
s {$sel:firewallPolicyResponse:CreateFirewallPolicyResponse' :: FirewallPolicyResponse
firewallPolicyResponse = FirewallPolicyResponse
a} :: CreateFirewallPolicyResponse)

instance Prelude.NFData CreateFirewallPolicyResponse where
  rnf :: CreateFirewallPolicyResponse -> ()
rnf CreateFirewallPolicyResponse' {Int
Text
FirewallPolicyResponse
firewallPolicyResponse :: FirewallPolicyResponse
updateToken :: Text
httpStatus :: Int
$sel:firewallPolicyResponse:CreateFirewallPolicyResponse' :: CreateFirewallPolicyResponse -> FirewallPolicyResponse
$sel:updateToken:CreateFirewallPolicyResponse' :: CreateFirewallPolicyResponse -> Text
$sel:httpStatus:CreateFirewallPolicyResponse' :: CreateFirewallPolicyResponse -> 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