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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.ManagedBlockChain.Types.NetworkEthereumAttributes
import Amazonka.ManagedBlockChain.Types.NetworkFabricAttributes
import qualified Amazonka.Prelude as Prelude

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

-- |
-- Create a value of 'NetworkFrameworkAttributes' 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', 'networkFrameworkAttributes_fabric' - Attributes of Hyperledger Fabric for a Managed Blockchain network that
-- uses Hyperledger Fabric.
--
-- 'ethereum', 'networkFrameworkAttributes_ethereum' - Attributes of an Ethereum network for Managed Blockchain resources
-- participating in an Ethereum network.
newNetworkFrameworkAttributes ::
  NetworkFrameworkAttributes
newNetworkFrameworkAttributes :: NetworkFrameworkAttributes
newNetworkFrameworkAttributes =
  NetworkFrameworkAttributes' :: Maybe NetworkFabricAttributes
-> Maybe NetworkEthereumAttributes -> NetworkFrameworkAttributes
NetworkFrameworkAttributes'
    { $sel:fabric:NetworkFrameworkAttributes' :: Maybe NetworkFabricAttributes
fabric =
        Maybe NetworkFabricAttributes
forall a. Maybe a
Prelude.Nothing,
      $sel:ethereum:NetworkFrameworkAttributes' :: Maybe NetworkEthereumAttributes
ethereum = Maybe NetworkEthereumAttributes
forall a. Maybe a
Prelude.Nothing
    }

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

-- | Attributes of an Ethereum network for Managed Blockchain resources
-- participating in an Ethereum network.
networkFrameworkAttributes_ethereum :: Lens.Lens' NetworkFrameworkAttributes (Prelude.Maybe NetworkEthereumAttributes)
networkFrameworkAttributes_ethereum :: (Maybe NetworkEthereumAttributes
 -> f (Maybe NetworkEthereumAttributes))
-> NetworkFrameworkAttributes -> f NetworkFrameworkAttributes
networkFrameworkAttributes_ethereum = (NetworkFrameworkAttributes -> Maybe NetworkEthereumAttributes)
-> (NetworkFrameworkAttributes
    -> Maybe NetworkEthereumAttributes -> NetworkFrameworkAttributes)
-> Lens
     NetworkFrameworkAttributes
     NetworkFrameworkAttributes
     (Maybe NetworkEthereumAttributes)
     (Maybe NetworkEthereumAttributes)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkFrameworkAttributes' {Maybe NetworkEthereumAttributes
ethereum :: Maybe NetworkEthereumAttributes
$sel:ethereum:NetworkFrameworkAttributes' :: NetworkFrameworkAttributes -> Maybe NetworkEthereumAttributes
ethereum} -> Maybe NetworkEthereumAttributes
ethereum) (\s :: NetworkFrameworkAttributes
s@NetworkFrameworkAttributes' {} Maybe NetworkEthereumAttributes
a -> NetworkFrameworkAttributes
s {$sel:ethereum:NetworkFrameworkAttributes' :: Maybe NetworkEthereumAttributes
ethereum = Maybe NetworkEthereumAttributes
a} :: NetworkFrameworkAttributes)

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

instance Prelude.Hashable NetworkFrameworkAttributes

instance Prelude.NFData NetworkFrameworkAttributes