{-# 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.NetworkManager.Types.ConnectPeerBgpConfiguration
-- 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.NetworkManager.Types.ConnectPeerBgpConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Describes a core network BGP configuration.
--
-- /See:/ 'newConnectPeerBgpConfiguration' smart constructor.
data ConnectPeerBgpConfiguration = ConnectPeerBgpConfiguration'
  { -- | The address of a core network.
    ConnectPeerBgpConfiguration -> Maybe Text
coreNetworkAddress :: Prelude.Maybe Prelude.Text,
    -- | The ASN of the Coret Network.
    ConnectPeerBgpConfiguration -> Maybe Integer
coreNetworkAsn :: Prelude.Maybe Prelude.Integer,
    -- | The address of a core network Connect peer.
    ConnectPeerBgpConfiguration -> Maybe Text
peerAddress :: Prelude.Maybe Prelude.Text,
    -- | The ASN of the Connect peer.
    ConnectPeerBgpConfiguration -> Maybe Integer
peerAsn :: Prelude.Maybe Prelude.Integer
  }
  deriving (ConnectPeerBgpConfiguration -> ConnectPeerBgpConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConnectPeerBgpConfiguration -> ConnectPeerBgpConfiguration -> Bool
$c/= :: ConnectPeerBgpConfiguration -> ConnectPeerBgpConfiguration -> Bool
== :: ConnectPeerBgpConfiguration -> ConnectPeerBgpConfiguration -> Bool
$c== :: ConnectPeerBgpConfiguration -> ConnectPeerBgpConfiguration -> Bool
Prelude.Eq, ReadPrec [ConnectPeerBgpConfiguration]
ReadPrec ConnectPeerBgpConfiguration
Int -> ReadS ConnectPeerBgpConfiguration
ReadS [ConnectPeerBgpConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConnectPeerBgpConfiguration]
$creadListPrec :: ReadPrec [ConnectPeerBgpConfiguration]
readPrec :: ReadPrec ConnectPeerBgpConfiguration
$creadPrec :: ReadPrec ConnectPeerBgpConfiguration
readList :: ReadS [ConnectPeerBgpConfiguration]
$creadList :: ReadS [ConnectPeerBgpConfiguration]
readsPrec :: Int -> ReadS ConnectPeerBgpConfiguration
$creadsPrec :: Int -> ReadS ConnectPeerBgpConfiguration
Prelude.Read, Int -> ConnectPeerBgpConfiguration -> ShowS
[ConnectPeerBgpConfiguration] -> ShowS
ConnectPeerBgpConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConnectPeerBgpConfiguration] -> ShowS
$cshowList :: [ConnectPeerBgpConfiguration] -> ShowS
show :: ConnectPeerBgpConfiguration -> String
$cshow :: ConnectPeerBgpConfiguration -> String
showsPrec :: Int -> ConnectPeerBgpConfiguration -> ShowS
$cshowsPrec :: Int -> ConnectPeerBgpConfiguration -> ShowS
Prelude.Show, forall x.
Rep ConnectPeerBgpConfiguration x -> ConnectPeerBgpConfiguration
forall x.
ConnectPeerBgpConfiguration -> Rep ConnectPeerBgpConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ConnectPeerBgpConfiguration x -> ConnectPeerBgpConfiguration
$cfrom :: forall x.
ConnectPeerBgpConfiguration -> Rep ConnectPeerBgpConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'ConnectPeerBgpConfiguration' 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:
--
-- 'coreNetworkAddress', 'connectPeerBgpConfiguration_coreNetworkAddress' - The address of a core network.
--
-- 'coreNetworkAsn', 'connectPeerBgpConfiguration_coreNetworkAsn' - The ASN of the Coret Network.
--
-- 'peerAddress', 'connectPeerBgpConfiguration_peerAddress' - The address of a core network Connect peer.
--
-- 'peerAsn', 'connectPeerBgpConfiguration_peerAsn' - The ASN of the Connect peer.
newConnectPeerBgpConfiguration ::
  ConnectPeerBgpConfiguration
newConnectPeerBgpConfiguration :: ConnectPeerBgpConfiguration
newConnectPeerBgpConfiguration =
  ConnectPeerBgpConfiguration'
    { $sel:coreNetworkAddress:ConnectPeerBgpConfiguration' :: Maybe Text
coreNetworkAddress =
        forall a. Maybe a
Prelude.Nothing,
      $sel:coreNetworkAsn:ConnectPeerBgpConfiguration' :: Maybe Integer
coreNetworkAsn = forall a. Maybe a
Prelude.Nothing,
      $sel:peerAddress:ConnectPeerBgpConfiguration' :: Maybe Text
peerAddress = forall a. Maybe a
Prelude.Nothing,
      $sel:peerAsn:ConnectPeerBgpConfiguration' :: Maybe Integer
peerAsn = forall a. Maybe a
Prelude.Nothing
    }

-- | The address of a core network.
connectPeerBgpConfiguration_coreNetworkAddress :: Lens.Lens' ConnectPeerBgpConfiguration (Prelude.Maybe Prelude.Text)
connectPeerBgpConfiguration_coreNetworkAddress :: Lens' ConnectPeerBgpConfiguration (Maybe Text)
connectPeerBgpConfiguration_coreNetworkAddress = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectPeerBgpConfiguration' {Maybe Text
coreNetworkAddress :: Maybe Text
$sel:coreNetworkAddress:ConnectPeerBgpConfiguration' :: ConnectPeerBgpConfiguration -> Maybe Text
coreNetworkAddress} -> Maybe Text
coreNetworkAddress) (\s :: ConnectPeerBgpConfiguration
s@ConnectPeerBgpConfiguration' {} Maybe Text
a -> ConnectPeerBgpConfiguration
s {$sel:coreNetworkAddress:ConnectPeerBgpConfiguration' :: Maybe Text
coreNetworkAddress = Maybe Text
a} :: ConnectPeerBgpConfiguration)

-- | The ASN of the Coret Network.
connectPeerBgpConfiguration_coreNetworkAsn :: Lens.Lens' ConnectPeerBgpConfiguration (Prelude.Maybe Prelude.Integer)
connectPeerBgpConfiguration_coreNetworkAsn :: Lens' ConnectPeerBgpConfiguration (Maybe Integer)
connectPeerBgpConfiguration_coreNetworkAsn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectPeerBgpConfiguration' {Maybe Integer
coreNetworkAsn :: Maybe Integer
$sel:coreNetworkAsn:ConnectPeerBgpConfiguration' :: ConnectPeerBgpConfiguration -> Maybe Integer
coreNetworkAsn} -> Maybe Integer
coreNetworkAsn) (\s :: ConnectPeerBgpConfiguration
s@ConnectPeerBgpConfiguration' {} Maybe Integer
a -> ConnectPeerBgpConfiguration
s {$sel:coreNetworkAsn:ConnectPeerBgpConfiguration' :: Maybe Integer
coreNetworkAsn = Maybe Integer
a} :: ConnectPeerBgpConfiguration)

-- | The address of a core network Connect peer.
connectPeerBgpConfiguration_peerAddress :: Lens.Lens' ConnectPeerBgpConfiguration (Prelude.Maybe Prelude.Text)
connectPeerBgpConfiguration_peerAddress :: Lens' ConnectPeerBgpConfiguration (Maybe Text)
connectPeerBgpConfiguration_peerAddress = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectPeerBgpConfiguration' {Maybe Text
peerAddress :: Maybe Text
$sel:peerAddress:ConnectPeerBgpConfiguration' :: ConnectPeerBgpConfiguration -> Maybe Text
peerAddress} -> Maybe Text
peerAddress) (\s :: ConnectPeerBgpConfiguration
s@ConnectPeerBgpConfiguration' {} Maybe Text
a -> ConnectPeerBgpConfiguration
s {$sel:peerAddress:ConnectPeerBgpConfiguration' :: Maybe Text
peerAddress = Maybe Text
a} :: ConnectPeerBgpConfiguration)

-- | The ASN of the Connect peer.
connectPeerBgpConfiguration_peerAsn :: Lens.Lens' ConnectPeerBgpConfiguration (Prelude.Maybe Prelude.Integer)
connectPeerBgpConfiguration_peerAsn :: Lens' ConnectPeerBgpConfiguration (Maybe Integer)
connectPeerBgpConfiguration_peerAsn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectPeerBgpConfiguration' {Maybe Integer
peerAsn :: Maybe Integer
$sel:peerAsn:ConnectPeerBgpConfiguration' :: ConnectPeerBgpConfiguration -> Maybe Integer
peerAsn} -> Maybe Integer
peerAsn) (\s :: ConnectPeerBgpConfiguration
s@ConnectPeerBgpConfiguration' {} Maybe Integer
a -> ConnectPeerBgpConfiguration
s {$sel:peerAsn:ConnectPeerBgpConfiguration' :: Maybe Integer
peerAsn = Maybe Integer
a} :: ConnectPeerBgpConfiguration)

instance Data.FromJSON ConnectPeerBgpConfiguration where
  parseJSON :: Value -> Parser ConnectPeerBgpConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ConnectPeerBgpConfiguration"
      ( \Object
x ->
          Maybe Text
-> Maybe Integer
-> Maybe Text
-> Maybe Integer
-> ConnectPeerBgpConfiguration
ConnectPeerBgpConfiguration'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"CoreNetworkAddress")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"CoreNetworkAsn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"PeerAddress")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"PeerAsn")
      )

instance Prelude.Hashable ConnectPeerBgpConfiguration where
  hashWithSalt :: Int -> ConnectPeerBgpConfiguration -> Int
hashWithSalt Int
_salt ConnectPeerBgpConfiguration' {Maybe Integer
Maybe Text
peerAsn :: Maybe Integer
peerAddress :: Maybe Text
coreNetworkAsn :: Maybe Integer
coreNetworkAddress :: Maybe Text
$sel:peerAsn:ConnectPeerBgpConfiguration' :: ConnectPeerBgpConfiguration -> Maybe Integer
$sel:peerAddress:ConnectPeerBgpConfiguration' :: ConnectPeerBgpConfiguration -> Maybe Text
$sel:coreNetworkAsn:ConnectPeerBgpConfiguration' :: ConnectPeerBgpConfiguration -> Maybe Integer
$sel:coreNetworkAddress:ConnectPeerBgpConfiguration' :: ConnectPeerBgpConfiguration -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
coreNetworkAddress
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
coreNetworkAsn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
peerAddress
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
peerAsn

instance Prelude.NFData ConnectPeerBgpConfiguration where
  rnf :: ConnectPeerBgpConfiguration -> ()
rnf ConnectPeerBgpConfiguration' {Maybe Integer
Maybe Text
peerAsn :: Maybe Integer
peerAddress :: Maybe Text
coreNetworkAsn :: Maybe Integer
coreNetworkAddress :: Maybe Text
$sel:peerAsn:ConnectPeerBgpConfiguration' :: ConnectPeerBgpConfiguration -> Maybe Integer
$sel:peerAddress:ConnectPeerBgpConfiguration' :: ConnectPeerBgpConfiguration -> Maybe Text
$sel:coreNetworkAsn:ConnectPeerBgpConfiguration' :: ConnectPeerBgpConfiguration -> Maybe Integer
$sel:coreNetworkAddress:ConnectPeerBgpConfiguration' :: ConnectPeerBgpConfiguration -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
coreNetworkAddress
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
coreNetworkAsn
      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