{-# 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.AppFlow.Types.OAuthCredentials where
import Amazonka.AppFlow.Types.ConnectorOAuthRequest
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data OAuthCredentials = OAuthCredentials'
{
OAuthCredentials -> Maybe (Sensitive Text)
accessToken :: Prelude.Maybe (Core.Sensitive Prelude.Text),
OAuthCredentials -> Maybe Text
refreshToken :: Prelude.Maybe Prelude.Text,
OAuthCredentials -> Maybe ConnectorOAuthRequest
oAuthRequest :: Prelude.Maybe ConnectorOAuthRequest,
OAuthCredentials -> Text
clientId :: Prelude.Text,
OAuthCredentials -> Sensitive Text
clientSecret :: Core.Sensitive Prelude.Text
}
deriving (OAuthCredentials -> OAuthCredentials -> Bool
(OAuthCredentials -> OAuthCredentials -> Bool)
-> (OAuthCredentials -> OAuthCredentials -> Bool)
-> Eq OAuthCredentials
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OAuthCredentials -> OAuthCredentials -> Bool
$c/= :: OAuthCredentials -> OAuthCredentials -> Bool
== :: OAuthCredentials -> OAuthCredentials -> Bool
$c== :: OAuthCredentials -> OAuthCredentials -> Bool
Prelude.Eq, Int -> OAuthCredentials -> ShowS
[OAuthCredentials] -> ShowS
OAuthCredentials -> String
(Int -> OAuthCredentials -> ShowS)
-> (OAuthCredentials -> String)
-> ([OAuthCredentials] -> ShowS)
-> Show OAuthCredentials
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OAuthCredentials] -> ShowS
$cshowList :: [OAuthCredentials] -> ShowS
show :: OAuthCredentials -> String
$cshow :: OAuthCredentials -> String
showsPrec :: Int -> OAuthCredentials -> ShowS
$cshowsPrec :: Int -> OAuthCredentials -> ShowS
Prelude.Show, (forall x. OAuthCredentials -> Rep OAuthCredentials x)
-> (forall x. Rep OAuthCredentials x -> OAuthCredentials)
-> Generic OAuthCredentials
forall x. Rep OAuthCredentials x -> OAuthCredentials
forall x. OAuthCredentials -> Rep OAuthCredentials x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OAuthCredentials x -> OAuthCredentials
$cfrom :: forall x. OAuthCredentials -> Rep OAuthCredentials x
Prelude.Generic)
newOAuthCredentials ::
Prelude.Text ->
Prelude.Text ->
OAuthCredentials
newOAuthCredentials :: Text -> Text -> OAuthCredentials
newOAuthCredentials Text
pClientId_ Text
pClientSecret_ =
OAuthCredentials' :: Maybe (Sensitive Text)
-> Maybe Text
-> Maybe ConnectorOAuthRequest
-> Text
-> Sensitive Text
-> OAuthCredentials
OAuthCredentials'
{ $sel:accessToken:OAuthCredentials' :: Maybe (Sensitive Text)
accessToken = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
$sel:refreshToken:OAuthCredentials' :: Maybe Text
refreshToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:oAuthRequest:OAuthCredentials' :: Maybe ConnectorOAuthRequest
oAuthRequest = Maybe ConnectorOAuthRequest
forall a. Maybe a
Prelude.Nothing,
$sel:clientId:OAuthCredentials' :: Text
clientId = Text
pClientId_,
$sel:clientSecret:OAuthCredentials' :: Sensitive Text
clientSecret = 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
pClientSecret_
}
oAuthCredentials_accessToken :: Lens.Lens' OAuthCredentials (Prelude.Maybe Prelude.Text)
oAuthCredentials_accessToken :: (Maybe Text -> f (Maybe Text))
-> OAuthCredentials -> f OAuthCredentials
oAuthCredentials_accessToken = (OAuthCredentials -> Maybe (Sensitive Text))
-> (OAuthCredentials -> Maybe (Sensitive Text) -> OAuthCredentials)
-> Lens
OAuthCredentials
OAuthCredentials
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OAuthCredentials' {Maybe (Sensitive Text)
accessToken :: Maybe (Sensitive Text)
$sel:accessToken:OAuthCredentials' :: OAuthCredentials -> Maybe (Sensitive Text)
accessToken} -> Maybe (Sensitive Text)
accessToken) (\s :: OAuthCredentials
s@OAuthCredentials' {} Maybe (Sensitive Text)
a -> OAuthCredentials
s {$sel:accessToken:OAuthCredentials' :: Maybe (Sensitive Text)
accessToken = Maybe (Sensitive Text)
a} :: OAuthCredentials) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> OAuthCredentials -> f OAuthCredentials)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> OAuthCredentials
-> f OAuthCredentials
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
oAuthCredentials_refreshToken :: Lens.Lens' OAuthCredentials (Prelude.Maybe Prelude.Text)
oAuthCredentials_refreshToken :: (Maybe Text -> f (Maybe Text))
-> OAuthCredentials -> f OAuthCredentials
oAuthCredentials_refreshToken = (OAuthCredentials -> Maybe Text)
-> (OAuthCredentials -> Maybe Text -> OAuthCredentials)
-> Lens OAuthCredentials OAuthCredentials (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OAuthCredentials' {Maybe Text
refreshToken :: Maybe Text
$sel:refreshToken:OAuthCredentials' :: OAuthCredentials -> Maybe Text
refreshToken} -> Maybe Text
refreshToken) (\s :: OAuthCredentials
s@OAuthCredentials' {} Maybe Text
a -> OAuthCredentials
s {$sel:refreshToken:OAuthCredentials' :: Maybe Text
refreshToken = Maybe Text
a} :: OAuthCredentials)
oAuthCredentials_oAuthRequest :: Lens.Lens' OAuthCredentials (Prelude.Maybe ConnectorOAuthRequest)
oAuthCredentials_oAuthRequest :: (Maybe ConnectorOAuthRequest -> f (Maybe ConnectorOAuthRequest))
-> OAuthCredentials -> f OAuthCredentials
oAuthCredentials_oAuthRequest = (OAuthCredentials -> Maybe ConnectorOAuthRequest)
-> (OAuthCredentials
-> Maybe ConnectorOAuthRequest -> OAuthCredentials)
-> Lens
OAuthCredentials
OAuthCredentials
(Maybe ConnectorOAuthRequest)
(Maybe ConnectorOAuthRequest)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OAuthCredentials' {Maybe ConnectorOAuthRequest
oAuthRequest :: Maybe ConnectorOAuthRequest
$sel:oAuthRequest:OAuthCredentials' :: OAuthCredentials -> Maybe ConnectorOAuthRequest
oAuthRequest} -> Maybe ConnectorOAuthRequest
oAuthRequest) (\s :: OAuthCredentials
s@OAuthCredentials' {} Maybe ConnectorOAuthRequest
a -> OAuthCredentials
s {$sel:oAuthRequest:OAuthCredentials' :: Maybe ConnectorOAuthRequest
oAuthRequest = Maybe ConnectorOAuthRequest
a} :: OAuthCredentials)
oAuthCredentials_clientId :: Lens.Lens' OAuthCredentials Prelude.Text
oAuthCredentials_clientId :: (Text -> f Text) -> OAuthCredentials -> f OAuthCredentials
oAuthCredentials_clientId = (OAuthCredentials -> Text)
-> (OAuthCredentials -> Text -> OAuthCredentials)
-> Lens OAuthCredentials OAuthCredentials Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OAuthCredentials' {Text
clientId :: Text
$sel:clientId:OAuthCredentials' :: OAuthCredentials -> Text
clientId} -> Text
clientId) (\s :: OAuthCredentials
s@OAuthCredentials' {} Text
a -> OAuthCredentials
s {$sel:clientId:OAuthCredentials' :: Text
clientId = Text
a} :: OAuthCredentials)
oAuthCredentials_clientSecret :: Lens.Lens' OAuthCredentials Prelude.Text
oAuthCredentials_clientSecret :: (Text -> f Text) -> OAuthCredentials -> f OAuthCredentials
oAuthCredentials_clientSecret = (OAuthCredentials -> Sensitive Text)
-> (OAuthCredentials -> Sensitive Text -> OAuthCredentials)
-> Lens
OAuthCredentials OAuthCredentials (Sensitive Text) (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OAuthCredentials' {Sensitive Text
clientSecret :: Sensitive Text
$sel:clientSecret:OAuthCredentials' :: OAuthCredentials -> Sensitive Text
clientSecret} -> Sensitive Text
clientSecret) (\s :: OAuthCredentials
s@OAuthCredentials' {} Sensitive Text
a -> OAuthCredentials
s {$sel:clientSecret:OAuthCredentials' :: Sensitive Text
clientSecret = Sensitive Text
a} :: OAuthCredentials) ((Sensitive Text -> f (Sensitive Text))
-> OAuthCredentials -> f OAuthCredentials)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> OAuthCredentials
-> f OAuthCredentials
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 OAuthCredentials
instance Prelude.NFData OAuthCredentials
instance Core.ToJSON OAuthCredentials where
toJSON :: OAuthCredentials -> Value
toJSON OAuthCredentials' {Maybe Text
Maybe (Sensitive Text)
Maybe ConnectorOAuthRequest
Text
Sensitive Text
clientSecret :: Sensitive Text
clientId :: Text
oAuthRequest :: Maybe ConnectorOAuthRequest
refreshToken :: Maybe Text
accessToken :: Maybe (Sensitive Text)
$sel:clientSecret:OAuthCredentials' :: OAuthCredentials -> Sensitive Text
$sel:clientId:OAuthCredentials' :: OAuthCredentials -> Text
$sel:oAuthRequest:OAuthCredentials' :: OAuthCredentials -> Maybe ConnectorOAuthRequest
$sel:refreshToken:OAuthCredentials' :: OAuthCredentials -> Maybe Text
$sel:accessToken:OAuthCredentials' :: OAuthCredentials -> Maybe (Sensitive Text)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"accessToken" 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)
accessToken,
(Text
"refreshToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
refreshToken,
(Text
"oAuthRequest" Text -> ConnectorOAuthRequest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ConnectorOAuthRequest -> Pair)
-> Maybe ConnectorOAuthRequest -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ConnectorOAuthRequest
oAuthRequest,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"clientId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clientId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"clientSecret" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
clientSecret)
]
)