{-# 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.Connect.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 POSIX
accessTokenExpiration :: Prelude.Maybe Core.POSIX,
Credentials -> Maybe (Sensitive Text)
accessToken :: Prelude.Maybe (Core.Sensitive Prelude.Text),
Credentials -> Maybe (Sensitive Text)
refreshToken :: Prelude.Maybe (Core.Sensitive Prelude.Text),
Credentials -> Maybe POSIX
refreshTokenExpiration :: Prelude.Maybe Core.POSIX
}
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, 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 POSIX
-> Maybe (Sensitive Text)
-> Maybe (Sensitive Text)
-> Maybe POSIX
-> Credentials
Credentials'
{ $sel:accessTokenExpiration:Credentials' :: Maybe POSIX
accessTokenExpiration =
Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:accessToken:Credentials' :: Maybe (Sensitive Text)
accessToken = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
$sel:refreshToken:Credentials' :: Maybe (Sensitive Text)
refreshToken = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
$sel:refreshTokenExpiration:Credentials' :: Maybe POSIX
refreshTokenExpiration = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
}
credentials_accessTokenExpiration :: Lens.Lens' Credentials (Prelude.Maybe Prelude.UTCTime)
credentials_accessTokenExpiration :: (Maybe UTCTime -> f (Maybe UTCTime))
-> Credentials -> f Credentials
credentials_accessTokenExpiration = (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
accessTokenExpiration :: Maybe POSIX
$sel:accessTokenExpiration:Credentials' :: Credentials -> Maybe POSIX
accessTokenExpiration} -> Maybe POSIX
accessTokenExpiration) (\s :: Credentials
s@Credentials' {} Maybe POSIX
a -> Credentials
s {$sel:accessTokenExpiration:Credentials' :: Maybe POSIX
accessTokenExpiration = 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_accessToken :: Lens.Lens' Credentials (Prelude.Maybe Prelude.Text)
credentials_accessToken :: (Maybe Text -> f (Maybe Text)) -> Credentials -> f Credentials
credentials_accessToken = (Credentials -> Maybe (Sensitive Text))
-> (Credentials -> Maybe (Sensitive Text) -> Credentials)
-> Lens
Credentials
Credentials
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Credentials' {Maybe (Sensitive Text)
accessToken :: Maybe (Sensitive Text)
$sel:accessToken:Credentials' :: Credentials -> Maybe (Sensitive Text)
accessToken} -> Maybe (Sensitive Text)
accessToken) (\s :: Credentials
s@Credentials' {} Maybe (Sensitive Text)
a -> Credentials
s {$sel:accessToken:Credentials' :: Maybe (Sensitive Text)
accessToken = Maybe (Sensitive Text)
a} :: Credentials) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> Credentials -> f Credentials)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> Credentials
-> f Credentials
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
credentials_refreshToken :: Lens.Lens' Credentials (Prelude.Maybe Prelude.Text)
credentials_refreshToken :: (Maybe Text -> f (Maybe Text)) -> Credentials -> f Credentials
credentials_refreshToken = (Credentials -> Maybe (Sensitive Text))
-> (Credentials -> Maybe (Sensitive Text) -> Credentials)
-> Lens
Credentials
Credentials
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Credentials' {Maybe (Sensitive Text)
refreshToken :: Maybe (Sensitive Text)
$sel:refreshToken:Credentials' :: Credentials -> Maybe (Sensitive Text)
refreshToken} -> Maybe (Sensitive Text)
refreshToken) (\s :: Credentials
s@Credentials' {} Maybe (Sensitive Text)
a -> Credentials
s {$sel:refreshToken:Credentials' :: Maybe (Sensitive Text)
refreshToken = Maybe (Sensitive Text)
a} :: Credentials) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> Credentials -> f Credentials)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> Credentials
-> f Credentials
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
credentials_refreshTokenExpiration :: Lens.Lens' Credentials (Prelude.Maybe Prelude.UTCTime)
credentials_refreshTokenExpiration :: (Maybe UTCTime -> f (Maybe UTCTime))
-> Credentials -> f Credentials
credentials_refreshTokenExpiration = (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
refreshTokenExpiration :: Maybe POSIX
$sel:refreshTokenExpiration:Credentials' :: Credentials -> Maybe POSIX
refreshTokenExpiration} -> Maybe POSIX
refreshTokenExpiration) (\s :: Credentials
s@Credentials' {} Maybe POSIX
a -> Credentials
s {$sel:refreshTokenExpiration:Credentials' :: Maybe POSIX
refreshTokenExpiration = 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
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 POSIX
-> Maybe (Sensitive Text)
-> Maybe (Sensitive Text)
-> Maybe POSIX
-> Credentials
Credentials'
(Maybe POSIX
-> Maybe (Sensitive Text)
-> Maybe (Sensitive Text)
-> Maybe POSIX
-> Credentials)
-> Parser (Maybe POSIX)
-> Parser
(Maybe (Sensitive Text)
-> Maybe (Sensitive Text) -> Maybe POSIX -> Credentials)
forall (f :: * -> *) a b. Functor 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
"AccessTokenExpiration")
Parser
(Maybe (Sensitive Text)
-> Maybe (Sensitive Text) -> Maybe POSIX -> Credentials)
-> Parser (Maybe (Sensitive Text))
-> Parser (Maybe (Sensitive Text) -> Maybe POSIX -> Credentials)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AccessToken")
Parser (Maybe (Sensitive Text) -> Maybe POSIX -> Credentials)
-> Parser (Maybe (Sensitive Text))
-> Parser (Maybe POSIX -> Credentials)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RefreshToken")
Parser (Maybe POSIX -> Credentials)
-> Parser (Maybe POSIX) -> Parser 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
"RefreshTokenExpiration")
)
instance Prelude.Hashable Credentials
instance Prelude.NFData Credentials