amazonka-codestar-2.0: gen/Amazonka/CodeStar/ListUserProfiles.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.CodeStar.ListUserProfiles
-- Copyright : (c) 2013-2023 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay
-- Stability : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists all the user profiles configured for your AWS account in AWS
-- CodeStar.
--
-- This operation returns paginated results.
module Amazonka.CodeStar.ListUserProfiles
( -- * Creating a Request
ListUserProfiles (..),
newListUserProfiles,
-- * Request Lenses
listUserProfiles_maxResults,
listUserProfiles_nextToken,
-- * Destructuring the Response
ListUserProfilesResponse (..),
newListUserProfilesResponse,
-- * Response Lenses
listUserProfilesResponse_nextToken,
listUserProfilesResponse_httpStatus,
listUserProfilesResponse_userProfiles,
)
where
import Amazonka.CodeStar.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:/ 'newListUserProfiles' smart constructor.
data ListUserProfiles = ListUserProfiles'
{ -- | The maximum number of results to return in a response.
maxResults :: Prelude.Maybe Prelude.Natural,
-- | The continuation token for the next set of results, if the results
-- cannot be returned in one response.
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic)
-- |
-- Create a value of 'ListUserProfiles' 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', 'listUserProfiles_maxResults' - The maximum number of results to return in a response.
--
-- 'nextToken', 'listUserProfiles_nextToken' - The continuation token for the next set of results, if the results
-- cannot be returned in one response.
newListUserProfiles ::
ListUserProfiles
newListUserProfiles =
ListUserProfiles'
{ maxResults = Prelude.Nothing,
nextToken = Prelude.Nothing
}
-- | The maximum number of results to return in a response.
listUserProfiles_maxResults :: Lens.Lens' ListUserProfiles (Prelude.Maybe Prelude.Natural)
listUserProfiles_maxResults = Lens.lens (\ListUserProfiles' {maxResults} -> maxResults) (\s@ListUserProfiles' {} a -> s {maxResults = a} :: ListUserProfiles)
-- | The continuation token for the next set of results, if the results
-- cannot be returned in one response.
listUserProfiles_nextToken :: Lens.Lens' ListUserProfiles (Prelude.Maybe Prelude.Text)
listUserProfiles_nextToken = Lens.lens (\ListUserProfiles' {nextToken} -> nextToken) (\s@ListUserProfiles' {} a -> s {nextToken = a} :: ListUserProfiles)
instance Core.AWSPager ListUserProfiles where
page rq rs
| Core.stop
( rs
Lens.^? listUserProfilesResponse_nextToken
Prelude.. Lens._Just
) =
Prelude.Nothing
| Core.stop
(rs Lens.^. listUserProfilesResponse_userProfiles) =
Prelude.Nothing
| Prelude.otherwise =
Prelude.Just
Prelude.$ rq
Prelude.& listUserProfiles_nextToken
Lens..~ rs
Lens.^? listUserProfilesResponse_nextToken
Prelude.. Lens._Just
instance Core.AWSRequest ListUserProfiles where
type
AWSResponse ListUserProfiles =
ListUserProfilesResponse
request overrides =
Request.postJSON (overrides defaultService)
response =
Response.receiveJSON
( \s h x ->
ListUserProfilesResponse'
Prelude.<$> (x Data..?> "nextToken")
Prelude.<*> (Prelude.pure (Prelude.fromEnum s))
Prelude.<*> (x Data..?> "userProfiles" Core..!@ Prelude.mempty)
)
instance Prelude.Hashable ListUserProfiles where
hashWithSalt _salt ListUserProfiles' {..} =
_salt
`Prelude.hashWithSalt` maxResults
`Prelude.hashWithSalt` nextToken
instance Prelude.NFData ListUserProfiles where
rnf ListUserProfiles' {..} =
Prelude.rnf maxResults
`Prelude.seq` Prelude.rnf nextToken
instance Data.ToHeaders ListUserProfiles where
toHeaders =
Prelude.const
( Prelude.mconcat
[ "X-Amz-Target"
Data.=# ( "CodeStar_20170419.ListUserProfiles" ::
Prelude.ByteString
),
"Content-Type"
Data.=# ( "application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON ListUserProfiles where
toJSON ListUserProfiles' {..} =
Data.object
( Prelude.catMaybes
[ ("maxResults" Data..=) Prelude.<$> maxResults,
("nextToken" Data..=) Prelude.<$> nextToken
]
)
instance Data.ToPath ListUserProfiles where
toPath = Prelude.const "/"
instance Data.ToQuery ListUserProfiles where
toQuery = Prelude.const Prelude.mempty
-- | /See:/ 'newListUserProfilesResponse' smart constructor.
data ListUserProfilesResponse = ListUserProfilesResponse'
{ -- | The continuation token to use when requesting the next set of results,
-- if there are more results to be returned.
nextToken :: Prelude.Maybe Prelude.Text,
-- | The response's http status code.
httpStatus :: Prelude.Int,
-- | All the user profiles configured in AWS CodeStar for an AWS account.
userProfiles :: [UserProfileSummary]
}
deriving (Prelude.Eq, Prelude.Show, Prelude.Generic)
-- |
-- Create a value of 'ListUserProfilesResponse' 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', 'listUserProfilesResponse_nextToken' - The continuation token to use when requesting the next set of results,
-- if there are more results to be returned.
--
-- 'httpStatus', 'listUserProfilesResponse_httpStatus' - The response's http status code.
--
-- 'userProfiles', 'listUserProfilesResponse_userProfiles' - All the user profiles configured in AWS CodeStar for an AWS account.
newListUserProfilesResponse ::
-- | 'httpStatus'
Prelude.Int ->
ListUserProfilesResponse
newListUserProfilesResponse pHttpStatus_ =
ListUserProfilesResponse'
{ nextToken =
Prelude.Nothing,
httpStatus = pHttpStatus_,
userProfiles = Prelude.mempty
}
-- | The continuation token to use when requesting the next set of results,
-- if there are more results to be returned.
listUserProfilesResponse_nextToken :: Lens.Lens' ListUserProfilesResponse (Prelude.Maybe Prelude.Text)
listUserProfilesResponse_nextToken = Lens.lens (\ListUserProfilesResponse' {nextToken} -> nextToken) (\s@ListUserProfilesResponse' {} a -> s {nextToken = a} :: ListUserProfilesResponse)
-- | The response's http status code.
listUserProfilesResponse_httpStatus :: Lens.Lens' ListUserProfilesResponse Prelude.Int
listUserProfilesResponse_httpStatus = Lens.lens (\ListUserProfilesResponse' {httpStatus} -> httpStatus) (\s@ListUserProfilesResponse' {} a -> s {httpStatus = a} :: ListUserProfilesResponse)
-- | All the user profiles configured in AWS CodeStar for an AWS account.
listUserProfilesResponse_userProfiles :: Lens.Lens' ListUserProfilesResponse [UserProfileSummary]
listUserProfilesResponse_userProfiles = Lens.lens (\ListUserProfilesResponse' {userProfiles} -> userProfiles) (\s@ListUserProfilesResponse' {} a -> s {userProfiles = a} :: ListUserProfilesResponse) Prelude.. Lens.coerced
instance Prelude.NFData ListUserProfilesResponse where
rnf ListUserProfilesResponse' {..} =
Prelude.rnf nextToken
`Prelude.seq` Prelude.rnf httpStatus
`Prelude.seq` Prelude.rnf userProfiles