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

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

-- | Configuration properties for logging events associated with a peer node
-- on a Hyperledger Fabric network on Managed Blockchain.
--
-- /See:/ 'newNodeLogPublishingConfiguration' smart constructor.
data NodeLogPublishingConfiguration = NodeLogPublishingConfiguration'
  { -- | Configuration properties for logging events associated with a node that
    -- is owned by a member of a Managed Blockchain network using the
    -- Hyperledger Fabric framework.
    NodeLogPublishingConfiguration
-> Maybe NodeFabricLogPublishingConfiguration
fabric :: Prelude.Maybe NodeFabricLogPublishingConfiguration
  }
  deriving (NodeLogPublishingConfiguration
-> NodeLogPublishingConfiguration -> Bool
(NodeLogPublishingConfiguration
 -> NodeLogPublishingConfiguration -> Bool)
-> (NodeLogPublishingConfiguration
    -> NodeLogPublishingConfiguration -> Bool)
-> Eq NodeLogPublishingConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NodeLogPublishingConfiguration
-> NodeLogPublishingConfiguration -> Bool
$c/= :: NodeLogPublishingConfiguration
-> NodeLogPublishingConfiguration -> Bool
== :: NodeLogPublishingConfiguration
-> NodeLogPublishingConfiguration -> Bool
$c== :: NodeLogPublishingConfiguration
-> NodeLogPublishingConfiguration -> Bool
Prelude.Eq, ReadPrec [NodeLogPublishingConfiguration]
ReadPrec NodeLogPublishingConfiguration
Int -> ReadS NodeLogPublishingConfiguration
ReadS [NodeLogPublishingConfiguration]
(Int -> ReadS NodeLogPublishingConfiguration)
-> ReadS [NodeLogPublishingConfiguration]
-> ReadPrec NodeLogPublishingConfiguration
-> ReadPrec [NodeLogPublishingConfiguration]
-> Read NodeLogPublishingConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NodeLogPublishingConfiguration]
$creadListPrec :: ReadPrec [NodeLogPublishingConfiguration]
readPrec :: ReadPrec NodeLogPublishingConfiguration
$creadPrec :: ReadPrec NodeLogPublishingConfiguration
readList :: ReadS [NodeLogPublishingConfiguration]
$creadList :: ReadS [NodeLogPublishingConfiguration]
readsPrec :: Int -> ReadS NodeLogPublishingConfiguration
$creadsPrec :: Int -> ReadS NodeLogPublishingConfiguration
Prelude.Read, Int -> NodeLogPublishingConfiguration -> ShowS
[NodeLogPublishingConfiguration] -> ShowS
NodeLogPublishingConfiguration -> String
(Int -> NodeLogPublishingConfiguration -> ShowS)
-> (NodeLogPublishingConfiguration -> String)
-> ([NodeLogPublishingConfiguration] -> ShowS)
-> Show NodeLogPublishingConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NodeLogPublishingConfiguration] -> ShowS
$cshowList :: [NodeLogPublishingConfiguration] -> ShowS
show :: NodeLogPublishingConfiguration -> String
$cshow :: NodeLogPublishingConfiguration -> String
showsPrec :: Int -> NodeLogPublishingConfiguration -> ShowS
$cshowsPrec :: Int -> NodeLogPublishingConfiguration -> ShowS
Prelude.Show, (forall x.
 NodeLogPublishingConfiguration
 -> Rep NodeLogPublishingConfiguration x)
-> (forall x.
    Rep NodeLogPublishingConfiguration x
    -> NodeLogPublishingConfiguration)
-> Generic NodeLogPublishingConfiguration
forall x.
Rep NodeLogPublishingConfiguration x
-> NodeLogPublishingConfiguration
forall x.
NodeLogPublishingConfiguration
-> Rep NodeLogPublishingConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep NodeLogPublishingConfiguration x
-> NodeLogPublishingConfiguration
$cfrom :: forall x.
NodeLogPublishingConfiguration
-> Rep NodeLogPublishingConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'NodeLogPublishingConfiguration' 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', 'nodeLogPublishingConfiguration_fabric' - Configuration properties for logging events associated with a node that
-- is owned by a member of a Managed Blockchain network using the
-- Hyperledger Fabric framework.
newNodeLogPublishingConfiguration ::
  NodeLogPublishingConfiguration
newNodeLogPublishingConfiguration :: NodeLogPublishingConfiguration
newNodeLogPublishingConfiguration =
  NodeLogPublishingConfiguration' :: Maybe NodeFabricLogPublishingConfiguration
-> NodeLogPublishingConfiguration
NodeLogPublishingConfiguration'
    { $sel:fabric:NodeLogPublishingConfiguration' :: Maybe NodeFabricLogPublishingConfiguration
fabric =
        Maybe NodeFabricLogPublishingConfiguration
forall a. Maybe a
Prelude.Nothing
    }

-- | Configuration properties for logging events associated with a node that
-- is owned by a member of a Managed Blockchain network using the
-- Hyperledger Fabric framework.
nodeLogPublishingConfiguration_fabric :: Lens.Lens' NodeLogPublishingConfiguration (Prelude.Maybe NodeFabricLogPublishingConfiguration)
nodeLogPublishingConfiguration_fabric :: (Maybe NodeFabricLogPublishingConfiguration
 -> f (Maybe NodeFabricLogPublishingConfiguration))
-> NodeLogPublishingConfiguration
-> f NodeLogPublishingConfiguration
nodeLogPublishingConfiguration_fabric = (NodeLogPublishingConfiguration
 -> Maybe NodeFabricLogPublishingConfiguration)
-> (NodeLogPublishingConfiguration
    -> Maybe NodeFabricLogPublishingConfiguration
    -> NodeLogPublishingConfiguration)
-> Lens
     NodeLogPublishingConfiguration
     NodeLogPublishingConfiguration
     (Maybe NodeFabricLogPublishingConfiguration)
     (Maybe NodeFabricLogPublishingConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodeLogPublishingConfiguration' {Maybe NodeFabricLogPublishingConfiguration
fabric :: Maybe NodeFabricLogPublishingConfiguration
$sel:fabric:NodeLogPublishingConfiguration' :: NodeLogPublishingConfiguration
-> Maybe NodeFabricLogPublishingConfiguration
fabric} -> Maybe NodeFabricLogPublishingConfiguration
fabric) (\s :: NodeLogPublishingConfiguration
s@NodeLogPublishingConfiguration' {} Maybe NodeFabricLogPublishingConfiguration
a -> NodeLogPublishingConfiguration
s {$sel:fabric:NodeLogPublishingConfiguration' :: Maybe NodeFabricLogPublishingConfiguration
fabric = Maybe NodeFabricLogPublishingConfiguration
a} :: NodeLogPublishingConfiguration)

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

instance
  Prelude.Hashable
    NodeLogPublishingConfiguration

instance
  Prelude.NFData
    NodeLogPublishingConfiguration

instance Core.ToJSON NodeLogPublishingConfiguration where
  toJSON :: NodeLogPublishingConfiguration -> Value
toJSON NodeLogPublishingConfiguration' {Maybe NodeFabricLogPublishingConfiguration
fabric :: Maybe NodeFabricLogPublishingConfiguration
$sel:fabric:NodeLogPublishingConfiguration' :: NodeLogPublishingConfiguration
-> Maybe NodeFabricLogPublishingConfiguration
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"Fabric" Text -> NodeFabricLogPublishingConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NodeFabricLogPublishingConfiguration -> Pair)
-> Maybe NodeFabricLogPublishingConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe NodeFabricLogPublishingConfiguration
fabric]
      )