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

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

-- |
-- Create a value of 'TransitGatewayRouteAttachment' 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', 'transitGatewayRouteAttachment_resourceId' - The ID of the resource.
--
-- 'resourceType', 'transitGatewayRouteAttachment_resourceType' - The resource type. Note that the @tgw-peering@ resource type has been
-- deprecated.
--
-- 'transitGatewayAttachmentId', 'transitGatewayRouteAttachment_transitGatewayAttachmentId' - The ID of the attachment.
newTransitGatewayRouteAttachment ::
  TransitGatewayRouteAttachment
newTransitGatewayRouteAttachment :: TransitGatewayRouteAttachment
newTransitGatewayRouteAttachment =
  TransitGatewayRouteAttachment'
    { $sel:resourceId:TransitGatewayRouteAttachment' :: Maybe Text
resourceId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:TransitGatewayRouteAttachment' :: Maybe TransitGatewayAttachmentResourceType
resourceType = forall a. Maybe a
Prelude.Nothing,
      $sel:transitGatewayAttachmentId:TransitGatewayRouteAttachment' :: Maybe Text
transitGatewayAttachmentId = forall a. Maybe a
Prelude.Nothing
    }

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

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

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

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

instance
  Prelude.Hashable
    TransitGatewayRouteAttachment
  where
  hashWithSalt :: Int -> TransitGatewayRouteAttachment -> Int
hashWithSalt Int
_salt TransitGatewayRouteAttachment' {Maybe Text
Maybe TransitGatewayAttachmentResourceType
transitGatewayAttachmentId :: Maybe Text
resourceType :: Maybe TransitGatewayAttachmentResourceType
resourceId :: Maybe Text
$sel:transitGatewayAttachmentId:TransitGatewayRouteAttachment' :: TransitGatewayRouteAttachment -> Maybe Text
$sel:resourceType:TransitGatewayRouteAttachment' :: TransitGatewayRouteAttachment
-> Maybe TransitGatewayAttachmentResourceType
$sel:resourceId:TransitGatewayRouteAttachment' :: TransitGatewayRouteAttachment -> 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 Text
transitGatewayAttachmentId

instance Prelude.NFData TransitGatewayRouteAttachment where
  rnf :: TransitGatewayRouteAttachment -> ()
rnf TransitGatewayRouteAttachment' {Maybe Text
Maybe TransitGatewayAttachmentResourceType
transitGatewayAttachmentId :: Maybe Text
resourceType :: Maybe TransitGatewayAttachmentResourceType
resourceId :: Maybe Text
$sel:transitGatewayAttachmentId:TransitGatewayRouteAttachment' :: TransitGatewayRouteAttachment -> Maybe Text
$sel:resourceType:TransitGatewayRouteAttachment' :: TransitGatewayRouteAttachment
-> Maybe TransitGatewayAttachmentResourceType
$sel:resourceId:TransitGatewayRouteAttachment' :: TransitGatewayRouteAttachment -> 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 Text
transitGatewayAttachmentId