{-# 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.TransitGatewayPropagation
-- 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.TransitGatewayPropagation 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.TransitGatewayAttachmentResourceType
import Amazonka.EC2.Types.TransitGatewayPropagationState
import qualified Amazonka.Prelude as Prelude

-- | Describes route propagation.
--
-- /See:/ 'newTransitGatewayPropagation' smart constructor.
data TransitGatewayPropagation = TransitGatewayPropagation'
  { -- | The ID of the resource.
    TransitGatewayPropagation -> Maybe Text
resourceId :: Prelude.Maybe Prelude.Text,
    -- | The resource type. Note that the @tgw-peering@ resource type has been
    -- deprecated.
    TransitGatewayPropagation
-> Maybe TransitGatewayAttachmentResourceType
resourceType :: Prelude.Maybe TransitGatewayAttachmentResourceType,
    -- | The state.
    TransitGatewayPropagation -> Maybe TransitGatewayPropagationState
state :: Prelude.Maybe TransitGatewayPropagationState,
    -- | The ID of the attachment.
    TransitGatewayPropagation -> Maybe Text
transitGatewayAttachmentId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the transit gateway route table announcement.
    TransitGatewayPropagation -> Maybe Text
transitGatewayRouteTableAnnouncementId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the transit gateway route table.
    TransitGatewayPropagation -> Maybe Text
transitGatewayRouteTableId :: Prelude.Maybe Prelude.Text
  }
  deriving (TransitGatewayPropagation -> TransitGatewayPropagation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TransitGatewayPropagation -> TransitGatewayPropagation -> Bool
$c/= :: TransitGatewayPropagation -> TransitGatewayPropagation -> Bool
== :: TransitGatewayPropagation -> TransitGatewayPropagation -> Bool
$c== :: TransitGatewayPropagation -> TransitGatewayPropagation -> Bool
Prelude.Eq, ReadPrec [TransitGatewayPropagation]
ReadPrec TransitGatewayPropagation
Int -> ReadS TransitGatewayPropagation
ReadS [TransitGatewayPropagation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TransitGatewayPropagation]
$creadListPrec :: ReadPrec [TransitGatewayPropagation]
readPrec :: ReadPrec TransitGatewayPropagation
$creadPrec :: ReadPrec TransitGatewayPropagation
readList :: ReadS [TransitGatewayPropagation]
$creadList :: ReadS [TransitGatewayPropagation]
readsPrec :: Int -> ReadS TransitGatewayPropagation
$creadsPrec :: Int -> ReadS TransitGatewayPropagation
Prelude.Read, Int -> TransitGatewayPropagation -> ShowS
[TransitGatewayPropagation] -> ShowS
TransitGatewayPropagation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TransitGatewayPropagation] -> ShowS
$cshowList :: [TransitGatewayPropagation] -> ShowS
show :: TransitGatewayPropagation -> String
$cshow :: TransitGatewayPropagation -> String
showsPrec :: Int -> TransitGatewayPropagation -> ShowS
$cshowsPrec :: Int -> TransitGatewayPropagation -> ShowS
Prelude.Show, forall x.
Rep TransitGatewayPropagation x -> TransitGatewayPropagation
forall x.
TransitGatewayPropagation -> Rep TransitGatewayPropagation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TransitGatewayPropagation x -> TransitGatewayPropagation
$cfrom :: forall x.
TransitGatewayPropagation -> Rep TransitGatewayPropagation x
Prelude.Generic)

-- |
-- Create a value of 'TransitGatewayPropagation' 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:
--
-- 'resourceId', 'transitGatewayPropagation_resourceId' - The ID of the resource.
--
-- 'resourceType', 'transitGatewayPropagation_resourceType' - The resource type. Note that the @tgw-peering@ resource type has been
-- deprecated.
--
-- 'state', 'transitGatewayPropagation_state' - The state.
--
-- 'transitGatewayAttachmentId', 'transitGatewayPropagation_transitGatewayAttachmentId' - The ID of the attachment.
--
-- 'transitGatewayRouteTableAnnouncementId', 'transitGatewayPropagation_transitGatewayRouteTableAnnouncementId' - The ID of the transit gateway route table announcement.
--
-- 'transitGatewayRouteTableId', 'transitGatewayPropagation_transitGatewayRouteTableId' - The ID of the transit gateway route table.
newTransitGatewayPropagation ::
  TransitGatewayPropagation
newTransitGatewayPropagation :: TransitGatewayPropagation
newTransitGatewayPropagation =
  TransitGatewayPropagation'
    { $sel:resourceId:TransitGatewayPropagation' :: Maybe Text
resourceId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:TransitGatewayPropagation' :: Maybe TransitGatewayAttachmentResourceType
resourceType = forall a. Maybe a
Prelude.Nothing,
      $sel:state:TransitGatewayPropagation' :: Maybe TransitGatewayPropagationState
state = forall a. Maybe a
Prelude.Nothing,
      $sel:transitGatewayAttachmentId:TransitGatewayPropagation' :: Maybe Text
transitGatewayAttachmentId = forall a. Maybe a
Prelude.Nothing,
      $sel:transitGatewayRouteTableAnnouncementId:TransitGatewayPropagation' :: Maybe Text
transitGatewayRouteTableAnnouncementId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:transitGatewayRouteTableId:TransitGatewayPropagation' :: Maybe Text
transitGatewayRouteTableId = forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the resource.
transitGatewayPropagation_resourceId :: Lens.Lens' TransitGatewayPropagation (Prelude.Maybe Prelude.Text)
transitGatewayPropagation_resourceId :: Lens' TransitGatewayPropagation (Maybe Text)
transitGatewayPropagation_resourceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransitGatewayPropagation' {Maybe Text
resourceId :: Maybe Text
$sel:resourceId:TransitGatewayPropagation' :: TransitGatewayPropagation -> Maybe Text
resourceId} -> Maybe Text
resourceId) (\s :: TransitGatewayPropagation
s@TransitGatewayPropagation' {} Maybe Text
a -> TransitGatewayPropagation
s {$sel:resourceId:TransitGatewayPropagation' :: Maybe Text
resourceId = Maybe Text
a} :: TransitGatewayPropagation)

-- | The resource type. Note that the @tgw-peering@ resource type has been
-- deprecated.
transitGatewayPropagation_resourceType :: Lens.Lens' TransitGatewayPropagation (Prelude.Maybe TransitGatewayAttachmentResourceType)
transitGatewayPropagation_resourceType :: Lens'
  TransitGatewayPropagation
  (Maybe TransitGatewayAttachmentResourceType)
transitGatewayPropagation_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransitGatewayPropagation' {Maybe TransitGatewayAttachmentResourceType
resourceType :: Maybe TransitGatewayAttachmentResourceType
$sel:resourceType:TransitGatewayPropagation' :: TransitGatewayPropagation
-> Maybe TransitGatewayAttachmentResourceType
resourceType} -> Maybe TransitGatewayAttachmentResourceType
resourceType) (\s :: TransitGatewayPropagation
s@TransitGatewayPropagation' {} Maybe TransitGatewayAttachmentResourceType
a -> TransitGatewayPropagation
s {$sel:resourceType:TransitGatewayPropagation' :: Maybe TransitGatewayAttachmentResourceType
resourceType = Maybe TransitGatewayAttachmentResourceType
a} :: TransitGatewayPropagation)

-- | The state.
transitGatewayPropagation_state :: Lens.Lens' TransitGatewayPropagation (Prelude.Maybe TransitGatewayPropagationState)
transitGatewayPropagation_state :: Lens'
  TransitGatewayPropagation (Maybe TransitGatewayPropagationState)
transitGatewayPropagation_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransitGatewayPropagation' {Maybe TransitGatewayPropagationState
state :: Maybe TransitGatewayPropagationState
$sel:state:TransitGatewayPropagation' :: TransitGatewayPropagation -> Maybe TransitGatewayPropagationState
state} -> Maybe TransitGatewayPropagationState
state) (\s :: TransitGatewayPropagation
s@TransitGatewayPropagation' {} Maybe TransitGatewayPropagationState
a -> TransitGatewayPropagation
s {$sel:state:TransitGatewayPropagation' :: Maybe TransitGatewayPropagationState
state = Maybe TransitGatewayPropagationState
a} :: TransitGatewayPropagation)

-- | The ID of the attachment.
transitGatewayPropagation_transitGatewayAttachmentId :: Lens.Lens' TransitGatewayPropagation (Prelude.Maybe Prelude.Text)
transitGatewayPropagation_transitGatewayAttachmentId :: Lens' TransitGatewayPropagation (Maybe Text)
transitGatewayPropagation_transitGatewayAttachmentId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransitGatewayPropagation' {Maybe Text
transitGatewayAttachmentId :: Maybe Text
$sel:transitGatewayAttachmentId:TransitGatewayPropagation' :: TransitGatewayPropagation -> Maybe Text
transitGatewayAttachmentId} -> Maybe Text
transitGatewayAttachmentId) (\s :: TransitGatewayPropagation
s@TransitGatewayPropagation' {} Maybe Text
a -> TransitGatewayPropagation
s {$sel:transitGatewayAttachmentId:TransitGatewayPropagation' :: Maybe Text
transitGatewayAttachmentId = Maybe Text
a} :: TransitGatewayPropagation)

-- | The ID of the transit gateway route table announcement.
transitGatewayPropagation_transitGatewayRouteTableAnnouncementId :: Lens.Lens' TransitGatewayPropagation (Prelude.Maybe Prelude.Text)
transitGatewayPropagation_transitGatewayRouteTableAnnouncementId :: Lens' TransitGatewayPropagation (Maybe Text)
transitGatewayPropagation_transitGatewayRouteTableAnnouncementId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransitGatewayPropagation' {Maybe Text
transitGatewayRouteTableAnnouncementId :: Maybe Text
$sel:transitGatewayRouteTableAnnouncementId:TransitGatewayPropagation' :: TransitGatewayPropagation -> Maybe Text
transitGatewayRouteTableAnnouncementId} -> Maybe Text
transitGatewayRouteTableAnnouncementId) (\s :: TransitGatewayPropagation
s@TransitGatewayPropagation' {} Maybe Text
a -> TransitGatewayPropagation
s {$sel:transitGatewayRouteTableAnnouncementId:TransitGatewayPropagation' :: Maybe Text
transitGatewayRouteTableAnnouncementId = Maybe Text
a} :: TransitGatewayPropagation)

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

instance Data.FromXML TransitGatewayPropagation where
  parseXML :: [Node] -> Either String TransitGatewayPropagation
parseXML [Node]
x =
    Maybe Text
-> Maybe TransitGatewayAttachmentResourceType
-> Maybe TransitGatewayPropagationState
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> TransitGatewayPropagation
TransitGatewayPropagation'
      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
"resourceId")
      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
"resourceType")
      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
"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
"transitGatewayAttachmentId")
      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
"transitGatewayRouteTableAnnouncementId")
      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 TransitGatewayPropagation where
  hashWithSalt :: Int -> TransitGatewayPropagation -> Int
hashWithSalt Int
_salt TransitGatewayPropagation' {Maybe Text
Maybe TransitGatewayAttachmentResourceType
Maybe TransitGatewayPropagationState
transitGatewayRouteTableId :: Maybe Text
transitGatewayRouteTableAnnouncementId :: Maybe Text
transitGatewayAttachmentId :: Maybe Text
state :: Maybe TransitGatewayPropagationState
resourceType :: Maybe TransitGatewayAttachmentResourceType
resourceId :: Maybe Text
$sel:transitGatewayRouteTableId:TransitGatewayPropagation' :: TransitGatewayPropagation -> Maybe Text
$sel:transitGatewayRouteTableAnnouncementId:TransitGatewayPropagation' :: TransitGatewayPropagation -> Maybe Text
$sel:transitGatewayAttachmentId:TransitGatewayPropagation' :: TransitGatewayPropagation -> Maybe Text
$sel:state:TransitGatewayPropagation' :: TransitGatewayPropagation -> Maybe TransitGatewayPropagationState
$sel:resourceType:TransitGatewayPropagation' :: TransitGatewayPropagation
-> Maybe TransitGatewayAttachmentResourceType
$sel:resourceId:TransitGatewayPropagation' :: TransitGatewayPropagation -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
resourceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TransitGatewayAttachmentResourceType
resourceType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TransitGatewayPropagationState
state
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
transitGatewayAttachmentId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
transitGatewayRouteTableAnnouncementId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
transitGatewayRouteTableId

instance Prelude.NFData TransitGatewayPropagation where
  rnf :: TransitGatewayPropagation -> ()
rnf TransitGatewayPropagation' {Maybe Text
Maybe TransitGatewayAttachmentResourceType
Maybe TransitGatewayPropagationState
transitGatewayRouteTableId :: Maybe Text
transitGatewayRouteTableAnnouncementId :: Maybe Text
transitGatewayAttachmentId :: Maybe Text
state :: Maybe TransitGatewayPropagationState
resourceType :: Maybe TransitGatewayAttachmentResourceType
resourceId :: Maybe Text
$sel:transitGatewayRouteTableId:TransitGatewayPropagation' :: TransitGatewayPropagation -> Maybe Text
$sel:transitGatewayRouteTableAnnouncementId:TransitGatewayPropagation' :: TransitGatewayPropagation -> Maybe Text
$sel:transitGatewayAttachmentId:TransitGatewayPropagation' :: TransitGatewayPropagation -> Maybe Text
$sel:state:TransitGatewayPropagation' :: TransitGatewayPropagation -> Maybe TransitGatewayPropagationState
$sel:resourceType:TransitGatewayPropagation' :: TransitGatewayPropagation
-> Maybe TransitGatewayAttachmentResourceType
$sel:resourceId:TransitGatewayPropagation' :: TransitGatewayPropagation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TransitGatewayAttachmentResourceType
resourceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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
transitGatewayAttachmentId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
transitGatewayRouteTableAnnouncementId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
transitGatewayRouteTableId