{-# 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.Lens as Lens
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
(OAuthProperties -> OAuthProperties -> Bool)
-> (OAuthProperties -> OAuthProperties -> Bool)
-> Eq OAuthProperties
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]
(Int -> ReadS OAuthProperties)
-> ReadS [OAuthProperties]
-> ReadPrec OAuthProperties
-> ReadPrec [OAuthProperties]
-> Read 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
(Int -> OAuthProperties -> ShowS)
-> (OAuthProperties -> String)
-> ([OAuthProperties] -> ShowS)
-> Show OAuthProperties
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. OAuthProperties -> Rep OAuthProperties x)
-> (forall x. Rep OAuthProperties x -> OAuthProperties)
-> Generic OAuthProperties
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' :: Text -> Text -> [Text] -> OAuthProperties
OAuthProperties'
{ $sel:tokenUrl:OAuthProperties' :: Text
tokenUrl = Text
pTokenUrl_,
$sel:authCodeUrl:OAuthProperties' :: Text
authCodeUrl = Text
pAuthCodeUrl_,
$sel:oAuthScopes:OAuthProperties' :: [Text]
oAuthScopes = [Text]
forall a. Monoid a => a
Prelude.mempty
}
oAuthProperties_tokenUrl :: Lens.Lens' OAuthProperties Prelude.Text
oAuthProperties_tokenUrl :: (Text -> f Text) -> OAuthProperties -> f OAuthProperties
oAuthProperties_tokenUrl = (OAuthProperties -> Text)
-> (OAuthProperties -> Text -> OAuthProperties)
-> Lens OAuthProperties OAuthProperties Text Text
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 :: (Text -> f Text) -> OAuthProperties -> f OAuthProperties
oAuthProperties_authCodeUrl = (OAuthProperties -> Text)
-> (OAuthProperties -> Text -> OAuthProperties)
-> Lens OAuthProperties OAuthProperties Text Text
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 :: ([Text] -> f [Text]) -> OAuthProperties -> f OAuthProperties
oAuthProperties_oAuthScopes = (OAuthProperties -> [Text])
-> (OAuthProperties -> [Text] -> OAuthProperties)
-> Lens OAuthProperties OAuthProperties [Text] [Text]
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) (([Text] -> f [Text]) -> OAuthProperties -> f OAuthProperties)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> OAuthProperties
-> f OAuthProperties
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON OAuthProperties where
parseJSON :: Value -> Parser OAuthProperties
parseJSON =
String
-> (Object -> Parser OAuthProperties)
-> Value
-> Parser OAuthProperties
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"OAuthProperties"
( \Object
x ->
Text -> Text -> [Text] -> OAuthProperties
OAuthProperties'
(Text -> Text -> [Text] -> OAuthProperties)
-> Parser Text -> Parser (Text -> [Text] -> OAuthProperties)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"tokenUrl")
Parser (Text -> [Text] -> OAuthProperties)
-> Parser Text -> Parser ([Text] -> OAuthProperties)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"authCodeUrl")
Parser ([Text] -> OAuthProperties)
-> Parser [Text] -> Parser OAuthProperties
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
"oAuthScopes" Parser (Maybe [Text]) -> [Text] -> Parser [Text]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Text]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable OAuthProperties
instance Prelude.NFData OAuthProperties
instance Core.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
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"tokenUrl" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
tokenUrl),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"authCodeUrl" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
authCodeUrl),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"oAuthScopes" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
oAuthScopes)
]
)