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

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

-- | Configuration properties for logging events associated with a member of
-- a Managed Blockchain network using the Hyperledger Fabric framework.
--
-- /See:/ 'newMemberFabricLogPublishingConfiguration' smart constructor.
data MemberFabricLogPublishingConfiguration = MemberFabricLogPublishingConfiguration'
  { -- | Configuration properties for logging events associated with a member\'s
    -- Certificate Authority (CA). CA logs help you determine when a member in
    -- your account joins the network, or when new peers register with a member
    -- CA.
    MemberFabricLogPublishingConfiguration -> Maybe LogConfigurations
caLogs :: Prelude.Maybe LogConfigurations
  }
  deriving (MemberFabricLogPublishingConfiguration
-> MemberFabricLogPublishingConfiguration -> Bool
(MemberFabricLogPublishingConfiguration
 -> MemberFabricLogPublishingConfiguration -> Bool)
-> (MemberFabricLogPublishingConfiguration
    -> MemberFabricLogPublishingConfiguration -> Bool)
-> Eq MemberFabricLogPublishingConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MemberFabricLogPublishingConfiguration
-> MemberFabricLogPublishingConfiguration -> Bool
$c/= :: MemberFabricLogPublishingConfiguration
-> MemberFabricLogPublishingConfiguration -> Bool
== :: MemberFabricLogPublishingConfiguration
-> MemberFabricLogPublishingConfiguration -> Bool
$c== :: MemberFabricLogPublishingConfiguration
-> MemberFabricLogPublishingConfiguration -> Bool
Prelude.Eq, ReadPrec [MemberFabricLogPublishingConfiguration]
ReadPrec MemberFabricLogPublishingConfiguration
Int -> ReadS MemberFabricLogPublishingConfiguration
ReadS [MemberFabricLogPublishingConfiguration]
(Int -> ReadS MemberFabricLogPublishingConfiguration)
-> ReadS [MemberFabricLogPublishingConfiguration]
-> ReadPrec MemberFabricLogPublishingConfiguration
-> ReadPrec [MemberFabricLogPublishingConfiguration]
-> Read MemberFabricLogPublishingConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MemberFabricLogPublishingConfiguration]
$creadListPrec :: ReadPrec [MemberFabricLogPublishingConfiguration]
readPrec :: ReadPrec MemberFabricLogPublishingConfiguration
$creadPrec :: ReadPrec MemberFabricLogPublishingConfiguration
readList :: ReadS [MemberFabricLogPublishingConfiguration]
$creadList :: ReadS [MemberFabricLogPublishingConfiguration]
readsPrec :: Int -> ReadS MemberFabricLogPublishingConfiguration
$creadsPrec :: Int -> ReadS MemberFabricLogPublishingConfiguration
Prelude.Read, Int -> MemberFabricLogPublishingConfiguration -> ShowS
[MemberFabricLogPublishingConfiguration] -> ShowS
MemberFabricLogPublishingConfiguration -> String
(Int -> MemberFabricLogPublishingConfiguration -> ShowS)
-> (MemberFabricLogPublishingConfiguration -> String)
-> ([MemberFabricLogPublishingConfiguration] -> ShowS)
-> Show MemberFabricLogPublishingConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MemberFabricLogPublishingConfiguration] -> ShowS
$cshowList :: [MemberFabricLogPublishingConfiguration] -> ShowS
show :: MemberFabricLogPublishingConfiguration -> String
$cshow :: MemberFabricLogPublishingConfiguration -> String
showsPrec :: Int -> MemberFabricLogPublishingConfiguration -> ShowS
$cshowsPrec :: Int -> MemberFabricLogPublishingConfiguration -> ShowS
Prelude.Show, (forall x.
 MemberFabricLogPublishingConfiguration
 -> Rep MemberFabricLogPublishingConfiguration x)
-> (forall x.
    Rep MemberFabricLogPublishingConfiguration x
    -> MemberFabricLogPublishingConfiguration)
-> Generic MemberFabricLogPublishingConfiguration
forall x.
Rep MemberFabricLogPublishingConfiguration x
-> MemberFabricLogPublishingConfiguration
forall x.
MemberFabricLogPublishingConfiguration
-> Rep MemberFabricLogPublishingConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MemberFabricLogPublishingConfiguration x
-> MemberFabricLogPublishingConfiguration
$cfrom :: forall x.
MemberFabricLogPublishingConfiguration
-> Rep MemberFabricLogPublishingConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'MemberFabricLogPublishingConfiguration' 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:
--
-- 'caLogs', 'memberFabricLogPublishingConfiguration_caLogs' - Configuration properties for logging events associated with a member\'s
-- Certificate Authority (CA). CA logs help you determine when a member in
-- your account joins the network, or when new peers register with a member
-- CA.
newMemberFabricLogPublishingConfiguration ::
  MemberFabricLogPublishingConfiguration
newMemberFabricLogPublishingConfiguration :: MemberFabricLogPublishingConfiguration
newMemberFabricLogPublishingConfiguration =
  MemberFabricLogPublishingConfiguration' :: Maybe LogConfigurations -> MemberFabricLogPublishingConfiguration
MemberFabricLogPublishingConfiguration'
    { $sel:caLogs:MemberFabricLogPublishingConfiguration' :: Maybe LogConfigurations
caLogs =
        Maybe LogConfigurations
forall a. Maybe a
Prelude.Nothing
    }

-- | Configuration properties for logging events associated with a member\'s
-- Certificate Authority (CA). CA logs help you determine when a member in
-- your account joins the network, or when new peers register with a member
-- CA.
memberFabricLogPublishingConfiguration_caLogs :: Lens.Lens' MemberFabricLogPublishingConfiguration (Prelude.Maybe LogConfigurations)
memberFabricLogPublishingConfiguration_caLogs :: (Maybe LogConfigurations -> f (Maybe LogConfigurations))
-> MemberFabricLogPublishingConfiguration
-> f MemberFabricLogPublishingConfiguration
memberFabricLogPublishingConfiguration_caLogs = (MemberFabricLogPublishingConfiguration -> Maybe LogConfigurations)
-> (MemberFabricLogPublishingConfiguration
    -> Maybe LogConfigurations
    -> MemberFabricLogPublishingConfiguration)
-> Lens
     MemberFabricLogPublishingConfiguration
     MemberFabricLogPublishingConfiguration
     (Maybe LogConfigurations)
     (Maybe LogConfigurations)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MemberFabricLogPublishingConfiguration' {Maybe LogConfigurations
caLogs :: Maybe LogConfigurations
$sel:caLogs:MemberFabricLogPublishingConfiguration' :: MemberFabricLogPublishingConfiguration -> Maybe LogConfigurations
caLogs} -> Maybe LogConfigurations
caLogs) (\s :: MemberFabricLogPublishingConfiguration
s@MemberFabricLogPublishingConfiguration' {} Maybe LogConfigurations
a -> MemberFabricLogPublishingConfiguration
s {$sel:caLogs:MemberFabricLogPublishingConfiguration' :: Maybe LogConfigurations
caLogs = Maybe LogConfigurations
a} :: MemberFabricLogPublishingConfiguration)

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

instance
  Prelude.Hashable
    MemberFabricLogPublishingConfiguration

instance
  Prelude.NFData
    MemberFabricLogPublishingConfiguration

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