{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.ManagedBlockChain.Types.NodeFabricAttributes 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

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

-- | 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 :: Lens' NodeFabricAttributes (Maybe Text)
nodeFabricAttributes_peerEndpoint = 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)

-- | The endpoint that identifies the peer node for peer channel-based event
-- services.
nodeFabricAttributes_peerEventEndpoint :: Lens.Lens' NodeFabricAttributes (Prelude.Maybe Prelude.Text)
nodeFabricAttributes_peerEventEndpoint :: Lens' NodeFabricAttributes (Maybe Text)
nodeFabricAttributes_peerEventEndpoint = 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)

instance Data.FromJSON NodeFabricAttributes where
  parseJSON :: Value -> Parser NodeFabricAttributes
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"NodeFabricAttributes"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> NodeFabricAttributes
NodeFabricAttributes'
            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
"PeerEndpoint")
            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
"PeerEventEndpoint")
      )

instance Prelude.Hashable NodeFabricAttributes where
  hashWithSalt :: Int -> NodeFabricAttributes -> Int
hashWithSalt Int
_salt NodeFabricAttributes' {Maybe Text
peerEventEndpoint :: Maybe Text
peerEndpoint :: Maybe Text
$sel:peerEventEndpoint:NodeFabricAttributes' :: NodeFabricAttributes -> Maybe Text
$sel:peerEndpoint:NodeFabricAttributes' :: NodeFabricAttributes -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
peerEndpoint
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
peerEventEndpoint

instance Prelude.NFData NodeFabricAttributes where
  rnf :: NodeFabricAttributes -> ()
rnf NodeFabricAttributes' {Maybe Text
peerEventEndpoint :: Maybe Text
peerEndpoint :: Maybe Text
$sel:peerEventEndpoint:NodeFabricAttributes' :: NodeFabricAttributes -> Maybe Text
$sel:peerEndpoint:NodeFabricAttributes' :: NodeFabricAttributes -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
peerEndpoint
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
peerEventEndpoint