{-# 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.CreateFirewall
-- 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)
--
-- Creates an AWS Network Firewall Firewall and accompanying FirewallStatus
-- for a VPC.
--
-- The firewall defines the configuration settings for an AWS Network
-- Firewall firewall. The settings that you can define at creation include
-- the firewall policy, the subnets in your VPC to use for the firewall
-- endpoints, and any tags that are attached to the firewall AWS resource.
--
-- After you create a firewall, you can provide additional settings, like
-- the logging configuration.
--
-- To update the settings for a firewall, you use the operations that apply
-- to the settings themselves, for example UpdateLoggingConfiguration,
-- AssociateSubnets, and UpdateFirewallDeleteProtection.
--
-- To manage a firewall\'s tags, use the standard AWS resource tagging
-- operations, ListTagsForResource, TagResource, and UntagResource.
--
-- To retrieve information about firewalls, use ListFirewalls and
-- DescribeFirewall.
module Amazonka.NetworkFirewall.CreateFirewall
  ( -- * Creating a Request
    CreateFirewall (..),
    newCreateFirewall,

    -- * Request Lenses
    createFirewall_firewallPolicyChangeProtection,
    createFirewall_subnetChangeProtection,
    createFirewall_deleteProtection,
    createFirewall_description,
    createFirewall_tags,
    createFirewall_firewallName,
    createFirewall_firewallPolicyArn,
    createFirewall_vpcId,
    createFirewall_subnetMappings,

    -- * Destructuring the Response
    CreateFirewallResponse (..),
    newCreateFirewallResponse,

    -- * Response Lenses
    createFirewallResponse_firewallStatus,
    createFirewallResponse_firewall,
    createFirewallResponse_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:/ 'newCreateFirewall' smart constructor.
data CreateFirewall = CreateFirewall'
  { -- | A setting indicating whether the firewall is protected against a change
    -- to the firewall policy association. Use this setting to protect against
    -- accidentally modifying the firewall policy for a firewall that is in
    -- use. When you create a firewall, the operation initializes this setting
    -- to @TRUE@.
    CreateFirewall -> Maybe Bool
firewallPolicyChangeProtection :: Prelude.Maybe Prelude.Bool,
    -- | 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@.
    CreateFirewall -> Maybe Bool
subnetChangeProtection :: Prelude.Maybe Prelude.Bool,
    -- | A flag indicating whether it is possible to delete the firewall. A
    -- setting of @TRUE@ indicates that the firewall is protected against
    -- deletion. Use this setting to protect against accidentally deleting a
    -- firewall that is in use. When you create a firewall, the operation
    -- initializes this flag to @TRUE@.
    CreateFirewall -> Maybe Bool
deleteProtection :: Prelude.Maybe Prelude.Bool,
    -- | A description of the firewall.
    CreateFirewall -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The key:value pairs to associate with the resource.
    CreateFirewall -> Maybe (NonEmpty Tag)
tags :: Prelude.Maybe (Prelude.NonEmpty Tag),
    -- | The descriptive name of the firewall. You can\'t change the name of a
    -- firewall after you create it.
    CreateFirewall -> Text
firewallName :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the FirewallPolicy that you want to
    -- use for the firewall.
    CreateFirewall -> Text
firewallPolicyArn :: Prelude.Text,
    -- | The unique identifier of the VPC where Network Firewall should create
    -- the firewall.
    --
    -- You can\'t change this setting after you create the firewall.
    CreateFirewall -> Text
vpcId :: Prelude.Text,
    -- | The public subnets to use for your Network Firewall firewalls. Each
    -- subnet must belong to a different Availability Zone in the VPC. Network
    -- Firewall creates a firewall endpoint in each subnet.
    CreateFirewall -> [SubnetMapping]
subnetMappings :: [SubnetMapping]
  }
  deriving (CreateFirewall -> CreateFirewall -> Bool
(CreateFirewall -> CreateFirewall -> Bool)
-> (CreateFirewall -> CreateFirewall -> Bool) -> Eq CreateFirewall
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateFirewall -> CreateFirewall -> Bool
$c/= :: CreateFirewall -> CreateFirewall -> Bool
== :: CreateFirewall -> CreateFirewall -> Bool
$c== :: CreateFirewall -> CreateFirewall -> Bool
Prelude.Eq, ReadPrec [CreateFirewall]
ReadPrec CreateFirewall
Int -> ReadS CreateFirewall
ReadS [CreateFirewall]
(Int -> ReadS CreateFirewall)
-> ReadS [CreateFirewall]
-> ReadPrec CreateFirewall
-> ReadPrec [CreateFirewall]
-> Read CreateFirewall
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateFirewall]
$creadListPrec :: ReadPrec [CreateFirewall]
readPrec :: ReadPrec CreateFirewall
$creadPrec :: ReadPrec CreateFirewall
readList :: ReadS [CreateFirewall]
$creadList :: ReadS [CreateFirewall]
readsPrec :: Int -> ReadS CreateFirewall
$creadsPrec :: Int -> ReadS CreateFirewall
Prelude.Read, Int -> CreateFirewall -> ShowS
[CreateFirewall] -> ShowS
CreateFirewall -> String
(Int -> CreateFirewall -> ShowS)
-> (CreateFirewall -> String)
-> ([CreateFirewall] -> ShowS)
-> Show CreateFirewall
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateFirewall] -> ShowS
$cshowList :: [CreateFirewall] -> ShowS
show :: CreateFirewall -> String
$cshow :: CreateFirewall -> String
showsPrec :: Int -> CreateFirewall -> ShowS
$cshowsPrec :: Int -> CreateFirewall -> ShowS
Prelude.Show, (forall x. CreateFirewall -> Rep CreateFirewall x)
-> (forall x. Rep CreateFirewall x -> CreateFirewall)
-> Generic CreateFirewall
forall x. Rep CreateFirewall x -> CreateFirewall
forall x. CreateFirewall -> Rep CreateFirewall x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateFirewall x -> CreateFirewall
$cfrom :: forall x. CreateFirewall -> Rep CreateFirewall x
Prelude.Generic)

-- |
-- Create a value of 'CreateFirewall' 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:
--
-- 'firewallPolicyChangeProtection', 'createFirewall_firewallPolicyChangeProtection' - A setting indicating whether the firewall is protected against a change
-- to the firewall policy association. Use this setting to protect against
-- accidentally modifying the firewall policy for a firewall that is in
-- use. When you create a firewall, the operation initializes this setting
-- to @TRUE@.
--
-- 'subnetChangeProtection', 'createFirewall_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@.
--
-- 'deleteProtection', 'createFirewall_deleteProtection' - A flag indicating whether it is possible to delete the firewall. A
-- setting of @TRUE@ indicates that the firewall is protected against
-- deletion. Use this setting to protect against accidentally deleting a
-- firewall that is in use. When you create a firewall, the operation
-- initializes this flag to @TRUE@.
--
-- 'description', 'createFirewall_description' - A description of the firewall.
--
-- 'tags', 'createFirewall_tags' - The key:value pairs to associate with the resource.
--
-- 'firewallName', 'createFirewall_firewallName' - The descriptive name of the firewall. You can\'t change the name of a
-- firewall after you create it.
--
-- 'firewallPolicyArn', 'createFirewall_firewallPolicyArn' - The Amazon Resource Name (ARN) of the FirewallPolicy that you want to
-- use for the firewall.
--
-- 'vpcId', 'createFirewall_vpcId' - The unique identifier of the VPC where Network Firewall should create
-- the firewall.
--
-- You can\'t change this setting after you create the firewall.
--
-- 'subnetMappings', 'createFirewall_subnetMappings' - The public subnets to use for your Network Firewall firewalls. Each
-- subnet must belong to a different Availability Zone in the VPC. Network
-- Firewall creates a firewall endpoint in each subnet.
newCreateFirewall ::
  -- | 'firewallName'
  Prelude.Text ->
  -- | 'firewallPolicyArn'
  Prelude.Text ->
  -- | 'vpcId'
  Prelude.Text ->
  CreateFirewall
newCreateFirewall :: Text -> Text -> Text -> CreateFirewall
newCreateFirewall
  Text
pFirewallName_
  Text
pFirewallPolicyArn_
  Text
pVpcId_ =
    CreateFirewall' :: Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Text
-> Maybe (NonEmpty Tag)
-> Text
-> Text
-> Text
-> [SubnetMapping]
-> CreateFirewall
CreateFirewall'
      { $sel:firewallPolicyChangeProtection:CreateFirewall' :: Maybe Bool
firewallPolicyChangeProtection =
          Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:subnetChangeProtection:CreateFirewall' :: Maybe Bool
subnetChangeProtection = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:deleteProtection:CreateFirewall' :: Maybe Bool
deleteProtection = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:description:CreateFirewall' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateFirewall' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
forall a. Maybe a
Prelude.Nothing,
        $sel:firewallName:CreateFirewall' :: Text
firewallName = Text
pFirewallName_,
        $sel:firewallPolicyArn:CreateFirewall' :: Text
firewallPolicyArn = Text
pFirewallPolicyArn_,
        $sel:vpcId:CreateFirewall' :: Text
vpcId = Text
pVpcId_,
        $sel:subnetMappings:CreateFirewall' :: [SubnetMapping]
subnetMappings = [SubnetMapping]
forall a. Monoid a => a
Prelude.mempty
      }

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

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

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

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

-- | The key:value pairs to associate with the resource.
createFirewall_tags :: Lens.Lens' CreateFirewall (Prelude.Maybe (Prelude.NonEmpty Tag))
createFirewall_tags :: (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateFirewall -> f CreateFirewall
createFirewall_tags = (CreateFirewall -> Maybe (NonEmpty Tag))
-> (CreateFirewall -> Maybe (NonEmpty Tag) -> CreateFirewall)
-> Lens
     CreateFirewall
     CreateFirewall
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFirewall' {Maybe (NonEmpty Tag)
tags :: Maybe (NonEmpty Tag)
$sel:tags:CreateFirewall' :: CreateFirewall -> Maybe (NonEmpty Tag)
tags} -> Maybe (NonEmpty Tag)
tags) (\s :: CreateFirewall
s@CreateFirewall' {} Maybe (NonEmpty Tag)
a -> CreateFirewall
s {$sel:tags:CreateFirewall' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
a} :: CreateFirewall) ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
 -> CreateFirewall -> f CreateFirewall)
-> ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
    -> Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateFirewall
-> f CreateFirewall
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag)
-> Iso
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
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 AnIso (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

-- | The Amazon Resource Name (ARN) of the FirewallPolicy that you want to
-- use for the firewall.
createFirewall_firewallPolicyArn :: Lens.Lens' CreateFirewall Prelude.Text
createFirewall_firewallPolicyArn :: (Text -> f Text) -> CreateFirewall -> f CreateFirewall
createFirewall_firewallPolicyArn = (CreateFirewall -> Text)
-> (CreateFirewall -> Text -> CreateFirewall)
-> Lens CreateFirewall CreateFirewall Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFirewall' {Text
firewallPolicyArn :: Text
$sel:firewallPolicyArn:CreateFirewall' :: CreateFirewall -> Text
firewallPolicyArn} -> Text
firewallPolicyArn) (\s :: CreateFirewall
s@CreateFirewall' {} Text
a -> CreateFirewall
s {$sel:firewallPolicyArn:CreateFirewall' :: Text
firewallPolicyArn = Text
a} :: CreateFirewall)

-- | The unique identifier of the VPC where Network Firewall should create
-- the firewall.
--
-- You can\'t change this setting after you create the firewall.
createFirewall_vpcId :: Lens.Lens' CreateFirewall Prelude.Text
createFirewall_vpcId :: (Text -> f Text) -> CreateFirewall -> f CreateFirewall
createFirewall_vpcId = (CreateFirewall -> Text)
-> (CreateFirewall -> Text -> CreateFirewall)
-> Lens CreateFirewall CreateFirewall Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFirewall' {Text
vpcId :: Text
$sel:vpcId:CreateFirewall' :: CreateFirewall -> Text
vpcId} -> Text
vpcId) (\s :: CreateFirewall
s@CreateFirewall' {} Text
a -> CreateFirewall
s {$sel:vpcId:CreateFirewall' :: Text
vpcId = Text
a} :: CreateFirewall)

-- | The public subnets to use for your Network Firewall firewalls. Each
-- subnet must belong to a different Availability Zone in the VPC. Network
-- Firewall creates a firewall endpoint in each subnet.
createFirewall_subnetMappings :: Lens.Lens' CreateFirewall [SubnetMapping]
createFirewall_subnetMappings :: ([SubnetMapping] -> f [SubnetMapping])
-> CreateFirewall -> f CreateFirewall
createFirewall_subnetMappings = (CreateFirewall -> [SubnetMapping])
-> (CreateFirewall -> [SubnetMapping] -> CreateFirewall)
-> Lens
     CreateFirewall CreateFirewall [SubnetMapping] [SubnetMapping]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFirewall' {[SubnetMapping]
subnetMappings :: [SubnetMapping]
$sel:subnetMappings:CreateFirewall' :: CreateFirewall -> [SubnetMapping]
subnetMappings} -> [SubnetMapping]
subnetMappings) (\s :: CreateFirewall
s@CreateFirewall' {} [SubnetMapping]
a -> CreateFirewall
s {$sel:subnetMappings:CreateFirewall' :: [SubnetMapping]
subnetMappings = [SubnetMapping]
a} :: CreateFirewall) (([SubnetMapping] -> f [SubnetMapping])
 -> CreateFirewall -> f CreateFirewall)
-> (([SubnetMapping] -> f [SubnetMapping])
    -> [SubnetMapping] -> f [SubnetMapping])
-> ([SubnetMapping] -> f [SubnetMapping])
-> CreateFirewall
-> f CreateFirewall
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([SubnetMapping] -> f [SubnetMapping])
-> [SubnetMapping] -> f [SubnetMapping]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData CreateFirewall

instance Core.ToHeaders CreateFirewall where
  toHeaders :: CreateFirewall -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateFirewall -> 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.CreateFirewall" ::
                          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 CreateFirewall where
  toJSON :: CreateFirewall -> Value
toJSON CreateFirewall' {[SubnetMapping]
Maybe Bool
Maybe (NonEmpty Tag)
Maybe Text
Text
subnetMappings :: [SubnetMapping]
vpcId :: Text
firewallPolicyArn :: Text
firewallName :: Text
tags :: Maybe (NonEmpty Tag)
description :: Maybe Text
deleteProtection :: Maybe Bool
subnetChangeProtection :: Maybe Bool
firewallPolicyChangeProtection :: Maybe Bool
$sel:subnetMappings:CreateFirewall' :: CreateFirewall -> [SubnetMapping]
$sel:vpcId:CreateFirewall' :: CreateFirewall -> Text
$sel:firewallPolicyArn:CreateFirewall' :: CreateFirewall -> Text
$sel:firewallName:CreateFirewall' :: CreateFirewall -> Text
$sel:tags:CreateFirewall' :: CreateFirewall -> Maybe (NonEmpty Tag)
$sel:description:CreateFirewall' :: CreateFirewall -> Maybe Text
$sel:deleteProtection:CreateFirewall' :: CreateFirewall -> Maybe Bool
$sel:subnetChangeProtection:CreateFirewall' :: CreateFirewall -> Maybe Bool
$sel:firewallPolicyChangeProtection:CreateFirewall' :: CreateFirewall -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"FirewallPolicyChangeProtection" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
firewallPolicyChangeProtection,
            (Text
"SubnetChangeProtection" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
subnetChangeProtection,
            (Text
"DeleteProtection" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
deleteProtection,
            (Text
"Description" 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
description,
            (Text
"Tags" Text -> NonEmpty Tag -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Tag -> Pair) -> Maybe (NonEmpty Tag) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Tag)
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"FirewallName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
firewallName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"FirewallPolicyArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
firewallPolicyArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"VpcId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
vpcId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"SubnetMappings" Text -> [SubnetMapping] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [SubnetMapping]
subnetMappings)
          ]
      )

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

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

-- | /See:/ 'newCreateFirewallResponse' smart constructor.
data CreateFirewallResponse = CreateFirewallResponse'
  { -- | Detailed information about the current status of a Firewall. You can
    -- retrieve this for a firewall by calling DescribeFirewall and providing
    -- the firewall name and ARN.
    CreateFirewallResponse -> Maybe FirewallStatus
firewallStatus :: Prelude.Maybe FirewallStatus,
    -- | The configuration settings for the firewall. These settings include the
    -- firewall policy and the subnets in your VPC to use for the firewall
    -- endpoints.
    CreateFirewallResponse -> Maybe Firewall
firewall :: Prelude.Maybe Firewall,
    -- | The response's http status code.
    CreateFirewallResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateFirewallResponse -> CreateFirewallResponse -> Bool
(CreateFirewallResponse -> CreateFirewallResponse -> Bool)
-> (CreateFirewallResponse -> CreateFirewallResponse -> Bool)
-> Eq CreateFirewallResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateFirewallResponse -> CreateFirewallResponse -> Bool
$c/= :: CreateFirewallResponse -> CreateFirewallResponse -> Bool
== :: CreateFirewallResponse -> CreateFirewallResponse -> Bool
$c== :: CreateFirewallResponse -> CreateFirewallResponse -> Bool
Prelude.Eq, ReadPrec [CreateFirewallResponse]
ReadPrec CreateFirewallResponse
Int -> ReadS CreateFirewallResponse
ReadS [CreateFirewallResponse]
(Int -> ReadS CreateFirewallResponse)
-> ReadS [CreateFirewallResponse]
-> ReadPrec CreateFirewallResponse
-> ReadPrec [CreateFirewallResponse]
-> Read CreateFirewallResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateFirewallResponse]
$creadListPrec :: ReadPrec [CreateFirewallResponse]
readPrec :: ReadPrec CreateFirewallResponse
$creadPrec :: ReadPrec CreateFirewallResponse
readList :: ReadS [CreateFirewallResponse]
$creadList :: ReadS [CreateFirewallResponse]
readsPrec :: Int -> ReadS CreateFirewallResponse
$creadsPrec :: Int -> ReadS CreateFirewallResponse
Prelude.Read, Int -> CreateFirewallResponse -> ShowS
[CreateFirewallResponse] -> ShowS
CreateFirewallResponse -> String
(Int -> CreateFirewallResponse -> ShowS)
-> (CreateFirewallResponse -> String)
-> ([CreateFirewallResponse] -> ShowS)
-> Show CreateFirewallResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateFirewallResponse] -> ShowS
$cshowList :: [CreateFirewallResponse] -> ShowS
show :: CreateFirewallResponse -> String
$cshow :: CreateFirewallResponse -> String
showsPrec :: Int -> CreateFirewallResponse -> ShowS
$cshowsPrec :: Int -> CreateFirewallResponse -> ShowS
Prelude.Show, (forall x. CreateFirewallResponse -> Rep CreateFirewallResponse x)
-> (forall x.
    Rep CreateFirewallResponse x -> CreateFirewallResponse)
-> Generic CreateFirewallResponse
forall x. Rep CreateFirewallResponse x -> CreateFirewallResponse
forall x. CreateFirewallResponse -> Rep CreateFirewallResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateFirewallResponse x -> CreateFirewallResponse
$cfrom :: forall x. CreateFirewallResponse -> Rep CreateFirewallResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateFirewallResponse' 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:
--
-- 'firewallStatus', 'createFirewallResponse_firewallStatus' - Detailed information about the current status of a Firewall. You can
-- retrieve this for a firewall by calling DescribeFirewall and providing
-- the firewall name and ARN.
--
-- 'firewall', 'createFirewallResponse_firewall' - The configuration settings for the firewall. These settings include the
-- firewall policy and the subnets in your VPC to use for the firewall
-- endpoints.
--
-- 'httpStatus', 'createFirewallResponse_httpStatus' - The response's http status code.
newCreateFirewallResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateFirewallResponse
newCreateFirewallResponse :: Int -> CreateFirewallResponse
newCreateFirewallResponse Int
pHttpStatus_ =
  CreateFirewallResponse' :: Maybe FirewallStatus
-> Maybe Firewall -> Int -> CreateFirewallResponse
CreateFirewallResponse'
    { $sel:firewallStatus:CreateFirewallResponse' :: Maybe FirewallStatus
firewallStatus =
        Maybe FirewallStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:firewall:CreateFirewallResponse' :: Maybe Firewall
firewall = Maybe Firewall
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateFirewallResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Detailed information about the current status of a Firewall. You can
-- retrieve this for a firewall by calling DescribeFirewall and providing
-- the firewall name and ARN.
createFirewallResponse_firewallStatus :: Lens.Lens' CreateFirewallResponse (Prelude.Maybe FirewallStatus)
createFirewallResponse_firewallStatus :: (Maybe FirewallStatus -> f (Maybe FirewallStatus))
-> CreateFirewallResponse -> f CreateFirewallResponse
createFirewallResponse_firewallStatus = (CreateFirewallResponse -> Maybe FirewallStatus)
-> (CreateFirewallResponse
    -> Maybe FirewallStatus -> CreateFirewallResponse)
-> Lens
     CreateFirewallResponse
     CreateFirewallResponse
     (Maybe FirewallStatus)
     (Maybe FirewallStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFirewallResponse' {Maybe FirewallStatus
firewallStatus :: Maybe FirewallStatus
$sel:firewallStatus:CreateFirewallResponse' :: CreateFirewallResponse -> Maybe FirewallStatus
firewallStatus} -> Maybe FirewallStatus
firewallStatus) (\s :: CreateFirewallResponse
s@CreateFirewallResponse' {} Maybe FirewallStatus
a -> CreateFirewallResponse
s {$sel:firewallStatus:CreateFirewallResponse' :: Maybe FirewallStatus
firewallStatus = Maybe FirewallStatus
a} :: CreateFirewallResponse)

-- | The configuration settings for the firewall. These settings include the
-- firewall policy and the subnets in your VPC to use for the firewall
-- endpoints.
createFirewallResponse_firewall :: Lens.Lens' CreateFirewallResponse (Prelude.Maybe Firewall)
createFirewallResponse_firewall :: (Maybe Firewall -> f (Maybe Firewall))
-> CreateFirewallResponse -> f CreateFirewallResponse
createFirewallResponse_firewall = (CreateFirewallResponse -> Maybe Firewall)
-> (CreateFirewallResponse
    -> Maybe Firewall -> CreateFirewallResponse)
-> Lens
     CreateFirewallResponse
     CreateFirewallResponse
     (Maybe Firewall)
     (Maybe Firewall)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFirewallResponse' {Maybe Firewall
firewall :: Maybe Firewall
$sel:firewall:CreateFirewallResponse' :: CreateFirewallResponse -> Maybe Firewall
firewall} -> Maybe Firewall
firewall) (\s :: CreateFirewallResponse
s@CreateFirewallResponse' {} Maybe Firewall
a -> CreateFirewallResponse
s {$sel:firewall:CreateFirewallResponse' :: Maybe Firewall
firewall = Maybe Firewall
a} :: CreateFirewallResponse)

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

instance Prelude.NFData CreateFirewallResponse