{-# 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.BgpOptions
-- 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.BgpOptions 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 the BGP options.
--
-- /See:/ 'newBgpOptions' smart constructor.
data BgpOptions = BgpOptions'
  { -- | The Peer ASN of the BGP.
    BgpOptions -> Maybe Integer
peerAsn :: Prelude.Maybe Prelude.Integer
  }
  deriving (BgpOptions -> BgpOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BgpOptions -> BgpOptions -> Bool
$c/= :: BgpOptions -> BgpOptions -> Bool
== :: BgpOptions -> BgpOptions -> Bool
$c== :: BgpOptions -> BgpOptions -> Bool
Prelude.Eq, ReadPrec [BgpOptions]
ReadPrec BgpOptions
Int -> ReadS BgpOptions
ReadS [BgpOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BgpOptions]
$creadListPrec :: ReadPrec [BgpOptions]
readPrec :: ReadPrec BgpOptions
$creadPrec :: ReadPrec BgpOptions
readList :: ReadS [BgpOptions]
$creadList :: ReadS [BgpOptions]
readsPrec :: Int -> ReadS BgpOptions
$creadsPrec :: Int -> ReadS BgpOptions
Prelude.Read, Int -> BgpOptions -> ShowS
[BgpOptions] -> ShowS
BgpOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BgpOptions] -> ShowS
$cshowList :: [BgpOptions] -> ShowS
show :: BgpOptions -> String
$cshow :: BgpOptions -> String
showsPrec :: Int -> BgpOptions -> ShowS
$cshowsPrec :: Int -> BgpOptions -> ShowS
Prelude.Show, forall x. Rep BgpOptions x -> BgpOptions
forall x. BgpOptions -> Rep BgpOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BgpOptions x -> BgpOptions
$cfrom :: forall x. BgpOptions -> Rep BgpOptions x
Prelude.Generic)

-- |
-- Create a value of 'BgpOptions' 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:
--
-- 'peerAsn', 'bgpOptions_peerAsn' - The Peer ASN of the BGP.
newBgpOptions ::
  BgpOptions
newBgpOptions :: BgpOptions
newBgpOptions =
  BgpOptions' {$sel:peerAsn:BgpOptions' :: Maybe Integer
peerAsn = forall a. Maybe a
Prelude.Nothing}

-- | The Peer ASN of the BGP.
bgpOptions_peerAsn :: Lens.Lens' BgpOptions (Prelude.Maybe Prelude.Integer)
bgpOptions_peerAsn :: Lens' BgpOptions (Maybe Integer)
bgpOptions_peerAsn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BgpOptions' {Maybe Integer
peerAsn :: Maybe Integer
$sel:peerAsn:BgpOptions' :: BgpOptions -> Maybe Integer
peerAsn} -> Maybe Integer
peerAsn) (\s :: BgpOptions
s@BgpOptions' {} Maybe Integer
a -> BgpOptions
s {$sel:peerAsn:BgpOptions' :: Maybe Integer
peerAsn = Maybe Integer
a} :: BgpOptions)

instance Prelude.Hashable BgpOptions where
  hashWithSalt :: Int -> BgpOptions -> Int
hashWithSalt Int
_salt BgpOptions' {Maybe Integer
peerAsn :: Maybe Integer
$sel:peerAsn:BgpOptions' :: BgpOptions -> Maybe Integer
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
peerAsn

instance Prelude.NFData BgpOptions where
  rnf :: BgpOptions -> ()
rnf BgpOptions' {Maybe Integer
peerAsn :: Maybe Integer
$sel:peerAsn:BgpOptions' :: BgpOptions -> Maybe Integer
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
peerAsn

instance Data.ToJSON BgpOptions where
  toJSON :: BgpOptions -> Value
toJSON BgpOptions' {Maybe Integer
peerAsn :: Maybe Integer
$sel:peerAsn:BgpOptions' :: BgpOptions -> Maybe Integer
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"PeerAsn" 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 Integer
peerAsn]
      )