{-# 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.NetworkFabricAttributes
-- 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.NetworkFabricAttributes where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.ManagedBlockChain.Types.Edition
import qualified Amazonka.Prelude as Prelude

-- | Attributes of Hyperledger Fabric for a network.
--
-- /See:/ 'newNetworkFabricAttributes' smart constructor.
data NetworkFabricAttributes = NetworkFabricAttributes'
  { -- | The edition of Amazon Managed Blockchain that Hyperledger Fabric uses.
    -- For more information, see
    -- <http://aws.amazon.com/managed-blockchain/pricing/ Amazon Managed Blockchain Pricing>.
    NetworkFabricAttributes -> Maybe Edition
edition :: Prelude.Maybe Edition,
    -- | The endpoint of the ordering service for the network.
    NetworkFabricAttributes -> Maybe Text
orderingServiceEndpoint :: Prelude.Maybe Prelude.Text
  }
  deriving (NetworkFabricAttributes -> NetworkFabricAttributes -> Bool
(NetworkFabricAttributes -> NetworkFabricAttributes -> Bool)
-> (NetworkFabricAttributes -> NetworkFabricAttributes -> Bool)
-> Eq NetworkFabricAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NetworkFabricAttributes -> NetworkFabricAttributes -> Bool
$c/= :: NetworkFabricAttributes -> NetworkFabricAttributes -> Bool
== :: NetworkFabricAttributes -> NetworkFabricAttributes -> Bool
$c== :: NetworkFabricAttributes -> NetworkFabricAttributes -> Bool
Prelude.Eq, ReadPrec [NetworkFabricAttributes]
ReadPrec NetworkFabricAttributes
Int -> ReadS NetworkFabricAttributes
ReadS [NetworkFabricAttributes]
(Int -> ReadS NetworkFabricAttributes)
-> ReadS [NetworkFabricAttributes]
-> ReadPrec NetworkFabricAttributes
-> ReadPrec [NetworkFabricAttributes]
-> Read NetworkFabricAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NetworkFabricAttributes]
$creadListPrec :: ReadPrec [NetworkFabricAttributes]
readPrec :: ReadPrec NetworkFabricAttributes
$creadPrec :: ReadPrec NetworkFabricAttributes
readList :: ReadS [NetworkFabricAttributes]
$creadList :: ReadS [NetworkFabricAttributes]
readsPrec :: Int -> ReadS NetworkFabricAttributes
$creadsPrec :: Int -> ReadS NetworkFabricAttributes
Prelude.Read, Int -> NetworkFabricAttributes -> ShowS
[NetworkFabricAttributes] -> ShowS
NetworkFabricAttributes -> String
(Int -> NetworkFabricAttributes -> ShowS)
-> (NetworkFabricAttributes -> String)
-> ([NetworkFabricAttributes] -> ShowS)
-> Show NetworkFabricAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NetworkFabricAttributes] -> ShowS
$cshowList :: [NetworkFabricAttributes] -> ShowS
show :: NetworkFabricAttributes -> String
$cshow :: NetworkFabricAttributes -> String
showsPrec :: Int -> NetworkFabricAttributes -> ShowS
$cshowsPrec :: Int -> NetworkFabricAttributes -> ShowS
Prelude.Show, (forall x.
 NetworkFabricAttributes -> Rep NetworkFabricAttributes x)
-> (forall x.
    Rep NetworkFabricAttributes x -> NetworkFabricAttributes)
-> Generic NetworkFabricAttributes
forall x. Rep NetworkFabricAttributes x -> NetworkFabricAttributes
forall x. NetworkFabricAttributes -> Rep NetworkFabricAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NetworkFabricAttributes x -> NetworkFabricAttributes
$cfrom :: forall x. NetworkFabricAttributes -> Rep NetworkFabricAttributes x
Prelude.Generic)

-- |
-- Create a value of 'NetworkFabricAttributes' 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:
--
-- 'edition', 'networkFabricAttributes_edition' - The edition of Amazon Managed Blockchain that Hyperledger Fabric uses.
-- For more information, see
-- <http://aws.amazon.com/managed-blockchain/pricing/ Amazon Managed Blockchain Pricing>.
--
-- 'orderingServiceEndpoint', 'networkFabricAttributes_orderingServiceEndpoint' - The endpoint of the ordering service for the network.
newNetworkFabricAttributes ::
  NetworkFabricAttributes
newNetworkFabricAttributes :: NetworkFabricAttributes
newNetworkFabricAttributes =
  NetworkFabricAttributes' :: Maybe Edition -> Maybe Text -> NetworkFabricAttributes
NetworkFabricAttributes'
    { $sel:edition:NetworkFabricAttributes' :: Maybe Edition
edition = Maybe Edition
forall a. Maybe a
Prelude.Nothing,
      $sel:orderingServiceEndpoint:NetworkFabricAttributes' :: Maybe Text
orderingServiceEndpoint = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The edition of Amazon Managed Blockchain that Hyperledger Fabric uses.
-- For more information, see
-- <http://aws.amazon.com/managed-blockchain/pricing/ Amazon Managed Blockchain Pricing>.
networkFabricAttributes_edition :: Lens.Lens' NetworkFabricAttributes (Prelude.Maybe Edition)
networkFabricAttributes_edition :: (Maybe Edition -> f (Maybe Edition))
-> NetworkFabricAttributes -> f NetworkFabricAttributes
networkFabricAttributes_edition = (NetworkFabricAttributes -> Maybe Edition)
-> (NetworkFabricAttributes
    -> Maybe Edition -> NetworkFabricAttributes)
-> Lens
     NetworkFabricAttributes
     NetworkFabricAttributes
     (Maybe Edition)
     (Maybe Edition)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkFabricAttributes' {Maybe Edition
edition :: Maybe Edition
$sel:edition:NetworkFabricAttributes' :: NetworkFabricAttributes -> Maybe Edition
edition} -> Maybe Edition
edition) (\s :: NetworkFabricAttributes
s@NetworkFabricAttributes' {} Maybe Edition
a -> NetworkFabricAttributes
s {$sel:edition:NetworkFabricAttributes' :: Maybe Edition
edition = Maybe Edition
a} :: NetworkFabricAttributes)

-- | The endpoint of the ordering service for the network.
networkFabricAttributes_orderingServiceEndpoint :: Lens.Lens' NetworkFabricAttributes (Prelude.Maybe Prelude.Text)
networkFabricAttributes_orderingServiceEndpoint :: (Maybe Text -> f (Maybe Text))
-> NetworkFabricAttributes -> f NetworkFabricAttributes
networkFabricAttributes_orderingServiceEndpoint = (NetworkFabricAttributes -> Maybe Text)
-> (NetworkFabricAttributes
    -> Maybe Text -> NetworkFabricAttributes)
-> Lens
     NetworkFabricAttributes
     NetworkFabricAttributes
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkFabricAttributes' {Maybe Text
orderingServiceEndpoint :: Maybe Text
$sel:orderingServiceEndpoint:NetworkFabricAttributes' :: NetworkFabricAttributes -> Maybe Text
orderingServiceEndpoint} -> Maybe Text
orderingServiceEndpoint) (\s :: NetworkFabricAttributes
s@NetworkFabricAttributes' {} Maybe Text
a -> NetworkFabricAttributes
s {$sel:orderingServiceEndpoint:NetworkFabricAttributes' :: Maybe Text
orderingServiceEndpoint = Maybe Text
a} :: NetworkFabricAttributes)

instance Core.FromJSON NetworkFabricAttributes where
  parseJSON :: Value -> Parser NetworkFabricAttributes
parseJSON =
    String
-> (Object -> Parser NetworkFabricAttributes)
-> Value
-> Parser NetworkFabricAttributes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"NetworkFabricAttributes"
      ( \Object
x ->
          Maybe Edition -> Maybe Text -> NetworkFabricAttributes
NetworkFabricAttributes'
            (Maybe Edition -> Maybe Text -> NetworkFabricAttributes)
-> Parser (Maybe Edition)
-> Parser (Maybe Text -> NetworkFabricAttributes)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Edition)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Edition")
            Parser (Maybe Text -> NetworkFabricAttributes)
-> Parser (Maybe Text) -> Parser NetworkFabricAttributes
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
"OrderingServiceEndpoint")
      )

instance Prelude.Hashable NetworkFabricAttributes

instance Prelude.NFData NetworkFabricAttributes