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

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

-- | Configuration properties for Hyperledger Fabric for a member in a
-- Managed Blockchain network using the Hyperledger Fabric framework.
--
-- /See:/ 'newMemberFabricConfiguration' smart constructor.
data MemberFabricConfiguration = MemberFabricConfiguration'
  { -- | The user name for the member\'s initial administrative user.
    MemberFabricConfiguration -> Text
adminUsername :: Prelude.Text,
    -- | The password for the member\'s initial administrative user. The
    -- @AdminPassword@ must be at least eight characters long and no more than
    -- 32 characters. It must contain at least one uppercase letter, one
    -- lowercase letter, and one digit. It cannot have a single quotation mark
    -- (‘), a double quotation marks (“), a forward slash(\/), a backward
    -- slash(\\), \@, or a space.
    MemberFabricConfiguration -> Sensitive Text
adminPassword :: Core.Sensitive Prelude.Text
  }
  deriving (MemberFabricConfiguration -> MemberFabricConfiguration -> Bool
(MemberFabricConfiguration -> MemberFabricConfiguration -> Bool)
-> (MemberFabricConfiguration -> MemberFabricConfiguration -> Bool)
-> Eq MemberFabricConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MemberFabricConfiguration -> MemberFabricConfiguration -> Bool
$c/= :: MemberFabricConfiguration -> MemberFabricConfiguration -> Bool
== :: MemberFabricConfiguration -> MemberFabricConfiguration -> Bool
$c== :: MemberFabricConfiguration -> MemberFabricConfiguration -> Bool
Prelude.Eq, Int -> MemberFabricConfiguration -> ShowS
[MemberFabricConfiguration] -> ShowS
MemberFabricConfiguration -> String
(Int -> MemberFabricConfiguration -> ShowS)
-> (MemberFabricConfiguration -> String)
-> ([MemberFabricConfiguration] -> ShowS)
-> Show MemberFabricConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MemberFabricConfiguration] -> ShowS
$cshowList :: [MemberFabricConfiguration] -> ShowS
show :: MemberFabricConfiguration -> String
$cshow :: MemberFabricConfiguration -> String
showsPrec :: Int -> MemberFabricConfiguration -> ShowS
$cshowsPrec :: Int -> MemberFabricConfiguration -> ShowS
Prelude.Show, (forall x.
 MemberFabricConfiguration -> Rep MemberFabricConfiguration x)
-> (forall x.
    Rep MemberFabricConfiguration x -> MemberFabricConfiguration)
-> Generic MemberFabricConfiguration
forall x.
Rep MemberFabricConfiguration x -> MemberFabricConfiguration
forall x.
MemberFabricConfiguration -> Rep MemberFabricConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MemberFabricConfiguration x -> MemberFabricConfiguration
$cfrom :: forall x.
MemberFabricConfiguration -> Rep MemberFabricConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'MemberFabricConfiguration' 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:
--
-- 'adminUsername', 'memberFabricConfiguration_adminUsername' - The user name for the member\'s initial administrative user.
--
-- 'adminPassword', 'memberFabricConfiguration_adminPassword' - The password for the member\'s initial administrative user. The
-- @AdminPassword@ must be at least eight characters long and no more than
-- 32 characters. It must contain at least one uppercase letter, one
-- lowercase letter, and one digit. It cannot have a single quotation mark
-- (‘), a double quotation marks (“), a forward slash(\/), a backward
-- slash(\\), \@, or a space.
newMemberFabricConfiguration ::
  -- | 'adminUsername'
  Prelude.Text ->
  -- | 'adminPassword'
  Prelude.Text ->
  MemberFabricConfiguration
newMemberFabricConfiguration :: Text -> Text -> MemberFabricConfiguration
newMemberFabricConfiguration
  Text
pAdminUsername_
  Text
pAdminPassword_ =
    MemberFabricConfiguration' :: Text -> Sensitive Text -> MemberFabricConfiguration
MemberFabricConfiguration'
      { $sel:adminUsername:MemberFabricConfiguration' :: Text
adminUsername =
          Text
pAdminUsername_,
        $sel:adminPassword:MemberFabricConfiguration' :: Sensitive Text
adminPassword =
          Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
 -> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pAdminPassword_
      }

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

-- | The password for the member\'s initial administrative user. The
-- @AdminPassword@ must be at least eight characters long and no more than
-- 32 characters. It must contain at least one uppercase letter, one
-- lowercase letter, and one digit. It cannot have a single quotation mark
-- (‘), a double quotation marks (“), a forward slash(\/), a backward
-- slash(\\), \@, or a space.
memberFabricConfiguration_adminPassword :: Lens.Lens' MemberFabricConfiguration Prelude.Text
memberFabricConfiguration_adminPassword :: (Text -> f Text)
-> MemberFabricConfiguration -> f MemberFabricConfiguration
memberFabricConfiguration_adminPassword = (MemberFabricConfiguration -> Sensitive Text)
-> (MemberFabricConfiguration
    -> Sensitive Text -> MemberFabricConfiguration)
-> Lens
     MemberFabricConfiguration
     MemberFabricConfiguration
     (Sensitive Text)
     (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MemberFabricConfiguration' {Sensitive Text
adminPassword :: Sensitive Text
$sel:adminPassword:MemberFabricConfiguration' :: MemberFabricConfiguration -> Sensitive Text
adminPassword} -> Sensitive Text
adminPassword) (\s :: MemberFabricConfiguration
s@MemberFabricConfiguration' {} Sensitive Text
a -> MemberFabricConfiguration
s {$sel:adminPassword:MemberFabricConfiguration' :: Sensitive Text
adminPassword = Sensitive Text
a} :: MemberFabricConfiguration) ((Sensitive Text -> f (Sensitive Text))
 -> MemberFabricConfiguration -> f MemberFabricConfiguration)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> MemberFabricConfiguration
-> f MemberFabricConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive

instance Prelude.Hashable MemberFabricConfiguration

instance Prelude.NFData MemberFabricConfiguration

instance Core.ToJSON MemberFabricConfiguration where
  toJSON :: MemberFabricConfiguration -> Value
toJSON MemberFabricConfiguration' {Text
Sensitive Text
adminPassword :: Sensitive Text
adminUsername :: Text
$sel:adminPassword:MemberFabricConfiguration' :: MemberFabricConfiguration -> Sensitive Text
$sel:adminUsername:MemberFabricConfiguration' :: MemberFabricConfiguration -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"AdminUsername" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
adminUsername),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"AdminPassword" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
adminPassword)
          ]
      )