{-# 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.AssociateSubnets
-- 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 the specified subnets in the Amazon VPC to the firewall. You
-- can specify one subnet for each of the Availability Zones that the VPC
-- spans.
--
-- This request creates an AWS Network Firewall firewall endpoint in each
-- of the subnets. To enable the firewall\'s protections, you must also
-- modify the VPC\'s route tables for each subnet\'s Availability Zone, to
-- redirect the traffic that\'s coming into and going out of the zone
-- through the firewall endpoint.
module Amazonka.NetworkFirewall.AssociateSubnets
  ( -- * Creating a Request
    AssociateSubnets (..),
    newAssociateSubnets,

    -- * Request Lenses
    associateSubnets_updateToken,
    associateSubnets_firewallArn,
    associateSubnets_firewallName,
    associateSubnets_subnetMappings,

    -- * Destructuring the Response
    AssociateSubnetsResponse (..),
    newAssociateSubnetsResponse,

    -- * Response Lenses
    associateSubnetsResponse_subnetMappings,
    associateSubnetsResponse_updateToken,
    associateSubnetsResponse_firewallArn,
    associateSubnetsResponse_firewallName,
    associateSubnetsResponse_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:/ 'newAssociateSubnets' smart constructor.
data AssociateSubnets = AssociateSubnets'
  { -- | 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.
    AssociateSubnets -> 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.
    AssociateSubnets -> 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.
    AssociateSubnets -> Maybe Text
firewallName :: Prelude.Maybe Prelude.Text,
    -- | The IDs of the subnets that you want to associate with the firewall.
    AssociateSubnets -> [SubnetMapping]
subnetMappings :: [SubnetMapping]
  }
  deriving (AssociateSubnets -> AssociateSubnets -> Bool
(AssociateSubnets -> AssociateSubnets -> Bool)
-> (AssociateSubnets -> AssociateSubnets -> Bool)
-> Eq AssociateSubnets
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateSubnets -> AssociateSubnets -> Bool
$c/= :: AssociateSubnets -> AssociateSubnets -> Bool
== :: AssociateSubnets -> AssociateSubnets -> Bool
$c== :: AssociateSubnets -> AssociateSubnets -> Bool
Prelude.Eq, ReadPrec [AssociateSubnets]
ReadPrec AssociateSubnets
Int -> ReadS AssociateSubnets
ReadS [AssociateSubnets]
(Int -> ReadS AssociateSubnets)
-> ReadS [AssociateSubnets]
-> ReadPrec AssociateSubnets
-> ReadPrec [AssociateSubnets]
-> Read AssociateSubnets
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateSubnets]
$creadListPrec :: ReadPrec [AssociateSubnets]
readPrec :: ReadPrec AssociateSubnets
$creadPrec :: ReadPrec AssociateSubnets
readList :: ReadS [AssociateSubnets]
$creadList :: ReadS [AssociateSubnets]
readsPrec :: Int -> ReadS AssociateSubnets
$creadsPrec :: Int -> ReadS AssociateSubnets
Prelude.Read, Int -> AssociateSubnets -> ShowS
[AssociateSubnets] -> ShowS
AssociateSubnets -> String
(Int -> AssociateSubnets -> ShowS)
-> (AssociateSubnets -> String)
-> ([AssociateSubnets] -> ShowS)
-> Show AssociateSubnets
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateSubnets] -> ShowS
$cshowList :: [AssociateSubnets] -> ShowS
show :: AssociateSubnets -> String
$cshow :: AssociateSubnets -> String
showsPrec :: Int -> AssociateSubnets -> ShowS
$cshowsPrec :: Int -> AssociateSubnets -> ShowS
Prelude.Show, (forall x. AssociateSubnets -> Rep AssociateSubnets x)
-> (forall x. Rep AssociateSubnets x -> AssociateSubnets)
-> Generic AssociateSubnets
forall x. Rep AssociateSubnets x -> AssociateSubnets
forall x. AssociateSubnets -> Rep AssociateSubnets x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssociateSubnets x -> AssociateSubnets
$cfrom :: forall x. AssociateSubnets -> Rep AssociateSubnets x
Prelude.Generic)

-- |
-- Create a value of 'AssociateSubnets' 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', 'associateSubnets_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', 'associateSubnets_firewallArn' - The Amazon Resource Name (ARN) of the firewall.
--
-- You must specify the ARN or the name, and you can specify both.
--
-- 'firewallName', 'associateSubnets_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.
--
-- 'subnetMappings', 'associateSubnets_subnetMappings' - The IDs of the subnets that you want to associate with the firewall.
newAssociateSubnets ::
  AssociateSubnets
newAssociateSubnets :: AssociateSubnets
newAssociateSubnets =
  AssociateSubnets' :: Maybe Text
-> Maybe Text -> Maybe Text -> [SubnetMapping] -> AssociateSubnets
AssociateSubnets'
    { $sel:updateToken:AssociateSubnets' :: Maybe Text
updateToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:firewallArn:AssociateSubnets' :: Maybe Text
firewallArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:firewallName:AssociateSubnets' :: Maybe Text
firewallName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:subnetMappings:AssociateSubnets' :: [SubnetMapping]
subnetMappings = [SubnetMapping]
forall a. Monoid a => a
Prelude.mempty
    }

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

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

-- | 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.
associateSubnets_firewallName :: Lens.Lens' AssociateSubnets (Prelude.Maybe Prelude.Text)
associateSubnets_firewallName :: (Maybe Text -> f (Maybe Text))
-> AssociateSubnets -> f AssociateSubnets
associateSubnets_firewallName = (AssociateSubnets -> Maybe Text)
-> (AssociateSubnets -> Maybe Text -> AssociateSubnets)
-> Lens AssociateSubnets AssociateSubnets (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateSubnets' {Maybe Text
firewallName :: Maybe Text
$sel:firewallName:AssociateSubnets' :: AssociateSubnets -> Maybe Text
firewallName} -> Maybe Text
firewallName) (\s :: AssociateSubnets
s@AssociateSubnets' {} Maybe Text
a -> AssociateSubnets
s {$sel:firewallName:AssociateSubnets' :: Maybe Text
firewallName = Maybe Text
a} :: AssociateSubnets)

-- | The IDs of the subnets that you want to associate with the firewall.
associateSubnets_subnetMappings :: Lens.Lens' AssociateSubnets [SubnetMapping]
associateSubnets_subnetMappings :: ([SubnetMapping] -> f [SubnetMapping])
-> AssociateSubnets -> f AssociateSubnets
associateSubnets_subnetMappings = (AssociateSubnets -> [SubnetMapping])
-> (AssociateSubnets -> [SubnetMapping] -> AssociateSubnets)
-> Lens
     AssociateSubnets AssociateSubnets [SubnetMapping] [SubnetMapping]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateSubnets' {[SubnetMapping]
subnetMappings :: [SubnetMapping]
$sel:subnetMappings:AssociateSubnets' :: AssociateSubnets -> [SubnetMapping]
subnetMappings} -> [SubnetMapping]
subnetMappings) (\s :: AssociateSubnets
s@AssociateSubnets' {} [SubnetMapping]
a -> AssociateSubnets
s {$sel:subnetMappings:AssociateSubnets' :: [SubnetMapping]
subnetMappings = [SubnetMapping]
a} :: AssociateSubnets) (([SubnetMapping] -> f [SubnetMapping])
 -> AssociateSubnets -> f AssociateSubnets)
-> (([SubnetMapping] -> f [SubnetMapping])
    -> [SubnetMapping] -> f [SubnetMapping])
-> ([SubnetMapping] -> f [SubnetMapping])
-> AssociateSubnets
-> f AssociateSubnets
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 AssociateSubnets where
  type
    AWSResponse AssociateSubnets =
      AssociateSubnetsResponse
  request :: AssociateSubnets -> Request AssociateSubnets
request = Service -> AssociateSubnets -> Request AssociateSubnets
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy AssociateSubnets
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AssociateSubnets)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse AssociateSubnets))
-> Logger
-> Service
-> Proxy AssociateSubnets
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AssociateSubnets)))
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 [SubnetMapping]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> AssociateSubnetsResponse
AssociateSubnetsResponse'
            (Maybe [SubnetMapping]
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Int
 -> AssociateSubnetsResponse)
-> Either String (Maybe [SubnetMapping])
-> Either
     String
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Int -> AssociateSubnetsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [SubnetMapping]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SubnetMappings" Either String (Maybe (Maybe [SubnetMapping]))
-> Maybe [SubnetMapping] -> Either String (Maybe [SubnetMapping])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [SubnetMapping]
forall a. Monoid a => a
Prelude.mempty)
            Either
  String
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Int -> AssociateSubnetsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text -> Maybe Text -> Int -> AssociateSubnetsResponse)
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
"UpdateToken")
            Either
  String
  (Maybe Text -> Maybe Text -> Int -> AssociateSubnetsResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> AssociateSubnetsResponse)
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 -> Int -> AssociateSubnetsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> AssociateSubnetsResponse)
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 -> AssociateSubnetsResponse)
-> Either String Int -> Either String AssociateSubnetsResponse
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 AssociateSubnets

instance Prelude.NFData AssociateSubnets

instance Core.ToHeaders AssociateSubnets where
  toHeaders :: AssociateSubnets -> ResponseHeaders
toHeaders =
    ResponseHeaders -> AssociateSubnets -> 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.AssociateSubnets" ::
                          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 AssociateSubnets where
  toJSON :: AssociateSubnets -> Value
toJSON AssociateSubnets' {[SubnetMapping]
Maybe Text
subnetMappings :: [SubnetMapping]
firewallName :: Maybe Text
firewallArn :: Maybe Text
updateToken :: Maybe Text
$sel:subnetMappings:AssociateSubnets' :: AssociateSubnets -> [SubnetMapping]
$sel:firewallName:AssociateSubnets' :: AssociateSubnets -> Maybe Text
$sel:firewallArn:AssociateSubnets' :: AssociateSubnets -> Maybe Text
$sel:updateToken:AssociateSubnets' :: AssociateSubnets -> 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
"SubnetMappings" Text -> [SubnetMapping] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [SubnetMapping]
subnetMappings)
          ]
      )

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

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

-- | /See:/ 'newAssociateSubnetsResponse' smart constructor.
data AssociateSubnetsResponse = AssociateSubnetsResponse'
  { -- | The IDs of the subnets that are associated with the firewall.
    AssociateSubnetsResponse -> Maybe [SubnetMapping]
subnetMappings :: Prelude.Maybe [SubnetMapping],
    -- | 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.
    AssociateSubnetsResponse -> Maybe Text
updateToken :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the firewall.
    AssociateSubnetsResponse -> 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.
    AssociateSubnetsResponse -> Maybe Text
firewallName :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    AssociateSubnetsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (AssociateSubnetsResponse -> AssociateSubnetsResponse -> Bool
(AssociateSubnetsResponse -> AssociateSubnetsResponse -> Bool)
-> (AssociateSubnetsResponse -> AssociateSubnetsResponse -> Bool)
-> Eq AssociateSubnetsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateSubnetsResponse -> AssociateSubnetsResponse -> Bool
$c/= :: AssociateSubnetsResponse -> AssociateSubnetsResponse -> Bool
== :: AssociateSubnetsResponse -> AssociateSubnetsResponse -> Bool
$c== :: AssociateSubnetsResponse -> AssociateSubnetsResponse -> Bool
Prelude.Eq, ReadPrec [AssociateSubnetsResponse]
ReadPrec AssociateSubnetsResponse
Int -> ReadS AssociateSubnetsResponse
ReadS [AssociateSubnetsResponse]
(Int -> ReadS AssociateSubnetsResponse)
-> ReadS [AssociateSubnetsResponse]
-> ReadPrec AssociateSubnetsResponse
-> ReadPrec [AssociateSubnetsResponse]
-> Read AssociateSubnetsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateSubnetsResponse]
$creadListPrec :: ReadPrec [AssociateSubnetsResponse]
readPrec :: ReadPrec AssociateSubnetsResponse
$creadPrec :: ReadPrec AssociateSubnetsResponse
readList :: ReadS [AssociateSubnetsResponse]
$creadList :: ReadS [AssociateSubnetsResponse]
readsPrec :: Int -> ReadS AssociateSubnetsResponse
$creadsPrec :: Int -> ReadS AssociateSubnetsResponse
Prelude.Read, Int -> AssociateSubnetsResponse -> ShowS
[AssociateSubnetsResponse] -> ShowS
AssociateSubnetsResponse -> String
(Int -> AssociateSubnetsResponse -> ShowS)
-> (AssociateSubnetsResponse -> String)
-> ([AssociateSubnetsResponse] -> ShowS)
-> Show AssociateSubnetsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateSubnetsResponse] -> ShowS
$cshowList :: [AssociateSubnetsResponse] -> ShowS
show :: AssociateSubnetsResponse -> String
$cshow :: AssociateSubnetsResponse -> String
showsPrec :: Int -> AssociateSubnetsResponse -> ShowS
$cshowsPrec :: Int -> AssociateSubnetsResponse -> ShowS
Prelude.Show, (forall x.
 AssociateSubnetsResponse -> Rep AssociateSubnetsResponse x)
-> (forall x.
    Rep AssociateSubnetsResponse x -> AssociateSubnetsResponse)
-> Generic AssociateSubnetsResponse
forall x.
Rep AssociateSubnetsResponse x -> AssociateSubnetsResponse
forall x.
AssociateSubnetsResponse -> Rep AssociateSubnetsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateSubnetsResponse x -> AssociateSubnetsResponse
$cfrom :: forall x.
AssociateSubnetsResponse -> Rep AssociateSubnetsResponse x
Prelude.Generic)

-- |
-- Create a value of 'AssociateSubnetsResponse' 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:
--
-- 'subnetMappings', 'associateSubnetsResponse_subnetMappings' - The IDs of the subnets that are associated with the firewall.
--
-- 'updateToken', 'associateSubnetsResponse_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', 'associateSubnetsResponse_firewallArn' - The Amazon Resource Name (ARN) of the firewall.
--
-- 'firewallName', 'associateSubnetsResponse_firewallName' - The descriptive name of the firewall. You can\'t change the name of a
-- firewall after you create it.
--
-- 'httpStatus', 'associateSubnetsResponse_httpStatus' - The response's http status code.
newAssociateSubnetsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  AssociateSubnetsResponse
newAssociateSubnetsResponse :: Int -> AssociateSubnetsResponse
newAssociateSubnetsResponse Int
pHttpStatus_ =
  AssociateSubnetsResponse' :: Maybe [SubnetMapping]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> AssociateSubnetsResponse
AssociateSubnetsResponse'
    { $sel:subnetMappings:AssociateSubnetsResponse' :: Maybe [SubnetMapping]
subnetMappings =
        Maybe [SubnetMapping]
forall a. Maybe a
Prelude.Nothing,
      $sel:updateToken:AssociateSubnetsResponse' :: Maybe Text
updateToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:firewallArn:AssociateSubnetsResponse' :: Maybe Text
firewallArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:firewallName:AssociateSubnetsResponse' :: Maybe Text
firewallName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:AssociateSubnetsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The IDs of the subnets that are associated with the firewall.
associateSubnetsResponse_subnetMappings :: Lens.Lens' AssociateSubnetsResponse (Prelude.Maybe [SubnetMapping])
associateSubnetsResponse_subnetMappings :: (Maybe [SubnetMapping] -> f (Maybe [SubnetMapping]))
-> AssociateSubnetsResponse -> f AssociateSubnetsResponse
associateSubnetsResponse_subnetMappings = (AssociateSubnetsResponse -> Maybe [SubnetMapping])
-> (AssociateSubnetsResponse
    -> Maybe [SubnetMapping] -> AssociateSubnetsResponse)
-> Lens
     AssociateSubnetsResponse
     AssociateSubnetsResponse
     (Maybe [SubnetMapping])
     (Maybe [SubnetMapping])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateSubnetsResponse' {Maybe [SubnetMapping]
subnetMappings :: Maybe [SubnetMapping]
$sel:subnetMappings:AssociateSubnetsResponse' :: AssociateSubnetsResponse -> Maybe [SubnetMapping]
subnetMappings} -> Maybe [SubnetMapping]
subnetMappings) (\s :: AssociateSubnetsResponse
s@AssociateSubnetsResponse' {} Maybe [SubnetMapping]
a -> AssociateSubnetsResponse
s {$sel:subnetMappings:AssociateSubnetsResponse' :: Maybe [SubnetMapping]
subnetMappings = Maybe [SubnetMapping]
a} :: AssociateSubnetsResponse) ((Maybe [SubnetMapping] -> f (Maybe [SubnetMapping]))
 -> AssociateSubnetsResponse -> f AssociateSubnetsResponse)
-> ((Maybe [SubnetMapping] -> f (Maybe [SubnetMapping]))
    -> Maybe [SubnetMapping] -> f (Maybe [SubnetMapping]))
-> (Maybe [SubnetMapping] -> f (Maybe [SubnetMapping]))
-> AssociateSubnetsResponse
-> f AssociateSubnetsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [SubnetMapping] [SubnetMapping] [SubnetMapping] [SubnetMapping]
-> Iso
     (Maybe [SubnetMapping])
     (Maybe [SubnetMapping])
     (Maybe [SubnetMapping])
     (Maybe [SubnetMapping])
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
  [SubnetMapping] [SubnetMapping] [SubnetMapping] [SubnetMapping]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

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

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

instance Prelude.NFData AssociateSubnetsResponse