{-# 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.QuickSight.Types.CredentialPair where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.QuickSight.Types.DataSourceParameters
data CredentialPair = CredentialPair'
{
CredentialPair -> Maybe (NonEmpty DataSourceParameters)
alternateDataSourceParameters :: Prelude.Maybe (Prelude.NonEmpty DataSourceParameters),
CredentialPair -> Text
username :: Prelude.Text,
CredentialPair -> Text
password :: Prelude.Text
}
deriving (CredentialPair -> CredentialPair -> Bool
(CredentialPair -> CredentialPair -> Bool)
-> (CredentialPair -> CredentialPair -> Bool) -> Eq CredentialPair
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CredentialPair -> CredentialPair -> Bool
$c/= :: CredentialPair -> CredentialPair -> Bool
== :: CredentialPair -> CredentialPair -> Bool
$c== :: CredentialPair -> CredentialPair -> Bool
Prelude.Eq, ReadPrec [CredentialPair]
ReadPrec CredentialPair
Int -> ReadS CredentialPair
ReadS [CredentialPair]
(Int -> ReadS CredentialPair)
-> ReadS [CredentialPair]
-> ReadPrec CredentialPair
-> ReadPrec [CredentialPair]
-> Read CredentialPair
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CredentialPair]
$creadListPrec :: ReadPrec [CredentialPair]
readPrec :: ReadPrec CredentialPair
$creadPrec :: ReadPrec CredentialPair
readList :: ReadS [CredentialPair]
$creadList :: ReadS [CredentialPair]
readsPrec :: Int -> ReadS CredentialPair
$creadsPrec :: Int -> ReadS CredentialPair
Prelude.Read, Int -> CredentialPair -> ShowS
[CredentialPair] -> ShowS
CredentialPair -> String
(Int -> CredentialPair -> ShowS)
-> (CredentialPair -> String)
-> ([CredentialPair] -> ShowS)
-> Show CredentialPair
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CredentialPair] -> ShowS
$cshowList :: [CredentialPair] -> ShowS
show :: CredentialPair -> String
$cshow :: CredentialPair -> String
showsPrec :: Int -> CredentialPair -> ShowS
$cshowsPrec :: Int -> CredentialPair -> ShowS
Prelude.Show, (forall x. CredentialPair -> Rep CredentialPair x)
-> (forall x. Rep CredentialPair x -> CredentialPair)
-> Generic CredentialPair
forall x. Rep CredentialPair x -> CredentialPair
forall x. CredentialPair -> Rep CredentialPair x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CredentialPair x -> CredentialPair
$cfrom :: forall x. CredentialPair -> Rep CredentialPair x
Prelude.Generic)
newCredentialPair ::
Prelude.Text ->
Prelude.Text ->
CredentialPair
newCredentialPair :: Text -> Text -> CredentialPair
newCredentialPair Text
pUsername_ Text
pPassword_ =
CredentialPair' :: Maybe (NonEmpty DataSourceParameters)
-> Text -> Text -> CredentialPair
CredentialPair'
{ $sel:alternateDataSourceParameters:CredentialPair' :: Maybe (NonEmpty DataSourceParameters)
alternateDataSourceParameters =
Maybe (NonEmpty DataSourceParameters)
forall a. Maybe a
Prelude.Nothing,
$sel:username:CredentialPair' :: Text
username = Text
pUsername_,
$sel:password:CredentialPair' :: Text
password = Text
pPassword_
}
credentialPair_alternateDataSourceParameters :: Lens.Lens' CredentialPair (Prelude.Maybe (Prelude.NonEmpty DataSourceParameters))
credentialPair_alternateDataSourceParameters :: (Maybe (NonEmpty DataSourceParameters)
-> f (Maybe (NonEmpty DataSourceParameters)))
-> CredentialPair -> f CredentialPair
credentialPair_alternateDataSourceParameters = (CredentialPair -> Maybe (NonEmpty DataSourceParameters))
-> (CredentialPair
-> Maybe (NonEmpty DataSourceParameters) -> CredentialPair)
-> Lens
CredentialPair
CredentialPair
(Maybe (NonEmpty DataSourceParameters))
(Maybe (NonEmpty DataSourceParameters))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CredentialPair' {Maybe (NonEmpty DataSourceParameters)
alternateDataSourceParameters :: Maybe (NonEmpty DataSourceParameters)
$sel:alternateDataSourceParameters:CredentialPair' :: CredentialPair -> Maybe (NonEmpty DataSourceParameters)
alternateDataSourceParameters} -> Maybe (NonEmpty DataSourceParameters)
alternateDataSourceParameters) (\s :: CredentialPair
s@CredentialPair' {} Maybe (NonEmpty DataSourceParameters)
a -> CredentialPair
s {$sel:alternateDataSourceParameters:CredentialPair' :: Maybe (NonEmpty DataSourceParameters)
alternateDataSourceParameters = Maybe (NonEmpty DataSourceParameters)
a} :: CredentialPair) ((Maybe (NonEmpty DataSourceParameters)
-> f (Maybe (NonEmpty DataSourceParameters)))
-> CredentialPair -> f CredentialPair)
-> ((Maybe (NonEmpty DataSourceParameters)
-> f (Maybe (NonEmpty DataSourceParameters)))
-> Maybe (NonEmpty DataSourceParameters)
-> f (Maybe (NonEmpty DataSourceParameters)))
-> (Maybe (NonEmpty DataSourceParameters)
-> f (Maybe (NonEmpty DataSourceParameters)))
-> CredentialPair
-> f CredentialPair
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(NonEmpty DataSourceParameters)
(NonEmpty DataSourceParameters)
(NonEmpty DataSourceParameters)
(NonEmpty DataSourceParameters)
-> Iso
(Maybe (NonEmpty DataSourceParameters))
(Maybe (NonEmpty DataSourceParameters))
(Maybe (NonEmpty DataSourceParameters))
(Maybe (NonEmpty DataSourceParameters))
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
(NonEmpty DataSourceParameters)
(NonEmpty DataSourceParameters)
(NonEmpty DataSourceParameters)
(NonEmpty DataSourceParameters)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
credentialPair_username :: Lens.Lens' CredentialPair Prelude.Text
credentialPair_username :: (Text -> f Text) -> CredentialPair -> f CredentialPair
credentialPair_username = (CredentialPair -> Text)
-> (CredentialPair -> Text -> CredentialPair)
-> Lens CredentialPair CredentialPair Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CredentialPair' {Text
username :: Text
$sel:username:CredentialPair' :: CredentialPair -> Text
username} -> Text
username) (\s :: CredentialPair
s@CredentialPair' {} Text
a -> CredentialPair
s {$sel:username:CredentialPair' :: Text
username = Text
a} :: CredentialPair)
credentialPair_password :: Lens.Lens' CredentialPair Prelude.Text
credentialPair_password :: (Text -> f Text) -> CredentialPair -> f CredentialPair
credentialPair_password = (CredentialPair -> Text)
-> (CredentialPair -> Text -> CredentialPair)
-> Lens CredentialPair CredentialPair Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CredentialPair' {Text
password :: Text
$sel:password:CredentialPair' :: CredentialPair -> Text
password} -> Text
password) (\s :: CredentialPair
s@CredentialPair' {} Text
a -> CredentialPair
s {$sel:password:CredentialPair' :: Text
password = Text
a} :: CredentialPair)
instance Prelude.Hashable CredentialPair
instance Prelude.NFData CredentialPair
instance Core.ToJSON CredentialPair where
toJSON :: CredentialPair -> Value
toJSON CredentialPair' {Maybe (NonEmpty DataSourceParameters)
Text
password :: Text
username :: Text
alternateDataSourceParameters :: Maybe (NonEmpty DataSourceParameters)
$sel:password:CredentialPair' :: CredentialPair -> Text
$sel:username:CredentialPair' :: CredentialPair -> Text
$sel:alternateDataSourceParameters:CredentialPair' :: CredentialPair -> Maybe (NonEmpty DataSourceParameters)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"AlternateDataSourceParameters" Text -> NonEmpty DataSourceParameters -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(NonEmpty DataSourceParameters -> Pair)
-> Maybe (NonEmpty DataSourceParameters) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty DataSourceParameters)
alternateDataSourceParameters,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Username" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
username),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Password" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
password)
]
)