{-# 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.TransitGatewayConnectPeerConfiguration
-- 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.TransitGatewayConnectPeerConfiguration 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.ProtocolValue
import Amazonka.EC2.Types.TransitGatewayAttachmentBgpConfiguration
import qualified Amazonka.Prelude as Prelude

-- | Describes the Connect peer details.
--
-- /See:/ 'newTransitGatewayConnectPeerConfiguration' smart constructor.
data TransitGatewayConnectPeerConfiguration = TransitGatewayConnectPeerConfiguration'
  { -- | The BGP configuration details.
    TransitGatewayConnectPeerConfiguration
-> Maybe [TransitGatewayAttachmentBgpConfiguration]
bgpConfigurations :: Prelude.Maybe [TransitGatewayAttachmentBgpConfiguration],
    -- | The range of interior BGP peer IP addresses.
    TransitGatewayConnectPeerConfiguration -> Maybe [Text]
insideCidrBlocks :: Prelude.Maybe [Prelude.Text],
    -- | The Connect peer IP address on the appliance side of the tunnel.
    TransitGatewayConnectPeerConfiguration -> Maybe Text
peerAddress :: Prelude.Maybe Prelude.Text,
    -- | The tunnel protocol.
    TransitGatewayConnectPeerConfiguration -> Maybe ProtocolValue
protocol :: Prelude.Maybe ProtocolValue,
    -- | The Connect peer IP address on the transit gateway side of the tunnel.
    TransitGatewayConnectPeerConfiguration -> Maybe Text
transitGatewayAddress :: Prelude.Maybe Prelude.Text
  }
  deriving (TransitGatewayConnectPeerConfiguration
-> TransitGatewayConnectPeerConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TransitGatewayConnectPeerConfiguration
-> TransitGatewayConnectPeerConfiguration -> Bool
$c/= :: TransitGatewayConnectPeerConfiguration
-> TransitGatewayConnectPeerConfiguration -> Bool
== :: TransitGatewayConnectPeerConfiguration
-> TransitGatewayConnectPeerConfiguration -> Bool
$c== :: TransitGatewayConnectPeerConfiguration
-> TransitGatewayConnectPeerConfiguration -> Bool
Prelude.Eq, ReadPrec [TransitGatewayConnectPeerConfiguration]
ReadPrec TransitGatewayConnectPeerConfiguration
Int -> ReadS TransitGatewayConnectPeerConfiguration
ReadS [TransitGatewayConnectPeerConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TransitGatewayConnectPeerConfiguration]
$creadListPrec :: ReadPrec [TransitGatewayConnectPeerConfiguration]
readPrec :: ReadPrec TransitGatewayConnectPeerConfiguration
$creadPrec :: ReadPrec TransitGatewayConnectPeerConfiguration
readList :: ReadS [TransitGatewayConnectPeerConfiguration]
$creadList :: ReadS [TransitGatewayConnectPeerConfiguration]
readsPrec :: Int -> ReadS TransitGatewayConnectPeerConfiguration
$creadsPrec :: Int -> ReadS TransitGatewayConnectPeerConfiguration
Prelude.Read, Int -> TransitGatewayConnectPeerConfiguration -> ShowS
[TransitGatewayConnectPeerConfiguration] -> ShowS
TransitGatewayConnectPeerConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TransitGatewayConnectPeerConfiguration] -> ShowS
$cshowList :: [TransitGatewayConnectPeerConfiguration] -> ShowS
show :: TransitGatewayConnectPeerConfiguration -> String
$cshow :: TransitGatewayConnectPeerConfiguration -> String
showsPrec :: Int -> TransitGatewayConnectPeerConfiguration -> ShowS
$cshowsPrec :: Int -> TransitGatewayConnectPeerConfiguration -> ShowS
Prelude.Show, forall x.
Rep TransitGatewayConnectPeerConfiguration x
-> TransitGatewayConnectPeerConfiguration
forall x.
TransitGatewayConnectPeerConfiguration
-> Rep TransitGatewayConnectPeerConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TransitGatewayConnectPeerConfiguration x
-> TransitGatewayConnectPeerConfiguration
$cfrom :: forall x.
TransitGatewayConnectPeerConfiguration
-> Rep TransitGatewayConnectPeerConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'TransitGatewayConnectPeerConfiguration' 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:
--
-- 'bgpConfigurations', 'transitGatewayConnectPeerConfiguration_bgpConfigurations' - The BGP configuration details.
--
-- 'insideCidrBlocks', 'transitGatewayConnectPeerConfiguration_insideCidrBlocks' - The range of interior BGP peer IP addresses.
--
-- 'peerAddress', 'transitGatewayConnectPeerConfiguration_peerAddress' - The Connect peer IP address on the appliance side of the tunnel.
--
-- 'protocol', 'transitGatewayConnectPeerConfiguration_protocol' - The tunnel protocol.
--
-- 'transitGatewayAddress', 'transitGatewayConnectPeerConfiguration_transitGatewayAddress' - The Connect peer IP address on the transit gateway side of the tunnel.
newTransitGatewayConnectPeerConfiguration ::
  TransitGatewayConnectPeerConfiguration
newTransitGatewayConnectPeerConfiguration :: TransitGatewayConnectPeerConfiguration
newTransitGatewayConnectPeerConfiguration =
  TransitGatewayConnectPeerConfiguration'
    { $sel:bgpConfigurations:TransitGatewayConnectPeerConfiguration' :: Maybe [TransitGatewayAttachmentBgpConfiguration]
bgpConfigurations =
        forall a. Maybe a
Prelude.Nothing,
      $sel:insideCidrBlocks:TransitGatewayConnectPeerConfiguration' :: Maybe [Text]
insideCidrBlocks = forall a. Maybe a
Prelude.Nothing,
      $sel:peerAddress:TransitGatewayConnectPeerConfiguration' :: Maybe Text
peerAddress = forall a. Maybe a
Prelude.Nothing,
      $sel:protocol:TransitGatewayConnectPeerConfiguration' :: Maybe ProtocolValue
protocol = forall a. Maybe a
Prelude.Nothing,
      $sel:transitGatewayAddress:TransitGatewayConnectPeerConfiguration' :: Maybe Text
transitGatewayAddress =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The BGP configuration details.
transitGatewayConnectPeerConfiguration_bgpConfigurations :: Lens.Lens' TransitGatewayConnectPeerConfiguration (Prelude.Maybe [TransitGatewayAttachmentBgpConfiguration])
transitGatewayConnectPeerConfiguration_bgpConfigurations :: Lens'
  TransitGatewayConnectPeerConfiguration
  (Maybe [TransitGatewayAttachmentBgpConfiguration])
transitGatewayConnectPeerConfiguration_bgpConfigurations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransitGatewayConnectPeerConfiguration' {Maybe [TransitGatewayAttachmentBgpConfiguration]
bgpConfigurations :: Maybe [TransitGatewayAttachmentBgpConfiguration]
$sel:bgpConfigurations:TransitGatewayConnectPeerConfiguration' :: TransitGatewayConnectPeerConfiguration
-> Maybe [TransitGatewayAttachmentBgpConfiguration]
bgpConfigurations} -> Maybe [TransitGatewayAttachmentBgpConfiguration]
bgpConfigurations) (\s :: TransitGatewayConnectPeerConfiguration
s@TransitGatewayConnectPeerConfiguration' {} Maybe [TransitGatewayAttachmentBgpConfiguration]
a -> TransitGatewayConnectPeerConfiguration
s {$sel:bgpConfigurations:TransitGatewayConnectPeerConfiguration' :: Maybe [TransitGatewayAttachmentBgpConfiguration]
bgpConfigurations = Maybe [TransitGatewayAttachmentBgpConfiguration]
a} :: TransitGatewayConnectPeerConfiguration) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The range of interior BGP peer IP addresses.
transitGatewayConnectPeerConfiguration_insideCidrBlocks :: Lens.Lens' TransitGatewayConnectPeerConfiguration (Prelude.Maybe [Prelude.Text])
transitGatewayConnectPeerConfiguration_insideCidrBlocks :: Lens' TransitGatewayConnectPeerConfiguration (Maybe [Text])
transitGatewayConnectPeerConfiguration_insideCidrBlocks = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransitGatewayConnectPeerConfiguration' {Maybe [Text]
insideCidrBlocks :: Maybe [Text]
$sel:insideCidrBlocks:TransitGatewayConnectPeerConfiguration' :: TransitGatewayConnectPeerConfiguration -> Maybe [Text]
insideCidrBlocks} -> Maybe [Text]
insideCidrBlocks) (\s :: TransitGatewayConnectPeerConfiguration
s@TransitGatewayConnectPeerConfiguration' {} Maybe [Text]
a -> TransitGatewayConnectPeerConfiguration
s {$sel:insideCidrBlocks:TransitGatewayConnectPeerConfiguration' :: Maybe [Text]
insideCidrBlocks = Maybe [Text]
a} :: TransitGatewayConnectPeerConfiguration) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Connect peer IP address on the appliance side of the tunnel.
transitGatewayConnectPeerConfiguration_peerAddress :: Lens.Lens' TransitGatewayConnectPeerConfiguration (Prelude.Maybe Prelude.Text)
transitGatewayConnectPeerConfiguration_peerAddress :: Lens' TransitGatewayConnectPeerConfiguration (Maybe Text)
transitGatewayConnectPeerConfiguration_peerAddress = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransitGatewayConnectPeerConfiguration' {Maybe Text
peerAddress :: Maybe Text
$sel:peerAddress:TransitGatewayConnectPeerConfiguration' :: TransitGatewayConnectPeerConfiguration -> Maybe Text
peerAddress} -> Maybe Text
peerAddress) (\s :: TransitGatewayConnectPeerConfiguration
s@TransitGatewayConnectPeerConfiguration' {} Maybe Text
a -> TransitGatewayConnectPeerConfiguration
s {$sel:peerAddress:TransitGatewayConnectPeerConfiguration' :: Maybe Text
peerAddress = Maybe Text
a} :: TransitGatewayConnectPeerConfiguration)

-- | The tunnel protocol.
transitGatewayConnectPeerConfiguration_protocol :: Lens.Lens' TransitGatewayConnectPeerConfiguration (Prelude.Maybe ProtocolValue)
transitGatewayConnectPeerConfiguration_protocol :: Lens' TransitGatewayConnectPeerConfiguration (Maybe ProtocolValue)
transitGatewayConnectPeerConfiguration_protocol = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransitGatewayConnectPeerConfiguration' {Maybe ProtocolValue
protocol :: Maybe ProtocolValue
$sel:protocol:TransitGatewayConnectPeerConfiguration' :: TransitGatewayConnectPeerConfiguration -> Maybe ProtocolValue
protocol} -> Maybe ProtocolValue
protocol) (\s :: TransitGatewayConnectPeerConfiguration
s@TransitGatewayConnectPeerConfiguration' {} Maybe ProtocolValue
a -> TransitGatewayConnectPeerConfiguration
s {$sel:protocol:TransitGatewayConnectPeerConfiguration' :: Maybe ProtocolValue
protocol = Maybe ProtocolValue
a} :: TransitGatewayConnectPeerConfiguration)

-- | The Connect peer IP address on the transit gateway side of the tunnel.
transitGatewayConnectPeerConfiguration_transitGatewayAddress :: Lens.Lens' TransitGatewayConnectPeerConfiguration (Prelude.Maybe Prelude.Text)
transitGatewayConnectPeerConfiguration_transitGatewayAddress :: Lens' TransitGatewayConnectPeerConfiguration (Maybe Text)
transitGatewayConnectPeerConfiguration_transitGatewayAddress = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransitGatewayConnectPeerConfiguration' {Maybe Text
transitGatewayAddress :: Maybe Text
$sel:transitGatewayAddress:TransitGatewayConnectPeerConfiguration' :: TransitGatewayConnectPeerConfiguration -> Maybe Text
transitGatewayAddress} -> Maybe Text
transitGatewayAddress) (\s :: TransitGatewayConnectPeerConfiguration
s@TransitGatewayConnectPeerConfiguration' {} Maybe Text
a -> TransitGatewayConnectPeerConfiguration
s {$sel:transitGatewayAddress:TransitGatewayConnectPeerConfiguration' :: Maybe Text
transitGatewayAddress = Maybe Text
a} :: TransitGatewayConnectPeerConfiguration)

instance
  Data.FromXML
    TransitGatewayConnectPeerConfiguration
  where
  parseXML :: [Node] -> Either String TransitGatewayConnectPeerConfiguration
parseXML [Node]
x =
    Maybe [TransitGatewayAttachmentBgpConfiguration]
-> Maybe [Text]
-> Maybe Text
-> Maybe ProtocolValue
-> Maybe Text
-> TransitGatewayConnectPeerConfiguration
TransitGatewayConnectPeerConfiguration'
      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
"bgpConfigurations"
                      forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                      forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"item")
                  )
      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
"insideCidrBlocks"
                      forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                      forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"item")
                  )
      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
"protocol")
      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")

instance
  Prelude.Hashable
    TransitGatewayConnectPeerConfiguration
  where
  hashWithSalt :: Int -> TransitGatewayConnectPeerConfiguration -> Int
hashWithSalt
    Int
_salt
    TransitGatewayConnectPeerConfiguration' {Maybe [Text]
Maybe [TransitGatewayAttachmentBgpConfiguration]
Maybe Text
Maybe ProtocolValue
transitGatewayAddress :: Maybe Text
protocol :: Maybe ProtocolValue
peerAddress :: Maybe Text
insideCidrBlocks :: Maybe [Text]
bgpConfigurations :: Maybe [TransitGatewayAttachmentBgpConfiguration]
$sel:transitGatewayAddress:TransitGatewayConnectPeerConfiguration' :: TransitGatewayConnectPeerConfiguration -> Maybe Text
$sel:protocol:TransitGatewayConnectPeerConfiguration' :: TransitGatewayConnectPeerConfiguration -> Maybe ProtocolValue
$sel:peerAddress:TransitGatewayConnectPeerConfiguration' :: TransitGatewayConnectPeerConfiguration -> Maybe Text
$sel:insideCidrBlocks:TransitGatewayConnectPeerConfiguration' :: TransitGatewayConnectPeerConfiguration -> Maybe [Text]
$sel:bgpConfigurations:TransitGatewayConnectPeerConfiguration' :: TransitGatewayConnectPeerConfiguration
-> Maybe [TransitGatewayAttachmentBgpConfiguration]
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [TransitGatewayAttachmentBgpConfiguration]
bgpConfigurations
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
insideCidrBlocks
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
peerAddress
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ProtocolValue
protocol
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
transitGatewayAddress

instance
  Prelude.NFData
    TransitGatewayConnectPeerConfiguration
  where
  rnf :: TransitGatewayConnectPeerConfiguration -> ()
rnf TransitGatewayConnectPeerConfiguration' {Maybe [Text]
Maybe [TransitGatewayAttachmentBgpConfiguration]
Maybe Text
Maybe ProtocolValue
transitGatewayAddress :: Maybe Text
protocol :: Maybe ProtocolValue
peerAddress :: Maybe Text
insideCidrBlocks :: Maybe [Text]
bgpConfigurations :: Maybe [TransitGatewayAttachmentBgpConfiguration]
$sel:transitGatewayAddress:TransitGatewayConnectPeerConfiguration' :: TransitGatewayConnectPeerConfiguration -> Maybe Text
$sel:protocol:TransitGatewayConnectPeerConfiguration' :: TransitGatewayConnectPeerConfiguration -> Maybe ProtocolValue
$sel:peerAddress:TransitGatewayConnectPeerConfiguration' :: TransitGatewayConnectPeerConfiguration -> Maybe Text
$sel:insideCidrBlocks:TransitGatewayConnectPeerConfiguration' :: TransitGatewayConnectPeerConfiguration -> Maybe [Text]
$sel:bgpConfigurations:TransitGatewayConnectPeerConfiguration' :: TransitGatewayConnectPeerConfiguration
-> Maybe [TransitGatewayAttachmentBgpConfiguration]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [TransitGatewayAttachmentBgpConfiguration]
bgpConfigurations
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
insideCidrBlocks
      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 ProtocolValue
protocol
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
transitGatewayAddress