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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 Ethereum for a node on a Managed Blockchain network that
    -- uses Ethereum.
    NodeFrameworkAttributes -> Maybe NodeEthereumAttributes
ethereum :: Prelude.Maybe NodeEthereumAttributes,
    -- | Attributes of Hyperledger Fabric for a peer node on a Managed Blockchain
    -- network that uses Hyperledger Fabric.
    NodeFrameworkAttributes -> Maybe NodeFabricAttributes
fabric :: Prelude.Maybe NodeFabricAttributes
  }
  deriving (NodeFrameworkAttributes -> NodeFrameworkAttributes -> Bool
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]
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
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. 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:
--
-- 'ethereum', 'nodeFrameworkAttributes_ethereum' - Attributes of Ethereum for a node on a Managed Blockchain network that
-- uses Ethereum.
--
-- 'fabric', 'nodeFrameworkAttributes_fabric' - Attributes of Hyperledger Fabric for a peer node on a Managed Blockchain
-- network that uses Hyperledger Fabric.
newNodeFrameworkAttributes ::
  NodeFrameworkAttributes
newNodeFrameworkAttributes :: NodeFrameworkAttributes
newNodeFrameworkAttributes =
  NodeFrameworkAttributes'
    { $sel:ethereum:NodeFrameworkAttributes' :: Maybe NodeEthereumAttributes
ethereum =
        forall a. Maybe a
Prelude.Nothing,
      $sel:fabric:NodeFrameworkAttributes' :: Maybe NodeFabricAttributes
fabric = forall a. Maybe a
Prelude.Nothing
    }

-- | Attributes of Ethereum for a node on a Managed Blockchain network that
-- uses Ethereum.
nodeFrameworkAttributes_ethereum :: Lens.Lens' NodeFrameworkAttributes (Prelude.Maybe NodeEthereumAttributes)
nodeFrameworkAttributes_ethereum :: Lens' NodeFrameworkAttributes (Maybe NodeEthereumAttributes)
nodeFrameworkAttributes_ethereum = 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)

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

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

instance Prelude.Hashable NodeFrameworkAttributes where
  hashWithSalt :: Int -> NodeFrameworkAttributes -> Int
hashWithSalt Int
_salt NodeFrameworkAttributes' {Maybe NodeEthereumAttributes
Maybe NodeFabricAttributes
fabric :: Maybe NodeFabricAttributes
ethereum :: Maybe NodeEthereumAttributes
$sel:fabric:NodeFrameworkAttributes' :: NodeFrameworkAttributes -> Maybe NodeFabricAttributes
$sel:ethereum:NodeFrameworkAttributes' :: NodeFrameworkAttributes -> Maybe NodeEthereumAttributes
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe NodeEthereumAttributes
ethereum
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe NodeFabricAttributes
fabric

instance Prelude.NFData NodeFrameworkAttributes where
  rnf :: NodeFrameworkAttributes -> ()
rnf NodeFrameworkAttributes' {Maybe NodeEthereumAttributes
Maybe NodeFabricAttributes
fabric :: Maybe NodeFabricAttributes
ethereum :: Maybe NodeEthereumAttributes
$sel:fabric:NodeFrameworkAttributes' :: NodeFrameworkAttributes -> Maybe NodeFabricAttributes
$sel:ethereum:NodeFrameworkAttributes' :: NodeFrameworkAttributes -> Maybe NodeEthereumAttributes
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe NodeEthereumAttributes
ethereum
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe NodeFabricAttributes
fabric