{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

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

-- |
-- Module      : Amazonka.CognitoIdentityProvider.AdminListUserAuthEvents
-- 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)
--
-- Lists a history of user activity and any risks detected as part of
-- Amazon Cognito advanced security.
--
-- This operation returns paginated results.
module Amazonka.CognitoIdentityProvider.AdminListUserAuthEvents
  ( -- * Creating a Request
    AdminListUserAuthEvents (..),
    newAdminListUserAuthEvents,

    -- * Request Lenses
    adminListUserAuthEvents_nextToken,
    adminListUserAuthEvents_maxResults,
    adminListUserAuthEvents_userPoolId,
    adminListUserAuthEvents_username,

    -- * Destructuring the Response
    AdminListUserAuthEventsResponse (..),
    newAdminListUserAuthEventsResponse,

    -- * Response Lenses
    adminListUserAuthEventsResponse_nextToken,
    adminListUserAuthEventsResponse_authEvents,
    adminListUserAuthEventsResponse_httpStatus,
  )
where

import Amazonka.CognitoIdentityProvider.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newAdminListUserAuthEvents' smart constructor.
data AdminListUserAuthEvents = AdminListUserAuthEvents'
  { -- | A pagination token.
    AdminListUserAuthEvents -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of authentication events to return.
    AdminListUserAuthEvents -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The user pool ID.
    AdminListUserAuthEvents -> Text
userPoolId :: Prelude.Text,
    -- | The user pool username or an alias.
    AdminListUserAuthEvents -> Sensitive Text
username :: Core.Sensitive Prelude.Text
  }
  deriving (AdminListUserAuthEvents -> AdminListUserAuthEvents -> Bool
(AdminListUserAuthEvents -> AdminListUserAuthEvents -> Bool)
-> (AdminListUserAuthEvents -> AdminListUserAuthEvents -> Bool)
-> Eq AdminListUserAuthEvents
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AdminListUserAuthEvents -> AdminListUserAuthEvents -> Bool
$c/= :: AdminListUserAuthEvents -> AdminListUserAuthEvents -> Bool
== :: AdminListUserAuthEvents -> AdminListUserAuthEvents -> Bool
$c== :: AdminListUserAuthEvents -> AdminListUserAuthEvents -> Bool
Prelude.Eq, Int -> AdminListUserAuthEvents -> ShowS
[AdminListUserAuthEvents] -> ShowS
AdminListUserAuthEvents -> String
(Int -> AdminListUserAuthEvents -> ShowS)
-> (AdminListUserAuthEvents -> String)
-> ([AdminListUserAuthEvents] -> ShowS)
-> Show AdminListUserAuthEvents
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AdminListUserAuthEvents] -> ShowS
$cshowList :: [AdminListUserAuthEvents] -> ShowS
show :: AdminListUserAuthEvents -> String
$cshow :: AdminListUserAuthEvents -> String
showsPrec :: Int -> AdminListUserAuthEvents -> ShowS
$cshowsPrec :: Int -> AdminListUserAuthEvents -> ShowS
Prelude.Show, (forall x.
 AdminListUserAuthEvents -> Rep AdminListUserAuthEvents x)
-> (forall x.
    Rep AdminListUserAuthEvents x -> AdminListUserAuthEvents)
-> Generic AdminListUserAuthEvents
forall x. Rep AdminListUserAuthEvents x -> AdminListUserAuthEvents
forall x. AdminListUserAuthEvents -> Rep AdminListUserAuthEvents x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AdminListUserAuthEvents x -> AdminListUserAuthEvents
$cfrom :: forall x. AdminListUserAuthEvents -> Rep AdminListUserAuthEvents x
Prelude.Generic)

-- |
-- Create a value of 'AdminListUserAuthEvents' 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:
--
-- 'nextToken', 'adminListUserAuthEvents_nextToken' - A pagination token.
--
-- 'maxResults', 'adminListUserAuthEvents_maxResults' - The maximum number of authentication events to return.
--
-- 'userPoolId', 'adminListUserAuthEvents_userPoolId' - The user pool ID.
--
-- 'username', 'adminListUserAuthEvents_username' - The user pool username or an alias.
newAdminListUserAuthEvents ::
  -- | 'userPoolId'
  Prelude.Text ->
  -- | 'username'
  Prelude.Text ->
  AdminListUserAuthEvents
newAdminListUserAuthEvents :: Text -> Text -> AdminListUserAuthEvents
newAdminListUserAuthEvents Text
pUserPoolId_ Text
pUsername_ =
  AdminListUserAuthEvents' :: Maybe Text
-> Maybe Natural
-> Text
-> Sensitive Text
-> AdminListUserAuthEvents
AdminListUserAuthEvents'
    { $sel:nextToken:AdminListUserAuthEvents' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:AdminListUserAuthEvents' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:userPoolId:AdminListUserAuthEvents' :: Text
userPoolId = Text
pUserPoolId_,
      $sel:username:AdminListUserAuthEvents' :: Sensitive Text
username = Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
 -> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pUsername_
    }

-- | A pagination token.
adminListUserAuthEvents_nextToken :: Lens.Lens' AdminListUserAuthEvents (Prelude.Maybe Prelude.Text)
adminListUserAuthEvents_nextToken :: (Maybe Text -> f (Maybe Text))
-> AdminListUserAuthEvents -> f AdminListUserAuthEvents
adminListUserAuthEvents_nextToken = (AdminListUserAuthEvents -> Maybe Text)
-> (AdminListUserAuthEvents
    -> Maybe Text -> AdminListUserAuthEvents)
-> Lens
     AdminListUserAuthEvents
     AdminListUserAuthEvents
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminListUserAuthEvents' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:AdminListUserAuthEvents' :: AdminListUserAuthEvents -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: AdminListUserAuthEvents
s@AdminListUserAuthEvents' {} Maybe Text
a -> AdminListUserAuthEvents
s {$sel:nextToken:AdminListUserAuthEvents' :: Maybe Text
nextToken = Maybe Text
a} :: AdminListUserAuthEvents)

-- | The maximum number of authentication events to return.
adminListUserAuthEvents_maxResults :: Lens.Lens' AdminListUserAuthEvents (Prelude.Maybe Prelude.Natural)
adminListUserAuthEvents_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> AdminListUserAuthEvents -> f AdminListUserAuthEvents
adminListUserAuthEvents_maxResults = (AdminListUserAuthEvents -> Maybe Natural)
-> (AdminListUserAuthEvents
    -> Maybe Natural -> AdminListUserAuthEvents)
-> Lens
     AdminListUserAuthEvents
     AdminListUserAuthEvents
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminListUserAuthEvents' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:AdminListUserAuthEvents' :: AdminListUserAuthEvents -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: AdminListUserAuthEvents
s@AdminListUserAuthEvents' {} Maybe Natural
a -> AdminListUserAuthEvents
s {$sel:maxResults:AdminListUserAuthEvents' :: Maybe Natural
maxResults = Maybe Natural
a} :: AdminListUserAuthEvents)

-- | The user pool ID.
adminListUserAuthEvents_userPoolId :: Lens.Lens' AdminListUserAuthEvents Prelude.Text
adminListUserAuthEvents_userPoolId :: (Text -> f Text)
-> AdminListUserAuthEvents -> f AdminListUserAuthEvents
adminListUserAuthEvents_userPoolId = (AdminListUserAuthEvents -> Text)
-> (AdminListUserAuthEvents -> Text -> AdminListUserAuthEvents)
-> Lens AdminListUserAuthEvents AdminListUserAuthEvents Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminListUserAuthEvents' {Text
userPoolId :: Text
$sel:userPoolId:AdminListUserAuthEvents' :: AdminListUserAuthEvents -> Text
userPoolId} -> Text
userPoolId) (\s :: AdminListUserAuthEvents
s@AdminListUserAuthEvents' {} Text
a -> AdminListUserAuthEvents
s {$sel:userPoolId:AdminListUserAuthEvents' :: Text
userPoolId = Text
a} :: AdminListUserAuthEvents)

-- | The user pool username or an alias.
adminListUserAuthEvents_username :: Lens.Lens' AdminListUserAuthEvents Prelude.Text
adminListUserAuthEvents_username :: (Text -> f Text)
-> AdminListUserAuthEvents -> f AdminListUserAuthEvents
adminListUserAuthEvents_username = (AdminListUserAuthEvents -> Sensitive Text)
-> (AdminListUserAuthEvents
    -> Sensitive Text -> AdminListUserAuthEvents)
-> Lens
     AdminListUserAuthEvents
     AdminListUserAuthEvents
     (Sensitive Text)
     (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminListUserAuthEvents' {Sensitive Text
username :: Sensitive Text
$sel:username:AdminListUserAuthEvents' :: AdminListUserAuthEvents -> Sensitive Text
username} -> Sensitive Text
username) (\s :: AdminListUserAuthEvents
s@AdminListUserAuthEvents' {} Sensitive Text
a -> AdminListUserAuthEvents
s {$sel:username:AdminListUserAuthEvents' :: Sensitive Text
username = Sensitive Text
a} :: AdminListUserAuthEvents) ((Sensitive Text -> f (Sensitive Text))
 -> AdminListUserAuthEvents -> f AdminListUserAuthEvents)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> AdminListUserAuthEvents
-> f AdminListUserAuthEvents
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive

instance Core.AWSPager AdminListUserAuthEvents where
  page :: AdminListUserAuthEvents
-> AWSResponse AdminListUserAuthEvents
-> Maybe AdminListUserAuthEvents
page AdminListUserAuthEvents
rq AWSResponse AdminListUserAuthEvents
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse AdminListUserAuthEvents
AdminListUserAuthEventsResponse
rs
            AdminListUserAuthEventsResponse
-> Getting (First Text) AdminListUserAuthEventsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> AdminListUserAuthEventsResponse
-> Const (First Text) AdminListUserAuthEventsResponse
Lens' AdminListUserAuthEventsResponse (Maybe Text)
adminListUserAuthEventsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> AdminListUserAuthEventsResponse
 -> Const (First Text) AdminListUserAuthEventsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) AdminListUserAuthEventsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe AdminListUserAuthEvents
forall a. Maybe a
Prelude.Nothing
    | Maybe [AuthEventType] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse AdminListUserAuthEvents
AdminListUserAuthEventsResponse
rs
            AdminListUserAuthEventsResponse
-> Getting
     (First [AuthEventType])
     AdminListUserAuthEventsResponse
     [AuthEventType]
-> Maybe [AuthEventType]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [AuthEventType]
 -> Const (First [AuthEventType]) (Maybe [AuthEventType]))
-> AdminListUserAuthEventsResponse
-> Const (First [AuthEventType]) AdminListUserAuthEventsResponse
Lens' AdminListUserAuthEventsResponse (Maybe [AuthEventType])
adminListUserAuthEventsResponse_authEvents
              ((Maybe [AuthEventType]
  -> Const (First [AuthEventType]) (Maybe [AuthEventType]))
 -> AdminListUserAuthEventsResponse
 -> Const (First [AuthEventType]) AdminListUserAuthEventsResponse)
-> (([AuthEventType]
     -> Const (First [AuthEventType]) [AuthEventType])
    -> Maybe [AuthEventType]
    -> Const (First [AuthEventType]) (Maybe [AuthEventType]))
-> Getting
     (First [AuthEventType])
     AdminListUserAuthEventsResponse
     [AuthEventType]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([AuthEventType] -> Const (First [AuthEventType]) [AuthEventType])
-> Maybe [AuthEventType]
-> Const (First [AuthEventType]) (Maybe [AuthEventType])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe AdminListUserAuthEvents
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      AdminListUserAuthEvents -> Maybe AdminListUserAuthEvents
forall a. a -> Maybe a
Prelude.Just (AdminListUserAuthEvents -> Maybe AdminListUserAuthEvents)
-> AdminListUserAuthEvents -> Maybe AdminListUserAuthEvents
forall a b. (a -> b) -> a -> b
Prelude.$
        AdminListUserAuthEvents
rq
          AdminListUserAuthEvents
-> (AdminListUserAuthEvents -> AdminListUserAuthEvents)
-> AdminListUserAuthEvents
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> AdminListUserAuthEvents -> Identity AdminListUserAuthEvents
Lens
  AdminListUserAuthEvents
  AdminListUserAuthEvents
  (Maybe Text)
  (Maybe Text)
adminListUserAuthEvents_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> AdminListUserAuthEvents -> Identity AdminListUserAuthEvents)
-> Maybe Text -> AdminListUserAuthEvents -> AdminListUserAuthEvents
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse AdminListUserAuthEvents
AdminListUserAuthEventsResponse
rs
          AdminListUserAuthEventsResponse
-> Getting (First Text) AdminListUserAuthEventsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> AdminListUserAuthEventsResponse
-> Const (First Text) AdminListUserAuthEventsResponse
Lens' AdminListUserAuthEventsResponse (Maybe Text)
adminListUserAuthEventsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> AdminListUserAuthEventsResponse
 -> Const (First Text) AdminListUserAuthEventsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) AdminListUserAuthEventsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest AdminListUserAuthEvents where
  type
    AWSResponse AdminListUserAuthEvents =
      AdminListUserAuthEventsResponse
  request :: AdminListUserAuthEvents -> Request AdminListUserAuthEvents
request = Service
-> AdminListUserAuthEvents -> Request AdminListUserAuthEvents
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy AdminListUserAuthEvents
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse AdminListUserAuthEvents)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse AdminListUserAuthEvents))
-> Logger
-> Service
-> Proxy AdminListUserAuthEvents
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse AdminListUserAuthEvents)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe [AuthEventType] -> Int -> AdminListUserAuthEventsResponse
AdminListUserAuthEventsResponse'
            (Maybe Text
 -> Maybe [AuthEventType] -> Int -> AdminListUserAuthEventsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [AuthEventType] -> Int -> AdminListUserAuthEventsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
            Either
  String
  (Maybe [AuthEventType] -> Int -> AdminListUserAuthEventsResponse)
-> Either String (Maybe [AuthEventType])
-> Either String (Int -> AdminListUserAuthEventsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [AuthEventType]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"AuthEvents" Either String (Maybe (Maybe [AuthEventType]))
-> Maybe [AuthEventType] -> Either String (Maybe [AuthEventType])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [AuthEventType]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> AdminListUserAuthEventsResponse)
-> Either String Int
-> Either String AdminListUserAuthEventsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable AdminListUserAuthEvents

instance Prelude.NFData AdminListUserAuthEvents

instance Core.ToHeaders AdminListUserAuthEvents where
  toHeaders :: AdminListUserAuthEvents -> ResponseHeaders
toHeaders =
    ResponseHeaders -> AdminListUserAuthEvents -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSCognitoIdentityProviderService.AdminListUserAuthEvents" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON AdminListUserAuthEvents where
  toJSON :: AdminListUserAuthEvents -> Value
toJSON AdminListUserAuthEvents' {Maybe Natural
Maybe Text
Text
Sensitive Text
username :: Sensitive Text
userPoolId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:username:AdminListUserAuthEvents' :: AdminListUserAuthEvents -> Sensitive Text
$sel:userPoolId:AdminListUserAuthEvents' :: AdminListUserAuthEvents -> Text
$sel:maxResults:AdminListUserAuthEvents' :: AdminListUserAuthEvents -> Maybe Natural
$sel:nextToken:AdminListUserAuthEvents' :: AdminListUserAuthEvents -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NextToken" 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
nextToken,
            (Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"UserPoolId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
userPoolId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Username" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
username)
          ]
      )

instance Core.ToPath AdminListUserAuthEvents where
  toPath :: AdminListUserAuthEvents -> ByteString
toPath = ByteString -> AdminListUserAuthEvents -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery AdminListUserAuthEvents where
  toQuery :: AdminListUserAuthEvents -> QueryString
toQuery = QueryString -> AdminListUserAuthEvents -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newAdminListUserAuthEventsResponse' smart constructor.
data AdminListUserAuthEventsResponse = AdminListUserAuthEventsResponse'
  { -- | A pagination token.
    AdminListUserAuthEventsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response object. It includes the @EventID@, @EventType@,
    -- @CreationDate@, @EventRisk@, and @EventResponse@.
    AdminListUserAuthEventsResponse -> Maybe [AuthEventType]
authEvents :: Prelude.Maybe [AuthEventType],
    -- | The response's http status code.
    AdminListUserAuthEventsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (AdminListUserAuthEventsResponse
-> AdminListUserAuthEventsResponse -> Bool
(AdminListUserAuthEventsResponse
 -> AdminListUserAuthEventsResponse -> Bool)
-> (AdminListUserAuthEventsResponse
    -> AdminListUserAuthEventsResponse -> Bool)
-> Eq AdminListUserAuthEventsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AdminListUserAuthEventsResponse
-> AdminListUserAuthEventsResponse -> Bool
$c/= :: AdminListUserAuthEventsResponse
-> AdminListUserAuthEventsResponse -> Bool
== :: AdminListUserAuthEventsResponse
-> AdminListUserAuthEventsResponse -> Bool
$c== :: AdminListUserAuthEventsResponse
-> AdminListUserAuthEventsResponse -> Bool
Prelude.Eq, ReadPrec [AdminListUserAuthEventsResponse]
ReadPrec AdminListUserAuthEventsResponse
Int -> ReadS AdminListUserAuthEventsResponse
ReadS [AdminListUserAuthEventsResponse]
(Int -> ReadS AdminListUserAuthEventsResponse)
-> ReadS [AdminListUserAuthEventsResponse]
-> ReadPrec AdminListUserAuthEventsResponse
-> ReadPrec [AdminListUserAuthEventsResponse]
-> Read AdminListUserAuthEventsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AdminListUserAuthEventsResponse]
$creadListPrec :: ReadPrec [AdminListUserAuthEventsResponse]
readPrec :: ReadPrec AdminListUserAuthEventsResponse
$creadPrec :: ReadPrec AdminListUserAuthEventsResponse
readList :: ReadS [AdminListUserAuthEventsResponse]
$creadList :: ReadS [AdminListUserAuthEventsResponse]
readsPrec :: Int -> ReadS AdminListUserAuthEventsResponse
$creadsPrec :: Int -> ReadS AdminListUserAuthEventsResponse
Prelude.Read, Int -> AdminListUserAuthEventsResponse -> ShowS
[AdminListUserAuthEventsResponse] -> ShowS
AdminListUserAuthEventsResponse -> String
(Int -> AdminListUserAuthEventsResponse -> ShowS)
-> (AdminListUserAuthEventsResponse -> String)
-> ([AdminListUserAuthEventsResponse] -> ShowS)
-> Show AdminListUserAuthEventsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AdminListUserAuthEventsResponse] -> ShowS
$cshowList :: [AdminListUserAuthEventsResponse] -> ShowS
show :: AdminListUserAuthEventsResponse -> String
$cshow :: AdminListUserAuthEventsResponse -> String
showsPrec :: Int -> AdminListUserAuthEventsResponse -> ShowS
$cshowsPrec :: Int -> AdminListUserAuthEventsResponse -> ShowS
Prelude.Show, (forall x.
 AdminListUserAuthEventsResponse
 -> Rep AdminListUserAuthEventsResponse x)
-> (forall x.
    Rep AdminListUserAuthEventsResponse x
    -> AdminListUserAuthEventsResponse)
-> Generic AdminListUserAuthEventsResponse
forall x.
Rep AdminListUserAuthEventsResponse x
-> AdminListUserAuthEventsResponse
forall x.
AdminListUserAuthEventsResponse
-> Rep AdminListUserAuthEventsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AdminListUserAuthEventsResponse x
-> AdminListUserAuthEventsResponse
$cfrom :: forall x.
AdminListUserAuthEventsResponse
-> Rep AdminListUserAuthEventsResponse x
Prelude.Generic)

-- |
-- Create a value of 'AdminListUserAuthEventsResponse' 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:
--
-- 'nextToken', 'adminListUserAuthEventsResponse_nextToken' - A pagination token.
--
-- 'authEvents', 'adminListUserAuthEventsResponse_authEvents' - The response object. It includes the @EventID@, @EventType@,
-- @CreationDate@, @EventRisk@, and @EventResponse@.
--
-- 'httpStatus', 'adminListUserAuthEventsResponse_httpStatus' - The response's http status code.
newAdminListUserAuthEventsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  AdminListUserAuthEventsResponse
newAdminListUserAuthEventsResponse :: Int -> AdminListUserAuthEventsResponse
newAdminListUserAuthEventsResponse Int
pHttpStatus_ =
  AdminListUserAuthEventsResponse' :: Maybe Text
-> Maybe [AuthEventType] -> Int -> AdminListUserAuthEventsResponse
AdminListUserAuthEventsResponse'
    { $sel:nextToken:AdminListUserAuthEventsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:authEvents:AdminListUserAuthEventsResponse' :: Maybe [AuthEventType]
authEvents = Maybe [AuthEventType]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:AdminListUserAuthEventsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A pagination token.
adminListUserAuthEventsResponse_nextToken :: Lens.Lens' AdminListUserAuthEventsResponse (Prelude.Maybe Prelude.Text)
adminListUserAuthEventsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> AdminListUserAuthEventsResponse
-> f AdminListUserAuthEventsResponse
adminListUserAuthEventsResponse_nextToken = (AdminListUserAuthEventsResponse -> Maybe Text)
-> (AdminListUserAuthEventsResponse
    -> Maybe Text -> AdminListUserAuthEventsResponse)
-> Lens' AdminListUserAuthEventsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminListUserAuthEventsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:AdminListUserAuthEventsResponse' :: AdminListUserAuthEventsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: AdminListUserAuthEventsResponse
s@AdminListUserAuthEventsResponse' {} Maybe Text
a -> AdminListUserAuthEventsResponse
s {$sel:nextToken:AdminListUserAuthEventsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: AdminListUserAuthEventsResponse)

-- | The response object. It includes the @EventID@, @EventType@,
-- @CreationDate@, @EventRisk@, and @EventResponse@.
adminListUserAuthEventsResponse_authEvents :: Lens.Lens' AdminListUserAuthEventsResponse (Prelude.Maybe [AuthEventType])
adminListUserAuthEventsResponse_authEvents :: (Maybe [AuthEventType] -> f (Maybe [AuthEventType]))
-> AdminListUserAuthEventsResponse
-> f AdminListUserAuthEventsResponse
adminListUserAuthEventsResponse_authEvents = (AdminListUserAuthEventsResponse -> Maybe [AuthEventType])
-> (AdminListUserAuthEventsResponse
    -> Maybe [AuthEventType] -> AdminListUserAuthEventsResponse)
-> Lens' AdminListUserAuthEventsResponse (Maybe [AuthEventType])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminListUserAuthEventsResponse' {Maybe [AuthEventType]
authEvents :: Maybe [AuthEventType]
$sel:authEvents:AdminListUserAuthEventsResponse' :: AdminListUserAuthEventsResponse -> Maybe [AuthEventType]
authEvents} -> Maybe [AuthEventType]
authEvents) (\s :: AdminListUserAuthEventsResponse
s@AdminListUserAuthEventsResponse' {} Maybe [AuthEventType]
a -> AdminListUserAuthEventsResponse
s {$sel:authEvents:AdminListUserAuthEventsResponse' :: Maybe [AuthEventType]
authEvents = Maybe [AuthEventType]
a} :: AdminListUserAuthEventsResponse) ((Maybe [AuthEventType] -> f (Maybe [AuthEventType]))
 -> AdminListUserAuthEventsResponse
 -> f AdminListUserAuthEventsResponse)
-> ((Maybe [AuthEventType] -> f (Maybe [AuthEventType]))
    -> Maybe [AuthEventType] -> f (Maybe [AuthEventType]))
-> (Maybe [AuthEventType] -> f (Maybe [AuthEventType]))
-> AdminListUserAuthEventsResponse
-> f AdminListUserAuthEventsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AuthEventType] [AuthEventType] [AuthEventType] [AuthEventType]
-> Iso
     (Maybe [AuthEventType])
     (Maybe [AuthEventType])
     (Maybe [AuthEventType])
     (Maybe [AuthEventType])
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
  [AuthEventType] [AuthEventType] [AuthEventType] [AuthEventType]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The response's http status code.
adminListUserAuthEventsResponse_httpStatus :: Lens.Lens' AdminListUserAuthEventsResponse Prelude.Int
adminListUserAuthEventsResponse_httpStatus :: (Int -> f Int)
-> AdminListUserAuthEventsResponse
-> f AdminListUserAuthEventsResponse
adminListUserAuthEventsResponse_httpStatus = (AdminListUserAuthEventsResponse -> Int)
-> (AdminListUserAuthEventsResponse
    -> Int -> AdminListUserAuthEventsResponse)
-> Lens
     AdminListUserAuthEventsResponse
     AdminListUserAuthEventsResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminListUserAuthEventsResponse' {Int
httpStatus :: Int
$sel:httpStatus:AdminListUserAuthEventsResponse' :: AdminListUserAuthEventsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AdminListUserAuthEventsResponse
s@AdminListUserAuthEventsResponse' {} Int
a -> AdminListUserAuthEventsResponse
s {$sel:httpStatus:AdminListUserAuthEventsResponse' :: Int
httpStatus = Int
a} :: AdminListUserAuthEventsResponse)

instance
  Prelude.NFData
    AdminListUserAuthEventsResponse