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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Attributes of Hyperledger Fabric for a member in a Managed Blockchain
-- network using the Hyperledger Fabric framework.
--
-- /See:/ 'newMemberFabricAttributes' smart constructor.
data MemberFabricAttributes = MemberFabricAttributes'
  { -- | The endpoint used to access the member\'s certificate authority.
    MemberFabricAttributes -> Maybe Text
caEndpoint :: Prelude.Maybe Prelude.Text,
    -- | The user name for the initial administrator user for the member.
    MemberFabricAttributes -> Maybe Text
adminUsername :: Prelude.Maybe Prelude.Text
  }
  deriving (MemberFabricAttributes -> MemberFabricAttributes -> Bool
(MemberFabricAttributes -> MemberFabricAttributes -> Bool)
-> (MemberFabricAttributes -> MemberFabricAttributes -> Bool)
-> Eq MemberFabricAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MemberFabricAttributes -> MemberFabricAttributes -> Bool
$c/= :: MemberFabricAttributes -> MemberFabricAttributes -> Bool
== :: MemberFabricAttributes -> MemberFabricAttributes -> Bool
$c== :: MemberFabricAttributes -> MemberFabricAttributes -> Bool
Prelude.Eq, ReadPrec [MemberFabricAttributes]
ReadPrec MemberFabricAttributes
Int -> ReadS MemberFabricAttributes
ReadS [MemberFabricAttributes]
(Int -> ReadS MemberFabricAttributes)
-> ReadS [MemberFabricAttributes]
-> ReadPrec MemberFabricAttributes
-> ReadPrec [MemberFabricAttributes]
-> Read MemberFabricAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MemberFabricAttributes]
$creadListPrec :: ReadPrec [MemberFabricAttributes]
readPrec :: ReadPrec MemberFabricAttributes
$creadPrec :: ReadPrec MemberFabricAttributes
readList :: ReadS [MemberFabricAttributes]
$creadList :: ReadS [MemberFabricAttributes]
readsPrec :: Int -> ReadS MemberFabricAttributes
$creadsPrec :: Int -> ReadS MemberFabricAttributes
Prelude.Read, Int -> MemberFabricAttributes -> ShowS
[MemberFabricAttributes] -> ShowS
MemberFabricAttributes -> String
(Int -> MemberFabricAttributes -> ShowS)
-> (MemberFabricAttributes -> String)
-> ([MemberFabricAttributes] -> ShowS)
-> Show MemberFabricAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MemberFabricAttributes] -> ShowS
$cshowList :: [MemberFabricAttributes] -> ShowS
show :: MemberFabricAttributes -> String
$cshow :: MemberFabricAttributes -> String
showsPrec :: Int -> MemberFabricAttributes -> ShowS
$cshowsPrec :: Int -> MemberFabricAttributes -> ShowS
Prelude.Show, (forall x. MemberFabricAttributes -> Rep MemberFabricAttributes x)
-> (forall x.
    Rep MemberFabricAttributes x -> MemberFabricAttributes)
-> Generic MemberFabricAttributes
forall x. Rep MemberFabricAttributes x -> MemberFabricAttributes
forall x. MemberFabricAttributes -> Rep MemberFabricAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MemberFabricAttributes x -> MemberFabricAttributes
$cfrom :: forall x. MemberFabricAttributes -> Rep MemberFabricAttributes x
Prelude.Generic)

-- |
-- Create a value of 'MemberFabricAttributes' 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:
--
-- 'caEndpoint', 'memberFabricAttributes_caEndpoint' - The endpoint used to access the member\'s certificate authority.
--
-- 'adminUsername', 'memberFabricAttributes_adminUsername' - The user name for the initial administrator user for the member.
newMemberFabricAttributes ::
  MemberFabricAttributes
newMemberFabricAttributes :: MemberFabricAttributes
newMemberFabricAttributes =
  MemberFabricAttributes' :: Maybe Text -> Maybe Text -> MemberFabricAttributes
MemberFabricAttributes'
    { $sel:caEndpoint:MemberFabricAttributes' :: Maybe Text
caEndpoint =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:adminUsername:MemberFabricAttributes' :: Maybe Text
adminUsername = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The endpoint used to access the member\'s certificate authority.
memberFabricAttributes_caEndpoint :: Lens.Lens' MemberFabricAttributes (Prelude.Maybe Prelude.Text)
memberFabricAttributes_caEndpoint :: (Maybe Text -> f (Maybe Text))
-> MemberFabricAttributes -> f MemberFabricAttributes
memberFabricAttributes_caEndpoint = (MemberFabricAttributes -> Maybe Text)
-> (MemberFabricAttributes -> Maybe Text -> MemberFabricAttributes)
-> Lens
     MemberFabricAttributes
     MemberFabricAttributes
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MemberFabricAttributes' {Maybe Text
caEndpoint :: Maybe Text
$sel:caEndpoint:MemberFabricAttributes' :: MemberFabricAttributes -> Maybe Text
caEndpoint} -> Maybe Text
caEndpoint) (\s :: MemberFabricAttributes
s@MemberFabricAttributes' {} Maybe Text
a -> MemberFabricAttributes
s {$sel:caEndpoint:MemberFabricAttributes' :: Maybe Text
caEndpoint = Maybe Text
a} :: MemberFabricAttributes)

-- | The user name for the initial administrator user for the member.
memberFabricAttributes_adminUsername :: Lens.Lens' MemberFabricAttributes (Prelude.Maybe Prelude.Text)
memberFabricAttributes_adminUsername :: (Maybe Text -> f (Maybe Text))
-> MemberFabricAttributes -> f MemberFabricAttributes
memberFabricAttributes_adminUsername = (MemberFabricAttributes -> Maybe Text)
-> (MemberFabricAttributes -> Maybe Text -> MemberFabricAttributes)
-> Lens
     MemberFabricAttributes
     MemberFabricAttributes
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MemberFabricAttributes' {Maybe Text
adminUsername :: Maybe Text
$sel:adminUsername:MemberFabricAttributes' :: MemberFabricAttributes -> Maybe Text
adminUsername} -> Maybe Text
adminUsername) (\s :: MemberFabricAttributes
s@MemberFabricAttributes' {} Maybe Text
a -> MemberFabricAttributes
s {$sel:adminUsername:MemberFabricAttributes' :: Maybe Text
adminUsername = Maybe Text
a} :: MemberFabricAttributes)

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

instance Prelude.Hashable MemberFabricAttributes

instance Prelude.NFData MemberFabricAttributes