{-# 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.ManagedBlockChain.Types.NodeFabricAttributes
-- 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.ManagedBlockChain.Types.NodeFabricAttributes where

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

-- | Attributes of Hyperledger Fabric for a peer node on a Hyperledger Fabric
-- network on Managed Blockchain.
--
-- /See:/ 'newNodeFabricAttributes' smart constructor.
data NodeFabricAttributes = NodeFabricAttributes'
  { -- | The endpoint that identifies the peer node for peer channel-based event
    -- services.
    NodeFabricAttributes -> Maybe Text
peerEventEndpoint :: Prelude.Maybe Prelude.Text,
    -- | The endpoint that identifies the peer node for all services except peer
    -- channel-based event services.
    NodeFabricAttributes -> Maybe Text
peerEndpoint :: Prelude.Maybe Prelude.Text
  }
  deriving (NodeFabricAttributes -> NodeFabricAttributes -> Bool
(NodeFabricAttributes -> NodeFabricAttributes -> Bool)
-> (NodeFabricAttributes -> NodeFabricAttributes -> Bool)
-> Eq NodeFabricAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NodeFabricAttributes -> NodeFabricAttributes -> Bool
$c/= :: NodeFabricAttributes -> NodeFabricAttributes -> Bool
== :: NodeFabricAttributes -> NodeFabricAttributes -> Bool
$c== :: NodeFabricAttributes -> NodeFabricAttributes -> Bool
Prelude.Eq, ReadPrec [NodeFabricAttributes]
ReadPrec NodeFabricAttributes
Int -> ReadS NodeFabricAttributes
ReadS [NodeFabricAttributes]
(Int -> ReadS NodeFabricAttributes)
-> ReadS [NodeFabricAttributes]
-> ReadPrec NodeFabricAttributes
-> ReadPrec [NodeFabricAttributes]
-> Read NodeFabricAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NodeFabricAttributes]
$creadListPrec :: ReadPrec [NodeFabricAttributes]
readPrec :: ReadPrec NodeFabricAttributes
$creadPrec :: ReadPrec NodeFabricAttributes
readList :: ReadS [NodeFabricAttributes]
$creadList :: ReadS [NodeFabricAttributes]
readsPrec :: Int -> ReadS NodeFabricAttributes
$creadsPrec :: Int -> ReadS NodeFabricAttributes
Prelude.Read, Int -> NodeFabricAttributes -> ShowS
[NodeFabricAttributes] -> ShowS
NodeFabricAttributes -> String
(Int -> NodeFabricAttributes -> ShowS)
-> (NodeFabricAttributes -> String)
-> ([NodeFabricAttributes] -> ShowS)
-> Show NodeFabricAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NodeFabricAttributes] -> ShowS
$cshowList :: [NodeFabricAttributes] -> ShowS
show :: NodeFabricAttributes -> String
$cshow :: NodeFabricAttributes -> String
showsPrec :: Int -> NodeFabricAttributes -> ShowS
$cshowsPrec :: Int -> NodeFabricAttributes -> ShowS
Prelude.Show, (forall x. NodeFabricAttributes -> Rep NodeFabricAttributes x)
-> (forall x. Rep NodeFabricAttributes x -> NodeFabricAttributes)
-> Generic NodeFabricAttributes
forall x. Rep NodeFabricAttributes x -> NodeFabricAttributes
forall x. NodeFabricAttributes -> Rep NodeFabricAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NodeFabricAttributes x -> NodeFabricAttributes
$cfrom :: forall x. NodeFabricAttributes -> Rep NodeFabricAttributes x
Prelude.Generic)

-- |
-- Create a value of 'NodeFabricAttributes' 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:
--
-- 'peerEventEndpoint', 'nodeFabricAttributes_peerEventEndpoint' - The endpoint that identifies the peer node for peer channel-based event
-- services.
--
-- 'peerEndpoint', 'nodeFabricAttributes_peerEndpoint' - The endpoint that identifies the peer node for all services except peer
-- channel-based event services.
newNodeFabricAttributes ::
  NodeFabricAttributes
newNodeFabricAttributes :: NodeFabricAttributes
newNodeFabricAttributes =
  NodeFabricAttributes' :: Maybe Text -> Maybe Text -> NodeFabricAttributes
NodeFabricAttributes'
    { $sel:peerEventEndpoint:NodeFabricAttributes' :: Maybe Text
peerEventEndpoint =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:peerEndpoint:NodeFabricAttributes' :: Maybe Text
peerEndpoint = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The endpoint that identifies the peer node for peer channel-based event
-- services.
nodeFabricAttributes_peerEventEndpoint :: Lens.Lens' NodeFabricAttributes (Prelude.Maybe Prelude.Text)
nodeFabricAttributes_peerEventEndpoint :: (Maybe Text -> f (Maybe Text))
-> NodeFabricAttributes -> f NodeFabricAttributes
nodeFabricAttributes_peerEventEndpoint = (NodeFabricAttributes -> Maybe Text)
-> (NodeFabricAttributes -> Maybe Text -> NodeFabricAttributes)
-> Lens
     NodeFabricAttributes NodeFabricAttributes (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeFabricAttributes' {Maybe Text
peerEventEndpoint :: Maybe Text
$sel:peerEventEndpoint:NodeFabricAttributes' :: NodeFabricAttributes -> Maybe Text
peerEventEndpoint} -> Maybe Text
peerEventEndpoint) (\s :: NodeFabricAttributes
s@NodeFabricAttributes' {} Maybe Text
a -> NodeFabricAttributes
s {$sel:peerEventEndpoint:NodeFabricAttributes' :: Maybe Text
peerEventEndpoint = Maybe Text
a} :: NodeFabricAttributes)

-- | The endpoint that identifies the peer node for all services except peer
-- channel-based event services.
nodeFabricAttributes_peerEndpoint :: Lens.Lens' NodeFabricAttributes (Prelude.Maybe Prelude.Text)
nodeFabricAttributes_peerEndpoint :: (Maybe Text -> f (Maybe Text))
-> NodeFabricAttributes -> f NodeFabricAttributes
nodeFabricAttributes_peerEndpoint = (NodeFabricAttributes -> Maybe Text)
-> (NodeFabricAttributes -> Maybe Text -> NodeFabricAttributes)
-> Lens
     NodeFabricAttributes NodeFabricAttributes (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeFabricAttributes' {Maybe Text
peerEndpoint :: Maybe Text
$sel:peerEndpoint:NodeFabricAttributes' :: NodeFabricAttributes -> Maybe Text
peerEndpoint} -> Maybe Text
peerEndpoint) (\s :: NodeFabricAttributes
s@NodeFabricAttributes' {} Maybe Text
a -> NodeFabricAttributes
s {$sel:peerEndpoint:NodeFabricAttributes' :: Maybe Text
peerEndpoint = Maybe Text
a} :: NodeFabricAttributes)

instance Core.FromJSON NodeFabricAttributes where
  parseJSON :: Value -> Parser NodeFabricAttributes
parseJSON =
    String
-> (Object -> Parser NodeFabricAttributes)
-> Value
-> Parser NodeFabricAttributes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"NodeFabricAttributes"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> NodeFabricAttributes
NodeFabricAttributes'
            (Maybe Text -> Maybe Text -> NodeFabricAttributes)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> NodeFabricAttributes)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PeerEventEndpoint")
            Parser (Maybe Text -> NodeFabricAttributes)
-> Parser (Maybe Text) -> Parser NodeFabricAttributes
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PeerEndpoint")
      )

instance Prelude.Hashable NodeFabricAttributes

instance Prelude.NFData NodeFabricAttributes