{-# 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.DirectConnect.Types.NewBGPPeer
-- 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.DirectConnect.Types.NewBGPPeer where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DirectConnect.Types.AddressFamily
import qualified Amazonka.Prelude as Prelude

-- | Information about a new BGP peer.
--
-- /See:/ 'newNewBGPPeer' smart constructor.
data NewBGPPeer = NewBGPPeer'
  { -- | The address family for the BGP peer.
    NewBGPPeer -> Maybe AddressFamily
addressFamily :: Prelude.Maybe AddressFamily,
    -- | The IP address assigned to the Amazon interface.
    NewBGPPeer -> Maybe Text
amazonAddress :: Prelude.Maybe Prelude.Text,
    -- | The autonomous system (AS) number for Border Gateway Protocol (BGP)
    -- configuration.
    NewBGPPeer -> Maybe Int
asn :: Prelude.Maybe Prelude.Int,
    -- | The authentication key for BGP configuration. This string has a minimum
    -- length of 6 characters and and a maximun lenth of 80 characters.
    NewBGPPeer -> Maybe Text
authKey :: Prelude.Maybe Prelude.Text,
    -- | The IP address assigned to the customer interface.
    NewBGPPeer -> Maybe Text
customerAddress :: Prelude.Maybe Prelude.Text
  }
  deriving (NewBGPPeer -> NewBGPPeer -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NewBGPPeer -> NewBGPPeer -> Bool
$c/= :: NewBGPPeer -> NewBGPPeer -> Bool
== :: NewBGPPeer -> NewBGPPeer -> Bool
$c== :: NewBGPPeer -> NewBGPPeer -> Bool
Prelude.Eq, ReadPrec [NewBGPPeer]
ReadPrec NewBGPPeer
Int -> ReadS NewBGPPeer
ReadS [NewBGPPeer]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NewBGPPeer]
$creadListPrec :: ReadPrec [NewBGPPeer]
readPrec :: ReadPrec NewBGPPeer
$creadPrec :: ReadPrec NewBGPPeer
readList :: ReadS [NewBGPPeer]
$creadList :: ReadS [NewBGPPeer]
readsPrec :: Int -> ReadS NewBGPPeer
$creadsPrec :: Int -> ReadS NewBGPPeer
Prelude.Read, Int -> NewBGPPeer -> ShowS
[NewBGPPeer] -> ShowS
NewBGPPeer -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NewBGPPeer] -> ShowS
$cshowList :: [NewBGPPeer] -> ShowS
show :: NewBGPPeer -> String
$cshow :: NewBGPPeer -> String
showsPrec :: Int -> NewBGPPeer -> ShowS
$cshowsPrec :: Int -> NewBGPPeer -> ShowS
Prelude.Show, forall x. Rep NewBGPPeer x -> NewBGPPeer
forall x. NewBGPPeer -> Rep NewBGPPeer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NewBGPPeer x -> NewBGPPeer
$cfrom :: forall x. NewBGPPeer -> Rep NewBGPPeer x
Prelude.Generic)

-- |
-- Create a value of 'NewBGPPeer' 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:
--
-- 'addressFamily', 'newBGPPeer_addressFamily' - The address family for the BGP peer.
--
-- 'amazonAddress', 'newBGPPeer_amazonAddress' - The IP address assigned to the Amazon interface.
--
-- 'asn', 'newBGPPeer_asn' - The autonomous system (AS) number for Border Gateway Protocol (BGP)
-- configuration.
--
-- 'authKey', 'newBGPPeer_authKey' - The authentication key for BGP configuration. This string has a minimum
-- length of 6 characters and and a maximun lenth of 80 characters.
--
-- 'customerAddress', 'newBGPPeer_customerAddress' - The IP address assigned to the customer interface.
newNewBGPPeer ::
  NewBGPPeer
newNewBGPPeer :: NewBGPPeer
newNewBGPPeer =
  NewBGPPeer'
    { $sel:addressFamily:NewBGPPeer' :: Maybe AddressFamily
addressFamily = forall a. Maybe a
Prelude.Nothing,
      $sel:amazonAddress:NewBGPPeer' :: Maybe Text
amazonAddress = forall a. Maybe a
Prelude.Nothing,
      $sel:asn:NewBGPPeer' :: Maybe Int
asn = forall a. Maybe a
Prelude.Nothing,
      $sel:authKey:NewBGPPeer' :: Maybe Text
authKey = forall a. Maybe a
Prelude.Nothing,
      $sel:customerAddress:NewBGPPeer' :: Maybe Text
customerAddress = forall a. Maybe a
Prelude.Nothing
    }

-- | The address family for the BGP peer.
newBGPPeer_addressFamily :: Lens.Lens' NewBGPPeer (Prelude.Maybe AddressFamily)
newBGPPeer_addressFamily :: Lens' NewBGPPeer (Maybe AddressFamily)
newBGPPeer_addressFamily = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NewBGPPeer' {Maybe AddressFamily
addressFamily :: Maybe AddressFamily
$sel:addressFamily:NewBGPPeer' :: NewBGPPeer -> Maybe AddressFamily
addressFamily} -> Maybe AddressFamily
addressFamily) (\s :: NewBGPPeer
s@NewBGPPeer' {} Maybe AddressFamily
a -> NewBGPPeer
s {$sel:addressFamily:NewBGPPeer' :: Maybe AddressFamily
addressFamily = Maybe AddressFamily
a} :: NewBGPPeer)

-- | The IP address assigned to the Amazon interface.
newBGPPeer_amazonAddress :: Lens.Lens' NewBGPPeer (Prelude.Maybe Prelude.Text)
newBGPPeer_amazonAddress :: Lens' NewBGPPeer (Maybe Text)
newBGPPeer_amazonAddress = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NewBGPPeer' {Maybe Text
amazonAddress :: Maybe Text
$sel:amazonAddress:NewBGPPeer' :: NewBGPPeer -> Maybe Text
amazonAddress} -> Maybe Text
amazonAddress) (\s :: NewBGPPeer
s@NewBGPPeer' {} Maybe Text
a -> NewBGPPeer
s {$sel:amazonAddress:NewBGPPeer' :: Maybe Text
amazonAddress = Maybe Text
a} :: NewBGPPeer)

-- | The autonomous system (AS) number for Border Gateway Protocol (BGP)
-- configuration.
newBGPPeer_asn :: Lens.Lens' NewBGPPeer (Prelude.Maybe Prelude.Int)
newBGPPeer_asn :: Lens' NewBGPPeer (Maybe Int)
newBGPPeer_asn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NewBGPPeer' {Maybe Int
asn :: Maybe Int
$sel:asn:NewBGPPeer' :: NewBGPPeer -> Maybe Int
asn} -> Maybe Int
asn) (\s :: NewBGPPeer
s@NewBGPPeer' {} Maybe Int
a -> NewBGPPeer
s {$sel:asn:NewBGPPeer' :: Maybe Int
asn = Maybe Int
a} :: NewBGPPeer)

-- | The authentication key for BGP configuration. This string has a minimum
-- length of 6 characters and and a maximun lenth of 80 characters.
newBGPPeer_authKey :: Lens.Lens' NewBGPPeer (Prelude.Maybe Prelude.Text)
newBGPPeer_authKey :: Lens' NewBGPPeer (Maybe Text)
newBGPPeer_authKey = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NewBGPPeer' {Maybe Text
authKey :: Maybe Text
$sel:authKey:NewBGPPeer' :: NewBGPPeer -> Maybe Text
authKey} -> Maybe Text
authKey) (\s :: NewBGPPeer
s@NewBGPPeer' {} Maybe Text
a -> NewBGPPeer
s {$sel:authKey:NewBGPPeer' :: Maybe Text
authKey = Maybe Text
a} :: NewBGPPeer)

-- | The IP address assigned to the customer interface.
newBGPPeer_customerAddress :: Lens.Lens' NewBGPPeer (Prelude.Maybe Prelude.Text)
newBGPPeer_customerAddress :: Lens' NewBGPPeer (Maybe Text)
newBGPPeer_customerAddress = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NewBGPPeer' {Maybe Text
customerAddress :: Maybe Text
$sel:customerAddress:NewBGPPeer' :: NewBGPPeer -> Maybe Text
customerAddress} -> Maybe Text
customerAddress) (\s :: NewBGPPeer
s@NewBGPPeer' {} Maybe Text
a -> NewBGPPeer
s {$sel:customerAddress:NewBGPPeer' :: Maybe Text
customerAddress = Maybe Text
a} :: NewBGPPeer)

instance Prelude.Hashable NewBGPPeer where
  hashWithSalt :: Int -> NewBGPPeer -> Int
hashWithSalt Int
_salt NewBGPPeer' {Maybe Int
Maybe Text
Maybe AddressFamily
customerAddress :: Maybe Text
authKey :: Maybe Text
asn :: Maybe Int
amazonAddress :: Maybe Text
addressFamily :: Maybe AddressFamily
$sel:customerAddress:NewBGPPeer' :: NewBGPPeer -> Maybe Text
$sel:authKey:NewBGPPeer' :: NewBGPPeer -> Maybe Text
$sel:asn:NewBGPPeer' :: NewBGPPeer -> Maybe Int
$sel:amazonAddress:NewBGPPeer' :: NewBGPPeer -> Maybe Text
$sel:addressFamily:NewBGPPeer' :: NewBGPPeer -> Maybe AddressFamily
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AddressFamily
addressFamily
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
amazonAddress
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
asn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
authKey
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
customerAddress

instance Prelude.NFData NewBGPPeer where
  rnf :: NewBGPPeer -> ()
rnf NewBGPPeer' {Maybe Int
Maybe Text
Maybe AddressFamily
customerAddress :: Maybe Text
authKey :: Maybe Text
asn :: Maybe Int
amazonAddress :: Maybe Text
addressFamily :: Maybe AddressFamily
$sel:customerAddress:NewBGPPeer' :: NewBGPPeer -> Maybe Text
$sel:authKey:NewBGPPeer' :: NewBGPPeer -> Maybe Text
$sel:asn:NewBGPPeer' :: NewBGPPeer -> Maybe Int
$sel:amazonAddress:NewBGPPeer' :: NewBGPPeer -> Maybe Text
$sel:addressFamily:NewBGPPeer' :: NewBGPPeer -> Maybe AddressFamily
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe AddressFamily
addressFamily
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
amazonAddress
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
asn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
authKey
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
customerAddress

instance Data.ToJSON NewBGPPeer where
  toJSON :: NewBGPPeer -> Value
toJSON NewBGPPeer' {Maybe Int
Maybe Text
Maybe AddressFamily
customerAddress :: Maybe Text
authKey :: Maybe Text
asn :: Maybe Int
amazonAddress :: Maybe Text
addressFamily :: Maybe AddressFamily
$sel:customerAddress:NewBGPPeer' :: NewBGPPeer -> Maybe Text
$sel:authKey:NewBGPPeer' :: NewBGPPeer -> Maybe Text
$sel:asn:NewBGPPeer' :: NewBGPPeer -> Maybe Int
$sel:amazonAddress:NewBGPPeer' :: NewBGPPeer -> Maybe Text
$sel:addressFamily:NewBGPPeer' :: NewBGPPeer -> Maybe AddressFamily
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"addressFamily" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AddressFamily
addressFamily,
            (Key
"amazonAddress" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
amazonAddress,
            (Key
"asn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
asn,
            (Key
"authKey" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
authKey,
            (Key
"customerAddress" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
customerAddress
          ]
      )