{-# 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.OAuthProperties where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data OAuthProperties = OAuthProperties'
{
OAuthProperties -> Text
tokenUrl :: Prelude.Text,
OAuthProperties -> Text
authCodeUrl :: Prelude.Text,
OAuthProperties -> [Text]
oAuthScopes :: [Prelude.Text]
}
deriving (OAuthProperties -> OAuthProperties -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OAuthProperties -> OAuthProperties -> Bool
$c/= :: OAuthProperties -> OAuthProperties -> Bool
== :: OAuthProperties -> OAuthProperties -> Bool
$c== :: OAuthProperties -> OAuthProperties -> Bool
Prelude.Eq, ReadPrec [OAuthProperties]
ReadPrec OAuthProperties
Int -> ReadS OAuthProperties
ReadS [OAuthProperties]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OAuthProperties]
$creadListPrec :: ReadPrec [OAuthProperties]
readPrec :: ReadPrec OAuthProperties
$creadPrec :: ReadPrec OAuthProperties
readList :: ReadS [OAuthProperties]
$creadList :: ReadS [OAuthProperties]
readsPrec :: Int -> ReadS OAuthProperties
$creadsPrec :: Int -> ReadS OAuthProperties
Prelude.Read, Int -> OAuthProperties -> ShowS
[OAuthProperties] -> ShowS
OAuthProperties -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OAuthProperties] -> ShowS
$cshowList :: [OAuthProperties] -> ShowS
show :: OAuthProperties -> String
$cshow :: OAuthProperties -> String
showsPrec :: Int -> OAuthProperties -> ShowS
$cshowsPrec :: Int -> OAuthProperties -> ShowS
Prelude.Show, forall x. Rep OAuthProperties x -> OAuthProperties
forall x. OAuthProperties -> Rep OAuthProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OAuthProperties x -> OAuthProperties
$cfrom :: forall x. OAuthProperties -> Rep OAuthProperties x
Prelude.Generic)
newOAuthProperties ::
Prelude.Text ->
Prelude.Text ->
OAuthProperties
newOAuthProperties :: Text -> Text -> OAuthProperties
newOAuthProperties Text
pTokenUrl_ Text
pAuthCodeUrl_ =
OAuthProperties'
{ $sel:tokenUrl:OAuthProperties' :: Text
tokenUrl = Text
pTokenUrl_,
$sel:authCodeUrl:OAuthProperties' :: Text
authCodeUrl = Text
pAuthCodeUrl_,
$sel:oAuthScopes:OAuthProperties' :: [Text]
oAuthScopes = forall a. Monoid a => a
Prelude.mempty
}
oAuthProperties_tokenUrl :: Lens.Lens' OAuthProperties Prelude.Text
oAuthProperties_tokenUrl :: Lens' OAuthProperties Text
oAuthProperties_tokenUrl = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OAuthProperties' {Text
tokenUrl :: Text
$sel:tokenUrl:OAuthProperties' :: OAuthProperties -> Text
tokenUrl} -> Text
tokenUrl) (\s :: OAuthProperties
s@OAuthProperties' {} Text
a -> OAuthProperties
s {$sel:tokenUrl:OAuthProperties' :: Text
tokenUrl = Text
a} :: OAuthProperties)
oAuthProperties_authCodeUrl :: Lens.Lens' OAuthProperties Prelude.Text
oAuthProperties_authCodeUrl :: Lens' OAuthProperties Text
oAuthProperties_authCodeUrl = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OAuthProperties' {Text
authCodeUrl :: Text
$sel:authCodeUrl:OAuthProperties' :: OAuthProperties -> Text
authCodeUrl} -> Text
authCodeUrl) (\s :: OAuthProperties
s@OAuthProperties' {} Text
a -> OAuthProperties
s {$sel:authCodeUrl:OAuthProperties' :: Text
authCodeUrl = Text
a} :: OAuthProperties)
oAuthProperties_oAuthScopes :: Lens.Lens' OAuthProperties [Prelude.Text]
oAuthProperties_oAuthScopes :: Lens' OAuthProperties [Text]
oAuthProperties_oAuthScopes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OAuthProperties' {[Text]
oAuthScopes :: [Text]
$sel:oAuthScopes:OAuthProperties' :: OAuthProperties -> [Text]
oAuthScopes} -> [Text]
oAuthScopes) (\s :: OAuthProperties
s@OAuthProperties' {} [Text]
a -> OAuthProperties
s {$sel:oAuthScopes:OAuthProperties' :: [Text]
oAuthScopes = [Text]
a} :: OAuthProperties) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON OAuthProperties where
parseJSON :: Value -> Parser OAuthProperties
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"OAuthProperties"
( \Object
x ->
Text -> Text -> [Text] -> OAuthProperties
OAuthProperties'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"tokenUrl")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"authCodeUrl")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"oAuthScopes" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable OAuthProperties where
hashWithSalt :: Int -> OAuthProperties -> Int
hashWithSalt Int
_salt OAuthProperties' {[Text]
Text
oAuthScopes :: [Text]
authCodeUrl :: Text
tokenUrl :: Text
$sel:oAuthScopes:OAuthProperties' :: OAuthProperties -> [Text]
$sel:authCodeUrl:OAuthProperties' :: OAuthProperties -> Text
$sel:tokenUrl:OAuthProperties' :: OAuthProperties -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
tokenUrl
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
authCodeUrl
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
oAuthScopes
instance Prelude.NFData OAuthProperties where
rnf :: OAuthProperties -> ()
rnf OAuthProperties' {[Text]
Text
oAuthScopes :: [Text]
authCodeUrl :: Text
tokenUrl :: Text
$sel:oAuthScopes:OAuthProperties' :: OAuthProperties -> [Text]
$sel:authCodeUrl:OAuthProperties' :: OAuthProperties -> Text
$sel:tokenUrl:OAuthProperties' :: OAuthProperties -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
tokenUrl
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
authCodeUrl
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Text]
oAuthScopes
instance Data.ToJSON OAuthProperties where
toJSON :: OAuthProperties -> Value
toJSON OAuthProperties' {[Text]
Text
oAuthScopes :: [Text]
authCodeUrl :: Text
tokenUrl :: Text
$sel:oAuthScopes:OAuthProperties' :: OAuthProperties -> [Text]
$sel:authCodeUrl:OAuthProperties' :: OAuthProperties -> Text
$sel:tokenUrl:OAuthProperties' :: OAuthProperties -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"tokenUrl" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
tokenUrl),
forall a. a -> Maybe a
Prelude.Just (Key
"authCodeUrl" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
authCodeUrl),
forall a. a -> Maybe a
Prelude.Just (Key
"oAuthScopes" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Text]
oAuthScopes)
]
)