{-# 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.LoginAuthConfigReqObj
-- 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.LoginAuthConfigReqObj where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The request object for this operation.
--
-- /See:/ 'newLoginAuthConfigReqObj' smart constructor.
data LoginAuthConfigReqObj = LoginAuthConfigReqObj'
  { -- | The web client ID for the Amazon Cognito user pools.
    LoginAuthConfigReqObj -> Maybe Text
awsUserPoolsWebClientId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Cognito identity pool ID used for the Amplify Admin UI login
    -- authorization.
    LoginAuthConfigReqObj -> Maybe Text
awsCognitoIdentityPoolId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Cognito user pool ID used for Amplify Admin UI login
    -- authentication.
    LoginAuthConfigReqObj -> Maybe Text
awsUserPoolsId :: Prelude.Maybe Prelude.Text,
    -- | The AWS Region for the Amplify Admin UI login.
    LoginAuthConfigReqObj -> Maybe Text
awsCognitoRegion :: Prelude.Maybe Prelude.Text
  }
  deriving (LoginAuthConfigReqObj -> LoginAuthConfigReqObj -> Bool
(LoginAuthConfigReqObj -> LoginAuthConfigReqObj -> Bool)
-> (LoginAuthConfigReqObj -> LoginAuthConfigReqObj -> Bool)
-> Eq LoginAuthConfigReqObj
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LoginAuthConfigReqObj -> LoginAuthConfigReqObj -> Bool
$c/= :: LoginAuthConfigReqObj -> LoginAuthConfigReqObj -> Bool
== :: LoginAuthConfigReqObj -> LoginAuthConfigReqObj -> Bool
$c== :: LoginAuthConfigReqObj -> LoginAuthConfigReqObj -> Bool
Prelude.Eq, ReadPrec [LoginAuthConfigReqObj]
ReadPrec LoginAuthConfigReqObj
Int -> ReadS LoginAuthConfigReqObj
ReadS [LoginAuthConfigReqObj]
(Int -> ReadS LoginAuthConfigReqObj)
-> ReadS [LoginAuthConfigReqObj]
-> ReadPrec LoginAuthConfigReqObj
-> ReadPrec [LoginAuthConfigReqObj]
-> Read LoginAuthConfigReqObj
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LoginAuthConfigReqObj]
$creadListPrec :: ReadPrec [LoginAuthConfigReqObj]
readPrec :: ReadPrec LoginAuthConfigReqObj
$creadPrec :: ReadPrec LoginAuthConfigReqObj
readList :: ReadS [LoginAuthConfigReqObj]
$creadList :: ReadS [LoginAuthConfigReqObj]
readsPrec :: Int -> ReadS LoginAuthConfigReqObj
$creadsPrec :: Int -> ReadS LoginAuthConfigReqObj
Prelude.Read, Int -> LoginAuthConfigReqObj -> ShowS
[LoginAuthConfigReqObj] -> ShowS
LoginAuthConfigReqObj -> String
(Int -> LoginAuthConfigReqObj -> ShowS)
-> (LoginAuthConfigReqObj -> String)
-> ([LoginAuthConfigReqObj] -> ShowS)
-> Show LoginAuthConfigReqObj
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LoginAuthConfigReqObj] -> ShowS
$cshowList :: [LoginAuthConfigReqObj] -> ShowS
show :: LoginAuthConfigReqObj -> String
$cshow :: LoginAuthConfigReqObj -> String
showsPrec :: Int -> LoginAuthConfigReqObj -> ShowS
$cshowsPrec :: Int -> LoginAuthConfigReqObj -> ShowS
Prelude.Show, (forall x. LoginAuthConfigReqObj -> Rep LoginAuthConfigReqObj x)
-> (forall x. Rep LoginAuthConfigReqObj x -> LoginAuthConfigReqObj)
-> Generic LoginAuthConfigReqObj
forall x. Rep LoginAuthConfigReqObj x -> LoginAuthConfigReqObj
forall x. LoginAuthConfigReqObj -> Rep LoginAuthConfigReqObj x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LoginAuthConfigReqObj x -> LoginAuthConfigReqObj
$cfrom :: forall x. LoginAuthConfigReqObj -> Rep LoginAuthConfigReqObj x
Prelude.Generic)

-- |
-- Create a value of 'LoginAuthConfigReqObj' 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:
--
-- 'awsUserPoolsWebClientId', 'loginAuthConfigReqObj_awsUserPoolsWebClientId' - The web client ID for the Amazon Cognito user pools.
--
-- 'awsCognitoIdentityPoolId', 'loginAuthConfigReqObj_awsCognitoIdentityPoolId' - The Amazon Cognito identity pool ID used for the Amplify Admin UI login
-- authorization.
--
-- 'awsUserPoolsId', 'loginAuthConfigReqObj_awsUserPoolsId' - The Amazon Cognito user pool ID used for Amplify Admin UI login
-- authentication.
--
-- 'awsCognitoRegion', 'loginAuthConfigReqObj_awsCognitoRegion' - The AWS Region for the Amplify Admin UI login.
newLoginAuthConfigReqObj ::
  LoginAuthConfigReqObj
newLoginAuthConfigReqObj :: LoginAuthConfigReqObj
newLoginAuthConfigReqObj =
  LoginAuthConfigReqObj' :: Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> LoginAuthConfigReqObj
LoginAuthConfigReqObj'
    { $sel:awsUserPoolsWebClientId:LoginAuthConfigReqObj' :: Maybe Text
awsUserPoolsWebClientId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:awsCognitoIdentityPoolId:LoginAuthConfigReqObj' :: Maybe Text
awsCognitoIdentityPoolId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:awsUserPoolsId:LoginAuthConfigReqObj' :: Maybe Text
awsUserPoolsId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:awsCognitoRegion:LoginAuthConfigReqObj' :: Maybe Text
awsCognitoRegion = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The web client ID for the Amazon Cognito user pools.
loginAuthConfigReqObj_awsUserPoolsWebClientId :: Lens.Lens' LoginAuthConfigReqObj (Prelude.Maybe Prelude.Text)
loginAuthConfigReqObj_awsUserPoolsWebClientId :: (Maybe Text -> f (Maybe Text))
-> LoginAuthConfigReqObj -> f LoginAuthConfigReqObj
loginAuthConfigReqObj_awsUserPoolsWebClientId = (LoginAuthConfigReqObj -> Maybe Text)
-> (LoginAuthConfigReqObj -> Maybe Text -> LoginAuthConfigReqObj)
-> Lens
     LoginAuthConfigReqObj
     LoginAuthConfigReqObj
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoginAuthConfigReqObj' {Maybe Text
awsUserPoolsWebClientId :: Maybe Text
$sel:awsUserPoolsWebClientId:LoginAuthConfigReqObj' :: LoginAuthConfigReqObj -> Maybe Text
awsUserPoolsWebClientId} -> Maybe Text
awsUserPoolsWebClientId) (\s :: LoginAuthConfigReqObj
s@LoginAuthConfigReqObj' {} Maybe Text
a -> LoginAuthConfigReqObj
s {$sel:awsUserPoolsWebClientId:LoginAuthConfigReqObj' :: Maybe Text
awsUserPoolsWebClientId = Maybe Text
a} :: LoginAuthConfigReqObj)

-- | The Amazon Cognito identity pool ID used for the Amplify Admin UI login
-- authorization.
loginAuthConfigReqObj_awsCognitoIdentityPoolId :: Lens.Lens' LoginAuthConfigReqObj (Prelude.Maybe Prelude.Text)
loginAuthConfigReqObj_awsCognitoIdentityPoolId :: (Maybe Text -> f (Maybe Text))
-> LoginAuthConfigReqObj -> f LoginAuthConfigReqObj
loginAuthConfigReqObj_awsCognitoIdentityPoolId = (LoginAuthConfigReqObj -> Maybe Text)
-> (LoginAuthConfigReqObj -> Maybe Text -> LoginAuthConfigReqObj)
-> Lens
     LoginAuthConfigReqObj
     LoginAuthConfigReqObj
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoginAuthConfigReqObj' {Maybe Text
awsCognitoIdentityPoolId :: Maybe Text
$sel:awsCognitoIdentityPoolId:LoginAuthConfigReqObj' :: LoginAuthConfigReqObj -> Maybe Text
awsCognitoIdentityPoolId} -> Maybe Text
awsCognitoIdentityPoolId) (\s :: LoginAuthConfigReqObj
s@LoginAuthConfigReqObj' {} Maybe Text
a -> LoginAuthConfigReqObj
s {$sel:awsCognitoIdentityPoolId:LoginAuthConfigReqObj' :: Maybe Text
awsCognitoIdentityPoolId = Maybe Text
a} :: LoginAuthConfigReqObj)

-- | The Amazon Cognito user pool ID used for Amplify Admin UI login
-- authentication.
loginAuthConfigReqObj_awsUserPoolsId :: Lens.Lens' LoginAuthConfigReqObj (Prelude.Maybe Prelude.Text)
loginAuthConfigReqObj_awsUserPoolsId :: (Maybe Text -> f (Maybe Text))
-> LoginAuthConfigReqObj -> f LoginAuthConfigReqObj
loginAuthConfigReqObj_awsUserPoolsId = (LoginAuthConfigReqObj -> Maybe Text)
-> (LoginAuthConfigReqObj -> Maybe Text -> LoginAuthConfigReqObj)
-> Lens
     LoginAuthConfigReqObj
     LoginAuthConfigReqObj
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoginAuthConfigReqObj' {Maybe Text
awsUserPoolsId :: Maybe Text
$sel:awsUserPoolsId:LoginAuthConfigReqObj' :: LoginAuthConfigReqObj -> Maybe Text
awsUserPoolsId} -> Maybe Text
awsUserPoolsId) (\s :: LoginAuthConfigReqObj
s@LoginAuthConfigReqObj' {} Maybe Text
a -> LoginAuthConfigReqObj
s {$sel:awsUserPoolsId:LoginAuthConfigReqObj' :: Maybe Text
awsUserPoolsId = Maybe Text
a} :: LoginAuthConfigReqObj)

-- | The AWS Region for the Amplify Admin UI login.
loginAuthConfigReqObj_awsCognitoRegion :: Lens.Lens' LoginAuthConfigReqObj (Prelude.Maybe Prelude.Text)
loginAuthConfigReqObj_awsCognitoRegion :: (Maybe Text -> f (Maybe Text))
-> LoginAuthConfigReqObj -> f LoginAuthConfigReqObj
loginAuthConfigReqObj_awsCognitoRegion = (LoginAuthConfigReqObj -> Maybe Text)
-> (LoginAuthConfigReqObj -> Maybe Text -> LoginAuthConfigReqObj)
-> Lens
     LoginAuthConfigReqObj
     LoginAuthConfigReqObj
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoginAuthConfigReqObj' {Maybe Text
awsCognitoRegion :: Maybe Text
$sel:awsCognitoRegion:LoginAuthConfigReqObj' :: LoginAuthConfigReqObj -> Maybe Text
awsCognitoRegion} -> Maybe Text
awsCognitoRegion) (\s :: LoginAuthConfigReqObj
s@LoginAuthConfigReqObj' {} Maybe Text
a -> LoginAuthConfigReqObj
s {$sel:awsCognitoRegion:LoginAuthConfigReqObj' :: Maybe Text
awsCognitoRegion = Maybe Text
a} :: LoginAuthConfigReqObj)

instance Core.FromJSON LoginAuthConfigReqObj where
  parseJSON :: Value -> Parser LoginAuthConfigReqObj
parseJSON =
    String
-> (Object -> Parser LoginAuthConfigReqObj)
-> Value
-> Parser LoginAuthConfigReqObj
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LoginAuthConfigReqObj"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> LoginAuthConfigReqObj
LoginAuthConfigReqObj'
            (Maybe Text
 -> Maybe Text -> Maybe Text -> Maybe Text -> LoginAuthConfigReqObj)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> LoginAuthConfigReqObj)
forall (f :: * -> *) a b. Functor 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
"aws_user_pools_web_client_id")
            Parser
  (Maybe Text -> Maybe Text -> Maybe Text -> LoginAuthConfigReqObj)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> LoginAuthConfigReqObj)
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
"aws_cognito_identity_pool_id")
            Parser (Maybe Text -> Maybe Text -> LoginAuthConfigReqObj)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> LoginAuthConfigReqObj)
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
"aws_user_pools_id")
            Parser (Maybe Text -> LoginAuthConfigReqObj)
-> Parser (Maybe Text) -> Parser LoginAuthConfigReqObj
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
"aws_cognito_region")
      )

instance Prelude.Hashable LoginAuthConfigReqObj

instance Prelude.NFData LoginAuthConfigReqObj

instance Core.ToJSON LoginAuthConfigReqObj where
  toJSON :: LoginAuthConfigReqObj -> Value
toJSON LoginAuthConfigReqObj' {Maybe Text
awsCognitoRegion :: Maybe Text
awsUserPoolsId :: Maybe Text
awsCognitoIdentityPoolId :: Maybe Text
awsUserPoolsWebClientId :: Maybe Text
$sel:awsCognitoRegion:LoginAuthConfigReqObj' :: LoginAuthConfigReqObj -> Maybe Text
$sel:awsUserPoolsId:LoginAuthConfigReqObj' :: LoginAuthConfigReqObj -> Maybe Text
$sel:awsCognitoIdentityPoolId:LoginAuthConfigReqObj' :: LoginAuthConfigReqObj -> Maybe Text
$sel:awsUserPoolsWebClientId:LoginAuthConfigReqObj' :: LoginAuthConfigReqObj -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"aws_user_pools_web_client_id" 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
awsUserPoolsWebClientId,
            (Text
"aws_cognito_identity_pool_id" 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
awsCognitoIdentityPoolId,
            (Text
"aws_user_pools_id" 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
awsUserPoolsId,
            (Text
"aws_cognito_region" 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
awsCognitoRegion
          ]
      )