{-# 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.EC2.Types.TransitGatewayAttachmentPropagation
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.EC2.Types.TransitGatewayAttachmentPropagation where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Internal
import Amazonka.EC2.Types.TransitGatewayPropagationState
import qualified Amazonka.Prelude as Prelude

-- | Describes a propagation route table.
--
-- /See:/ 'newTransitGatewayAttachmentPropagation' smart constructor.
data TransitGatewayAttachmentPropagation = TransitGatewayAttachmentPropagation'
  { -- | The state of the propagation route table.
    TransitGatewayAttachmentPropagation
-> Maybe TransitGatewayPropagationState
state :: Prelude.Maybe TransitGatewayPropagationState,
    -- | The ID of the propagation route table.
    TransitGatewayAttachmentPropagation -> Maybe Text
transitGatewayRouteTableId :: Prelude.Maybe Prelude.Text
  }
  deriving (TransitGatewayAttachmentPropagation
-> TransitGatewayAttachmentPropagation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TransitGatewayAttachmentPropagation
-> TransitGatewayAttachmentPropagation -> Bool
$c/= :: TransitGatewayAttachmentPropagation
-> TransitGatewayAttachmentPropagation -> Bool
== :: TransitGatewayAttachmentPropagation
-> TransitGatewayAttachmentPropagation -> Bool
$c== :: TransitGatewayAttachmentPropagation
-> TransitGatewayAttachmentPropagation -> Bool
Prelude.Eq, ReadPrec [TransitGatewayAttachmentPropagation]
ReadPrec TransitGatewayAttachmentPropagation
Int -> ReadS TransitGatewayAttachmentPropagation
ReadS [TransitGatewayAttachmentPropagation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TransitGatewayAttachmentPropagation]
$creadListPrec :: ReadPrec [TransitGatewayAttachmentPropagation]
readPrec :: ReadPrec TransitGatewayAttachmentPropagation
$creadPrec :: ReadPrec TransitGatewayAttachmentPropagation
readList :: ReadS [TransitGatewayAttachmentPropagation]
$creadList :: ReadS [TransitGatewayAttachmentPropagation]
readsPrec :: Int -> ReadS TransitGatewayAttachmentPropagation
$creadsPrec :: Int -> ReadS TransitGatewayAttachmentPropagation
Prelude.Read, Int -> TransitGatewayAttachmentPropagation -> ShowS
[TransitGatewayAttachmentPropagation] -> ShowS
TransitGatewayAttachmentPropagation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TransitGatewayAttachmentPropagation] -> ShowS
$cshowList :: [TransitGatewayAttachmentPropagation] -> ShowS
show :: TransitGatewayAttachmentPropagation -> String
$cshow :: TransitGatewayAttachmentPropagation -> String
showsPrec :: Int -> TransitGatewayAttachmentPropagation -> ShowS
$cshowsPrec :: Int -> TransitGatewayAttachmentPropagation -> ShowS
Prelude.Show, forall x.
Rep TransitGatewayAttachmentPropagation x
-> TransitGatewayAttachmentPropagation
forall x.
TransitGatewayAttachmentPropagation
-> Rep TransitGatewayAttachmentPropagation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TransitGatewayAttachmentPropagation x
-> TransitGatewayAttachmentPropagation
$cfrom :: forall x.
TransitGatewayAttachmentPropagation
-> Rep TransitGatewayAttachmentPropagation x
Prelude.Generic)

-- |
-- Create a value of 'TransitGatewayAttachmentPropagation' 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', 'transitGatewayAttachmentPropagation_state' - The state of the propagation route table.
--
-- 'transitGatewayRouteTableId', 'transitGatewayAttachmentPropagation_transitGatewayRouteTableId' - The ID of the propagation route table.
newTransitGatewayAttachmentPropagation ::
  TransitGatewayAttachmentPropagation
newTransitGatewayAttachmentPropagation :: TransitGatewayAttachmentPropagation
newTransitGatewayAttachmentPropagation =
  TransitGatewayAttachmentPropagation'
    { $sel:state:TransitGatewayAttachmentPropagation' :: Maybe TransitGatewayPropagationState
state =
        forall a. Maybe a
Prelude.Nothing,
      $sel:transitGatewayRouteTableId:TransitGatewayAttachmentPropagation' :: Maybe Text
transitGatewayRouteTableId =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The state of the propagation route table.
transitGatewayAttachmentPropagation_state :: Lens.Lens' TransitGatewayAttachmentPropagation (Prelude.Maybe TransitGatewayPropagationState)
transitGatewayAttachmentPropagation_state :: Lens'
  TransitGatewayAttachmentPropagation
  (Maybe TransitGatewayPropagationState)
transitGatewayAttachmentPropagation_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransitGatewayAttachmentPropagation' {Maybe TransitGatewayPropagationState
state :: Maybe TransitGatewayPropagationState
$sel:state:TransitGatewayAttachmentPropagation' :: TransitGatewayAttachmentPropagation
-> Maybe TransitGatewayPropagationState
state} -> Maybe TransitGatewayPropagationState
state) (\s :: TransitGatewayAttachmentPropagation
s@TransitGatewayAttachmentPropagation' {} Maybe TransitGatewayPropagationState
a -> TransitGatewayAttachmentPropagation
s {$sel:state:TransitGatewayAttachmentPropagation' :: Maybe TransitGatewayPropagationState
state = Maybe TransitGatewayPropagationState
a} :: TransitGatewayAttachmentPropagation)

-- | The ID of the propagation route table.
transitGatewayAttachmentPropagation_transitGatewayRouteTableId :: Lens.Lens' TransitGatewayAttachmentPropagation (Prelude.Maybe Prelude.Text)
transitGatewayAttachmentPropagation_transitGatewayRouteTableId :: Lens' TransitGatewayAttachmentPropagation (Maybe Text)
transitGatewayAttachmentPropagation_transitGatewayRouteTableId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransitGatewayAttachmentPropagation' {Maybe Text
transitGatewayRouteTableId :: Maybe Text
$sel:transitGatewayRouteTableId:TransitGatewayAttachmentPropagation' :: TransitGatewayAttachmentPropagation -> Maybe Text
transitGatewayRouteTableId} -> Maybe Text
transitGatewayRouteTableId) (\s :: TransitGatewayAttachmentPropagation
s@TransitGatewayAttachmentPropagation' {} Maybe Text
a -> TransitGatewayAttachmentPropagation
s {$sel:transitGatewayRouteTableId:TransitGatewayAttachmentPropagation' :: Maybe Text
transitGatewayRouteTableId = Maybe Text
a} :: TransitGatewayAttachmentPropagation)

instance
  Data.FromXML
    TransitGatewayAttachmentPropagation
  where
  parseXML :: [Node] -> Either String TransitGatewayAttachmentPropagation
parseXML [Node]
x =
    Maybe TransitGatewayPropagationState
-> Maybe Text -> TransitGatewayAttachmentPropagation
TransitGatewayAttachmentPropagation'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"state")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"transitGatewayRouteTableId")

instance
  Prelude.Hashable
    TransitGatewayAttachmentPropagation
  where
  hashWithSalt :: Int -> TransitGatewayAttachmentPropagation -> Int
hashWithSalt
    Int
_salt
    TransitGatewayAttachmentPropagation' {Maybe Text
Maybe TransitGatewayPropagationState
transitGatewayRouteTableId :: Maybe Text
state :: Maybe TransitGatewayPropagationState
$sel:transitGatewayRouteTableId:TransitGatewayAttachmentPropagation' :: TransitGatewayAttachmentPropagation -> Maybe Text
$sel:state:TransitGatewayAttachmentPropagation' :: TransitGatewayAttachmentPropagation
-> Maybe TransitGatewayPropagationState
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TransitGatewayPropagationState
state
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
transitGatewayRouteTableId

instance
  Prelude.NFData
    TransitGatewayAttachmentPropagation
  where
  rnf :: TransitGatewayAttachmentPropagation -> ()
rnf TransitGatewayAttachmentPropagation' {Maybe Text
Maybe TransitGatewayPropagationState
transitGatewayRouteTableId :: Maybe Text
state :: Maybe TransitGatewayPropagationState
$sel:transitGatewayRouteTableId:TransitGatewayAttachmentPropagation' :: TransitGatewayAttachmentPropagation -> Maybe Text
$sel:state:TransitGatewayAttachmentPropagation' :: TransitGatewayAttachmentPropagation
-> Maybe TransitGatewayPropagationState
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe TransitGatewayPropagationState
state
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
transitGatewayRouteTableId