{-# 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.AssociateFirewallPolicy
-- 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)
--
-- Associates a FirewallPolicy to a Firewall.
--
-- A firewall policy defines how to monitor and manage your VPC network
-- traffic, using a collection of inspection rule groups and other
-- settings. Each firewall requires one firewall policy association, and
-- you can use the same firewall policy for multiple firewalls.
module Amazonka.NetworkFirewall.AssociateFirewallPolicy
  ( -- * Creating a Request
    AssociateFirewallPolicy (..),
    newAssociateFirewallPolicy,

    -- * Request Lenses
    associateFirewallPolicy_updateToken,
    associateFirewallPolicy_firewallArn,
    associateFirewallPolicy_firewallName,
    associateFirewallPolicy_firewallPolicyArn,

    -- * Destructuring the Response
    AssociateFirewallPolicyResponse (..),
    newAssociateFirewallPolicyResponse,

    -- * Response Lenses
    associateFirewallPolicyResponse_updateToken,
    associateFirewallPolicyResponse_firewallArn,
    associateFirewallPolicyResponse_firewallPolicyArn,
    associateFirewallPolicyResponse_firewallName,
    associateFirewallPolicyResponse_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:/ 'newAssociateFirewallPolicy' smart constructor.
data AssociateFirewallPolicy = AssociateFirewallPolicy'
  { -- | An optional token that you can use for optimistic locking. Network
    -- Firewall returns a token to your requests that access the firewall. The
    -- token marks the state of the firewall resource at the time of the
    -- request.
    --
    -- To make an unconditional change to the firewall, omit the token in your
    -- update request. Without the token, Network Firewall performs your
    -- updates regardless of whether the firewall has changed since you last
    -- retrieved it.
    --
    -- To make a conditional change to the firewall, provide the token in your
    -- update request. Network Firewall uses the token to ensure that the
    -- firewall hasn\'t changed since you last retrieved it. If it has changed,
    -- the operation fails with an @InvalidTokenException@. If this happens,
    -- retrieve the firewall again to get a current copy of it with a new
    -- token. Reapply your changes as needed, then try the operation again
    -- using the new token.
    AssociateFirewallPolicy -> Maybe Text
updateToken :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the firewall.
    --
    -- You must specify the ARN or the name, and you can specify both.
    AssociateFirewallPolicy -> Maybe Text
firewallArn :: Prelude.Maybe Prelude.Text,
    -- | The descriptive name of the firewall. You can\'t change the name of a
    -- firewall after you create it.
    --
    -- You must specify the ARN or the name, and you can specify both.
    AssociateFirewallPolicy -> Maybe Text
firewallName :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the firewall policy.
    AssociateFirewallPolicy -> Text
firewallPolicyArn :: Prelude.Text
  }
  deriving (AssociateFirewallPolicy -> AssociateFirewallPolicy -> Bool
(AssociateFirewallPolicy -> AssociateFirewallPolicy -> Bool)
-> (AssociateFirewallPolicy -> AssociateFirewallPolicy -> Bool)
-> Eq AssociateFirewallPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateFirewallPolicy -> AssociateFirewallPolicy -> Bool
$c/= :: AssociateFirewallPolicy -> AssociateFirewallPolicy -> Bool
== :: AssociateFirewallPolicy -> AssociateFirewallPolicy -> Bool
$c== :: AssociateFirewallPolicy -> AssociateFirewallPolicy -> Bool
Prelude.Eq, ReadPrec [AssociateFirewallPolicy]
ReadPrec AssociateFirewallPolicy
Int -> ReadS AssociateFirewallPolicy
ReadS [AssociateFirewallPolicy]
(Int -> ReadS AssociateFirewallPolicy)
-> ReadS [AssociateFirewallPolicy]
-> ReadPrec AssociateFirewallPolicy
-> ReadPrec [AssociateFirewallPolicy]
-> Read AssociateFirewallPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateFirewallPolicy]
$creadListPrec :: ReadPrec [AssociateFirewallPolicy]
readPrec :: ReadPrec AssociateFirewallPolicy
$creadPrec :: ReadPrec AssociateFirewallPolicy
readList :: ReadS [AssociateFirewallPolicy]
$creadList :: ReadS [AssociateFirewallPolicy]
readsPrec :: Int -> ReadS AssociateFirewallPolicy
$creadsPrec :: Int -> ReadS AssociateFirewallPolicy
Prelude.Read, Int -> AssociateFirewallPolicy -> ShowS
[AssociateFirewallPolicy] -> ShowS
AssociateFirewallPolicy -> String
(Int -> AssociateFirewallPolicy -> ShowS)
-> (AssociateFirewallPolicy -> String)
-> ([AssociateFirewallPolicy] -> ShowS)
-> Show AssociateFirewallPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateFirewallPolicy] -> ShowS
$cshowList :: [AssociateFirewallPolicy] -> ShowS
show :: AssociateFirewallPolicy -> String
$cshow :: AssociateFirewallPolicy -> String
showsPrec :: Int -> AssociateFirewallPolicy -> ShowS
$cshowsPrec :: Int -> AssociateFirewallPolicy -> ShowS
Prelude.Show, (forall x.
 AssociateFirewallPolicy -> Rep AssociateFirewallPolicy x)
-> (forall x.
    Rep AssociateFirewallPolicy x -> AssociateFirewallPolicy)
-> Generic AssociateFirewallPolicy
forall x. Rep AssociateFirewallPolicy x -> AssociateFirewallPolicy
forall x. AssociateFirewallPolicy -> Rep AssociateFirewallPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssociateFirewallPolicy x -> AssociateFirewallPolicy
$cfrom :: forall x. AssociateFirewallPolicy -> Rep AssociateFirewallPolicy x
Prelude.Generic)

-- |
-- Create a value of 'AssociateFirewallPolicy' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'updateToken', 'associateFirewallPolicy_updateToken' - An optional token that you can use for optimistic locking. Network
-- Firewall returns a token to your requests that access the firewall. The
-- token marks the state of the firewall resource at the time of the
-- request.
--
-- To make an unconditional change to the firewall, omit the token in your
-- update request. Without the token, Network Firewall performs your
-- updates regardless of whether the firewall has changed since you last
-- retrieved it.
--
-- To make a conditional change to the firewall, provide the token in your
-- update request. Network Firewall uses the token to ensure that the
-- firewall hasn\'t changed since you last retrieved it. If it has changed,
-- the operation fails with an @InvalidTokenException@. If this happens,
-- retrieve the firewall again to get a current copy of it with a new
-- token. Reapply your changes as needed, then try the operation again
-- using the new token.
--
-- 'firewallArn', 'associateFirewallPolicy_firewallArn' - The Amazon Resource Name (ARN) of the firewall.
--
-- You must specify the ARN or the name, and you can specify both.
--
-- 'firewallName', 'associateFirewallPolicy_firewallName' - The descriptive name of the firewall. You can\'t change the name of a
-- firewall after you create it.
--
-- You must specify the ARN or the name, and you can specify both.
--
-- 'firewallPolicyArn', 'associateFirewallPolicy_firewallPolicyArn' - The Amazon Resource Name (ARN) of the firewall policy.
newAssociateFirewallPolicy ::
  -- | 'firewallPolicyArn'
  Prelude.Text ->
  AssociateFirewallPolicy
newAssociateFirewallPolicy :: Text -> AssociateFirewallPolicy
newAssociateFirewallPolicy Text
pFirewallPolicyArn_ =
  AssociateFirewallPolicy' :: Maybe Text
-> Maybe Text -> Maybe Text -> Text -> AssociateFirewallPolicy
AssociateFirewallPolicy'
    { $sel:updateToken:AssociateFirewallPolicy' :: Maybe Text
updateToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:firewallArn:AssociateFirewallPolicy' :: Maybe Text
firewallArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:firewallName:AssociateFirewallPolicy' :: Maybe Text
firewallName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:firewallPolicyArn:AssociateFirewallPolicy' :: Text
firewallPolicyArn = Text
pFirewallPolicyArn_
    }

-- | An optional token that you can use for optimistic locking. Network
-- Firewall returns a token to your requests that access the firewall. The
-- token marks the state of the firewall resource at the time of the
-- request.
--
-- To make an unconditional change to the firewall, omit the token in your
-- update request. Without the token, Network Firewall performs your
-- updates regardless of whether the firewall has changed since you last
-- retrieved it.
--
-- To make a conditional change to the firewall, provide the token in your
-- update request. Network Firewall uses the token to ensure that the
-- firewall hasn\'t changed since you last retrieved it. If it has changed,
-- the operation fails with an @InvalidTokenException@. If this happens,
-- retrieve the firewall again to get a current copy of it with a new
-- token. Reapply your changes as needed, then try the operation again
-- using the new token.
associateFirewallPolicy_updateToken :: Lens.Lens' AssociateFirewallPolicy (Prelude.Maybe Prelude.Text)
associateFirewallPolicy_updateToken :: (Maybe Text -> f (Maybe Text))
-> AssociateFirewallPolicy -> f AssociateFirewallPolicy
associateFirewallPolicy_updateToken = (AssociateFirewallPolicy -> Maybe Text)
-> (AssociateFirewallPolicy
    -> Maybe Text -> AssociateFirewallPolicy)
-> Lens
     AssociateFirewallPolicy
     AssociateFirewallPolicy
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateFirewallPolicy' {Maybe Text
updateToken :: Maybe Text
$sel:updateToken:AssociateFirewallPolicy' :: AssociateFirewallPolicy -> Maybe Text
updateToken} -> Maybe Text
updateToken) (\s :: AssociateFirewallPolicy
s@AssociateFirewallPolicy' {} Maybe Text
a -> AssociateFirewallPolicy
s {$sel:updateToken:AssociateFirewallPolicy' :: Maybe Text
updateToken = Maybe Text
a} :: AssociateFirewallPolicy)

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

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

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

instance Core.AWSRequest AssociateFirewallPolicy where
  type
    AWSResponse AssociateFirewallPolicy =
      AssociateFirewallPolicyResponse
  request :: AssociateFirewallPolicy -> Request AssociateFirewallPolicy
request = Service
-> AssociateFirewallPolicy -> Request AssociateFirewallPolicy
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy AssociateFirewallPolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse AssociateFirewallPolicy)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse AssociateFirewallPolicy))
-> Logger
-> Service
-> Proxy AssociateFirewallPolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse AssociateFirewallPolicy)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> AssociateFirewallPolicyResponse
AssociateFirewallPolicyResponse'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Int
 -> AssociateFirewallPolicyResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> AssociateFirewallPolicyResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"UpdateToken")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> AssociateFirewallPolicyResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text -> Int -> AssociateFirewallPolicyResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"FirewallArn")
            Either
  String
  (Maybe Text
   -> Maybe Text -> Int -> AssociateFirewallPolicyResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Int -> AssociateFirewallPolicyResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"FirewallPolicyArn")
            Either
  String (Maybe Text -> Int -> AssociateFirewallPolicyResponse)
-> Either String (Maybe Text)
-> Either String (Int -> AssociateFirewallPolicyResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"FirewallName")
            Either String (Int -> AssociateFirewallPolicyResponse)
-> Either String Int
-> Either String AssociateFirewallPolicyResponse
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 AssociateFirewallPolicy

instance Prelude.NFData AssociateFirewallPolicy

instance Core.ToHeaders AssociateFirewallPolicy where
  toHeaders :: AssociateFirewallPolicy -> ResponseHeaders
toHeaders =
    ResponseHeaders -> AssociateFirewallPolicy -> 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.AssociateFirewallPolicy" ::
                          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 AssociateFirewallPolicy where
  toJSON :: AssociateFirewallPolicy -> Value
toJSON AssociateFirewallPolicy' {Maybe Text
Text
firewallPolicyArn :: Text
firewallName :: Maybe Text
firewallArn :: Maybe Text
updateToken :: Maybe Text
$sel:firewallPolicyArn:AssociateFirewallPolicy' :: AssociateFirewallPolicy -> Text
$sel:firewallName:AssociateFirewallPolicy' :: AssociateFirewallPolicy -> Maybe Text
$sel:firewallArn:AssociateFirewallPolicy' :: AssociateFirewallPolicy -> Maybe Text
$sel:updateToken:AssociateFirewallPolicy' :: AssociateFirewallPolicy -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"UpdateToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
updateToken,
            (Text
"FirewallArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
firewallArn,
            (Text
"FirewallName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
firewallName,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"FirewallPolicyArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
firewallPolicyArn)
          ]
      )

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

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

-- | /See:/ 'newAssociateFirewallPolicyResponse' smart constructor.
data AssociateFirewallPolicyResponse = AssociateFirewallPolicyResponse'
  { -- | An optional token that you can use for optimistic locking. Network
    -- Firewall returns a token to your requests that access the firewall. The
    -- token marks the state of the firewall resource at the time of the
    -- request.
    --
    -- To make an unconditional change to the firewall, omit the token in your
    -- update request. Without the token, Network Firewall performs your
    -- updates regardless of whether the firewall has changed since you last
    -- retrieved it.
    --
    -- To make a conditional change to the firewall, provide the token in your
    -- update request. Network Firewall uses the token to ensure that the
    -- firewall hasn\'t changed since you last retrieved it. If it has changed,
    -- the operation fails with an @InvalidTokenException@. If this happens,
    -- retrieve the firewall again to get a current copy of it with a new
    -- token. Reapply your changes as needed, then try the operation again
    -- using the new token.
    AssociateFirewallPolicyResponse -> Maybe Text
updateToken :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the firewall.
    AssociateFirewallPolicyResponse -> Maybe Text
firewallArn :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the firewall policy.
    AssociateFirewallPolicyResponse -> Maybe Text
firewallPolicyArn :: Prelude.Maybe Prelude.Text,
    -- | The descriptive name of the firewall. You can\'t change the name of a
    -- firewall after you create it.
    AssociateFirewallPolicyResponse -> Maybe Text
firewallName :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    AssociateFirewallPolicyResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (AssociateFirewallPolicyResponse
-> AssociateFirewallPolicyResponse -> Bool
(AssociateFirewallPolicyResponse
 -> AssociateFirewallPolicyResponse -> Bool)
-> (AssociateFirewallPolicyResponse
    -> AssociateFirewallPolicyResponse -> Bool)
-> Eq AssociateFirewallPolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateFirewallPolicyResponse
-> AssociateFirewallPolicyResponse -> Bool
$c/= :: AssociateFirewallPolicyResponse
-> AssociateFirewallPolicyResponse -> Bool
== :: AssociateFirewallPolicyResponse
-> AssociateFirewallPolicyResponse -> Bool
$c== :: AssociateFirewallPolicyResponse
-> AssociateFirewallPolicyResponse -> Bool
Prelude.Eq, ReadPrec [AssociateFirewallPolicyResponse]
ReadPrec AssociateFirewallPolicyResponse
Int -> ReadS AssociateFirewallPolicyResponse
ReadS [AssociateFirewallPolicyResponse]
(Int -> ReadS AssociateFirewallPolicyResponse)
-> ReadS [AssociateFirewallPolicyResponse]
-> ReadPrec AssociateFirewallPolicyResponse
-> ReadPrec [AssociateFirewallPolicyResponse]
-> Read AssociateFirewallPolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateFirewallPolicyResponse]
$creadListPrec :: ReadPrec [AssociateFirewallPolicyResponse]
readPrec :: ReadPrec AssociateFirewallPolicyResponse
$creadPrec :: ReadPrec AssociateFirewallPolicyResponse
readList :: ReadS [AssociateFirewallPolicyResponse]
$creadList :: ReadS [AssociateFirewallPolicyResponse]
readsPrec :: Int -> ReadS AssociateFirewallPolicyResponse
$creadsPrec :: Int -> ReadS AssociateFirewallPolicyResponse
Prelude.Read, Int -> AssociateFirewallPolicyResponse -> ShowS
[AssociateFirewallPolicyResponse] -> ShowS
AssociateFirewallPolicyResponse -> String
(Int -> AssociateFirewallPolicyResponse -> ShowS)
-> (AssociateFirewallPolicyResponse -> String)
-> ([AssociateFirewallPolicyResponse] -> ShowS)
-> Show AssociateFirewallPolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateFirewallPolicyResponse] -> ShowS
$cshowList :: [AssociateFirewallPolicyResponse] -> ShowS
show :: AssociateFirewallPolicyResponse -> String
$cshow :: AssociateFirewallPolicyResponse -> String
showsPrec :: Int -> AssociateFirewallPolicyResponse -> ShowS
$cshowsPrec :: Int -> AssociateFirewallPolicyResponse -> ShowS
Prelude.Show, (forall x.
 AssociateFirewallPolicyResponse
 -> Rep AssociateFirewallPolicyResponse x)
-> (forall x.
    Rep AssociateFirewallPolicyResponse x
    -> AssociateFirewallPolicyResponse)
-> Generic AssociateFirewallPolicyResponse
forall x.
Rep AssociateFirewallPolicyResponse x
-> AssociateFirewallPolicyResponse
forall x.
AssociateFirewallPolicyResponse
-> Rep AssociateFirewallPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateFirewallPolicyResponse x
-> AssociateFirewallPolicyResponse
$cfrom :: forall x.
AssociateFirewallPolicyResponse
-> Rep AssociateFirewallPolicyResponse x
Prelude.Generic)

-- |
-- Create a value of 'AssociateFirewallPolicyResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'updateToken', 'associateFirewallPolicyResponse_updateToken' - An optional token that you can use for optimistic locking. Network
-- Firewall returns a token to your requests that access the firewall. The
-- token marks the state of the firewall resource at the time of the
-- request.
--
-- To make an unconditional change to the firewall, omit the token in your
-- update request. Without the token, Network Firewall performs your
-- updates regardless of whether the firewall has changed since you last
-- retrieved it.
--
-- To make a conditional change to the firewall, provide the token in your
-- update request. Network Firewall uses the token to ensure that the
-- firewall hasn\'t changed since you last retrieved it. If it has changed,
-- the operation fails with an @InvalidTokenException@. If this happens,
-- retrieve the firewall again to get a current copy of it with a new
-- token. Reapply your changes as needed, then try the operation again
-- using the new token.
--
-- 'firewallArn', 'associateFirewallPolicyResponse_firewallArn' - The Amazon Resource Name (ARN) of the firewall.
--
-- 'firewallPolicyArn', 'associateFirewallPolicyResponse_firewallPolicyArn' - The Amazon Resource Name (ARN) of the firewall policy.
--
-- 'firewallName', 'associateFirewallPolicyResponse_firewallName' - The descriptive name of the firewall. You can\'t change the name of a
-- firewall after you create it.
--
-- 'httpStatus', 'associateFirewallPolicyResponse_httpStatus' - The response's http status code.
newAssociateFirewallPolicyResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  AssociateFirewallPolicyResponse
newAssociateFirewallPolicyResponse :: Int -> AssociateFirewallPolicyResponse
newAssociateFirewallPolicyResponse Int
pHttpStatus_ =
  AssociateFirewallPolicyResponse' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> AssociateFirewallPolicyResponse
AssociateFirewallPolicyResponse'
    { $sel:updateToken:AssociateFirewallPolicyResponse' :: Maybe Text
updateToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:firewallArn:AssociateFirewallPolicyResponse' :: Maybe Text
firewallArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:firewallPolicyArn:AssociateFirewallPolicyResponse' :: Maybe Text
firewallPolicyArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:firewallName:AssociateFirewallPolicyResponse' :: Maybe Text
firewallName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:AssociateFirewallPolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An optional token that you can use for optimistic locking. Network
-- Firewall returns a token to your requests that access the firewall. The
-- token marks the state of the firewall resource at the time of the
-- request.
--
-- To make an unconditional change to the firewall, omit the token in your
-- update request. Without the token, Network Firewall performs your
-- updates regardless of whether the firewall has changed since you last
-- retrieved it.
--
-- To make a conditional change to the firewall, provide the token in your
-- update request. Network Firewall uses the token to ensure that the
-- firewall hasn\'t changed since you last retrieved it. If it has changed,
-- the operation fails with an @InvalidTokenException@. If this happens,
-- retrieve the firewall again to get a current copy of it with a new
-- token. Reapply your changes as needed, then try the operation again
-- using the new token.
associateFirewallPolicyResponse_updateToken :: Lens.Lens' AssociateFirewallPolicyResponse (Prelude.Maybe Prelude.Text)
associateFirewallPolicyResponse_updateToken :: (Maybe Text -> f (Maybe Text))
-> AssociateFirewallPolicyResponse
-> f AssociateFirewallPolicyResponse
associateFirewallPolicyResponse_updateToken = (AssociateFirewallPolicyResponse -> Maybe Text)
-> (AssociateFirewallPolicyResponse
    -> Maybe Text -> AssociateFirewallPolicyResponse)
-> Lens
     AssociateFirewallPolicyResponse
     AssociateFirewallPolicyResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateFirewallPolicyResponse' {Maybe Text
updateToken :: Maybe Text
$sel:updateToken:AssociateFirewallPolicyResponse' :: AssociateFirewallPolicyResponse -> Maybe Text
updateToken} -> Maybe Text
updateToken) (\s :: AssociateFirewallPolicyResponse
s@AssociateFirewallPolicyResponse' {} Maybe Text
a -> AssociateFirewallPolicyResponse
s {$sel:updateToken:AssociateFirewallPolicyResponse' :: Maybe Text
updateToken = Maybe Text
a} :: AssociateFirewallPolicyResponse)

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

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

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

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

instance
  Prelude.NFData
    AssociateFirewallPolicyResponse