{-# 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 #-}
module Amazonka.Chime.Types.Credential where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Credential = Credential'
{
Credential -> Maybe (Sensitive Text)
username :: Prelude.Maybe (Core.Sensitive Prelude.Text),
Credential -> Maybe (Sensitive Text)
password :: Prelude.Maybe (Core.Sensitive Prelude.Text)
}
deriving (Credential -> Credential -> Bool
(Credential -> Credential -> Bool)
-> (Credential -> Credential -> Bool) -> Eq Credential
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Credential -> Credential -> Bool
$c/= :: Credential -> Credential -> Bool
== :: Credential -> Credential -> Bool
$c== :: Credential -> Credential -> Bool
Prelude.Eq, Int -> Credential -> ShowS
[Credential] -> ShowS
Credential -> String
(Int -> Credential -> ShowS)
-> (Credential -> String)
-> ([Credential] -> ShowS)
-> Show Credential
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Credential] -> ShowS
$cshowList :: [Credential] -> ShowS
show :: Credential -> String
$cshow :: Credential -> String
showsPrec :: Int -> Credential -> ShowS
$cshowsPrec :: Int -> Credential -> ShowS
Prelude.Show, (forall x. Credential -> Rep Credential x)
-> (forall x. Rep Credential x -> Credential) -> Generic Credential
forall x. Rep Credential x -> Credential
forall x. Credential -> Rep Credential x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Credential x -> Credential
$cfrom :: forall x. Credential -> Rep Credential x
Prelude.Generic)
newCredential ::
Credential
newCredential :: Credential
newCredential =
Credential' :: Maybe (Sensitive Text) -> Maybe (Sensitive Text) -> Credential
Credential'
{ $sel:username:Credential' :: Maybe (Sensitive Text)
username = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
$sel:password:Credential' :: Maybe (Sensitive Text)
password = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing
}
credential_username :: Lens.Lens' Credential (Prelude.Maybe Prelude.Text)
credential_username :: (Maybe Text -> f (Maybe Text)) -> Credential -> f Credential
credential_username = (Credential -> Maybe (Sensitive Text))
-> (Credential -> Maybe (Sensitive Text) -> Credential)
-> Lens
Credential
Credential
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Credential' {Maybe (Sensitive Text)
username :: Maybe (Sensitive Text)
$sel:username:Credential' :: Credential -> Maybe (Sensitive Text)
username} -> Maybe (Sensitive Text)
username) (\s :: Credential
s@Credential' {} Maybe (Sensitive Text)
a -> Credential
s {$sel:username:Credential' :: Maybe (Sensitive Text)
username = Maybe (Sensitive Text)
a} :: Credential) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> Credential -> f Credential)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> Credential
-> f Credential
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
(Maybe Text)
(Maybe Text)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive
credential_password :: Lens.Lens' Credential (Prelude.Maybe Prelude.Text)
credential_password :: (Maybe Text -> f (Maybe Text)) -> Credential -> f Credential
credential_password = (Credential -> Maybe (Sensitive Text))
-> (Credential -> Maybe (Sensitive Text) -> Credential)
-> Lens
Credential
Credential
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Credential' {Maybe (Sensitive Text)
password :: Maybe (Sensitive Text)
$sel:password:Credential' :: Credential -> Maybe (Sensitive Text)
password} -> Maybe (Sensitive Text)
password) (\s :: Credential
s@Credential' {} Maybe (Sensitive Text)
a -> Credential
s {$sel:password:Credential' :: Maybe (Sensitive Text)
password = Maybe (Sensitive Text)
a} :: Credential) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> Credential -> f Credential)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> Credential
-> f Credential
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
(Maybe Text)
(Maybe Text)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive
instance Prelude.Hashable Credential
instance Prelude.NFData Credential
instance Core.ToJSON Credential where
toJSON :: Credential -> Value
toJSON Credential' {Maybe (Sensitive Text)
password :: Maybe (Sensitive Text)
username :: Maybe (Sensitive Text)
$sel:password:Credential' :: Credential -> Maybe (Sensitive Text)
$sel:username:Credential' :: Credential -> Maybe (Sensitive Text)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Username" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
username,
(Text
"Password" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
password
]
)