{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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_firewallArn,
    associateFirewallPolicy_firewallName,
    associateFirewallPolicy_updateToken,
    associateFirewallPolicy_firewallPolicyArn,

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

    -- * Response Lenses
    associateFirewallPolicyResponse_firewallArn,
    associateFirewallPolicyResponse_firewallName,
    associateFirewallPolicyResponse_firewallPolicyArn,
    associateFirewallPolicyResponse_updateToken,
    associateFirewallPolicyResponse_httpStatus,
  )
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:/ 'newAssociateFirewallPolicy' smart constructor.
data AssociateFirewallPolicy = AssociateFirewallPolicy'
  { -- | 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,
    -- | 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 policy.
    AssociateFirewallPolicy -> Text
firewallPolicyArn :: Prelude.Text
  }
  deriving (AssociateFirewallPolicy -> AssociateFirewallPolicy -> Bool
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]
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
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. 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:
--
-- '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.
--
-- '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.
--
-- 'firewallPolicyArn', 'associateFirewallPolicy_firewallPolicyArn' - The Amazon Resource Name (ARN) of the firewall policy.
newAssociateFirewallPolicy ::
  -- | 'firewallPolicyArn'
  Prelude.Text ->
  AssociateFirewallPolicy
newAssociateFirewallPolicy :: Text -> AssociateFirewallPolicy
newAssociateFirewallPolicy Text
pFirewallPolicyArn_ =
  AssociateFirewallPolicy'
    { $sel:firewallArn:AssociateFirewallPolicy' :: Maybe Text
firewallArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:firewallName:AssociateFirewallPolicy' :: Maybe Text
firewallName = forall a. Maybe a
Prelude.Nothing,
      $sel:updateToken:AssociateFirewallPolicy' :: Maybe Text
updateToken = forall a. Maybe a
Prelude.Nothing,
      $sel:firewallPolicyArn:AssociateFirewallPolicy' :: Text
firewallPolicyArn = Text
pFirewallPolicyArn_
    }

-- | 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 :: Lens' AssociateFirewallPolicy (Maybe Text)
associateFirewallPolicy_firewallArn = 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 :: Lens' AssociateFirewallPolicy (Maybe Text)
associateFirewallPolicy_firewallName = 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)

-- | 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 :: Lens' AssociateFirewallPolicy (Maybe Text)
associateFirewallPolicy_updateToken = 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 policy.
associateFirewallPolicy_firewallPolicyArn :: Lens.Lens' AssociateFirewallPolicy Prelude.Text
associateFirewallPolicy_firewallPolicyArn :: Lens' AssociateFirewallPolicy Text
associateFirewallPolicy_firewallPolicyArn = 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 :: (Service -> Service)
-> AssociateFirewallPolicy -> Request AssociateFirewallPolicy
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 AssociateFirewallPolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse AssociateFirewallPolicy)))
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 ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> AssociateFirewallPolicyResponse
AssociateFirewallPolicyResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"FirewallArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"FirewallName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"FirewallPolicyArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"UpdateToken")
            forall (f :: * -> *) a b. Applicative f => 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))
      )

instance Prelude.Hashable AssociateFirewallPolicy where
  hashWithSalt :: Int -> AssociateFirewallPolicy -> Int
hashWithSalt Int
_salt AssociateFirewallPolicy' {Maybe Text
Text
firewallPolicyArn :: Text
updateToken :: Maybe Text
firewallName :: Maybe Text
firewallArn :: Maybe Text
$sel:firewallPolicyArn:AssociateFirewallPolicy' :: AssociateFirewallPolicy -> Text
$sel:updateToken:AssociateFirewallPolicy' :: AssociateFirewallPolicy -> Maybe Text
$sel:firewallName:AssociateFirewallPolicy' :: AssociateFirewallPolicy -> Maybe Text
$sel:firewallArn:AssociateFirewallPolicy' :: AssociateFirewallPolicy -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
firewallArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
firewallName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
updateToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
firewallPolicyArn

instance Prelude.NFData AssociateFirewallPolicy where
  rnf :: AssociateFirewallPolicy -> ()
rnf AssociateFirewallPolicy' {Maybe Text
Text
firewallPolicyArn :: Text
updateToken :: Maybe Text
firewallName :: Maybe Text
firewallArn :: Maybe Text
$sel:firewallPolicyArn:AssociateFirewallPolicy' :: AssociateFirewallPolicy -> Text
$sel:updateToken:AssociateFirewallPolicy' :: AssociateFirewallPolicy -> Maybe Text
$sel:firewallName:AssociateFirewallPolicy' :: AssociateFirewallPolicy -> Maybe Text
$sel:firewallArn:AssociateFirewallPolicy' :: AssociateFirewallPolicy -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
firewallArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
firewallName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
updateToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
firewallPolicyArn

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

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

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

-- | /See:/ 'newAssociateFirewallPolicyResponse' smart constructor.
data AssociateFirewallPolicyResponse = AssociateFirewallPolicyResponse'
  { -- | The Amazon Resource Name (ARN) of the firewall.
    AssociateFirewallPolicyResponse -> 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.
    AssociateFirewallPolicyResponse -> Maybe Text
firewallName :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the firewall policy.
    AssociateFirewallPolicyResponse -> Maybe Text
firewallPolicyArn :: Prelude.Maybe Prelude.Text,
    -- | 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 response's http status code.
    AssociateFirewallPolicyResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (AssociateFirewallPolicyResponse
-> AssociateFirewallPolicyResponse -> Bool
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]
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
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.
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:
--
-- 'firewallArn', 'associateFirewallPolicyResponse_firewallArn' - The Amazon Resource Name (ARN) of the firewall.
--
-- 'firewallName', 'associateFirewallPolicyResponse_firewallName' - The descriptive name of the firewall. You can\'t change the name of a
-- firewall after you create it.
--
-- 'firewallPolicyArn', 'associateFirewallPolicyResponse_firewallPolicyArn' - The Amazon Resource Name (ARN) of the firewall policy.
--
-- '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.
--
-- 'httpStatus', 'associateFirewallPolicyResponse_httpStatus' - The response's http status code.
newAssociateFirewallPolicyResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  AssociateFirewallPolicyResponse
newAssociateFirewallPolicyResponse :: Int -> AssociateFirewallPolicyResponse
newAssociateFirewallPolicyResponse Int
pHttpStatus_ =
  AssociateFirewallPolicyResponse'
    { $sel:firewallArn:AssociateFirewallPolicyResponse' :: Maybe Text
firewallArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:firewallName:AssociateFirewallPolicyResponse' :: Maybe Text
firewallName = forall a. Maybe a
Prelude.Nothing,
      $sel:firewallPolicyArn:AssociateFirewallPolicyResponse' :: Maybe Text
firewallPolicyArn = forall a. Maybe a
Prelude.Nothing,
      $sel:updateToken:AssociateFirewallPolicyResponse' :: Maybe Text
updateToken = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:AssociateFirewallPolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Resource Name (ARN) of the firewall.
associateFirewallPolicyResponse_firewallArn :: Lens.Lens' AssociateFirewallPolicyResponse (Prelude.Maybe Prelude.Text)
associateFirewallPolicyResponse_firewallArn :: Lens' AssociateFirewallPolicyResponse (Maybe Text)
associateFirewallPolicyResponse_firewallArn = 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 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 :: Lens' AssociateFirewallPolicyResponse (Maybe Text)
associateFirewallPolicyResponse_firewallName = 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 Amazon Resource Name (ARN) of the firewall policy.
associateFirewallPolicyResponse_firewallPolicyArn :: Lens.Lens' AssociateFirewallPolicyResponse (Prelude.Maybe Prelude.Text)
associateFirewallPolicyResponse_firewallPolicyArn :: Lens' AssociateFirewallPolicyResponse (Maybe Text)
associateFirewallPolicyResponse_firewallPolicyArn = 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)

-- | 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 :: Lens' AssociateFirewallPolicyResponse (Maybe Text)
associateFirewallPolicyResponse_updateToken = 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 response's http status code.
associateFirewallPolicyResponse_httpStatus :: Lens.Lens' AssociateFirewallPolicyResponse Prelude.Int
associateFirewallPolicyResponse_httpStatus :: Lens' AssociateFirewallPolicyResponse Int
associateFirewallPolicyResponse_httpStatus = 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
  where
  rnf :: AssociateFirewallPolicyResponse -> ()
rnf AssociateFirewallPolicyResponse' {Int
Maybe Text
httpStatus :: Int
updateToken :: Maybe Text
firewallPolicyArn :: Maybe Text
firewallName :: Maybe Text
firewallArn :: Maybe Text
$sel:httpStatus:AssociateFirewallPolicyResponse' :: AssociateFirewallPolicyResponse -> Int
$sel:updateToken:AssociateFirewallPolicyResponse' :: AssociateFirewallPolicyResponse -> Maybe Text
$sel:firewallPolicyArn:AssociateFirewallPolicyResponse' :: AssociateFirewallPolicyResponse -> Maybe Text
$sel:firewallName:AssociateFirewallPolicyResponse' :: AssociateFirewallPolicyResponse -> Maybe Text
$sel:firewallArn:AssociateFirewallPolicyResponse' :: AssociateFirewallPolicyResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
firewallArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
firewallName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
firewallPolicyArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
updateToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus