{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.DirectConnect.Types.NewBGPPeer where

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

-- | Information about a new BGP peer.
--
-- /See:/ 'newNewBGPPeer' smart constructor.
data NewBGPPeer = NewBGPPeer'
  { -- | The IP address assigned to the customer interface.
    NewBGPPeer -> Maybe Text
customerAddress :: Prelude.Maybe Prelude.Text,
    -- | The IP address assigned to the Amazon interface.
    NewBGPPeer -> Maybe Text
amazonAddress :: Prelude.Maybe Prelude.Text,
    -- | The address family for the BGP peer.
    NewBGPPeer -> Maybe AddressFamily
addressFamily :: Prelude.Maybe AddressFamily,
    -- | 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
  }
  deriving (NewBGPPeer -> NewBGPPeer -> Bool
(NewBGPPeer -> NewBGPPeer -> Bool)
-> (NewBGPPeer -> NewBGPPeer -> Bool) -> Eq NewBGPPeer
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]
(Int -> ReadS NewBGPPeer)
-> ReadS [NewBGPPeer]
-> ReadPrec NewBGPPeer
-> ReadPrec [NewBGPPeer]
-> Read 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
(Int -> NewBGPPeer -> ShowS)
-> (NewBGPPeer -> String)
-> ([NewBGPPeer] -> ShowS)
-> Show NewBGPPeer
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. NewBGPPeer -> Rep NewBGPPeer x)
-> (forall x. Rep NewBGPPeer x -> NewBGPPeer) -> Generic NewBGPPeer
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:
--
-- 'customerAddress', 'newBGPPeer_customerAddress' - The IP address assigned to the customer interface.
--
-- 'amazonAddress', 'newBGPPeer_amazonAddress' - The IP address assigned to the Amazon interface.
--
-- 'addressFamily', 'newBGPPeer_addressFamily' - The address family for the BGP peer.
--
-- '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.
newNewBGPPeer ::
  NewBGPPeer
newNewBGPPeer :: NewBGPPeer
newNewBGPPeer =
  NewBGPPeer' :: Maybe Text
-> Maybe Text
-> Maybe AddressFamily
-> Maybe Int
-> Maybe Text
-> NewBGPPeer
NewBGPPeer'
    { $sel:customerAddress:NewBGPPeer' :: Maybe Text
customerAddress = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:amazonAddress:NewBGPPeer' :: Maybe Text
amazonAddress = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:addressFamily:NewBGPPeer' :: Maybe AddressFamily
addressFamily = Maybe AddressFamily
forall a. Maybe a
Prelude.Nothing,
      $sel:asn:NewBGPPeer' :: Maybe Int
asn = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:authKey:NewBGPPeer' :: Maybe Text
authKey = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The IP address assigned to the customer interface.
newBGPPeer_customerAddress :: Lens.Lens' NewBGPPeer (Prelude.Maybe Prelude.Text)
newBGPPeer_customerAddress :: (Maybe Text -> f (Maybe Text)) -> NewBGPPeer -> f NewBGPPeer
newBGPPeer_customerAddress = (NewBGPPeer -> Maybe Text)
-> (NewBGPPeer -> Maybe Text -> NewBGPPeer)
-> Lens NewBGPPeer NewBGPPeer (Maybe Text) (Maybe Text)
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)

-- | The IP address assigned to the Amazon interface.
newBGPPeer_amazonAddress :: Lens.Lens' NewBGPPeer (Prelude.Maybe Prelude.Text)
newBGPPeer_amazonAddress :: (Maybe Text -> f (Maybe Text)) -> NewBGPPeer -> f NewBGPPeer
newBGPPeer_amazonAddress = (NewBGPPeer -> Maybe Text)
-> (NewBGPPeer -> Maybe Text -> NewBGPPeer)
-> Lens NewBGPPeer NewBGPPeer (Maybe Text) (Maybe Text)
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 address family for the BGP peer.
newBGPPeer_addressFamily :: Lens.Lens' NewBGPPeer (Prelude.Maybe AddressFamily)
newBGPPeer_addressFamily :: (Maybe AddressFamily -> f (Maybe AddressFamily))
-> NewBGPPeer -> f NewBGPPeer
newBGPPeer_addressFamily = (NewBGPPeer -> Maybe AddressFamily)
-> (NewBGPPeer -> Maybe AddressFamily -> NewBGPPeer)
-> Lens
     NewBGPPeer NewBGPPeer (Maybe AddressFamily) (Maybe 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 autonomous system (AS) number for Border Gateway Protocol (BGP)
-- configuration.
newBGPPeer_asn :: Lens.Lens' NewBGPPeer (Prelude.Maybe Prelude.Int)
newBGPPeer_asn :: (Maybe Int -> f (Maybe Int)) -> NewBGPPeer -> f NewBGPPeer
newBGPPeer_asn = (NewBGPPeer -> Maybe Int)
-> (NewBGPPeer -> Maybe Int -> NewBGPPeer)
-> Lens NewBGPPeer NewBGPPeer (Maybe Int) (Maybe Int)
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 :: (Maybe Text -> f (Maybe Text)) -> NewBGPPeer -> f NewBGPPeer
newBGPPeer_authKey = (NewBGPPeer -> Maybe Text)
-> (NewBGPPeer -> Maybe Text -> NewBGPPeer)
-> Lens NewBGPPeer NewBGPPeer (Maybe Text) (Maybe Text)
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)

instance Prelude.Hashable NewBGPPeer

instance Prelude.NFData NewBGPPeer

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