amazonka-quicksight-2.0: gen/Amazonka/QuickSight/ListUsers.hs
{-# 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.QuickSight.ListUsers
-- Copyright : (c) 2013-2023 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay
-- Stability : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns a list of all of the Amazon QuickSight users belonging to this
-- account.
module Amazonka.QuickSight.ListUsers
( -- * Creating a Request
ListUsers (..),
newListUsers,
-- * Request Lenses
listUsers_maxResults,
listUsers_nextToken,
listUsers_awsAccountId,
listUsers_namespace,
-- * Destructuring the Response
ListUsersResponse (..),
newListUsersResponse,
-- * Response Lenses
listUsersResponse_nextToken,
listUsersResponse_requestId,
listUsersResponse_userList,
listUsersResponse_status,
)
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
import Amazonka.QuickSight.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
-- | /See:/ 'newListUsers' smart constructor.
data ListUsers = ListUsers'
{ -- | The maximum number of results to return from this request.
maxResults :: Prelude.Maybe Prelude.Natural,
-- | A pagination token that can be used in a subsequent request.
nextToken :: Prelude.Maybe Prelude.Text,
-- | The ID for the Amazon Web Services account that the user is in.
-- Currently, you use the ID for the Amazon Web Services account that
-- contains your Amazon QuickSight account.
awsAccountId :: Prelude.Text,
-- | The namespace. Currently, you should set this to @default@.
namespace :: Prelude.Text
}
deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic)
-- |
-- Create a value of 'ListUsers' 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:
--
-- 'maxResults', 'listUsers_maxResults' - The maximum number of results to return from this request.
--
-- 'nextToken', 'listUsers_nextToken' - A pagination token that can be used in a subsequent request.
--
-- 'awsAccountId', 'listUsers_awsAccountId' - The ID for the Amazon Web Services account that the user is in.
-- Currently, you use the ID for the Amazon Web Services account that
-- contains your Amazon QuickSight account.
--
-- 'namespace', 'listUsers_namespace' - The namespace. Currently, you should set this to @default@.
newListUsers ::
-- | 'awsAccountId'
Prelude.Text ->
-- | 'namespace'
Prelude.Text ->
ListUsers
newListUsers pAwsAccountId_ pNamespace_ =
ListUsers'
{ maxResults = Prelude.Nothing,
nextToken = Prelude.Nothing,
awsAccountId = pAwsAccountId_,
namespace = pNamespace_
}
-- | The maximum number of results to return from this request.
listUsers_maxResults :: Lens.Lens' ListUsers (Prelude.Maybe Prelude.Natural)
listUsers_maxResults = Lens.lens (\ListUsers' {maxResults} -> maxResults) (\s@ListUsers' {} a -> s {maxResults = a} :: ListUsers)
-- | A pagination token that can be used in a subsequent request.
listUsers_nextToken :: Lens.Lens' ListUsers (Prelude.Maybe Prelude.Text)
listUsers_nextToken = Lens.lens (\ListUsers' {nextToken} -> nextToken) (\s@ListUsers' {} a -> s {nextToken = a} :: ListUsers)
-- | The ID for the Amazon Web Services account that the user is in.
-- Currently, you use the ID for the Amazon Web Services account that
-- contains your Amazon QuickSight account.
listUsers_awsAccountId :: Lens.Lens' ListUsers Prelude.Text
listUsers_awsAccountId = Lens.lens (\ListUsers' {awsAccountId} -> awsAccountId) (\s@ListUsers' {} a -> s {awsAccountId = a} :: ListUsers)
-- | The namespace. Currently, you should set this to @default@.
listUsers_namespace :: Lens.Lens' ListUsers Prelude.Text
listUsers_namespace = Lens.lens (\ListUsers' {namespace} -> namespace) (\s@ListUsers' {} a -> s {namespace = a} :: ListUsers)
instance Core.AWSRequest ListUsers where
type AWSResponse ListUsers = ListUsersResponse
request overrides =
Request.get (overrides defaultService)
response =
Response.receiveJSON
( \s h x ->
ListUsersResponse'
Prelude.<$> (x Data..?> "NextToken")
Prelude.<*> (x Data..?> "RequestId")
Prelude.<*> (x Data..?> "UserList" Core..!@ Prelude.mempty)
Prelude.<*> (Prelude.pure (Prelude.fromEnum s))
)
instance Prelude.Hashable ListUsers where
hashWithSalt _salt ListUsers' {..} =
_salt
`Prelude.hashWithSalt` maxResults
`Prelude.hashWithSalt` nextToken
`Prelude.hashWithSalt` awsAccountId
`Prelude.hashWithSalt` namespace
instance Prelude.NFData ListUsers where
rnf ListUsers' {..} =
Prelude.rnf maxResults
`Prelude.seq` Prelude.rnf nextToken
`Prelude.seq` Prelude.rnf awsAccountId
`Prelude.seq` Prelude.rnf namespace
instance Data.ToHeaders ListUsers where
toHeaders =
Prelude.const
( Prelude.mconcat
[ "Content-Type"
Data.=# ( "application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Data.ToPath ListUsers where
toPath ListUsers' {..} =
Prelude.mconcat
[ "/accounts/",
Data.toBS awsAccountId,
"/namespaces/",
Data.toBS namespace,
"/users"
]
instance Data.ToQuery ListUsers where
toQuery ListUsers' {..} =
Prelude.mconcat
[ "max-results" Data.=: maxResults,
"next-token" Data.=: nextToken
]
-- | /See:/ 'newListUsersResponse' smart constructor.
data ListUsersResponse = ListUsersResponse'
{ -- | A pagination token that can be used in a subsequent request.
nextToken :: Prelude.Maybe Prelude.Text,
-- | The Amazon Web Services request ID for this operation.
requestId :: Prelude.Maybe Prelude.Text,
-- | The list of users.
userList :: Prelude.Maybe [User],
-- | The HTTP status of the request.
status :: Prelude.Int
}
deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic)
-- |
-- Create a value of 'ListUsersResponse' 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', 'listUsersResponse_nextToken' - A pagination token that can be used in a subsequent request.
--
-- 'requestId', 'listUsersResponse_requestId' - The Amazon Web Services request ID for this operation.
--
-- 'userList', 'listUsersResponse_userList' - The list of users.
--
-- 'status', 'listUsersResponse_status' - The HTTP status of the request.
newListUsersResponse ::
-- | 'status'
Prelude.Int ->
ListUsersResponse
newListUsersResponse pStatus_ =
ListUsersResponse'
{ nextToken = Prelude.Nothing,
requestId = Prelude.Nothing,
userList = Prelude.Nothing,
status = pStatus_
}
-- | A pagination token that can be used in a subsequent request.
listUsersResponse_nextToken :: Lens.Lens' ListUsersResponse (Prelude.Maybe Prelude.Text)
listUsersResponse_nextToken = Lens.lens (\ListUsersResponse' {nextToken} -> nextToken) (\s@ListUsersResponse' {} a -> s {nextToken = a} :: ListUsersResponse)
-- | The Amazon Web Services request ID for this operation.
listUsersResponse_requestId :: Lens.Lens' ListUsersResponse (Prelude.Maybe Prelude.Text)
listUsersResponse_requestId = Lens.lens (\ListUsersResponse' {requestId} -> requestId) (\s@ListUsersResponse' {} a -> s {requestId = a} :: ListUsersResponse)
-- | The list of users.
listUsersResponse_userList :: Lens.Lens' ListUsersResponse (Prelude.Maybe [User])
listUsersResponse_userList = Lens.lens (\ListUsersResponse' {userList} -> userList) (\s@ListUsersResponse' {} a -> s {userList = a} :: ListUsersResponse) Prelude.. Lens.mapping Lens.coerced
-- | The HTTP status of the request.
listUsersResponse_status :: Lens.Lens' ListUsersResponse Prelude.Int
listUsersResponse_status = Lens.lens (\ListUsersResponse' {status} -> status) (\s@ListUsersResponse' {} a -> s {status = a} :: ListUsersResponse)
instance Prelude.NFData ListUsersResponse where
rnf ListUsersResponse' {..} =
Prelude.rnf nextToken
`Prelude.seq` Prelude.rnf requestId
`Prelude.seq` Prelude.rnf userList
`Prelude.seq` Prelude.rnf status