{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.NetworkManager.Types.TransitGatewayRegistration
-- 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)
module Amazonka.NetworkManager.Types.TransitGatewayRegistration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.NetworkManager.Types.TransitGatewayRegistrationStateReason
import qualified Amazonka.Prelude as Prelude

-- | Describes the registration of a transit gateway to a global network.
--
-- /See:/ 'newTransitGatewayRegistration' smart constructor.
data TransitGatewayRegistration = TransitGatewayRegistration'
  { -- | The state of the transit gateway registration.
    TransitGatewayRegistration
-> Maybe TransitGatewayRegistrationStateReason
state :: Prelude.Maybe TransitGatewayRegistrationStateReason,
    -- | The ID of the global network.
    TransitGatewayRegistration -> Maybe Text
globalNetworkId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the transit gateway.
    TransitGatewayRegistration -> Maybe Text
transitGatewayArn :: Prelude.Maybe Prelude.Text
  }
  deriving (TransitGatewayRegistration -> TransitGatewayRegistration -> Bool
(TransitGatewayRegistration -> TransitGatewayRegistration -> Bool)
-> (TransitGatewayRegistration
    -> TransitGatewayRegistration -> Bool)
-> Eq TransitGatewayRegistration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TransitGatewayRegistration -> TransitGatewayRegistration -> Bool
$c/= :: TransitGatewayRegistration -> TransitGatewayRegistration -> Bool
== :: TransitGatewayRegistration -> TransitGatewayRegistration -> Bool
$c== :: TransitGatewayRegistration -> TransitGatewayRegistration -> Bool
Prelude.Eq, ReadPrec [TransitGatewayRegistration]
ReadPrec TransitGatewayRegistration
Int -> ReadS TransitGatewayRegistration
ReadS [TransitGatewayRegistration]
(Int -> ReadS TransitGatewayRegistration)
-> ReadS [TransitGatewayRegistration]
-> ReadPrec TransitGatewayRegistration
-> ReadPrec [TransitGatewayRegistration]
-> Read TransitGatewayRegistration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TransitGatewayRegistration]
$creadListPrec :: ReadPrec [TransitGatewayRegistration]
readPrec :: ReadPrec TransitGatewayRegistration
$creadPrec :: ReadPrec TransitGatewayRegistration
readList :: ReadS [TransitGatewayRegistration]
$creadList :: ReadS [TransitGatewayRegistration]
readsPrec :: Int -> ReadS TransitGatewayRegistration
$creadsPrec :: Int -> ReadS TransitGatewayRegistration
Prelude.Read, Int -> TransitGatewayRegistration -> ShowS
[TransitGatewayRegistration] -> ShowS
TransitGatewayRegistration -> String
(Int -> TransitGatewayRegistration -> ShowS)
-> (TransitGatewayRegistration -> String)
-> ([TransitGatewayRegistration] -> ShowS)
-> Show TransitGatewayRegistration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TransitGatewayRegistration] -> ShowS
$cshowList :: [TransitGatewayRegistration] -> ShowS
show :: TransitGatewayRegistration -> String
$cshow :: TransitGatewayRegistration -> String
showsPrec :: Int -> TransitGatewayRegistration -> ShowS
$cshowsPrec :: Int -> TransitGatewayRegistration -> ShowS
Prelude.Show, (forall x.
 TransitGatewayRegistration -> Rep TransitGatewayRegistration x)
-> (forall x.
    Rep TransitGatewayRegistration x -> TransitGatewayRegistration)
-> Generic TransitGatewayRegistration
forall x.
Rep TransitGatewayRegistration x -> TransitGatewayRegistration
forall x.
TransitGatewayRegistration -> Rep TransitGatewayRegistration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TransitGatewayRegistration x -> TransitGatewayRegistration
$cfrom :: forall x.
TransitGatewayRegistration -> Rep TransitGatewayRegistration x
Prelude.Generic)

-- |
-- Create a value of 'TransitGatewayRegistration' 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:
--
-- 'state', 'transitGatewayRegistration_state' - The state of the transit gateway registration.
--
-- 'globalNetworkId', 'transitGatewayRegistration_globalNetworkId' - The ID of the global network.
--
-- 'transitGatewayArn', 'transitGatewayRegistration_transitGatewayArn' - The Amazon Resource Name (ARN) of the transit gateway.
newTransitGatewayRegistration ::
  TransitGatewayRegistration
newTransitGatewayRegistration :: TransitGatewayRegistration
newTransitGatewayRegistration =
  TransitGatewayRegistration' :: Maybe TransitGatewayRegistrationStateReason
-> Maybe Text -> Maybe Text -> TransitGatewayRegistration
TransitGatewayRegistration'
    { $sel:state:TransitGatewayRegistration' :: Maybe TransitGatewayRegistrationStateReason
state =
        Maybe TransitGatewayRegistrationStateReason
forall a. Maybe a
Prelude.Nothing,
      $sel:globalNetworkId:TransitGatewayRegistration' :: Maybe Text
globalNetworkId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:transitGatewayArn:TransitGatewayRegistration' :: Maybe Text
transitGatewayArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The state of the transit gateway registration.
transitGatewayRegistration_state :: Lens.Lens' TransitGatewayRegistration (Prelude.Maybe TransitGatewayRegistrationStateReason)
transitGatewayRegistration_state :: (Maybe TransitGatewayRegistrationStateReason
 -> f (Maybe TransitGatewayRegistrationStateReason))
-> TransitGatewayRegistration -> f TransitGatewayRegistration
transitGatewayRegistration_state = (TransitGatewayRegistration
 -> Maybe TransitGatewayRegistrationStateReason)
-> (TransitGatewayRegistration
    -> Maybe TransitGatewayRegistrationStateReason
    -> TransitGatewayRegistration)
-> Lens
     TransitGatewayRegistration
     TransitGatewayRegistration
     (Maybe TransitGatewayRegistrationStateReason)
     (Maybe TransitGatewayRegistrationStateReason)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransitGatewayRegistration' {Maybe TransitGatewayRegistrationStateReason
state :: Maybe TransitGatewayRegistrationStateReason
$sel:state:TransitGatewayRegistration' :: TransitGatewayRegistration
-> Maybe TransitGatewayRegistrationStateReason
state} -> Maybe TransitGatewayRegistrationStateReason
state) (\s :: TransitGatewayRegistration
s@TransitGatewayRegistration' {} Maybe TransitGatewayRegistrationStateReason
a -> TransitGatewayRegistration
s {$sel:state:TransitGatewayRegistration' :: Maybe TransitGatewayRegistrationStateReason
state = Maybe TransitGatewayRegistrationStateReason
a} :: TransitGatewayRegistration)

-- | The ID of the global network.
transitGatewayRegistration_globalNetworkId :: Lens.Lens' TransitGatewayRegistration (Prelude.Maybe Prelude.Text)
transitGatewayRegistration_globalNetworkId :: (Maybe Text -> f (Maybe Text))
-> TransitGatewayRegistration -> f TransitGatewayRegistration
transitGatewayRegistration_globalNetworkId = (TransitGatewayRegistration -> Maybe Text)
-> (TransitGatewayRegistration
    -> Maybe Text -> TransitGatewayRegistration)
-> Lens
     TransitGatewayRegistration
     TransitGatewayRegistration
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransitGatewayRegistration' {Maybe Text
globalNetworkId :: Maybe Text
$sel:globalNetworkId:TransitGatewayRegistration' :: TransitGatewayRegistration -> Maybe Text
globalNetworkId} -> Maybe Text
globalNetworkId) (\s :: TransitGatewayRegistration
s@TransitGatewayRegistration' {} Maybe Text
a -> TransitGatewayRegistration
s {$sel:globalNetworkId:TransitGatewayRegistration' :: Maybe Text
globalNetworkId = Maybe Text
a} :: TransitGatewayRegistration)

-- | The Amazon Resource Name (ARN) of the transit gateway.
transitGatewayRegistration_transitGatewayArn :: Lens.Lens' TransitGatewayRegistration (Prelude.Maybe Prelude.Text)
transitGatewayRegistration_transitGatewayArn :: (Maybe Text -> f (Maybe Text))
-> TransitGatewayRegistration -> f TransitGatewayRegistration
transitGatewayRegistration_transitGatewayArn = (TransitGatewayRegistration -> Maybe Text)
-> (TransitGatewayRegistration
    -> Maybe Text -> TransitGatewayRegistration)
-> Lens
     TransitGatewayRegistration
     TransitGatewayRegistration
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransitGatewayRegistration' {Maybe Text
transitGatewayArn :: Maybe Text
$sel:transitGatewayArn:TransitGatewayRegistration' :: TransitGatewayRegistration -> Maybe Text
transitGatewayArn} -> Maybe Text
transitGatewayArn) (\s :: TransitGatewayRegistration
s@TransitGatewayRegistration' {} Maybe Text
a -> TransitGatewayRegistration
s {$sel:transitGatewayArn:TransitGatewayRegistration' :: Maybe Text
transitGatewayArn = Maybe Text
a} :: TransitGatewayRegistration)

instance Core.FromJSON TransitGatewayRegistration where
  parseJSON :: Value -> Parser TransitGatewayRegistration
parseJSON =
    String
-> (Object -> Parser TransitGatewayRegistration)
-> Value
-> Parser TransitGatewayRegistration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TransitGatewayRegistration"
      ( \Object
x ->
          Maybe TransitGatewayRegistrationStateReason
-> Maybe Text -> Maybe Text -> TransitGatewayRegistration
TransitGatewayRegistration'
            (Maybe TransitGatewayRegistrationStateReason
 -> Maybe Text -> Maybe Text -> TransitGatewayRegistration)
-> Parser (Maybe TransitGatewayRegistrationStateReason)
-> Parser (Maybe Text -> Maybe Text -> TransitGatewayRegistration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Parser (Maybe TransitGatewayRegistrationStateReason)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"State")
            Parser (Maybe Text -> Maybe Text -> TransitGatewayRegistration)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> TransitGatewayRegistration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"GlobalNetworkId")
            Parser (Maybe Text -> TransitGatewayRegistration)
-> Parser (Maybe Text) -> Parser TransitGatewayRegistration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TransitGatewayArn")
      )

instance Prelude.Hashable TransitGatewayRegistration

instance Prelude.NFData TransitGatewayRegistration