{-# 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.CognitoIdentity.Types.Credentials where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Credentials = Credentials'
{
Credentials -> Maybe Text
sessionToken :: Prelude.Maybe Prelude.Text,
Credentials -> Maybe POSIX
expiration :: Prelude.Maybe Core.POSIX,
Credentials -> Maybe Text
secretKey :: Prelude.Maybe Prelude.Text,
Credentials -> Maybe Text
accessKeyId :: Prelude.Maybe Prelude.Text
}
deriving (Credentials -> Credentials -> Bool
(Credentials -> Credentials -> Bool)
-> (Credentials -> Credentials -> Bool) -> Eq Credentials
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Credentials -> Credentials -> Bool
$c/= :: Credentials -> Credentials -> Bool
== :: Credentials -> Credentials -> Bool
$c== :: Credentials -> Credentials -> Bool
Prelude.Eq, ReadPrec [Credentials]
ReadPrec Credentials
Int -> ReadS Credentials
ReadS [Credentials]
(Int -> ReadS Credentials)
-> ReadS [Credentials]
-> ReadPrec Credentials
-> ReadPrec [Credentials]
-> Read Credentials
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Credentials]
$creadListPrec :: ReadPrec [Credentials]
readPrec :: ReadPrec Credentials
$creadPrec :: ReadPrec Credentials
readList :: ReadS [Credentials]
$creadList :: ReadS [Credentials]
readsPrec :: Int -> ReadS Credentials
$creadsPrec :: Int -> ReadS Credentials
Prelude.Read, Int -> Credentials -> ShowS
[Credentials] -> ShowS
Credentials -> String
(Int -> Credentials -> ShowS)
-> (Credentials -> String)
-> ([Credentials] -> ShowS)
-> Show Credentials
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Credentials] -> ShowS
$cshowList :: [Credentials] -> ShowS
show :: Credentials -> String
$cshow :: Credentials -> String
showsPrec :: Int -> Credentials -> ShowS
$cshowsPrec :: Int -> Credentials -> ShowS
Prelude.Show, (forall x. Credentials -> Rep Credentials x)
-> (forall x. Rep Credentials x -> Credentials)
-> Generic Credentials
forall x. Rep Credentials x -> Credentials
forall x. Credentials -> Rep Credentials x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Credentials x -> Credentials
$cfrom :: forall x. Credentials -> Rep Credentials x
Prelude.Generic)
newCredentials ::
Credentials
newCredentials :: Credentials
newCredentials =
Credentials' :: Maybe Text
-> Maybe POSIX -> Maybe Text -> Maybe Text -> Credentials
Credentials'
{ $sel:sessionToken:Credentials' :: Maybe Text
sessionToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:expiration:Credentials' :: Maybe POSIX
expiration = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:secretKey:Credentials' :: Maybe Text
secretKey = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:accessKeyId:Credentials' :: Maybe Text
accessKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
credentials_sessionToken :: Lens.Lens' Credentials (Prelude.Maybe Prelude.Text)
credentials_sessionToken :: (Maybe Text -> f (Maybe Text)) -> Credentials -> f Credentials
credentials_sessionToken = (Credentials -> Maybe Text)
-> (Credentials -> Maybe Text -> Credentials)
-> Lens Credentials Credentials (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Credentials' {Maybe Text
sessionToken :: Maybe Text
$sel:sessionToken:Credentials' :: Credentials -> Maybe Text
sessionToken} -> Maybe Text
sessionToken) (\s :: Credentials
s@Credentials' {} Maybe Text
a -> Credentials
s {$sel:sessionToken:Credentials' :: Maybe Text
sessionToken = Maybe Text
a} :: Credentials)
credentials_expiration :: Lens.Lens' Credentials (Prelude.Maybe Prelude.UTCTime)
credentials_expiration :: (Maybe UTCTime -> f (Maybe UTCTime))
-> Credentials -> f Credentials
credentials_expiration = (Credentials -> Maybe POSIX)
-> (Credentials -> Maybe POSIX -> Credentials)
-> Lens Credentials Credentials (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Credentials' {Maybe POSIX
expiration :: Maybe POSIX
$sel:expiration:Credentials' :: Credentials -> Maybe POSIX
expiration} -> Maybe POSIX
expiration) (\s :: Credentials
s@Credentials' {} Maybe POSIX
a -> Credentials
s {$sel:expiration:Credentials' :: Maybe POSIX
expiration = Maybe POSIX
a} :: Credentials) ((Maybe POSIX -> f (Maybe POSIX)) -> Credentials -> f Credentials)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Credentials
-> f Credentials
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
credentials_secretKey :: Lens.Lens' Credentials (Prelude.Maybe Prelude.Text)
credentials_secretKey :: (Maybe Text -> f (Maybe Text)) -> Credentials -> f Credentials
credentials_secretKey = (Credentials -> Maybe Text)
-> (Credentials -> Maybe Text -> Credentials)
-> Lens Credentials Credentials (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Credentials' {Maybe Text
secretKey :: Maybe Text
$sel:secretKey:Credentials' :: Credentials -> Maybe Text
secretKey} -> Maybe Text
secretKey) (\s :: Credentials
s@Credentials' {} Maybe Text
a -> Credentials
s {$sel:secretKey:Credentials' :: Maybe Text
secretKey = Maybe Text
a} :: Credentials)
credentials_accessKeyId :: Lens.Lens' Credentials (Prelude.Maybe Prelude.Text)
credentials_accessKeyId :: (Maybe Text -> f (Maybe Text)) -> Credentials -> f Credentials
credentials_accessKeyId = (Credentials -> Maybe Text)
-> (Credentials -> Maybe Text -> Credentials)
-> Lens Credentials Credentials (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Credentials' {Maybe Text
accessKeyId :: Maybe Text
$sel:accessKeyId:Credentials' :: Credentials -> Maybe Text
accessKeyId} -> Maybe Text
accessKeyId) (\s :: Credentials
s@Credentials' {} Maybe Text
a -> Credentials
s {$sel:accessKeyId:Credentials' :: Maybe Text
accessKeyId = Maybe Text
a} :: Credentials)
instance Core.FromJSON Credentials where
parseJSON :: Value -> Parser Credentials
parseJSON =
String
-> (Object -> Parser Credentials) -> Value -> Parser Credentials
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Credentials"
( \Object
x ->
Maybe Text
-> Maybe POSIX -> Maybe Text -> Maybe Text -> Credentials
Credentials'
(Maybe Text
-> Maybe POSIX -> Maybe Text -> Maybe Text -> Credentials)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe Text -> Maybe Text -> Credentials)
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
"SessionToken")
Parser (Maybe POSIX -> Maybe Text -> Maybe Text -> Credentials)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> Maybe Text -> Credentials)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Expiration")
Parser (Maybe Text -> Maybe Text -> Credentials)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Credentials)
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
"SecretKey")
Parser (Maybe Text -> Credentials)
-> Parser (Maybe Text) -> Parser Credentials
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
"AccessKeyId")
)
instance Prelude.Hashable Credentials
instance Prelude.NFData Credentials