{-# 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.AmplifyBackend.Types.SocialProviderSettings where
import Amazonka.AmplifyBackend.Types.BackendAuthAppleProviderConfig
import Amazonka.AmplifyBackend.Types.BackendAuthSocialProviderConfig
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data SocialProviderSettings = SocialProviderSettings'
{ SocialProviderSettings -> Maybe BackendAuthSocialProviderConfig
loginWithAmazon :: Prelude.Maybe BackendAuthSocialProviderConfig,
SocialProviderSettings -> Maybe BackendAuthAppleProviderConfig
signInWithApple :: Prelude.Maybe BackendAuthAppleProviderConfig,
SocialProviderSettings -> Maybe BackendAuthSocialProviderConfig
facebook :: Prelude.Maybe BackendAuthSocialProviderConfig,
SocialProviderSettings -> Maybe BackendAuthSocialProviderConfig
google :: Prelude.Maybe BackendAuthSocialProviderConfig
}
deriving (SocialProviderSettings -> SocialProviderSettings -> Bool
(SocialProviderSettings -> SocialProviderSettings -> Bool)
-> (SocialProviderSettings -> SocialProviderSettings -> Bool)
-> Eq SocialProviderSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SocialProviderSettings -> SocialProviderSettings -> Bool
$c/= :: SocialProviderSettings -> SocialProviderSettings -> Bool
== :: SocialProviderSettings -> SocialProviderSettings -> Bool
$c== :: SocialProviderSettings -> SocialProviderSettings -> Bool
Prelude.Eq, ReadPrec [SocialProviderSettings]
ReadPrec SocialProviderSettings
Int -> ReadS SocialProviderSettings
ReadS [SocialProviderSettings]
(Int -> ReadS SocialProviderSettings)
-> ReadS [SocialProviderSettings]
-> ReadPrec SocialProviderSettings
-> ReadPrec [SocialProviderSettings]
-> Read SocialProviderSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SocialProviderSettings]
$creadListPrec :: ReadPrec [SocialProviderSettings]
readPrec :: ReadPrec SocialProviderSettings
$creadPrec :: ReadPrec SocialProviderSettings
readList :: ReadS [SocialProviderSettings]
$creadList :: ReadS [SocialProviderSettings]
readsPrec :: Int -> ReadS SocialProviderSettings
$creadsPrec :: Int -> ReadS SocialProviderSettings
Prelude.Read, Int -> SocialProviderSettings -> ShowS
[SocialProviderSettings] -> ShowS
SocialProviderSettings -> String
(Int -> SocialProviderSettings -> ShowS)
-> (SocialProviderSettings -> String)
-> ([SocialProviderSettings] -> ShowS)
-> Show SocialProviderSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SocialProviderSettings] -> ShowS
$cshowList :: [SocialProviderSettings] -> ShowS
show :: SocialProviderSettings -> String
$cshow :: SocialProviderSettings -> String
showsPrec :: Int -> SocialProviderSettings -> ShowS
$cshowsPrec :: Int -> SocialProviderSettings -> ShowS
Prelude.Show, (forall x. SocialProviderSettings -> Rep SocialProviderSettings x)
-> (forall x.
Rep SocialProviderSettings x -> SocialProviderSettings)
-> Generic SocialProviderSettings
forall x. Rep SocialProviderSettings x -> SocialProviderSettings
forall x. SocialProviderSettings -> Rep SocialProviderSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SocialProviderSettings x -> SocialProviderSettings
$cfrom :: forall x. SocialProviderSettings -> Rep SocialProviderSettings x
Prelude.Generic)
newSocialProviderSettings ::
SocialProviderSettings
newSocialProviderSettings :: SocialProviderSettings
newSocialProviderSettings =
SocialProviderSettings' :: Maybe BackendAuthSocialProviderConfig
-> Maybe BackendAuthAppleProviderConfig
-> Maybe BackendAuthSocialProviderConfig
-> Maybe BackendAuthSocialProviderConfig
-> SocialProviderSettings
SocialProviderSettings'
{ $sel:loginWithAmazon:SocialProviderSettings' :: Maybe BackendAuthSocialProviderConfig
loginWithAmazon =
Maybe BackendAuthSocialProviderConfig
forall a. Maybe a
Prelude.Nothing,
$sel:signInWithApple:SocialProviderSettings' :: Maybe BackendAuthAppleProviderConfig
signInWithApple = Maybe BackendAuthAppleProviderConfig
forall a. Maybe a
Prelude.Nothing,
$sel:facebook:SocialProviderSettings' :: Maybe BackendAuthSocialProviderConfig
facebook = Maybe BackendAuthSocialProviderConfig
forall a. Maybe a
Prelude.Nothing,
$sel:google:SocialProviderSettings' :: Maybe BackendAuthSocialProviderConfig
google = Maybe BackendAuthSocialProviderConfig
forall a. Maybe a
Prelude.Nothing
}
socialProviderSettings_loginWithAmazon :: Lens.Lens' SocialProviderSettings (Prelude.Maybe BackendAuthSocialProviderConfig)
socialProviderSettings_loginWithAmazon :: (Maybe BackendAuthSocialProviderConfig
-> f (Maybe BackendAuthSocialProviderConfig))
-> SocialProviderSettings -> f SocialProviderSettings
socialProviderSettings_loginWithAmazon = (SocialProviderSettings -> Maybe BackendAuthSocialProviderConfig)
-> (SocialProviderSettings
-> Maybe BackendAuthSocialProviderConfig -> SocialProviderSettings)
-> Lens
SocialProviderSettings
SocialProviderSettings
(Maybe BackendAuthSocialProviderConfig)
(Maybe BackendAuthSocialProviderConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SocialProviderSettings' {Maybe BackendAuthSocialProviderConfig
loginWithAmazon :: Maybe BackendAuthSocialProviderConfig
$sel:loginWithAmazon:SocialProviderSettings' :: SocialProviderSettings -> Maybe BackendAuthSocialProviderConfig
loginWithAmazon} -> Maybe BackendAuthSocialProviderConfig
loginWithAmazon) (\s :: SocialProviderSettings
s@SocialProviderSettings' {} Maybe BackendAuthSocialProviderConfig
a -> SocialProviderSettings
s {$sel:loginWithAmazon:SocialProviderSettings' :: Maybe BackendAuthSocialProviderConfig
loginWithAmazon = Maybe BackendAuthSocialProviderConfig
a} :: SocialProviderSettings)
socialProviderSettings_signInWithApple :: Lens.Lens' SocialProviderSettings (Prelude.Maybe BackendAuthAppleProviderConfig)
socialProviderSettings_signInWithApple :: (Maybe BackendAuthAppleProviderConfig
-> f (Maybe BackendAuthAppleProviderConfig))
-> SocialProviderSettings -> f SocialProviderSettings
socialProviderSettings_signInWithApple = (SocialProviderSettings -> Maybe BackendAuthAppleProviderConfig)
-> (SocialProviderSettings
-> Maybe BackendAuthAppleProviderConfig -> SocialProviderSettings)
-> Lens
SocialProviderSettings
SocialProviderSettings
(Maybe BackendAuthAppleProviderConfig)
(Maybe BackendAuthAppleProviderConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SocialProviderSettings' {Maybe BackendAuthAppleProviderConfig
signInWithApple :: Maybe BackendAuthAppleProviderConfig
$sel:signInWithApple:SocialProviderSettings' :: SocialProviderSettings -> Maybe BackendAuthAppleProviderConfig
signInWithApple} -> Maybe BackendAuthAppleProviderConfig
signInWithApple) (\s :: SocialProviderSettings
s@SocialProviderSettings' {} Maybe BackendAuthAppleProviderConfig
a -> SocialProviderSettings
s {$sel:signInWithApple:SocialProviderSettings' :: Maybe BackendAuthAppleProviderConfig
signInWithApple = Maybe BackendAuthAppleProviderConfig
a} :: SocialProviderSettings)
socialProviderSettings_facebook :: Lens.Lens' SocialProviderSettings (Prelude.Maybe BackendAuthSocialProviderConfig)
socialProviderSettings_facebook :: (Maybe BackendAuthSocialProviderConfig
-> f (Maybe BackendAuthSocialProviderConfig))
-> SocialProviderSettings -> f SocialProviderSettings
socialProviderSettings_facebook = (SocialProviderSettings -> Maybe BackendAuthSocialProviderConfig)
-> (SocialProviderSettings
-> Maybe BackendAuthSocialProviderConfig -> SocialProviderSettings)
-> Lens
SocialProviderSettings
SocialProviderSettings
(Maybe BackendAuthSocialProviderConfig)
(Maybe BackendAuthSocialProviderConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SocialProviderSettings' {Maybe BackendAuthSocialProviderConfig
facebook :: Maybe BackendAuthSocialProviderConfig
$sel:facebook:SocialProviderSettings' :: SocialProviderSettings -> Maybe BackendAuthSocialProviderConfig
facebook} -> Maybe BackendAuthSocialProviderConfig
facebook) (\s :: SocialProviderSettings
s@SocialProviderSettings' {} Maybe BackendAuthSocialProviderConfig
a -> SocialProviderSettings
s {$sel:facebook:SocialProviderSettings' :: Maybe BackendAuthSocialProviderConfig
facebook = Maybe BackendAuthSocialProviderConfig
a} :: SocialProviderSettings)
socialProviderSettings_google :: Lens.Lens' SocialProviderSettings (Prelude.Maybe BackendAuthSocialProviderConfig)
socialProviderSettings_google :: (Maybe BackendAuthSocialProviderConfig
-> f (Maybe BackendAuthSocialProviderConfig))
-> SocialProviderSettings -> f SocialProviderSettings
socialProviderSettings_google = (SocialProviderSettings -> Maybe BackendAuthSocialProviderConfig)
-> (SocialProviderSettings
-> Maybe BackendAuthSocialProviderConfig -> SocialProviderSettings)
-> Lens
SocialProviderSettings
SocialProviderSettings
(Maybe BackendAuthSocialProviderConfig)
(Maybe BackendAuthSocialProviderConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SocialProviderSettings' {Maybe BackendAuthSocialProviderConfig
google :: Maybe BackendAuthSocialProviderConfig
$sel:google:SocialProviderSettings' :: SocialProviderSettings -> Maybe BackendAuthSocialProviderConfig
google} -> Maybe BackendAuthSocialProviderConfig
google) (\s :: SocialProviderSettings
s@SocialProviderSettings' {} Maybe BackendAuthSocialProviderConfig
a -> SocialProviderSettings
s {$sel:google:SocialProviderSettings' :: Maybe BackendAuthSocialProviderConfig
google = Maybe BackendAuthSocialProviderConfig
a} :: SocialProviderSettings)
instance Core.FromJSON SocialProviderSettings where
parseJSON :: Value -> Parser SocialProviderSettings
parseJSON =
String
-> (Object -> Parser SocialProviderSettings)
-> Value
-> Parser SocialProviderSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"SocialProviderSettings"
( \Object
x ->
Maybe BackendAuthSocialProviderConfig
-> Maybe BackendAuthAppleProviderConfig
-> Maybe BackendAuthSocialProviderConfig
-> Maybe BackendAuthSocialProviderConfig
-> SocialProviderSettings
SocialProviderSettings'
(Maybe BackendAuthSocialProviderConfig
-> Maybe BackendAuthAppleProviderConfig
-> Maybe BackendAuthSocialProviderConfig
-> Maybe BackendAuthSocialProviderConfig
-> SocialProviderSettings)
-> Parser (Maybe BackendAuthSocialProviderConfig)
-> Parser
(Maybe BackendAuthAppleProviderConfig
-> Maybe BackendAuthSocialProviderConfig
-> Maybe BackendAuthSocialProviderConfig
-> SocialProviderSettings)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe BackendAuthSocialProviderConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LoginWithAmazon")
Parser
(Maybe BackendAuthAppleProviderConfig
-> Maybe BackendAuthSocialProviderConfig
-> Maybe BackendAuthSocialProviderConfig
-> SocialProviderSettings)
-> Parser (Maybe BackendAuthAppleProviderConfig)
-> Parser
(Maybe BackendAuthSocialProviderConfig
-> Maybe BackendAuthSocialProviderConfig -> SocialProviderSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe BackendAuthAppleProviderConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SignInWithApple")
Parser
(Maybe BackendAuthSocialProviderConfig
-> Maybe BackendAuthSocialProviderConfig -> SocialProviderSettings)
-> Parser (Maybe BackendAuthSocialProviderConfig)
-> Parser
(Maybe BackendAuthSocialProviderConfig -> SocialProviderSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe BackendAuthSocialProviderConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Facebook")
Parser
(Maybe BackendAuthSocialProviderConfig -> SocialProviderSettings)
-> Parser (Maybe BackendAuthSocialProviderConfig)
-> Parser SocialProviderSettings
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe BackendAuthSocialProviderConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Google")
)
instance Prelude.Hashable SocialProviderSettings
instance Prelude.NFData SocialProviderSettings
instance Core.ToJSON SocialProviderSettings where
toJSON :: SocialProviderSettings -> Value
toJSON SocialProviderSettings' {Maybe BackendAuthAppleProviderConfig
Maybe BackendAuthSocialProviderConfig
google :: Maybe BackendAuthSocialProviderConfig
facebook :: Maybe BackendAuthSocialProviderConfig
signInWithApple :: Maybe BackendAuthAppleProviderConfig
loginWithAmazon :: Maybe BackendAuthSocialProviderConfig
$sel:google:SocialProviderSettings' :: SocialProviderSettings -> Maybe BackendAuthSocialProviderConfig
$sel:facebook:SocialProviderSettings' :: SocialProviderSettings -> Maybe BackendAuthSocialProviderConfig
$sel:signInWithApple:SocialProviderSettings' :: SocialProviderSettings -> Maybe BackendAuthAppleProviderConfig
$sel:loginWithAmazon:SocialProviderSettings' :: SocialProviderSettings -> Maybe BackendAuthSocialProviderConfig
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"LoginWithAmazon" Text -> BackendAuthSocialProviderConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(BackendAuthSocialProviderConfig -> Pair)
-> Maybe BackendAuthSocialProviderConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe BackendAuthSocialProviderConfig
loginWithAmazon,
(Text
"SignInWithApple" Text -> BackendAuthAppleProviderConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(BackendAuthAppleProviderConfig -> Pair)
-> Maybe BackendAuthAppleProviderConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe BackendAuthAppleProviderConfig
signInWithApple,
(Text
"Facebook" Text -> BackendAuthSocialProviderConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (BackendAuthSocialProviderConfig -> Pair)
-> Maybe BackendAuthSocialProviderConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe BackendAuthSocialProviderConfig
facebook,
(Text
"Google" Text -> BackendAuthSocialProviderConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (BackendAuthSocialProviderConfig -> Pair)
-> Maybe BackendAuthSocialProviderConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe BackendAuthSocialProviderConfig
google
]
)