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

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

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

-- |
-- Create a value of 'MemberLogPublishingConfiguration' 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', 'memberLogPublishingConfiguration_fabric' - Configuration properties for logging events associated with a member of
-- a Managed Blockchain network using the Hyperledger Fabric framework.
newMemberLogPublishingConfiguration ::
  MemberLogPublishingConfiguration
newMemberLogPublishingConfiguration :: MemberLogPublishingConfiguration
newMemberLogPublishingConfiguration =
  MemberLogPublishingConfiguration' :: Maybe MemberFabricLogPublishingConfiguration
-> MemberLogPublishingConfiguration
MemberLogPublishingConfiguration'
    { $sel:fabric:MemberLogPublishingConfiguration' :: Maybe MemberFabricLogPublishingConfiguration
fabric =
        Maybe MemberFabricLogPublishingConfiguration
forall a. Maybe a
Prelude.Nothing
    }

-- | Configuration properties for logging events associated with a member of
-- a Managed Blockchain network using the Hyperledger Fabric framework.
memberLogPublishingConfiguration_fabric :: Lens.Lens' MemberLogPublishingConfiguration (Prelude.Maybe MemberFabricLogPublishingConfiguration)
memberLogPublishingConfiguration_fabric :: (Maybe MemberFabricLogPublishingConfiguration
 -> f (Maybe MemberFabricLogPublishingConfiguration))
-> MemberLogPublishingConfiguration
-> f MemberLogPublishingConfiguration
memberLogPublishingConfiguration_fabric = (MemberLogPublishingConfiguration
 -> Maybe MemberFabricLogPublishingConfiguration)
-> (MemberLogPublishingConfiguration
    -> Maybe MemberFabricLogPublishingConfiguration
    -> MemberLogPublishingConfiguration)
-> Lens
     MemberLogPublishingConfiguration
     MemberLogPublishingConfiguration
     (Maybe MemberFabricLogPublishingConfiguration)
     (Maybe MemberFabricLogPublishingConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MemberLogPublishingConfiguration' {Maybe MemberFabricLogPublishingConfiguration
fabric :: Maybe MemberFabricLogPublishingConfiguration
$sel:fabric:MemberLogPublishingConfiguration' :: MemberLogPublishingConfiguration
-> Maybe MemberFabricLogPublishingConfiguration
fabric} -> Maybe MemberFabricLogPublishingConfiguration
fabric) (\s :: MemberLogPublishingConfiguration
s@MemberLogPublishingConfiguration' {} Maybe MemberFabricLogPublishingConfiguration
a -> MemberLogPublishingConfiguration
s {$sel:fabric:MemberLogPublishingConfiguration' :: Maybe MemberFabricLogPublishingConfiguration
fabric = Maybe MemberFabricLogPublishingConfiguration
a} :: MemberLogPublishingConfiguration)

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

instance
  Prelude.Hashable
    MemberLogPublishingConfiguration

instance
  Prelude.NFData
    MemberLogPublishingConfiguration

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