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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.ManagedBlockChain.Types.NodeEthereumAttributes
import Amazonka.ManagedBlockChain.Types.NodeFabricAttributes
import qualified Amazonka.Prelude as Prelude

-- | Attributes relevant to a node on a Managed Blockchain network for the
-- blockchain framework that the network uses.
--
-- /See:/ 'newNodeFrameworkAttributes' smart constructor.
data NodeFrameworkAttributes = NodeFrameworkAttributes'
  { -- | Attributes of Hyperledger Fabric for a peer node on a Managed Blockchain
    -- network that uses Hyperledger Fabric.
    NodeFrameworkAttributes -> Maybe NodeFabricAttributes
fabric :: Prelude.Maybe NodeFabricAttributes,
    -- | Attributes of Ethereum for a node on a Managed Blockchain network that
    -- uses Ethereum.
    NodeFrameworkAttributes -> Maybe NodeEthereumAttributes
ethereum :: Prelude.Maybe NodeEthereumAttributes
  }
  deriving (NodeFrameworkAttributes -> NodeFrameworkAttributes -> Bool
(NodeFrameworkAttributes -> NodeFrameworkAttributes -> Bool)
-> (NodeFrameworkAttributes -> NodeFrameworkAttributes -> Bool)
-> Eq NodeFrameworkAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NodeFrameworkAttributes -> NodeFrameworkAttributes -> Bool
$c/= :: NodeFrameworkAttributes -> NodeFrameworkAttributes -> Bool
== :: NodeFrameworkAttributes -> NodeFrameworkAttributes -> Bool
$c== :: NodeFrameworkAttributes -> NodeFrameworkAttributes -> Bool
Prelude.Eq, ReadPrec [NodeFrameworkAttributes]
ReadPrec NodeFrameworkAttributes
Int -> ReadS NodeFrameworkAttributes
ReadS [NodeFrameworkAttributes]
(Int -> ReadS NodeFrameworkAttributes)
-> ReadS [NodeFrameworkAttributes]
-> ReadPrec NodeFrameworkAttributes
-> ReadPrec [NodeFrameworkAttributes]
-> Read NodeFrameworkAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NodeFrameworkAttributes]
$creadListPrec :: ReadPrec [NodeFrameworkAttributes]
readPrec :: ReadPrec NodeFrameworkAttributes
$creadPrec :: ReadPrec NodeFrameworkAttributes
readList :: ReadS [NodeFrameworkAttributes]
$creadList :: ReadS [NodeFrameworkAttributes]
readsPrec :: Int -> ReadS NodeFrameworkAttributes
$creadsPrec :: Int -> ReadS NodeFrameworkAttributes
Prelude.Read, Int -> NodeFrameworkAttributes -> ShowS
[NodeFrameworkAttributes] -> ShowS
NodeFrameworkAttributes -> String
(Int -> NodeFrameworkAttributes -> ShowS)
-> (NodeFrameworkAttributes -> String)
-> ([NodeFrameworkAttributes] -> ShowS)
-> Show NodeFrameworkAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NodeFrameworkAttributes] -> ShowS
$cshowList :: [NodeFrameworkAttributes] -> ShowS
show :: NodeFrameworkAttributes -> String
$cshow :: NodeFrameworkAttributes -> String
showsPrec :: Int -> NodeFrameworkAttributes -> ShowS
$cshowsPrec :: Int -> NodeFrameworkAttributes -> ShowS
Prelude.Show, (forall x.
 NodeFrameworkAttributes -> Rep NodeFrameworkAttributes x)
-> (forall x.
    Rep NodeFrameworkAttributes x -> NodeFrameworkAttributes)
-> Generic NodeFrameworkAttributes
forall x. Rep NodeFrameworkAttributes x -> NodeFrameworkAttributes
forall x. NodeFrameworkAttributes -> Rep NodeFrameworkAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NodeFrameworkAttributes x -> NodeFrameworkAttributes
$cfrom :: forall x. NodeFrameworkAttributes -> Rep NodeFrameworkAttributes x
Prelude.Generic)

-- |
-- Create a value of 'NodeFrameworkAttributes' 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:
--
-- 'fabric', 'nodeFrameworkAttributes_fabric' - Attributes of Hyperledger Fabric for a peer node on a Managed Blockchain
-- network that uses Hyperledger Fabric.
--
-- 'ethereum', 'nodeFrameworkAttributes_ethereum' - Attributes of Ethereum for a node on a Managed Blockchain network that
-- uses Ethereum.
newNodeFrameworkAttributes ::
  NodeFrameworkAttributes
newNodeFrameworkAttributes :: NodeFrameworkAttributes
newNodeFrameworkAttributes =
  NodeFrameworkAttributes' :: Maybe NodeFabricAttributes
-> Maybe NodeEthereumAttributes -> NodeFrameworkAttributes
NodeFrameworkAttributes'
    { $sel:fabric:NodeFrameworkAttributes' :: Maybe NodeFabricAttributes
fabric = Maybe NodeFabricAttributes
forall a. Maybe a
Prelude.Nothing,
      $sel:ethereum:NodeFrameworkAttributes' :: Maybe NodeEthereumAttributes
ethereum = Maybe NodeEthereumAttributes
forall a. Maybe a
Prelude.Nothing
    }

-- | Attributes of Hyperledger Fabric for a peer node on a Managed Blockchain
-- network that uses Hyperledger Fabric.
nodeFrameworkAttributes_fabric :: Lens.Lens' NodeFrameworkAttributes (Prelude.Maybe NodeFabricAttributes)
nodeFrameworkAttributes_fabric :: (Maybe NodeFabricAttributes -> f (Maybe NodeFabricAttributes))
-> NodeFrameworkAttributes -> f NodeFrameworkAttributes
nodeFrameworkAttributes_fabric = (NodeFrameworkAttributes -> Maybe NodeFabricAttributes)
-> (NodeFrameworkAttributes
    -> Maybe NodeFabricAttributes -> NodeFrameworkAttributes)
-> Lens
     NodeFrameworkAttributes
     NodeFrameworkAttributes
     (Maybe NodeFabricAttributes)
     (Maybe NodeFabricAttributes)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeFrameworkAttributes' {Maybe NodeFabricAttributes
fabric :: Maybe NodeFabricAttributes
$sel:fabric:NodeFrameworkAttributes' :: NodeFrameworkAttributes -> Maybe NodeFabricAttributes
fabric} -> Maybe NodeFabricAttributes
fabric) (\s :: NodeFrameworkAttributes
s@NodeFrameworkAttributes' {} Maybe NodeFabricAttributes
a -> NodeFrameworkAttributes
s {$sel:fabric:NodeFrameworkAttributes' :: Maybe NodeFabricAttributes
fabric = Maybe NodeFabricAttributes
a} :: NodeFrameworkAttributes)

-- | Attributes of Ethereum for a node on a Managed Blockchain network that
-- uses Ethereum.
nodeFrameworkAttributes_ethereum :: Lens.Lens' NodeFrameworkAttributes (Prelude.Maybe NodeEthereumAttributes)
nodeFrameworkAttributes_ethereum :: (Maybe NodeEthereumAttributes -> f (Maybe NodeEthereumAttributes))
-> NodeFrameworkAttributes -> f NodeFrameworkAttributes
nodeFrameworkAttributes_ethereum = (NodeFrameworkAttributes -> Maybe NodeEthereumAttributes)
-> (NodeFrameworkAttributes
    -> Maybe NodeEthereumAttributes -> NodeFrameworkAttributes)
-> Lens
     NodeFrameworkAttributes
     NodeFrameworkAttributes
     (Maybe NodeEthereumAttributes)
     (Maybe NodeEthereumAttributes)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeFrameworkAttributes' {Maybe NodeEthereumAttributes
ethereum :: Maybe NodeEthereumAttributes
$sel:ethereum:NodeFrameworkAttributes' :: NodeFrameworkAttributes -> Maybe NodeEthereumAttributes
ethereum} -> Maybe NodeEthereumAttributes
ethereum) (\s :: NodeFrameworkAttributes
s@NodeFrameworkAttributes' {} Maybe NodeEthereumAttributes
a -> NodeFrameworkAttributes
s {$sel:ethereum:NodeFrameworkAttributes' :: Maybe NodeEthereumAttributes
ethereum = Maybe NodeEthereumAttributes
a} :: NodeFrameworkAttributes)

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

instance Prelude.Hashable NodeFrameworkAttributes

instance Prelude.NFData NodeFrameworkAttributes