{-# 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.TransitGatewayAttachmentAssociation
-- 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.TransitGatewayAttachmentAssociation 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 qualified Amazonka.Prelude as Prelude

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

-- |
-- Create a value of 'TransitGatewayAttachmentAssociation' 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', 'transitGatewayAttachmentAssociation_state' - The state of the association.
--
-- 'transitGatewayRouteTableId', 'transitGatewayAttachmentAssociation_transitGatewayRouteTableId' - The ID of the route table for the transit gateway.
newTransitGatewayAttachmentAssociation ::
  TransitGatewayAttachmentAssociation
newTransitGatewayAttachmentAssociation :: TransitGatewayAttachmentAssociation
newTransitGatewayAttachmentAssociation =
  TransitGatewayAttachmentAssociation'
    { $sel:state:TransitGatewayAttachmentAssociation' :: Maybe TransitGatewayAssociationState
state =
        forall a. Maybe a
Prelude.Nothing,
      $sel:transitGatewayRouteTableId:TransitGatewayAttachmentAssociation' :: Maybe Text
transitGatewayRouteTableId =
        forall a. Maybe a
Prelude.Nothing
    }

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

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

instance
  Data.FromXML
    TransitGatewayAttachmentAssociation
  where
  parseXML :: [Node] -> Either String TransitGatewayAttachmentAssociation
parseXML [Node]
x =
    Maybe TransitGatewayAssociationState
-> Maybe Text -> TransitGatewayAttachmentAssociation
TransitGatewayAttachmentAssociation'
      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
    TransitGatewayAttachmentAssociation
  where
  hashWithSalt :: Int -> TransitGatewayAttachmentAssociation -> Int
hashWithSalt
    Int
_salt
    TransitGatewayAttachmentAssociation' {Maybe Text
Maybe TransitGatewayAssociationState
transitGatewayRouteTableId :: Maybe Text
state :: Maybe TransitGatewayAssociationState
$sel:transitGatewayRouteTableId:TransitGatewayAttachmentAssociation' :: TransitGatewayAttachmentAssociation -> Maybe Text
$sel:state:TransitGatewayAttachmentAssociation' :: TransitGatewayAttachmentAssociation
-> Maybe TransitGatewayAssociationState
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TransitGatewayAssociationState
state
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
transitGatewayRouteTableId

instance
  Prelude.NFData
    TransitGatewayAttachmentAssociation
  where
  rnf :: TransitGatewayAttachmentAssociation -> ()
rnf TransitGatewayAttachmentAssociation' {Maybe Text
Maybe TransitGatewayAssociationState
transitGatewayRouteTableId :: Maybe Text
state :: Maybe TransitGatewayAssociationState
$sel:transitGatewayRouteTableId:TransitGatewayAttachmentAssociation' :: TransitGatewayAttachmentAssociation -> Maybe Text
$sel:state:TransitGatewayAttachmentAssociation' :: TransitGatewayAttachmentAssociation
-> Maybe TransitGatewayAssociationState
..} =
    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
transitGatewayRouteTableId