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

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

-- |
-- Create a value of 'TransitGatewayRouteTableAssociation' 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', 'transitGatewayRouteTableAssociation_resourceId' - The ID of the resource.
--
-- 'resourceType', 'transitGatewayRouteTableAssociation_resourceType' - The resource type. Note that the @tgw-peering@ resource type has been
-- deprecated.
--
-- 'state', 'transitGatewayRouteTableAssociation_state' - The state of the association.
--
-- 'transitGatewayAttachmentId', 'transitGatewayRouteTableAssociation_transitGatewayAttachmentId' - The ID of the attachment.
newTransitGatewayRouteTableAssociation ::
  TransitGatewayRouteTableAssociation
newTransitGatewayRouteTableAssociation :: TransitGatewayRouteTableAssociation
newTransitGatewayRouteTableAssociation =
  TransitGatewayRouteTableAssociation'
    { $sel:resourceId:TransitGatewayRouteTableAssociation' :: Maybe Text
resourceId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:TransitGatewayRouteTableAssociation' :: Maybe TransitGatewayAttachmentResourceType
resourceType = forall a. Maybe a
Prelude.Nothing,
      $sel:state:TransitGatewayRouteTableAssociation' :: Maybe TransitGatewayAssociationState
state = forall a. Maybe a
Prelude.Nothing,
      $sel:transitGatewayAttachmentId:TransitGatewayRouteTableAssociation' :: Maybe Text
transitGatewayAttachmentId =
        forall a. Maybe a
Prelude.Nothing
    }

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

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

-- | The state of the association.
transitGatewayRouteTableAssociation_state :: Lens.Lens' TransitGatewayRouteTableAssociation (Prelude.Maybe TransitGatewayAssociationState)
transitGatewayRouteTableAssociation_state :: Lens'
  TransitGatewayRouteTableAssociation
  (Maybe TransitGatewayAssociationState)
transitGatewayRouteTableAssociation_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransitGatewayRouteTableAssociation' {Maybe TransitGatewayAssociationState
state :: Maybe TransitGatewayAssociationState
$sel:state:TransitGatewayRouteTableAssociation' :: TransitGatewayRouteTableAssociation
-> Maybe TransitGatewayAssociationState
state} -> Maybe TransitGatewayAssociationState
state) (\s :: TransitGatewayRouteTableAssociation
s@TransitGatewayRouteTableAssociation' {} Maybe TransitGatewayAssociationState
a -> TransitGatewayRouteTableAssociation
s {$sel:state:TransitGatewayRouteTableAssociation' :: Maybe TransitGatewayAssociationState
state = Maybe TransitGatewayAssociationState
a} :: TransitGatewayRouteTableAssociation)

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

instance
  Data.FromXML
    TransitGatewayRouteTableAssociation
  where
  parseXML :: [Node] -> Either String TransitGatewayRouteTableAssociation
parseXML [Node]
x =
    Maybe Text
-> Maybe TransitGatewayAttachmentResourceType
-> Maybe TransitGatewayAssociationState
-> Maybe Text
-> TransitGatewayRouteTableAssociation
TransitGatewayRouteTableAssociation'
      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")

instance
  Prelude.Hashable
    TransitGatewayRouteTableAssociation
  where
  hashWithSalt :: Int -> TransitGatewayRouteTableAssociation -> Int
hashWithSalt
    Int
_salt
    TransitGatewayRouteTableAssociation' {Maybe Text
Maybe TransitGatewayAssociationState
Maybe TransitGatewayAttachmentResourceType
transitGatewayAttachmentId :: Maybe Text
state :: Maybe TransitGatewayAssociationState
resourceType :: Maybe TransitGatewayAttachmentResourceType
resourceId :: Maybe Text
$sel:transitGatewayAttachmentId:TransitGatewayRouteTableAssociation' :: TransitGatewayRouteTableAssociation -> Maybe Text
$sel:state:TransitGatewayRouteTableAssociation' :: TransitGatewayRouteTableAssociation
-> Maybe TransitGatewayAssociationState
$sel:resourceType:TransitGatewayRouteTableAssociation' :: TransitGatewayRouteTableAssociation
-> Maybe TransitGatewayAttachmentResourceType
$sel:resourceId:TransitGatewayRouteTableAssociation' :: TransitGatewayRouteTableAssociation -> 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 TransitGatewayAssociationState
state
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
transitGatewayAttachmentId

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