{-# 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.ELBV2.Types.AuthenticateCognitoActionConfig
-- 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.ELBV2.Types.AuthenticateCognitoActionConfig where

import qualified Amazonka.Core as Core
import Amazonka.ELBV2.Types.AuthenticateCognitoActionConditionalBehaviorEnum
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Request parameters to use when integrating with Amazon Cognito to
-- authenticate users.
--
-- /See:/ 'newAuthenticateCognitoActionConfig' smart constructor.
data AuthenticateCognitoActionConfig = AuthenticateCognitoActionConfig'
  { -- | The query parameters (up to 10) to include in the redirect request to
    -- the authorization endpoint.
    AuthenticateCognitoActionConfig -> Maybe (HashMap Text Text)
authenticationRequestExtraParams :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The set of user claims to be requested from the IdP. The default is
    -- @openid@.
    --
    -- To verify which scope values your IdP supports and how to separate
    -- multiple values, see the documentation for your IdP.
    AuthenticateCognitoActionConfig -> Maybe Text
scope :: Prelude.Maybe Prelude.Text,
    -- | The behavior if the user is not authenticated. The following are
    -- possible values:
    --
    -- -   deny@@ - Return an HTTP 401 Unauthorized error.
    --
    -- -   allow@@ - Allow the request to be forwarded to the target.
    --
    -- -   authenticate@@ - Redirect the request to the IdP authorization
    --     endpoint. This is the default value.
    AuthenticateCognitoActionConfig
-> Maybe AuthenticateCognitoActionConditionalBehaviorEnum
onUnauthenticatedRequest :: Prelude.Maybe AuthenticateCognitoActionConditionalBehaviorEnum,
    -- | The name of the cookie used to maintain session information. The default
    -- is AWSELBAuthSessionCookie.
    AuthenticateCognitoActionConfig -> Maybe Text
sessionCookieName :: Prelude.Maybe Prelude.Text,
    -- | The maximum duration of the authentication session, in seconds. The
    -- default is 604800 seconds (7 days).
    AuthenticateCognitoActionConfig -> Maybe Integer
sessionTimeout :: Prelude.Maybe Prelude.Integer,
    -- | The Amazon Resource Name (ARN) of the Amazon Cognito user pool.
    AuthenticateCognitoActionConfig -> Text
userPoolArn :: Prelude.Text,
    -- | The ID of the Amazon Cognito user pool client.
    AuthenticateCognitoActionConfig -> Text
userPoolClientId :: Prelude.Text,
    -- | The domain prefix or fully-qualified domain name of the Amazon Cognito
    -- user pool.
    AuthenticateCognitoActionConfig -> Text
userPoolDomain :: Prelude.Text
  }
  deriving (AuthenticateCognitoActionConfig
-> AuthenticateCognitoActionConfig -> Bool
(AuthenticateCognitoActionConfig
 -> AuthenticateCognitoActionConfig -> Bool)
-> (AuthenticateCognitoActionConfig
    -> AuthenticateCognitoActionConfig -> Bool)
-> Eq AuthenticateCognitoActionConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AuthenticateCognitoActionConfig
-> AuthenticateCognitoActionConfig -> Bool
$c/= :: AuthenticateCognitoActionConfig
-> AuthenticateCognitoActionConfig -> Bool
== :: AuthenticateCognitoActionConfig
-> AuthenticateCognitoActionConfig -> Bool
$c== :: AuthenticateCognitoActionConfig
-> AuthenticateCognitoActionConfig -> Bool
Prelude.Eq, ReadPrec [AuthenticateCognitoActionConfig]
ReadPrec AuthenticateCognitoActionConfig
Int -> ReadS AuthenticateCognitoActionConfig
ReadS [AuthenticateCognitoActionConfig]
(Int -> ReadS AuthenticateCognitoActionConfig)
-> ReadS [AuthenticateCognitoActionConfig]
-> ReadPrec AuthenticateCognitoActionConfig
-> ReadPrec [AuthenticateCognitoActionConfig]
-> Read AuthenticateCognitoActionConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AuthenticateCognitoActionConfig]
$creadListPrec :: ReadPrec [AuthenticateCognitoActionConfig]
readPrec :: ReadPrec AuthenticateCognitoActionConfig
$creadPrec :: ReadPrec AuthenticateCognitoActionConfig
readList :: ReadS [AuthenticateCognitoActionConfig]
$creadList :: ReadS [AuthenticateCognitoActionConfig]
readsPrec :: Int -> ReadS AuthenticateCognitoActionConfig
$creadsPrec :: Int -> ReadS AuthenticateCognitoActionConfig
Prelude.Read, Int -> AuthenticateCognitoActionConfig -> ShowS
[AuthenticateCognitoActionConfig] -> ShowS
AuthenticateCognitoActionConfig -> String
(Int -> AuthenticateCognitoActionConfig -> ShowS)
-> (AuthenticateCognitoActionConfig -> String)
-> ([AuthenticateCognitoActionConfig] -> ShowS)
-> Show AuthenticateCognitoActionConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AuthenticateCognitoActionConfig] -> ShowS
$cshowList :: [AuthenticateCognitoActionConfig] -> ShowS
show :: AuthenticateCognitoActionConfig -> String
$cshow :: AuthenticateCognitoActionConfig -> String
showsPrec :: Int -> AuthenticateCognitoActionConfig -> ShowS
$cshowsPrec :: Int -> AuthenticateCognitoActionConfig -> ShowS
Prelude.Show, (forall x.
 AuthenticateCognitoActionConfig
 -> Rep AuthenticateCognitoActionConfig x)
-> (forall x.
    Rep AuthenticateCognitoActionConfig x
    -> AuthenticateCognitoActionConfig)
-> Generic AuthenticateCognitoActionConfig
forall x.
Rep AuthenticateCognitoActionConfig x
-> AuthenticateCognitoActionConfig
forall x.
AuthenticateCognitoActionConfig
-> Rep AuthenticateCognitoActionConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AuthenticateCognitoActionConfig x
-> AuthenticateCognitoActionConfig
$cfrom :: forall x.
AuthenticateCognitoActionConfig
-> Rep AuthenticateCognitoActionConfig x
Prelude.Generic)

-- |
-- Create a value of 'AuthenticateCognitoActionConfig' 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:
--
-- 'authenticationRequestExtraParams', 'authenticateCognitoActionConfig_authenticationRequestExtraParams' - The query parameters (up to 10) to include in the redirect request to
-- the authorization endpoint.
--
-- 'scope', 'authenticateCognitoActionConfig_scope' - The set of user claims to be requested from the IdP. The default is
-- @openid@.
--
-- To verify which scope values your IdP supports and how to separate
-- multiple values, see the documentation for your IdP.
--
-- 'onUnauthenticatedRequest', 'authenticateCognitoActionConfig_onUnauthenticatedRequest' - The behavior if the user is not authenticated. The following are
-- possible values:
--
-- -   deny@@ - Return an HTTP 401 Unauthorized error.
--
-- -   allow@@ - Allow the request to be forwarded to the target.
--
-- -   authenticate@@ - Redirect the request to the IdP authorization
--     endpoint. This is the default value.
--
-- 'sessionCookieName', 'authenticateCognitoActionConfig_sessionCookieName' - The name of the cookie used to maintain session information. The default
-- is AWSELBAuthSessionCookie.
--
-- 'sessionTimeout', 'authenticateCognitoActionConfig_sessionTimeout' - The maximum duration of the authentication session, in seconds. The
-- default is 604800 seconds (7 days).
--
-- 'userPoolArn', 'authenticateCognitoActionConfig_userPoolArn' - The Amazon Resource Name (ARN) of the Amazon Cognito user pool.
--
-- 'userPoolClientId', 'authenticateCognitoActionConfig_userPoolClientId' - The ID of the Amazon Cognito user pool client.
--
-- 'userPoolDomain', 'authenticateCognitoActionConfig_userPoolDomain' - The domain prefix or fully-qualified domain name of the Amazon Cognito
-- user pool.
newAuthenticateCognitoActionConfig ::
  -- | 'userPoolArn'
  Prelude.Text ->
  -- | 'userPoolClientId'
  Prelude.Text ->
  -- | 'userPoolDomain'
  Prelude.Text ->
  AuthenticateCognitoActionConfig
newAuthenticateCognitoActionConfig :: Text -> Text -> Text -> AuthenticateCognitoActionConfig
newAuthenticateCognitoActionConfig
  Text
pUserPoolArn_
  Text
pUserPoolClientId_
  Text
pUserPoolDomain_ =
    AuthenticateCognitoActionConfig' :: Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe AuthenticateCognitoActionConditionalBehaviorEnum
-> Maybe Text
-> Maybe Integer
-> Text
-> Text
-> Text
-> AuthenticateCognitoActionConfig
AuthenticateCognitoActionConfig'
      { $sel:authenticationRequestExtraParams:AuthenticateCognitoActionConfig' :: Maybe (HashMap Text Text)
authenticationRequestExtraParams =
          Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:scope:AuthenticateCognitoActionConfig' :: Maybe Text
scope = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:onUnauthenticatedRequest:AuthenticateCognitoActionConfig' :: Maybe AuthenticateCognitoActionConditionalBehaviorEnum
onUnauthenticatedRequest = Maybe AuthenticateCognitoActionConditionalBehaviorEnum
forall a. Maybe a
Prelude.Nothing,
        $sel:sessionCookieName:AuthenticateCognitoActionConfig' :: Maybe Text
sessionCookieName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:sessionTimeout:AuthenticateCognitoActionConfig' :: Maybe Integer
sessionTimeout = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
        $sel:userPoolArn:AuthenticateCognitoActionConfig' :: Text
userPoolArn = Text
pUserPoolArn_,
        $sel:userPoolClientId:AuthenticateCognitoActionConfig' :: Text
userPoolClientId = Text
pUserPoolClientId_,
        $sel:userPoolDomain:AuthenticateCognitoActionConfig' :: Text
userPoolDomain = Text
pUserPoolDomain_
      }

-- | The query parameters (up to 10) to include in the redirect request to
-- the authorization endpoint.
authenticateCognitoActionConfig_authenticationRequestExtraParams :: Lens.Lens' AuthenticateCognitoActionConfig (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
authenticateCognitoActionConfig_authenticationRequestExtraParams :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> AuthenticateCognitoActionConfig
-> f AuthenticateCognitoActionConfig
authenticateCognitoActionConfig_authenticationRequestExtraParams = (AuthenticateCognitoActionConfig -> Maybe (HashMap Text Text))
-> (AuthenticateCognitoActionConfig
    -> Maybe (HashMap Text Text) -> AuthenticateCognitoActionConfig)
-> Lens
     AuthenticateCognitoActionConfig
     AuthenticateCognitoActionConfig
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuthenticateCognitoActionConfig' {Maybe (HashMap Text Text)
authenticationRequestExtraParams :: Maybe (HashMap Text Text)
$sel:authenticationRequestExtraParams:AuthenticateCognitoActionConfig' :: AuthenticateCognitoActionConfig -> Maybe (HashMap Text Text)
authenticationRequestExtraParams} -> Maybe (HashMap Text Text)
authenticationRequestExtraParams) (\s :: AuthenticateCognitoActionConfig
s@AuthenticateCognitoActionConfig' {} Maybe (HashMap Text Text)
a -> AuthenticateCognitoActionConfig
s {$sel:authenticationRequestExtraParams:AuthenticateCognitoActionConfig' :: Maybe (HashMap Text Text)
authenticationRequestExtraParams = Maybe (HashMap Text Text)
a} :: AuthenticateCognitoActionConfig) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> AuthenticateCognitoActionConfig
 -> f AuthenticateCognitoActionConfig)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> AuthenticateCognitoActionConfig
-> f AuthenticateCognitoActionConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The set of user claims to be requested from the IdP. The default is
-- @openid@.
--
-- To verify which scope values your IdP supports and how to separate
-- multiple values, see the documentation for your IdP.
authenticateCognitoActionConfig_scope :: Lens.Lens' AuthenticateCognitoActionConfig (Prelude.Maybe Prelude.Text)
authenticateCognitoActionConfig_scope :: (Maybe Text -> f (Maybe Text))
-> AuthenticateCognitoActionConfig
-> f AuthenticateCognitoActionConfig
authenticateCognitoActionConfig_scope = (AuthenticateCognitoActionConfig -> Maybe Text)
-> (AuthenticateCognitoActionConfig
    -> Maybe Text -> AuthenticateCognitoActionConfig)
-> Lens
     AuthenticateCognitoActionConfig
     AuthenticateCognitoActionConfig
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuthenticateCognitoActionConfig' {Maybe Text
scope :: Maybe Text
$sel:scope:AuthenticateCognitoActionConfig' :: AuthenticateCognitoActionConfig -> Maybe Text
scope} -> Maybe Text
scope) (\s :: AuthenticateCognitoActionConfig
s@AuthenticateCognitoActionConfig' {} Maybe Text
a -> AuthenticateCognitoActionConfig
s {$sel:scope:AuthenticateCognitoActionConfig' :: Maybe Text
scope = Maybe Text
a} :: AuthenticateCognitoActionConfig)

-- | The behavior if the user is not authenticated. The following are
-- possible values:
--
-- -   deny@@ - Return an HTTP 401 Unauthorized error.
--
-- -   allow@@ - Allow the request to be forwarded to the target.
--
-- -   authenticate@@ - Redirect the request to the IdP authorization
--     endpoint. This is the default value.
authenticateCognitoActionConfig_onUnauthenticatedRequest :: Lens.Lens' AuthenticateCognitoActionConfig (Prelude.Maybe AuthenticateCognitoActionConditionalBehaviorEnum)
authenticateCognitoActionConfig_onUnauthenticatedRequest :: (Maybe AuthenticateCognitoActionConditionalBehaviorEnum
 -> f (Maybe AuthenticateCognitoActionConditionalBehaviorEnum))
-> AuthenticateCognitoActionConfig
-> f AuthenticateCognitoActionConfig
authenticateCognitoActionConfig_onUnauthenticatedRequest = (AuthenticateCognitoActionConfig
 -> Maybe AuthenticateCognitoActionConditionalBehaviorEnum)
-> (AuthenticateCognitoActionConfig
    -> Maybe AuthenticateCognitoActionConditionalBehaviorEnum
    -> AuthenticateCognitoActionConfig)
-> Lens
     AuthenticateCognitoActionConfig
     AuthenticateCognitoActionConfig
     (Maybe AuthenticateCognitoActionConditionalBehaviorEnum)
     (Maybe AuthenticateCognitoActionConditionalBehaviorEnum)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuthenticateCognitoActionConfig' {Maybe AuthenticateCognitoActionConditionalBehaviorEnum
onUnauthenticatedRequest :: Maybe AuthenticateCognitoActionConditionalBehaviorEnum
$sel:onUnauthenticatedRequest:AuthenticateCognitoActionConfig' :: AuthenticateCognitoActionConfig
-> Maybe AuthenticateCognitoActionConditionalBehaviorEnum
onUnauthenticatedRequest} -> Maybe AuthenticateCognitoActionConditionalBehaviorEnum
onUnauthenticatedRequest) (\s :: AuthenticateCognitoActionConfig
s@AuthenticateCognitoActionConfig' {} Maybe AuthenticateCognitoActionConditionalBehaviorEnum
a -> AuthenticateCognitoActionConfig
s {$sel:onUnauthenticatedRequest:AuthenticateCognitoActionConfig' :: Maybe AuthenticateCognitoActionConditionalBehaviorEnum
onUnauthenticatedRequest = Maybe AuthenticateCognitoActionConditionalBehaviorEnum
a} :: AuthenticateCognitoActionConfig)

-- | The name of the cookie used to maintain session information. The default
-- is AWSELBAuthSessionCookie.
authenticateCognitoActionConfig_sessionCookieName :: Lens.Lens' AuthenticateCognitoActionConfig (Prelude.Maybe Prelude.Text)
authenticateCognitoActionConfig_sessionCookieName :: (Maybe Text -> f (Maybe Text))
-> AuthenticateCognitoActionConfig
-> f AuthenticateCognitoActionConfig
authenticateCognitoActionConfig_sessionCookieName = (AuthenticateCognitoActionConfig -> Maybe Text)
-> (AuthenticateCognitoActionConfig
    -> Maybe Text -> AuthenticateCognitoActionConfig)
-> Lens
     AuthenticateCognitoActionConfig
     AuthenticateCognitoActionConfig
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuthenticateCognitoActionConfig' {Maybe Text
sessionCookieName :: Maybe Text
$sel:sessionCookieName:AuthenticateCognitoActionConfig' :: AuthenticateCognitoActionConfig -> Maybe Text
sessionCookieName} -> Maybe Text
sessionCookieName) (\s :: AuthenticateCognitoActionConfig
s@AuthenticateCognitoActionConfig' {} Maybe Text
a -> AuthenticateCognitoActionConfig
s {$sel:sessionCookieName:AuthenticateCognitoActionConfig' :: Maybe Text
sessionCookieName = Maybe Text
a} :: AuthenticateCognitoActionConfig)

-- | The maximum duration of the authentication session, in seconds. The
-- default is 604800 seconds (7 days).
authenticateCognitoActionConfig_sessionTimeout :: Lens.Lens' AuthenticateCognitoActionConfig (Prelude.Maybe Prelude.Integer)
authenticateCognitoActionConfig_sessionTimeout :: (Maybe Integer -> f (Maybe Integer))
-> AuthenticateCognitoActionConfig
-> f AuthenticateCognitoActionConfig
authenticateCognitoActionConfig_sessionTimeout = (AuthenticateCognitoActionConfig -> Maybe Integer)
-> (AuthenticateCognitoActionConfig
    -> Maybe Integer -> AuthenticateCognitoActionConfig)
-> Lens
     AuthenticateCognitoActionConfig
     AuthenticateCognitoActionConfig
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuthenticateCognitoActionConfig' {Maybe Integer
sessionTimeout :: Maybe Integer
$sel:sessionTimeout:AuthenticateCognitoActionConfig' :: AuthenticateCognitoActionConfig -> Maybe Integer
sessionTimeout} -> Maybe Integer
sessionTimeout) (\s :: AuthenticateCognitoActionConfig
s@AuthenticateCognitoActionConfig' {} Maybe Integer
a -> AuthenticateCognitoActionConfig
s {$sel:sessionTimeout:AuthenticateCognitoActionConfig' :: Maybe Integer
sessionTimeout = Maybe Integer
a} :: AuthenticateCognitoActionConfig)

-- | The Amazon Resource Name (ARN) of the Amazon Cognito user pool.
authenticateCognitoActionConfig_userPoolArn :: Lens.Lens' AuthenticateCognitoActionConfig Prelude.Text
authenticateCognitoActionConfig_userPoolArn :: (Text -> f Text)
-> AuthenticateCognitoActionConfig
-> f AuthenticateCognitoActionConfig
authenticateCognitoActionConfig_userPoolArn = (AuthenticateCognitoActionConfig -> Text)
-> (AuthenticateCognitoActionConfig
    -> Text -> AuthenticateCognitoActionConfig)
-> Lens
     AuthenticateCognitoActionConfig
     AuthenticateCognitoActionConfig
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuthenticateCognitoActionConfig' {Text
userPoolArn :: Text
$sel:userPoolArn:AuthenticateCognitoActionConfig' :: AuthenticateCognitoActionConfig -> Text
userPoolArn} -> Text
userPoolArn) (\s :: AuthenticateCognitoActionConfig
s@AuthenticateCognitoActionConfig' {} Text
a -> AuthenticateCognitoActionConfig
s {$sel:userPoolArn:AuthenticateCognitoActionConfig' :: Text
userPoolArn = Text
a} :: AuthenticateCognitoActionConfig)

-- | The ID of the Amazon Cognito user pool client.
authenticateCognitoActionConfig_userPoolClientId :: Lens.Lens' AuthenticateCognitoActionConfig Prelude.Text
authenticateCognitoActionConfig_userPoolClientId :: (Text -> f Text)
-> AuthenticateCognitoActionConfig
-> f AuthenticateCognitoActionConfig
authenticateCognitoActionConfig_userPoolClientId = (AuthenticateCognitoActionConfig -> Text)
-> (AuthenticateCognitoActionConfig
    -> Text -> AuthenticateCognitoActionConfig)
-> Lens
     AuthenticateCognitoActionConfig
     AuthenticateCognitoActionConfig
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuthenticateCognitoActionConfig' {Text
userPoolClientId :: Text
$sel:userPoolClientId:AuthenticateCognitoActionConfig' :: AuthenticateCognitoActionConfig -> Text
userPoolClientId} -> Text
userPoolClientId) (\s :: AuthenticateCognitoActionConfig
s@AuthenticateCognitoActionConfig' {} Text
a -> AuthenticateCognitoActionConfig
s {$sel:userPoolClientId:AuthenticateCognitoActionConfig' :: Text
userPoolClientId = Text
a} :: AuthenticateCognitoActionConfig)

-- | The domain prefix or fully-qualified domain name of the Amazon Cognito
-- user pool.
authenticateCognitoActionConfig_userPoolDomain :: Lens.Lens' AuthenticateCognitoActionConfig Prelude.Text
authenticateCognitoActionConfig_userPoolDomain :: (Text -> f Text)
-> AuthenticateCognitoActionConfig
-> f AuthenticateCognitoActionConfig
authenticateCognitoActionConfig_userPoolDomain = (AuthenticateCognitoActionConfig -> Text)
-> (AuthenticateCognitoActionConfig
    -> Text -> AuthenticateCognitoActionConfig)
-> Lens
     AuthenticateCognitoActionConfig
     AuthenticateCognitoActionConfig
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuthenticateCognitoActionConfig' {Text
userPoolDomain :: Text
$sel:userPoolDomain:AuthenticateCognitoActionConfig' :: AuthenticateCognitoActionConfig -> Text
userPoolDomain} -> Text
userPoolDomain) (\s :: AuthenticateCognitoActionConfig
s@AuthenticateCognitoActionConfig' {} Text
a -> AuthenticateCognitoActionConfig
s {$sel:userPoolDomain:AuthenticateCognitoActionConfig' :: Text
userPoolDomain = Text
a} :: AuthenticateCognitoActionConfig)

instance Core.FromXML AuthenticateCognitoActionConfig where
  parseXML :: [Node] -> Either String AuthenticateCognitoActionConfig
parseXML [Node]
x =
    Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe AuthenticateCognitoActionConditionalBehaviorEnum
-> Maybe Text
-> Maybe Integer
-> Text
-> Text
-> Text
-> AuthenticateCognitoActionConfig
AuthenticateCognitoActionConfig'
      (Maybe (HashMap Text Text)
 -> Maybe Text
 -> Maybe AuthenticateCognitoActionConditionalBehaviorEnum
 -> Maybe Text
 -> Maybe Integer
 -> Text
 -> Text
 -> Text
 -> AuthenticateCognitoActionConfig)
-> Either String (Maybe (HashMap Text Text))
-> Either
     String
     (Maybe Text
      -> Maybe AuthenticateCognitoActionConditionalBehaviorEnum
      -> Maybe Text
      -> Maybe Integer
      -> Text
      -> Text
      -> Text
      -> AuthenticateCognitoActionConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"AuthenticationRequestExtraParams"
                      Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                      Either String [Node]
-> ([Node] -> Either String (Maybe (HashMap Text Text)))
-> Either String (Maybe (HashMap Text Text))
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String (HashMap Text Text))
-> [Node] -> Either String (Maybe (HashMap Text Text))
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> Text -> Text -> [Node] -> Either String (HashMap Text Text)
forall k v.
(Eq k, Hashable k, FromText k, FromXML v) =>
Text -> Text -> Text -> [Node] -> Either String (HashMap k v)
Core.parseXMLMap Text
"entry" Text
"key" Text
"value")
                  )
      Either
  String
  (Maybe Text
   -> Maybe AuthenticateCognitoActionConditionalBehaviorEnum
   -> Maybe Text
   -> Maybe Integer
   -> Text
   -> Text
   -> Text
   -> AuthenticateCognitoActionConfig)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe AuthenticateCognitoActionConditionalBehaviorEnum
      -> Maybe Text
      -> Maybe Integer
      -> Text
      -> Text
      -> Text
      -> AuthenticateCognitoActionConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Scope")
      Either
  String
  (Maybe AuthenticateCognitoActionConditionalBehaviorEnum
   -> Maybe Text
   -> Maybe Integer
   -> Text
   -> Text
   -> Text
   -> AuthenticateCognitoActionConfig)
-> Either
     String (Maybe AuthenticateCognitoActionConditionalBehaviorEnum)
-> Either
     String
     (Maybe Text
      -> Maybe Integer
      -> Text
      -> Text
      -> Text
      -> AuthenticateCognitoActionConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node]
-> Text
-> Either
     String (Maybe AuthenticateCognitoActionConditionalBehaviorEnum)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"OnUnauthenticatedRequest")
      Either
  String
  (Maybe Text
   -> Maybe Integer
   -> Text
   -> Text
   -> Text
   -> AuthenticateCognitoActionConfig)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Integer
      -> Text -> Text -> Text -> AuthenticateCognitoActionConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"SessionCookieName")
      Either
  String
  (Maybe Integer
   -> Text -> Text -> Text -> AuthenticateCognitoActionConfig)
-> Either String (Maybe Integer)
-> Either
     String (Text -> Text -> Text -> AuthenticateCognitoActionConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Integer)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"SessionTimeout")
      Either
  String (Text -> Text -> Text -> AuthenticateCognitoActionConfig)
-> Either String Text
-> Either String (Text -> Text -> AuthenticateCognitoActionConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"UserPoolArn")
      Either String (Text -> Text -> AuthenticateCognitoActionConfig)
-> Either String Text
-> Either String (Text -> AuthenticateCognitoActionConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"UserPoolClientId")
      Either String (Text -> AuthenticateCognitoActionConfig)
-> Either String Text
-> Either String AuthenticateCognitoActionConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"UserPoolDomain")

instance
  Prelude.Hashable
    AuthenticateCognitoActionConfig

instance
  Prelude.NFData
    AuthenticateCognitoActionConfig

instance Core.ToQuery AuthenticateCognitoActionConfig where
  toQuery :: AuthenticateCognitoActionConfig -> QueryString
toQuery AuthenticateCognitoActionConfig' {Maybe Integer
Maybe Text
Maybe (HashMap Text Text)
Maybe AuthenticateCognitoActionConditionalBehaviorEnum
Text
userPoolDomain :: Text
userPoolClientId :: Text
userPoolArn :: Text
sessionTimeout :: Maybe Integer
sessionCookieName :: Maybe Text
onUnauthenticatedRequest :: Maybe AuthenticateCognitoActionConditionalBehaviorEnum
scope :: Maybe Text
authenticationRequestExtraParams :: Maybe (HashMap Text Text)
$sel:userPoolDomain:AuthenticateCognitoActionConfig' :: AuthenticateCognitoActionConfig -> Text
$sel:userPoolClientId:AuthenticateCognitoActionConfig' :: AuthenticateCognitoActionConfig -> Text
$sel:userPoolArn:AuthenticateCognitoActionConfig' :: AuthenticateCognitoActionConfig -> Text
$sel:sessionTimeout:AuthenticateCognitoActionConfig' :: AuthenticateCognitoActionConfig -> Maybe Integer
$sel:sessionCookieName:AuthenticateCognitoActionConfig' :: AuthenticateCognitoActionConfig -> Maybe Text
$sel:onUnauthenticatedRequest:AuthenticateCognitoActionConfig' :: AuthenticateCognitoActionConfig
-> Maybe AuthenticateCognitoActionConditionalBehaviorEnum
$sel:scope:AuthenticateCognitoActionConfig' :: AuthenticateCognitoActionConfig -> Maybe Text
$sel:authenticationRequestExtraParams:AuthenticateCognitoActionConfig' :: AuthenticateCognitoActionConfig -> Maybe (HashMap Text Text)
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"AuthenticationRequestExtraParams"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            ( ByteString
-> ByteString -> ByteString -> HashMap Text Text -> QueryString
forall k v.
(ToQuery k, ToQuery v) =>
ByteString
-> ByteString -> ByteString -> HashMap k v -> QueryString
Core.toQueryMap ByteString
"entry" ByteString
"key" ByteString
"value"
                (HashMap Text Text -> QueryString)
-> Maybe (HashMap Text Text) -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
authenticationRequestExtraParams
            ),
        ByteString
"Scope" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
scope,
        ByteString
"OnUnauthenticatedRequest"
          ByteString
-> Maybe AuthenticateCognitoActionConditionalBehaviorEnum
-> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe AuthenticateCognitoActionConditionalBehaviorEnum
onUnauthenticatedRequest,
        ByteString
"SessionCookieName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
sessionCookieName,
        ByteString
"SessionTimeout" ByteString -> Maybe Integer -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Integer
sessionTimeout,
        ByteString
"UserPoolArn" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
userPoolArn,
        ByteString
"UserPoolClientId" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
userPoolClientId,
        ByteString
"UserPoolDomain" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
userPoolDomain
      ]