{-# 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.TransitGatewayAttachmentBgpConfiguration
-- 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.TransitGatewayAttachmentBgpConfiguration 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.BgpStatus
import qualified Amazonka.Prelude as Prelude

-- | The BGP configuration information.
--
-- /See:/ 'newTransitGatewayAttachmentBgpConfiguration' smart constructor.
data TransitGatewayAttachmentBgpConfiguration = TransitGatewayAttachmentBgpConfiguration'
  { -- | The BGP status.
    TransitGatewayAttachmentBgpConfiguration -> Maybe BgpStatus
bgpStatus :: Prelude.Maybe BgpStatus,
    -- | The interior BGP peer IP address for the appliance.
    TransitGatewayAttachmentBgpConfiguration -> Maybe Text
peerAddress :: Prelude.Maybe Prelude.Text,
    -- | The peer Autonomous System Number (ASN).
    TransitGatewayAttachmentBgpConfiguration -> Maybe Integer
peerAsn :: Prelude.Maybe Prelude.Integer,
    -- | The interior BGP peer IP address for the transit gateway.
    TransitGatewayAttachmentBgpConfiguration -> Maybe Text
transitGatewayAddress :: Prelude.Maybe Prelude.Text,
    -- | The transit gateway Autonomous System Number (ASN).
    TransitGatewayAttachmentBgpConfiguration -> Maybe Integer
transitGatewayAsn :: Prelude.Maybe Prelude.Integer
  }
  deriving (TransitGatewayAttachmentBgpConfiguration
-> TransitGatewayAttachmentBgpConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TransitGatewayAttachmentBgpConfiguration
-> TransitGatewayAttachmentBgpConfiguration -> Bool
$c/= :: TransitGatewayAttachmentBgpConfiguration
-> TransitGatewayAttachmentBgpConfiguration -> Bool
== :: TransitGatewayAttachmentBgpConfiguration
-> TransitGatewayAttachmentBgpConfiguration -> Bool
$c== :: TransitGatewayAttachmentBgpConfiguration
-> TransitGatewayAttachmentBgpConfiguration -> Bool
Prelude.Eq, ReadPrec [TransitGatewayAttachmentBgpConfiguration]
ReadPrec TransitGatewayAttachmentBgpConfiguration
Int -> ReadS TransitGatewayAttachmentBgpConfiguration
ReadS [TransitGatewayAttachmentBgpConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TransitGatewayAttachmentBgpConfiguration]
$creadListPrec :: ReadPrec [TransitGatewayAttachmentBgpConfiguration]
readPrec :: ReadPrec TransitGatewayAttachmentBgpConfiguration
$creadPrec :: ReadPrec TransitGatewayAttachmentBgpConfiguration
readList :: ReadS [TransitGatewayAttachmentBgpConfiguration]
$creadList :: ReadS [TransitGatewayAttachmentBgpConfiguration]
readsPrec :: Int -> ReadS TransitGatewayAttachmentBgpConfiguration
$creadsPrec :: Int -> ReadS TransitGatewayAttachmentBgpConfiguration
Prelude.Read, Int -> TransitGatewayAttachmentBgpConfiguration -> ShowS
[TransitGatewayAttachmentBgpConfiguration] -> ShowS
TransitGatewayAttachmentBgpConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TransitGatewayAttachmentBgpConfiguration] -> ShowS
$cshowList :: [TransitGatewayAttachmentBgpConfiguration] -> ShowS
show :: TransitGatewayAttachmentBgpConfiguration -> String
$cshow :: TransitGatewayAttachmentBgpConfiguration -> String
showsPrec :: Int -> TransitGatewayAttachmentBgpConfiguration -> ShowS
$cshowsPrec :: Int -> TransitGatewayAttachmentBgpConfiguration -> ShowS
Prelude.Show, forall x.
Rep TransitGatewayAttachmentBgpConfiguration x
-> TransitGatewayAttachmentBgpConfiguration
forall x.
TransitGatewayAttachmentBgpConfiguration
-> Rep TransitGatewayAttachmentBgpConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TransitGatewayAttachmentBgpConfiguration x
-> TransitGatewayAttachmentBgpConfiguration
$cfrom :: forall x.
TransitGatewayAttachmentBgpConfiguration
-> Rep TransitGatewayAttachmentBgpConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'TransitGatewayAttachmentBgpConfiguration' 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:
--
-- 'bgpStatus', 'transitGatewayAttachmentBgpConfiguration_bgpStatus' - The BGP status.
--
-- 'peerAddress', 'transitGatewayAttachmentBgpConfiguration_peerAddress' - The interior BGP peer IP address for the appliance.
--
-- 'peerAsn', 'transitGatewayAttachmentBgpConfiguration_peerAsn' - The peer Autonomous System Number (ASN).
--
-- 'transitGatewayAddress', 'transitGatewayAttachmentBgpConfiguration_transitGatewayAddress' - The interior BGP peer IP address for the transit gateway.
--
-- 'transitGatewayAsn', 'transitGatewayAttachmentBgpConfiguration_transitGatewayAsn' - The transit gateway Autonomous System Number (ASN).
newTransitGatewayAttachmentBgpConfiguration ::
  TransitGatewayAttachmentBgpConfiguration
newTransitGatewayAttachmentBgpConfiguration :: TransitGatewayAttachmentBgpConfiguration
newTransitGatewayAttachmentBgpConfiguration =
  TransitGatewayAttachmentBgpConfiguration'
    { $sel:bgpStatus:TransitGatewayAttachmentBgpConfiguration' :: Maybe BgpStatus
bgpStatus =
        forall a. Maybe a
Prelude.Nothing,
      $sel:peerAddress:TransitGatewayAttachmentBgpConfiguration' :: Maybe Text
peerAddress = forall a. Maybe a
Prelude.Nothing,
      $sel:peerAsn:TransitGatewayAttachmentBgpConfiguration' :: Maybe Integer
peerAsn = forall a. Maybe a
Prelude.Nothing,
      $sel:transitGatewayAddress:TransitGatewayAttachmentBgpConfiguration' :: Maybe Text
transitGatewayAddress =
        forall a. Maybe a
Prelude.Nothing,
      $sel:transitGatewayAsn:TransitGatewayAttachmentBgpConfiguration' :: Maybe Integer
transitGatewayAsn =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The BGP status.
transitGatewayAttachmentBgpConfiguration_bgpStatus :: Lens.Lens' TransitGatewayAttachmentBgpConfiguration (Prelude.Maybe BgpStatus)
transitGatewayAttachmentBgpConfiguration_bgpStatus :: Lens' TransitGatewayAttachmentBgpConfiguration (Maybe BgpStatus)
transitGatewayAttachmentBgpConfiguration_bgpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransitGatewayAttachmentBgpConfiguration' {Maybe BgpStatus
bgpStatus :: Maybe BgpStatus
$sel:bgpStatus:TransitGatewayAttachmentBgpConfiguration' :: TransitGatewayAttachmentBgpConfiguration -> Maybe BgpStatus
bgpStatus} -> Maybe BgpStatus
bgpStatus) (\s :: TransitGatewayAttachmentBgpConfiguration
s@TransitGatewayAttachmentBgpConfiguration' {} Maybe BgpStatus
a -> TransitGatewayAttachmentBgpConfiguration
s {$sel:bgpStatus:TransitGatewayAttachmentBgpConfiguration' :: Maybe BgpStatus
bgpStatus = Maybe BgpStatus
a} :: TransitGatewayAttachmentBgpConfiguration)

-- | The interior BGP peer IP address for the appliance.
transitGatewayAttachmentBgpConfiguration_peerAddress :: Lens.Lens' TransitGatewayAttachmentBgpConfiguration (Prelude.Maybe Prelude.Text)
transitGatewayAttachmentBgpConfiguration_peerAddress :: Lens' TransitGatewayAttachmentBgpConfiguration (Maybe Text)
transitGatewayAttachmentBgpConfiguration_peerAddress = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransitGatewayAttachmentBgpConfiguration' {Maybe Text
peerAddress :: Maybe Text
$sel:peerAddress:TransitGatewayAttachmentBgpConfiguration' :: TransitGatewayAttachmentBgpConfiguration -> Maybe Text
peerAddress} -> Maybe Text
peerAddress) (\s :: TransitGatewayAttachmentBgpConfiguration
s@TransitGatewayAttachmentBgpConfiguration' {} Maybe Text
a -> TransitGatewayAttachmentBgpConfiguration
s {$sel:peerAddress:TransitGatewayAttachmentBgpConfiguration' :: Maybe Text
peerAddress = Maybe Text
a} :: TransitGatewayAttachmentBgpConfiguration)

-- | The peer Autonomous System Number (ASN).
transitGatewayAttachmentBgpConfiguration_peerAsn :: Lens.Lens' TransitGatewayAttachmentBgpConfiguration (Prelude.Maybe Prelude.Integer)
transitGatewayAttachmentBgpConfiguration_peerAsn :: Lens' TransitGatewayAttachmentBgpConfiguration (Maybe Integer)
transitGatewayAttachmentBgpConfiguration_peerAsn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransitGatewayAttachmentBgpConfiguration' {Maybe Integer
peerAsn :: Maybe Integer
$sel:peerAsn:TransitGatewayAttachmentBgpConfiguration' :: TransitGatewayAttachmentBgpConfiguration -> Maybe Integer
peerAsn} -> Maybe Integer
peerAsn) (\s :: TransitGatewayAttachmentBgpConfiguration
s@TransitGatewayAttachmentBgpConfiguration' {} Maybe Integer
a -> TransitGatewayAttachmentBgpConfiguration
s {$sel:peerAsn:TransitGatewayAttachmentBgpConfiguration' :: Maybe Integer
peerAsn = Maybe Integer
a} :: TransitGatewayAttachmentBgpConfiguration)

-- | The interior BGP peer IP address for the transit gateway.
transitGatewayAttachmentBgpConfiguration_transitGatewayAddress :: Lens.Lens' TransitGatewayAttachmentBgpConfiguration (Prelude.Maybe Prelude.Text)
transitGatewayAttachmentBgpConfiguration_transitGatewayAddress :: Lens' TransitGatewayAttachmentBgpConfiguration (Maybe Text)
transitGatewayAttachmentBgpConfiguration_transitGatewayAddress = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransitGatewayAttachmentBgpConfiguration' {Maybe Text
transitGatewayAddress :: Maybe Text
$sel:transitGatewayAddress:TransitGatewayAttachmentBgpConfiguration' :: TransitGatewayAttachmentBgpConfiguration -> Maybe Text
transitGatewayAddress} -> Maybe Text
transitGatewayAddress) (\s :: TransitGatewayAttachmentBgpConfiguration
s@TransitGatewayAttachmentBgpConfiguration' {} Maybe Text
a -> TransitGatewayAttachmentBgpConfiguration
s {$sel:transitGatewayAddress:TransitGatewayAttachmentBgpConfiguration' :: Maybe Text
transitGatewayAddress = Maybe Text
a} :: TransitGatewayAttachmentBgpConfiguration)

-- | The transit gateway Autonomous System Number (ASN).
transitGatewayAttachmentBgpConfiguration_transitGatewayAsn :: Lens.Lens' TransitGatewayAttachmentBgpConfiguration (Prelude.Maybe Prelude.Integer)
transitGatewayAttachmentBgpConfiguration_transitGatewayAsn :: Lens' TransitGatewayAttachmentBgpConfiguration (Maybe Integer)
transitGatewayAttachmentBgpConfiguration_transitGatewayAsn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransitGatewayAttachmentBgpConfiguration' {Maybe Integer
transitGatewayAsn :: Maybe Integer
$sel:transitGatewayAsn:TransitGatewayAttachmentBgpConfiguration' :: TransitGatewayAttachmentBgpConfiguration -> Maybe Integer
transitGatewayAsn} -> Maybe Integer
transitGatewayAsn) (\s :: TransitGatewayAttachmentBgpConfiguration
s@TransitGatewayAttachmentBgpConfiguration' {} Maybe Integer
a -> TransitGatewayAttachmentBgpConfiguration
s {$sel:transitGatewayAsn:TransitGatewayAttachmentBgpConfiguration' :: Maybe Integer
transitGatewayAsn = Maybe Integer
a} :: TransitGatewayAttachmentBgpConfiguration)

instance
  Data.FromXML
    TransitGatewayAttachmentBgpConfiguration
  where
  parseXML :: [Node] -> Either String TransitGatewayAttachmentBgpConfiguration
parseXML [Node]
x =
    Maybe BgpStatus
-> Maybe Text
-> Maybe Integer
-> Maybe Text
-> Maybe Integer
-> TransitGatewayAttachmentBgpConfiguration
TransitGatewayAttachmentBgpConfiguration'
      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
"bgpStatus")
      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
"peerAddress")
      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
"peerAsn")
      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
"transitGatewayAddress")
      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
"transitGatewayAsn")

instance
  Prelude.Hashable
    TransitGatewayAttachmentBgpConfiguration
  where
  hashWithSalt :: Int -> TransitGatewayAttachmentBgpConfiguration -> Int
hashWithSalt
    Int
_salt
    TransitGatewayAttachmentBgpConfiguration' {Maybe Integer
Maybe Text
Maybe BgpStatus
transitGatewayAsn :: Maybe Integer
transitGatewayAddress :: Maybe Text
peerAsn :: Maybe Integer
peerAddress :: Maybe Text
bgpStatus :: Maybe BgpStatus
$sel:transitGatewayAsn:TransitGatewayAttachmentBgpConfiguration' :: TransitGatewayAttachmentBgpConfiguration -> Maybe Integer
$sel:transitGatewayAddress:TransitGatewayAttachmentBgpConfiguration' :: TransitGatewayAttachmentBgpConfiguration -> Maybe Text
$sel:peerAsn:TransitGatewayAttachmentBgpConfiguration' :: TransitGatewayAttachmentBgpConfiguration -> Maybe Integer
$sel:peerAddress:TransitGatewayAttachmentBgpConfiguration' :: TransitGatewayAttachmentBgpConfiguration -> Maybe Text
$sel:bgpStatus:TransitGatewayAttachmentBgpConfiguration' :: TransitGatewayAttachmentBgpConfiguration -> Maybe BgpStatus
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe BgpStatus
bgpStatus
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
peerAddress
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
peerAsn
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
transitGatewayAddress
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
transitGatewayAsn

instance
  Prelude.NFData
    TransitGatewayAttachmentBgpConfiguration
  where
  rnf :: TransitGatewayAttachmentBgpConfiguration -> ()
rnf TransitGatewayAttachmentBgpConfiguration' {Maybe Integer
Maybe Text
Maybe BgpStatus
transitGatewayAsn :: Maybe Integer
transitGatewayAddress :: Maybe Text
peerAsn :: Maybe Integer
peerAddress :: Maybe Text
bgpStatus :: Maybe BgpStatus
$sel:transitGatewayAsn:TransitGatewayAttachmentBgpConfiguration' :: TransitGatewayAttachmentBgpConfiguration -> Maybe Integer
$sel:transitGatewayAddress:TransitGatewayAttachmentBgpConfiguration' :: TransitGatewayAttachmentBgpConfiguration -> Maybe Text
$sel:peerAsn:TransitGatewayAttachmentBgpConfiguration' :: TransitGatewayAttachmentBgpConfiguration -> Maybe Integer
$sel:peerAddress:TransitGatewayAttachmentBgpConfiguration' :: TransitGatewayAttachmentBgpConfiguration -> Maybe Text
$sel:bgpStatus:TransitGatewayAttachmentBgpConfiguration' :: TransitGatewayAttachmentBgpConfiguration -> Maybe BgpStatus
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe BgpStatus
bgpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
peerAddress
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
peerAsn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
transitGatewayAddress
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
transitGatewayAsn