{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.AmplifyBackend.Types.LoginAuthConfigReqObj 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

-- | The request object for this operation.
--
-- /See:/ 'newLoginAuthConfigReqObj' smart constructor.
data LoginAuthConfigReqObj = LoginAuthConfigReqObj'
  { -- | The Amazon Cognito identity pool ID used for the Amplify Admin UI login
    -- authorization.
    LoginAuthConfigReqObj -> Maybe Text
awsCognitoIdentityPoolId :: Prelude.Maybe Prelude.Text,
    -- | The AWS Region for the Amplify Admin UI login.
    LoginAuthConfigReqObj -> Maybe Text
awsCognitoRegion :: 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 web client ID for the Amazon Cognito user pools.
    LoginAuthConfigReqObj -> Maybe Text
awsUserPoolsWebClientId :: Prelude.Maybe Prelude.Text
  }
  deriving (LoginAuthConfigReqObj -> LoginAuthConfigReqObj -> Bool
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]
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
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. 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:
--
-- 'awsCognitoIdentityPoolId', 'loginAuthConfigReqObj_awsCognitoIdentityPoolId' - The Amazon Cognito identity pool ID used for the Amplify Admin UI login
-- authorization.
--
-- 'awsCognitoRegion', 'loginAuthConfigReqObj_awsCognitoRegion' - The AWS Region for the Amplify Admin UI login.
--
-- 'awsUserPoolsId', 'loginAuthConfigReqObj_awsUserPoolsId' - The Amazon Cognito user pool ID used for Amplify Admin UI login
-- authentication.
--
-- 'awsUserPoolsWebClientId', 'loginAuthConfigReqObj_awsUserPoolsWebClientId' - The web client ID for the Amazon Cognito user pools.
newLoginAuthConfigReqObj ::
  LoginAuthConfigReqObj
newLoginAuthConfigReqObj :: LoginAuthConfigReqObj
newLoginAuthConfigReqObj =
  LoginAuthConfigReqObj'
    { $sel:awsCognitoIdentityPoolId:LoginAuthConfigReqObj' :: Maybe Text
awsCognitoIdentityPoolId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:awsCognitoRegion:LoginAuthConfigReqObj' :: Maybe Text
awsCognitoRegion = forall a. Maybe a
Prelude.Nothing,
      $sel:awsUserPoolsId:LoginAuthConfigReqObj' :: Maybe Text
awsUserPoolsId = forall a. Maybe a
Prelude.Nothing,
      $sel:awsUserPoolsWebClientId:LoginAuthConfigReqObj' :: Maybe Text
awsUserPoolsWebClientId = forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: Lens' LoginAuthConfigReqObj (Maybe Text)
loginAuthConfigReqObj_awsCognitoIdentityPoolId = 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 AWS Region for the Amplify Admin UI login.
loginAuthConfigReqObj_awsCognitoRegion :: Lens.Lens' LoginAuthConfigReqObj (Prelude.Maybe Prelude.Text)
loginAuthConfigReqObj_awsCognitoRegion :: Lens' LoginAuthConfigReqObj (Maybe Text)
loginAuthConfigReqObj_awsCognitoRegion = 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)

-- | The Amazon Cognito user pool ID used for Amplify Admin UI login
-- authentication.
loginAuthConfigReqObj_awsUserPoolsId :: Lens.Lens' LoginAuthConfigReqObj (Prelude.Maybe Prelude.Text)
loginAuthConfigReqObj_awsUserPoolsId :: Lens' LoginAuthConfigReqObj (Maybe Text)
loginAuthConfigReqObj_awsUserPoolsId = 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 web client ID for the Amazon Cognito user pools.
loginAuthConfigReqObj_awsUserPoolsWebClientId :: Lens.Lens' LoginAuthConfigReqObj (Prelude.Maybe Prelude.Text)
loginAuthConfigReqObj_awsUserPoolsWebClientId :: Lens' LoginAuthConfigReqObj (Maybe Text)
loginAuthConfigReqObj_awsUserPoolsWebClientId = 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)

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

instance Prelude.Hashable LoginAuthConfigReqObj where
  hashWithSalt :: Int -> LoginAuthConfigReqObj -> Int
hashWithSalt Int
_salt LoginAuthConfigReqObj' {Maybe Text
awsUserPoolsWebClientId :: Maybe Text
awsUserPoolsId :: Maybe Text
awsCognitoRegion :: Maybe Text
awsCognitoIdentityPoolId :: Maybe Text
$sel:awsUserPoolsWebClientId:LoginAuthConfigReqObj' :: LoginAuthConfigReqObj -> Maybe Text
$sel:awsUserPoolsId:LoginAuthConfigReqObj' :: LoginAuthConfigReqObj -> Maybe Text
$sel:awsCognitoRegion:LoginAuthConfigReqObj' :: LoginAuthConfigReqObj -> Maybe Text
$sel:awsCognitoIdentityPoolId:LoginAuthConfigReqObj' :: LoginAuthConfigReqObj -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
awsCognitoIdentityPoolId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
awsCognitoRegion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
awsUserPoolsId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
awsUserPoolsWebClientId

instance Prelude.NFData LoginAuthConfigReqObj where
  rnf :: LoginAuthConfigReqObj -> ()
rnf LoginAuthConfigReqObj' {Maybe Text
awsUserPoolsWebClientId :: Maybe Text
awsUserPoolsId :: Maybe Text
awsCognitoRegion :: Maybe Text
awsCognitoIdentityPoolId :: Maybe Text
$sel:awsUserPoolsWebClientId:LoginAuthConfigReqObj' :: LoginAuthConfigReqObj -> Maybe Text
$sel:awsUserPoolsId:LoginAuthConfigReqObj' :: LoginAuthConfigReqObj -> Maybe Text
$sel:awsCognitoRegion:LoginAuthConfigReqObj' :: LoginAuthConfigReqObj -> Maybe Text
$sel:awsCognitoIdentityPoolId:LoginAuthConfigReqObj' :: LoginAuthConfigReqObj -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
awsCognitoIdentityPoolId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
awsCognitoRegion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
awsUserPoolsId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
awsUserPoolsWebClientId

instance Data.ToJSON LoginAuthConfigReqObj where
  toJSON :: LoginAuthConfigReqObj -> Value
toJSON LoginAuthConfigReqObj' {Maybe Text
awsUserPoolsWebClientId :: Maybe Text
awsUserPoolsId :: Maybe Text
awsCognitoRegion :: Maybe Text
awsCognitoIdentityPoolId :: Maybe Text
$sel:awsUserPoolsWebClientId:LoginAuthConfigReqObj' :: LoginAuthConfigReqObj -> Maybe Text
$sel:awsUserPoolsId:LoginAuthConfigReqObj' :: LoginAuthConfigReqObj -> Maybe Text
$sel:awsCognitoRegion:LoginAuthConfigReqObj' :: LoginAuthConfigReqObj -> Maybe Text
$sel:awsCognitoIdentityPoolId:LoginAuthConfigReqObj' :: LoginAuthConfigReqObj -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"aws_cognito_identity_pool_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
awsCognitoIdentityPoolId,
            (Key
"aws_cognito_region" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
awsCognitoRegion,
            (Key
"aws_user_pools_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
awsUserPoolsId,
            (Key
"aws_user_pools_web_client_id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
awsUserPoolsWebClientId
          ]
      )