{-# 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.Connect.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) -- -- Provides summary information about the users for the specified Amazon -- Connect instance. -- -- This operation returns paginated results. module Amazonka.Connect.ListUsers ( -- * Creating a Request ListUsers (..), newListUsers, -- * Request Lenses listUsers_maxResults, listUsers_nextToken, listUsers_instanceId, -- * Destructuring the Response ListUsersResponse (..), newListUsersResponse, -- * Response Lenses listUsersResponse_nextToken, listUsersResponse_userSummaryList, listUsersResponse_httpStatus, ) where import Amazonka.Connect.Types 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 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 per page. The default MaxResult -- size is 100. maxResults :: Prelude.Maybe Prelude.Natural, -- | The token for the next set of results. Use the value returned in the -- previous response in the next request to retrieve the next set of -- results. nextToken :: Prelude.Maybe Prelude.Text, -- | The identifier of the Amazon Connect instance. You can find the -- instanceId in the ARN of the instance. instanceId :: Prelude.Text } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'ListUsers' with all optional fields omitted. -- -- Use or 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 per page. The default MaxResult -- size is 100. -- -- 'nextToken', 'listUsers_nextToken' - The token for the next set of results. Use the value returned in the -- previous response in the next request to retrieve the next set of -- results. -- -- 'instanceId', 'listUsers_instanceId' - The identifier of the Amazon Connect instance. You can find the -- instanceId in the ARN of the instance. newListUsers :: -- | 'instanceId' Prelude.Text -> ListUsers newListUsers pInstanceId_ = ListUsers' { maxResults = Prelude.Nothing, nextToken = Prelude.Nothing, instanceId = pInstanceId_ } -- | The maximum number of results to return per page. The default MaxResult -- size is 100. listUsers_maxResults :: Lens.Lens' ListUsers (Prelude.Maybe Prelude.Natural) listUsers_maxResults = Lens.lens (\ListUsers' {maxResults} -> maxResults) (\s@ListUsers' {} a -> s {maxResults = a} :: ListUsers) -- | The token for the next set of results. Use the value returned in the -- previous response in the next request to retrieve the next set of -- results. listUsers_nextToken :: Lens.Lens' ListUsers (Prelude.Maybe Prelude.Text) listUsers_nextToken = Lens.lens (\ListUsers' {nextToken} -> nextToken) (\s@ListUsers' {} a -> s {nextToken = a} :: ListUsers) -- | The identifier of the Amazon Connect instance. You can find the -- instanceId in the ARN of the instance. listUsers_instanceId :: Lens.Lens' ListUsers Prelude.Text listUsers_instanceId = Lens.lens (\ListUsers' {instanceId} -> instanceId) (\s@ListUsers' {} a -> s {instanceId = a} :: ListUsers) instance Core.AWSPager ListUsers where page rq rs | Core.stop ( rs Lens.^? listUsersResponse_nextToken Prelude.. Lens._Just ) = Prelude.Nothing | Core.stop ( rs Lens.^? listUsersResponse_userSummaryList Prelude.. Lens._Just ) = Prelude.Nothing | Prelude.otherwise = Prelude.Just Prelude.$ rq Prelude.& listUsers_nextToken Lens..~ rs Lens.^? listUsersResponse_nextToken Prelude.. Lens._Just 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..?> "UserSummaryList" 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` instanceId instance Prelude.NFData ListUsers where rnf ListUsers' {..} = Prelude.rnf maxResults `Prelude.seq` Prelude.rnf nextToken `Prelude.seq` Prelude.rnf instanceId instance Data.ToHeaders ListUsers where toHeaders = Prelude.const ( Prelude.mconcat [ "Content-Type" Data.=# ( "application/x-amz-json-1.1" :: Prelude.ByteString ) ] ) instance Data.ToPath ListUsers where toPath ListUsers' {..} = Prelude.mconcat ["/users-summary/", Data.toBS instanceId] instance Data.ToQuery ListUsers where toQuery ListUsers' {..} = Prelude.mconcat [ "maxResults" Data.=: maxResults, "nextToken" Data.=: nextToken ] -- | /See:/ 'newListUsersResponse' smart constructor. data ListUsersResponse = ListUsersResponse' { -- | If there are additional results, this is the token for the next set of -- results. nextToken :: Prelude.Maybe Prelude.Text, -- | Information about the users. userSummaryList :: Prelude.Maybe [UserSummary], -- | The response's http status code. httpStatus :: Prelude.Int } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'ListUsersResponse' with all optional fields omitted. -- -- Use or to modify other optional fields. -- -- The following record fields are available, with the corresponding lenses provided -- for backwards compatibility: -- -- 'nextToken', 'listUsersResponse_nextToken' - If there are additional results, this is the token for the next set of -- results. -- -- 'userSummaryList', 'listUsersResponse_userSummaryList' - Information about the users. -- -- 'httpStatus', 'listUsersResponse_httpStatus' - The response's http status code. newListUsersResponse :: -- | 'httpStatus' Prelude.Int -> ListUsersResponse newListUsersResponse pHttpStatus_ = ListUsersResponse' { nextToken = Prelude.Nothing, userSummaryList = Prelude.Nothing, httpStatus = pHttpStatus_ } -- | If there are additional results, this is the token for the next set of -- results. listUsersResponse_nextToken :: Lens.Lens' ListUsersResponse (Prelude.Maybe Prelude.Text) listUsersResponse_nextToken = Lens.lens (\ListUsersResponse' {nextToken} -> nextToken) (\s@ListUsersResponse' {} a -> s {nextToken = a} :: ListUsersResponse) -- | Information about the users. listUsersResponse_userSummaryList :: Lens.Lens' ListUsersResponse (Prelude.Maybe [UserSummary]) listUsersResponse_userSummaryList = Lens.lens (\ListUsersResponse' {userSummaryList} -> userSummaryList) (\s@ListUsersResponse' {} a -> s {userSummaryList = a} :: ListUsersResponse) Prelude.. Lens.mapping Lens.coerced -- | The response's http status code. listUsersResponse_httpStatus :: Lens.Lens' ListUsersResponse Prelude.Int listUsersResponse_httpStatus = Lens.lens (\ListUsersResponse' {httpStatus} -> httpStatus) (\s@ListUsersResponse' {} a -> s {httpStatus = a} :: ListUsersResponse) instance Prelude.NFData ListUsersResponse where rnf ListUsersResponse' {..} = Prelude.rnf nextToken `Prelude.seq` Prelude.rnf userSummaryList `Prelude.seq` Prelude.rnf httpStatus