{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.AmplifyBackend.Types.CreateBackendAuthOAuthConfig
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.AmplifyBackend.Types.CreateBackendAuthOAuthConfig where

import Amazonka.AmplifyBackend.Types.OAuthGrantType
import Amazonka.AmplifyBackend.Types.OAuthScopesElement
import Amazonka.AmplifyBackend.Types.SocialProviderSettings
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Creates the OAuth configuration for your Amplify project.
--
-- /See:/ 'newCreateBackendAuthOAuthConfig' smart constructor.
data CreateBackendAuthOAuthConfig = CreateBackendAuthOAuthConfig'
  { -- | The settings for using social providers to access your Amplify app.
    CreateBackendAuthOAuthConfig -> Maybe SocialProviderSettings
socialProviderSettings :: Prelude.Maybe SocialProviderSettings,
    -- | The domain prefix for your Amplify app.
    CreateBackendAuthOAuthConfig -> Maybe Text
domainPrefix :: Prelude.Maybe Prelude.Text,
    -- | Redirect URLs that OAuth uses when a user signs out of an Amplify app.
    CreateBackendAuthOAuthConfig -> [Text]
redirectSignOutURIs :: [Prelude.Text],
    -- | The redirected URI for signing in to your Amplify app.
    CreateBackendAuthOAuthConfig -> [Text]
redirectSignInURIs :: [Prelude.Text],
    -- | The OAuth grant type that you use to allow app users to authenticate
    -- from your Amplify app.
    CreateBackendAuthOAuthConfig -> OAuthGrantType
oAuthGrantType :: OAuthGrantType,
    -- | List of OAuth-related flows used to allow your app users to authenticate
    -- from your Amplify app.
    CreateBackendAuthOAuthConfig -> [OAuthScopesElement]
oAuthScopes :: [OAuthScopesElement]
  }
  deriving (CreateBackendAuthOAuthConfig
-> CreateBackendAuthOAuthConfig -> Bool
(CreateBackendAuthOAuthConfig
 -> CreateBackendAuthOAuthConfig -> Bool)
-> (CreateBackendAuthOAuthConfig
    -> CreateBackendAuthOAuthConfig -> Bool)
-> Eq CreateBackendAuthOAuthConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateBackendAuthOAuthConfig
-> CreateBackendAuthOAuthConfig -> Bool
$c/= :: CreateBackendAuthOAuthConfig
-> CreateBackendAuthOAuthConfig -> Bool
== :: CreateBackendAuthOAuthConfig
-> CreateBackendAuthOAuthConfig -> Bool
$c== :: CreateBackendAuthOAuthConfig
-> CreateBackendAuthOAuthConfig -> Bool
Prelude.Eq, ReadPrec [CreateBackendAuthOAuthConfig]
ReadPrec CreateBackendAuthOAuthConfig
Int -> ReadS CreateBackendAuthOAuthConfig
ReadS [CreateBackendAuthOAuthConfig]
(Int -> ReadS CreateBackendAuthOAuthConfig)
-> ReadS [CreateBackendAuthOAuthConfig]
-> ReadPrec CreateBackendAuthOAuthConfig
-> ReadPrec [CreateBackendAuthOAuthConfig]
-> Read CreateBackendAuthOAuthConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateBackendAuthOAuthConfig]
$creadListPrec :: ReadPrec [CreateBackendAuthOAuthConfig]
readPrec :: ReadPrec CreateBackendAuthOAuthConfig
$creadPrec :: ReadPrec CreateBackendAuthOAuthConfig
readList :: ReadS [CreateBackendAuthOAuthConfig]
$creadList :: ReadS [CreateBackendAuthOAuthConfig]
readsPrec :: Int -> ReadS CreateBackendAuthOAuthConfig
$creadsPrec :: Int -> ReadS CreateBackendAuthOAuthConfig
Prelude.Read, Int -> CreateBackendAuthOAuthConfig -> ShowS
[CreateBackendAuthOAuthConfig] -> ShowS
CreateBackendAuthOAuthConfig -> String
(Int -> CreateBackendAuthOAuthConfig -> ShowS)
-> (CreateBackendAuthOAuthConfig -> String)
-> ([CreateBackendAuthOAuthConfig] -> ShowS)
-> Show CreateBackendAuthOAuthConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateBackendAuthOAuthConfig] -> ShowS
$cshowList :: [CreateBackendAuthOAuthConfig] -> ShowS
show :: CreateBackendAuthOAuthConfig -> String
$cshow :: CreateBackendAuthOAuthConfig -> String
showsPrec :: Int -> CreateBackendAuthOAuthConfig -> ShowS
$cshowsPrec :: Int -> CreateBackendAuthOAuthConfig -> ShowS
Prelude.Show, (forall x.
 CreateBackendAuthOAuthConfig -> Rep CreateBackendAuthOAuthConfig x)
-> (forall x.
    Rep CreateBackendAuthOAuthConfig x -> CreateBackendAuthOAuthConfig)
-> Generic CreateBackendAuthOAuthConfig
forall x.
Rep CreateBackendAuthOAuthConfig x -> CreateBackendAuthOAuthConfig
forall x.
CreateBackendAuthOAuthConfig -> Rep CreateBackendAuthOAuthConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateBackendAuthOAuthConfig x -> CreateBackendAuthOAuthConfig
$cfrom :: forall x.
CreateBackendAuthOAuthConfig -> Rep CreateBackendAuthOAuthConfig x
Prelude.Generic)

-- |
-- Create a value of 'CreateBackendAuthOAuthConfig' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'socialProviderSettings', 'createBackendAuthOAuthConfig_socialProviderSettings' - The settings for using social providers to access your Amplify app.
--
-- 'domainPrefix', 'createBackendAuthOAuthConfig_domainPrefix' - The domain prefix for your Amplify app.
--
-- 'redirectSignOutURIs', 'createBackendAuthOAuthConfig_redirectSignOutURIs' - Redirect URLs that OAuth uses when a user signs out of an Amplify app.
--
-- 'redirectSignInURIs', 'createBackendAuthOAuthConfig_redirectSignInURIs' - The redirected URI for signing in to your Amplify app.
--
-- 'oAuthGrantType', 'createBackendAuthOAuthConfig_oAuthGrantType' - The OAuth grant type that you use to allow app users to authenticate
-- from your Amplify app.
--
-- 'oAuthScopes', 'createBackendAuthOAuthConfig_oAuthScopes' - List of OAuth-related flows used to allow your app users to authenticate
-- from your Amplify app.
newCreateBackendAuthOAuthConfig ::
  -- | 'oAuthGrantType'
  OAuthGrantType ->
  CreateBackendAuthOAuthConfig
newCreateBackendAuthOAuthConfig :: OAuthGrantType -> CreateBackendAuthOAuthConfig
newCreateBackendAuthOAuthConfig OAuthGrantType
pOAuthGrantType_ =
  CreateBackendAuthOAuthConfig' :: Maybe SocialProviderSettings
-> Maybe Text
-> [Text]
-> [Text]
-> OAuthGrantType
-> [OAuthScopesElement]
-> CreateBackendAuthOAuthConfig
CreateBackendAuthOAuthConfig'
    { $sel:socialProviderSettings:CreateBackendAuthOAuthConfig' :: Maybe SocialProviderSettings
socialProviderSettings =
        Maybe SocialProviderSettings
forall a. Maybe a
Prelude.Nothing,
      $sel:domainPrefix:CreateBackendAuthOAuthConfig' :: Maybe Text
domainPrefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:redirectSignOutURIs:CreateBackendAuthOAuthConfig' :: [Text]
redirectSignOutURIs = [Text]
forall a. Monoid a => a
Prelude.mempty,
      $sel:redirectSignInURIs:CreateBackendAuthOAuthConfig' :: [Text]
redirectSignInURIs = [Text]
forall a. Monoid a => a
Prelude.mempty,
      $sel:oAuthGrantType:CreateBackendAuthOAuthConfig' :: OAuthGrantType
oAuthGrantType = OAuthGrantType
pOAuthGrantType_,
      $sel:oAuthScopes:CreateBackendAuthOAuthConfig' :: [OAuthScopesElement]
oAuthScopes = [OAuthScopesElement]
forall a. Monoid a => a
Prelude.mempty
    }

-- | The settings for using social providers to access your Amplify app.
createBackendAuthOAuthConfig_socialProviderSettings :: Lens.Lens' CreateBackendAuthOAuthConfig (Prelude.Maybe SocialProviderSettings)
createBackendAuthOAuthConfig_socialProviderSettings :: (Maybe SocialProviderSettings -> f (Maybe SocialProviderSettings))
-> CreateBackendAuthOAuthConfig -> f CreateBackendAuthOAuthConfig
createBackendAuthOAuthConfig_socialProviderSettings = (CreateBackendAuthOAuthConfig -> Maybe SocialProviderSettings)
-> (CreateBackendAuthOAuthConfig
    -> Maybe SocialProviderSettings -> CreateBackendAuthOAuthConfig)
-> Lens
     CreateBackendAuthOAuthConfig
     CreateBackendAuthOAuthConfig
     (Maybe SocialProviderSettings)
     (Maybe SocialProviderSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendAuthOAuthConfig' {Maybe SocialProviderSettings
socialProviderSettings :: Maybe SocialProviderSettings
$sel:socialProviderSettings:CreateBackendAuthOAuthConfig' :: CreateBackendAuthOAuthConfig -> Maybe SocialProviderSettings
socialProviderSettings} -> Maybe SocialProviderSettings
socialProviderSettings) (\s :: CreateBackendAuthOAuthConfig
s@CreateBackendAuthOAuthConfig' {} Maybe SocialProviderSettings
a -> CreateBackendAuthOAuthConfig
s {$sel:socialProviderSettings:CreateBackendAuthOAuthConfig' :: Maybe SocialProviderSettings
socialProviderSettings = Maybe SocialProviderSettings
a} :: CreateBackendAuthOAuthConfig)

-- | The domain prefix for your Amplify app.
createBackendAuthOAuthConfig_domainPrefix :: Lens.Lens' CreateBackendAuthOAuthConfig (Prelude.Maybe Prelude.Text)
createBackendAuthOAuthConfig_domainPrefix :: (Maybe Text -> f (Maybe Text))
-> CreateBackendAuthOAuthConfig -> f CreateBackendAuthOAuthConfig
createBackendAuthOAuthConfig_domainPrefix = (CreateBackendAuthOAuthConfig -> Maybe Text)
-> (CreateBackendAuthOAuthConfig
    -> Maybe Text -> CreateBackendAuthOAuthConfig)
-> Lens
     CreateBackendAuthOAuthConfig
     CreateBackendAuthOAuthConfig
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendAuthOAuthConfig' {Maybe Text
domainPrefix :: Maybe Text
$sel:domainPrefix:CreateBackendAuthOAuthConfig' :: CreateBackendAuthOAuthConfig -> Maybe Text
domainPrefix} -> Maybe Text
domainPrefix) (\s :: CreateBackendAuthOAuthConfig
s@CreateBackendAuthOAuthConfig' {} Maybe Text
a -> CreateBackendAuthOAuthConfig
s {$sel:domainPrefix:CreateBackendAuthOAuthConfig' :: Maybe Text
domainPrefix = Maybe Text
a} :: CreateBackendAuthOAuthConfig)

-- | Redirect URLs that OAuth uses when a user signs out of an Amplify app.
createBackendAuthOAuthConfig_redirectSignOutURIs :: Lens.Lens' CreateBackendAuthOAuthConfig [Prelude.Text]
createBackendAuthOAuthConfig_redirectSignOutURIs :: ([Text] -> f [Text])
-> CreateBackendAuthOAuthConfig -> f CreateBackendAuthOAuthConfig
createBackendAuthOAuthConfig_redirectSignOutURIs = (CreateBackendAuthOAuthConfig -> [Text])
-> (CreateBackendAuthOAuthConfig
    -> [Text] -> CreateBackendAuthOAuthConfig)
-> Lens
     CreateBackendAuthOAuthConfig
     CreateBackendAuthOAuthConfig
     [Text]
     [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendAuthOAuthConfig' {[Text]
redirectSignOutURIs :: [Text]
$sel:redirectSignOutURIs:CreateBackendAuthOAuthConfig' :: CreateBackendAuthOAuthConfig -> [Text]
redirectSignOutURIs} -> [Text]
redirectSignOutURIs) (\s :: CreateBackendAuthOAuthConfig
s@CreateBackendAuthOAuthConfig' {} [Text]
a -> CreateBackendAuthOAuthConfig
s {$sel:redirectSignOutURIs:CreateBackendAuthOAuthConfig' :: [Text]
redirectSignOutURIs = [Text]
a} :: CreateBackendAuthOAuthConfig) (([Text] -> f [Text])
 -> CreateBackendAuthOAuthConfig -> f CreateBackendAuthOAuthConfig)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> CreateBackendAuthOAuthConfig
-> f CreateBackendAuthOAuthConfig
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

-- | The redirected URI for signing in to your Amplify app.
createBackendAuthOAuthConfig_redirectSignInURIs :: Lens.Lens' CreateBackendAuthOAuthConfig [Prelude.Text]
createBackendAuthOAuthConfig_redirectSignInURIs :: ([Text] -> f [Text])
-> CreateBackendAuthOAuthConfig -> f CreateBackendAuthOAuthConfig
createBackendAuthOAuthConfig_redirectSignInURIs = (CreateBackendAuthOAuthConfig -> [Text])
-> (CreateBackendAuthOAuthConfig
    -> [Text] -> CreateBackendAuthOAuthConfig)
-> Lens
     CreateBackendAuthOAuthConfig
     CreateBackendAuthOAuthConfig
     [Text]
     [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendAuthOAuthConfig' {[Text]
redirectSignInURIs :: [Text]
$sel:redirectSignInURIs:CreateBackendAuthOAuthConfig' :: CreateBackendAuthOAuthConfig -> [Text]
redirectSignInURIs} -> [Text]
redirectSignInURIs) (\s :: CreateBackendAuthOAuthConfig
s@CreateBackendAuthOAuthConfig' {} [Text]
a -> CreateBackendAuthOAuthConfig
s {$sel:redirectSignInURIs:CreateBackendAuthOAuthConfig' :: [Text]
redirectSignInURIs = [Text]
a} :: CreateBackendAuthOAuthConfig) (([Text] -> f [Text])
 -> CreateBackendAuthOAuthConfig -> f CreateBackendAuthOAuthConfig)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> CreateBackendAuthOAuthConfig
-> f CreateBackendAuthOAuthConfig
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

-- | The OAuth grant type that you use to allow app users to authenticate
-- from your Amplify app.
createBackendAuthOAuthConfig_oAuthGrantType :: Lens.Lens' CreateBackendAuthOAuthConfig OAuthGrantType
createBackendAuthOAuthConfig_oAuthGrantType :: (OAuthGrantType -> f OAuthGrantType)
-> CreateBackendAuthOAuthConfig -> f CreateBackendAuthOAuthConfig
createBackendAuthOAuthConfig_oAuthGrantType = (CreateBackendAuthOAuthConfig -> OAuthGrantType)
-> (CreateBackendAuthOAuthConfig
    -> OAuthGrantType -> CreateBackendAuthOAuthConfig)
-> Lens
     CreateBackendAuthOAuthConfig
     CreateBackendAuthOAuthConfig
     OAuthGrantType
     OAuthGrantType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendAuthOAuthConfig' {OAuthGrantType
oAuthGrantType :: OAuthGrantType
$sel:oAuthGrantType:CreateBackendAuthOAuthConfig' :: CreateBackendAuthOAuthConfig -> OAuthGrantType
oAuthGrantType} -> OAuthGrantType
oAuthGrantType) (\s :: CreateBackendAuthOAuthConfig
s@CreateBackendAuthOAuthConfig' {} OAuthGrantType
a -> CreateBackendAuthOAuthConfig
s {$sel:oAuthGrantType:CreateBackendAuthOAuthConfig' :: OAuthGrantType
oAuthGrantType = OAuthGrantType
a} :: CreateBackendAuthOAuthConfig)

-- | List of OAuth-related flows used to allow your app users to authenticate
-- from your Amplify app.
createBackendAuthOAuthConfig_oAuthScopes :: Lens.Lens' CreateBackendAuthOAuthConfig [OAuthScopesElement]
createBackendAuthOAuthConfig_oAuthScopes :: ([OAuthScopesElement] -> f [OAuthScopesElement])
-> CreateBackendAuthOAuthConfig -> f CreateBackendAuthOAuthConfig
createBackendAuthOAuthConfig_oAuthScopes = (CreateBackendAuthOAuthConfig -> [OAuthScopesElement])
-> (CreateBackendAuthOAuthConfig
    -> [OAuthScopesElement] -> CreateBackendAuthOAuthConfig)
-> Lens
     CreateBackendAuthOAuthConfig
     CreateBackendAuthOAuthConfig
     [OAuthScopesElement]
     [OAuthScopesElement]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendAuthOAuthConfig' {[OAuthScopesElement]
oAuthScopes :: [OAuthScopesElement]
$sel:oAuthScopes:CreateBackendAuthOAuthConfig' :: CreateBackendAuthOAuthConfig -> [OAuthScopesElement]
oAuthScopes} -> [OAuthScopesElement]
oAuthScopes) (\s :: CreateBackendAuthOAuthConfig
s@CreateBackendAuthOAuthConfig' {} [OAuthScopesElement]
a -> CreateBackendAuthOAuthConfig
s {$sel:oAuthScopes:CreateBackendAuthOAuthConfig' :: [OAuthScopesElement]
oAuthScopes = [OAuthScopesElement]
a} :: CreateBackendAuthOAuthConfig) (([OAuthScopesElement] -> f [OAuthScopesElement])
 -> CreateBackendAuthOAuthConfig -> f CreateBackendAuthOAuthConfig)
-> (([OAuthScopesElement] -> f [OAuthScopesElement])
    -> [OAuthScopesElement] -> f [OAuthScopesElement])
-> ([OAuthScopesElement] -> f [OAuthScopesElement])
-> CreateBackendAuthOAuthConfig
-> f CreateBackendAuthOAuthConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([OAuthScopesElement] -> f [OAuthScopesElement])
-> [OAuthScopesElement] -> f [OAuthScopesElement]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON CreateBackendAuthOAuthConfig where
  parseJSON :: Value -> Parser CreateBackendAuthOAuthConfig
parseJSON =
    String
-> (Object -> Parser CreateBackendAuthOAuthConfig)
-> Value
-> Parser CreateBackendAuthOAuthConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CreateBackendAuthOAuthConfig"
      ( \Object
x ->
          Maybe SocialProviderSettings
-> Maybe Text
-> [Text]
-> [Text]
-> OAuthGrantType
-> [OAuthScopesElement]
-> CreateBackendAuthOAuthConfig
CreateBackendAuthOAuthConfig'
            (Maybe SocialProviderSettings
 -> Maybe Text
 -> [Text]
 -> [Text]
 -> OAuthGrantType
 -> [OAuthScopesElement]
 -> CreateBackendAuthOAuthConfig)
-> Parser (Maybe SocialProviderSettings)
-> Parser
     (Maybe Text
      -> [Text]
      -> [Text]
      -> OAuthGrantType
      -> [OAuthScopesElement]
      -> CreateBackendAuthOAuthConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe SocialProviderSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"socialProviderSettings")
            Parser
  (Maybe Text
   -> [Text]
   -> [Text]
   -> OAuthGrantType
   -> [OAuthScopesElement]
   -> CreateBackendAuthOAuthConfig)
-> Parser (Maybe Text)
-> Parser
     ([Text]
      -> [Text]
      -> OAuthGrantType
      -> [OAuthScopesElement]
      -> CreateBackendAuthOAuthConfig)
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
"domainPrefix")
            Parser
  ([Text]
   -> [Text]
   -> OAuthGrantType
   -> [OAuthScopesElement]
   -> CreateBackendAuthOAuthConfig)
-> Parser [Text]
-> Parser
     ([Text]
      -> OAuthGrantType
      -> [OAuthScopesElement]
      -> CreateBackendAuthOAuthConfig)
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
"redirectSignOutURIs"
                            Parser (Maybe [Text]) -> [Text] -> Parser [Text]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  ([Text]
   -> OAuthGrantType
   -> [OAuthScopesElement]
   -> CreateBackendAuthOAuthConfig)
-> Parser [Text]
-> Parser
     (OAuthGrantType
      -> [OAuthScopesElement] -> CreateBackendAuthOAuthConfig)
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
"redirectSignInURIs"
                            Parser (Maybe [Text]) -> [Text] -> Parser [Text]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (OAuthGrantType
   -> [OAuthScopesElement] -> CreateBackendAuthOAuthConfig)
-> Parser OAuthGrantType
-> Parser ([OAuthScopesElement] -> CreateBackendAuthOAuthConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser OAuthGrantType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"oAuthGrantType")
            Parser ([OAuthScopesElement] -> CreateBackendAuthOAuthConfig)
-> Parser [OAuthScopesElement]
-> Parser CreateBackendAuthOAuthConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [OAuthScopesElement])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"oAuthScopes" Parser (Maybe [OAuthScopesElement])
-> [OAuthScopesElement] -> Parser [OAuthScopesElement]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [OAuthScopesElement]
forall a. Monoid a => a
Prelude.mempty)
      )

instance
  Prelude.Hashable
    CreateBackendAuthOAuthConfig

instance Prelude.NFData CreateBackendAuthOAuthConfig

instance Core.ToJSON CreateBackendAuthOAuthConfig where
  toJSON :: CreateBackendAuthOAuthConfig -> Value
toJSON CreateBackendAuthOAuthConfig' {[Text]
[OAuthScopesElement]
Maybe Text
Maybe SocialProviderSettings
OAuthGrantType
oAuthScopes :: [OAuthScopesElement]
oAuthGrantType :: OAuthGrantType
redirectSignInURIs :: [Text]
redirectSignOutURIs :: [Text]
domainPrefix :: Maybe Text
socialProviderSettings :: Maybe SocialProviderSettings
$sel:oAuthScopes:CreateBackendAuthOAuthConfig' :: CreateBackendAuthOAuthConfig -> [OAuthScopesElement]
$sel:oAuthGrantType:CreateBackendAuthOAuthConfig' :: CreateBackendAuthOAuthConfig -> OAuthGrantType
$sel:redirectSignInURIs:CreateBackendAuthOAuthConfig' :: CreateBackendAuthOAuthConfig -> [Text]
$sel:redirectSignOutURIs:CreateBackendAuthOAuthConfig' :: CreateBackendAuthOAuthConfig -> [Text]
$sel:domainPrefix:CreateBackendAuthOAuthConfig' :: CreateBackendAuthOAuthConfig -> Maybe Text
$sel:socialProviderSettings:CreateBackendAuthOAuthConfig' :: CreateBackendAuthOAuthConfig -> Maybe SocialProviderSettings
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"socialProviderSettings" Text -> SocialProviderSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (SocialProviderSettings -> Pair)
-> Maybe SocialProviderSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SocialProviderSettings
socialProviderSettings,
            (Text
"domainPrefix" 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
domainPrefix,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"redirectSignOutURIs" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
redirectSignOutURIs),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"redirectSignInURIs" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
redirectSignInURIs),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"oAuthGrantType" Text -> OAuthGrantType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= OAuthGrantType
oAuthGrantType),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"oAuthScopes" Text -> [OAuthScopesElement] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [OAuthScopesElement]
oAuthScopes)
          ]
      )