{-# 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.SageMaker.ListUserProfiles
-- 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 user profiles.
--
-- This operation returns paginated results.
module Amazonka.SageMaker.ListUserProfiles
  ( -- * Creating a Request
    ListUserProfiles (..),
    newListUserProfiles,

    -- * Request Lenses
    listUserProfiles_domainIdEquals,
    listUserProfiles_userProfileNameContains,
    listUserProfiles_nextToken,
    listUserProfiles_sortOrder,
    listUserProfiles_maxResults,
    listUserProfiles_sortBy,

    -- * Destructuring the Response
    ListUserProfilesResponse (..),
    newListUserProfilesResponse,

    -- * Response Lenses
    listUserProfilesResponse_userProfiles,
    listUserProfilesResponse_nextToken,
    listUserProfilesResponse_httpStatus,
  )
where

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
import Amazonka.SageMaker.Types

-- | /See:/ 'newListUserProfiles' smart constructor.
data ListUserProfiles = ListUserProfiles'
  { -- | A parameter by which to filter the results.
    ListUserProfiles -> Maybe Text
domainIdEquals :: Prelude.Maybe Prelude.Text,
    -- | A parameter by which to filter the results.
    ListUserProfiles -> Maybe Text
userProfileNameContains :: Prelude.Maybe Prelude.Text,
    -- | If the previous response was truncated, you will receive this token. Use
    -- it in your next request to receive the next set of results.
    ListUserProfiles -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The sort order for the results. The default is Ascending.
    ListUserProfiles -> Maybe SortOrder
sortOrder :: Prelude.Maybe SortOrder,
    -- | Returns a list up to a specified limit.
    ListUserProfiles -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The parameter by which to sort the results. The default is CreationTime.
    ListUserProfiles -> Maybe UserProfileSortKey
sortBy :: Prelude.Maybe UserProfileSortKey
  }
  deriving (ListUserProfiles -> ListUserProfiles -> Bool
(ListUserProfiles -> ListUserProfiles -> Bool)
-> (ListUserProfiles -> ListUserProfiles -> Bool)
-> Eq ListUserProfiles
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListUserProfiles -> ListUserProfiles -> Bool
$c/= :: ListUserProfiles -> ListUserProfiles -> Bool
== :: ListUserProfiles -> ListUserProfiles -> Bool
$c== :: ListUserProfiles -> ListUserProfiles -> Bool
Prelude.Eq, ReadPrec [ListUserProfiles]
ReadPrec ListUserProfiles
Int -> ReadS ListUserProfiles
ReadS [ListUserProfiles]
(Int -> ReadS ListUserProfiles)
-> ReadS [ListUserProfiles]
-> ReadPrec ListUserProfiles
-> ReadPrec [ListUserProfiles]
-> Read ListUserProfiles
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListUserProfiles]
$creadListPrec :: ReadPrec [ListUserProfiles]
readPrec :: ReadPrec ListUserProfiles
$creadPrec :: ReadPrec ListUserProfiles
readList :: ReadS [ListUserProfiles]
$creadList :: ReadS [ListUserProfiles]
readsPrec :: Int -> ReadS ListUserProfiles
$creadsPrec :: Int -> ReadS ListUserProfiles
Prelude.Read, Int -> ListUserProfiles -> ShowS
[ListUserProfiles] -> ShowS
ListUserProfiles -> String
(Int -> ListUserProfiles -> ShowS)
-> (ListUserProfiles -> String)
-> ([ListUserProfiles] -> ShowS)
-> Show ListUserProfiles
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListUserProfiles] -> ShowS
$cshowList :: [ListUserProfiles] -> ShowS
show :: ListUserProfiles -> String
$cshow :: ListUserProfiles -> String
showsPrec :: Int -> ListUserProfiles -> ShowS
$cshowsPrec :: Int -> ListUserProfiles -> ShowS
Prelude.Show, (forall x. ListUserProfiles -> Rep ListUserProfiles x)
-> (forall x. Rep ListUserProfiles x -> ListUserProfiles)
-> Generic ListUserProfiles
forall x. Rep ListUserProfiles x -> ListUserProfiles
forall x. ListUserProfiles -> Rep ListUserProfiles x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListUserProfiles x -> ListUserProfiles
$cfrom :: forall x. ListUserProfiles -> Rep ListUserProfiles x
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:
--
-- 'domainIdEquals', 'listUserProfiles_domainIdEquals' - A parameter by which to filter the results.
--
-- 'userProfileNameContains', 'listUserProfiles_userProfileNameContains' - A parameter by which to filter the results.
--
-- 'nextToken', 'listUserProfiles_nextToken' - If the previous response was truncated, you will receive this token. Use
-- it in your next request to receive the next set of results.
--
-- 'sortOrder', 'listUserProfiles_sortOrder' - The sort order for the results. The default is Ascending.
--
-- 'maxResults', 'listUserProfiles_maxResults' - Returns a list up to a specified limit.
--
-- 'sortBy', 'listUserProfiles_sortBy' - The parameter by which to sort the results. The default is CreationTime.
newListUserProfiles ::
  ListUserProfiles
newListUserProfiles :: ListUserProfiles
newListUserProfiles =
  ListUserProfiles' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe SortOrder
-> Maybe Natural
-> Maybe UserProfileSortKey
-> ListUserProfiles
ListUserProfiles'
    { $sel:domainIdEquals:ListUserProfiles' :: Maybe Text
domainIdEquals = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:userProfileNameContains:ListUserProfiles' :: Maybe Text
userProfileNameContains = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListUserProfiles' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sortOrder:ListUserProfiles' :: Maybe SortOrder
sortOrder = Maybe SortOrder
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListUserProfiles' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:sortBy:ListUserProfiles' :: Maybe UserProfileSortKey
sortBy = Maybe UserProfileSortKey
forall a. Maybe a
Prelude.Nothing
    }

-- | A parameter by which to filter the results.
listUserProfiles_domainIdEquals :: Lens.Lens' ListUserProfiles (Prelude.Maybe Prelude.Text)
listUserProfiles_domainIdEquals :: (Maybe Text -> f (Maybe Text))
-> ListUserProfiles -> f ListUserProfiles
listUserProfiles_domainIdEquals = (ListUserProfiles -> Maybe Text)
-> (ListUserProfiles -> Maybe Text -> ListUserProfiles)
-> Lens ListUserProfiles ListUserProfiles (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUserProfiles' {Maybe Text
domainIdEquals :: Maybe Text
$sel:domainIdEquals:ListUserProfiles' :: ListUserProfiles -> Maybe Text
domainIdEquals} -> Maybe Text
domainIdEquals) (\s :: ListUserProfiles
s@ListUserProfiles' {} Maybe Text
a -> ListUserProfiles
s {$sel:domainIdEquals:ListUserProfiles' :: Maybe Text
domainIdEquals = Maybe Text
a} :: ListUserProfiles)

-- | A parameter by which to filter the results.
listUserProfiles_userProfileNameContains :: Lens.Lens' ListUserProfiles (Prelude.Maybe Prelude.Text)
listUserProfiles_userProfileNameContains :: (Maybe Text -> f (Maybe Text))
-> ListUserProfiles -> f ListUserProfiles
listUserProfiles_userProfileNameContains = (ListUserProfiles -> Maybe Text)
-> (ListUserProfiles -> Maybe Text -> ListUserProfiles)
-> Lens ListUserProfiles ListUserProfiles (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUserProfiles' {Maybe Text
userProfileNameContains :: Maybe Text
$sel:userProfileNameContains:ListUserProfiles' :: ListUserProfiles -> Maybe Text
userProfileNameContains} -> Maybe Text
userProfileNameContains) (\s :: ListUserProfiles
s@ListUserProfiles' {} Maybe Text
a -> ListUserProfiles
s {$sel:userProfileNameContains:ListUserProfiles' :: Maybe Text
userProfileNameContains = Maybe Text
a} :: ListUserProfiles)

-- | If the previous response was truncated, you will receive this token. Use
-- it in your next request to receive the next set of results.
listUserProfiles_nextToken :: Lens.Lens' ListUserProfiles (Prelude.Maybe Prelude.Text)
listUserProfiles_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListUserProfiles -> f ListUserProfiles
listUserProfiles_nextToken = (ListUserProfiles -> Maybe Text)
-> (ListUserProfiles -> Maybe Text -> ListUserProfiles)
-> Lens ListUserProfiles ListUserProfiles (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUserProfiles' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListUserProfiles' :: ListUserProfiles -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListUserProfiles
s@ListUserProfiles' {} Maybe Text
a -> ListUserProfiles
s {$sel:nextToken:ListUserProfiles' :: Maybe Text
nextToken = Maybe Text
a} :: ListUserProfiles)

-- | The sort order for the results. The default is Ascending.
listUserProfiles_sortOrder :: Lens.Lens' ListUserProfiles (Prelude.Maybe SortOrder)
listUserProfiles_sortOrder :: (Maybe SortOrder -> f (Maybe SortOrder))
-> ListUserProfiles -> f ListUserProfiles
listUserProfiles_sortOrder = (ListUserProfiles -> Maybe SortOrder)
-> (ListUserProfiles -> Maybe SortOrder -> ListUserProfiles)
-> Lens
     ListUserProfiles
     ListUserProfiles
     (Maybe SortOrder)
     (Maybe SortOrder)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUserProfiles' {Maybe SortOrder
sortOrder :: Maybe SortOrder
$sel:sortOrder:ListUserProfiles' :: ListUserProfiles -> Maybe SortOrder
sortOrder} -> Maybe SortOrder
sortOrder) (\s :: ListUserProfiles
s@ListUserProfiles' {} Maybe SortOrder
a -> ListUserProfiles
s {$sel:sortOrder:ListUserProfiles' :: Maybe SortOrder
sortOrder = Maybe SortOrder
a} :: ListUserProfiles)

-- | Returns a list up to a specified limit.
listUserProfiles_maxResults :: Lens.Lens' ListUserProfiles (Prelude.Maybe Prelude.Natural)
listUserProfiles_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListUserProfiles -> f ListUserProfiles
listUserProfiles_maxResults = (ListUserProfiles -> Maybe Natural)
-> (ListUserProfiles -> Maybe Natural -> ListUserProfiles)
-> Lens
     ListUserProfiles ListUserProfiles (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUserProfiles' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListUserProfiles' :: ListUserProfiles -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListUserProfiles
s@ListUserProfiles' {} Maybe Natural
a -> ListUserProfiles
s {$sel:maxResults:ListUserProfiles' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListUserProfiles)

-- | The parameter by which to sort the results. The default is CreationTime.
listUserProfiles_sortBy :: Lens.Lens' ListUserProfiles (Prelude.Maybe UserProfileSortKey)
listUserProfiles_sortBy :: (Maybe UserProfileSortKey -> f (Maybe UserProfileSortKey))
-> ListUserProfiles -> f ListUserProfiles
listUserProfiles_sortBy = (ListUserProfiles -> Maybe UserProfileSortKey)
-> (ListUserProfiles
    -> Maybe UserProfileSortKey -> ListUserProfiles)
-> Lens
     ListUserProfiles
     ListUserProfiles
     (Maybe UserProfileSortKey)
     (Maybe UserProfileSortKey)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUserProfiles' {Maybe UserProfileSortKey
sortBy :: Maybe UserProfileSortKey
$sel:sortBy:ListUserProfiles' :: ListUserProfiles -> Maybe UserProfileSortKey
sortBy} -> Maybe UserProfileSortKey
sortBy) (\s :: ListUserProfiles
s@ListUserProfiles' {} Maybe UserProfileSortKey
a -> ListUserProfiles
s {$sel:sortBy:ListUserProfiles' :: Maybe UserProfileSortKey
sortBy = Maybe UserProfileSortKey
a} :: ListUserProfiles)

instance Core.AWSPager ListUserProfiles where
  page :: ListUserProfiles
-> AWSResponse ListUserProfiles -> Maybe ListUserProfiles
page ListUserProfiles
rq AWSResponse ListUserProfiles
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListUserProfiles
ListUserProfilesResponse
rs
            ListUserProfilesResponse
-> Getting (First Text) ListUserProfilesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListUserProfilesResponse
-> Const (First Text) ListUserProfilesResponse
Lens' ListUserProfilesResponse (Maybe Text)
listUserProfilesResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListUserProfilesResponse
 -> Const (First Text) ListUserProfilesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListUserProfilesResponse 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 ListUserProfiles
forall a. Maybe a
Prelude.Nothing
    | Maybe [UserProfileDetails] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListUserProfiles
ListUserProfilesResponse
rs
            ListUserProfilesResponse
-> Getting
     (First [UserProfileDetails])
     ListUserProfilesResponse
     [UserProfileDetails]
-> Maybe [UserProfileDetails]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [UserProfileDetails]
 -> Const (First [UserProfileDetails]) (Maybe [UserProfileDetails]))
-> ListUserProfilesResponse
-> Const (First [UserProfileDetails]) ListUserProfilesResponse
Lens' ListUserProfilesResponse (Maybe [UserProfileDetails])
listUserProfilesResponse_userProfiles
              ((Maybe [UserProfileDetails]
  -> Const (First [UserProfileDetails]) (Maybe [UserProfileDetails]))
 -> ListUserProfilesResponse
 -> Const (First [UserProfileDetails]) ListUserProfilesResponse)
-> (([UserProfileDetails]
     -> Const (First [UserProfileDetails]) [UserProfileDetails])
    -> Maybe [UserProfileDetails]
    -> Const (First [UserProfileDetails]) (Maybe [UserProfileDetails]))
-> Getting
     (First [UserProfileDetails])
     ListUserProfilesResponse
     [UserProfileDetails]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([UserProfileDetails]
 -> Const (First [UserProfileDetails]) [UserProfileDetails])
-> Maybe [UserProfileDetails]
-> Const (First [UserProfileDetails]) (Maybe [UserProfileDetails])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListUserProfiles
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListUserProfiles -> Maybe ListUserProfiles
forall a. a -> Maybe a
Prelude.Just (ListUserProfiles -> Maybe ListUserProfiles)
-> ListUserProfiles -> Maybe ListUserProfiles
forall a b. (a -> b) -> a -> b
Prelude.$
        ListUserProfiles
rq
          ListUserProfiles
-> (ListUserProfiles -> ListUserProfiles) -> ListUserProfiles
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListUserProfiles -> Identity ListUserProfiles
Lens ListUserProfiles ListUserProfiles (Maybe Text) (Maybe Text)
listUserProfiles_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListUserProfiles -> Identity ListUserProfiles)
-> Maybe Text -> ListUserProfiles -> ListUserProfiles
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListUserProfiles
ListUserProfilesResponse
rs
          ListUserProfilesResponse
-> Getting (First Text) ListUserProfilesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListUserProfilesResponse
-> Const (First Text) ListUserProfilesResponse
Lens' ListUserProfilesResponse (Maybe Text)
listUserProfilesResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListUserProfilesResponse
 -> Const (First Text) ListUserProfilesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListUserProfilesResponse 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 ListUserProfiles where
  type
    AWSResponse ListUserProfiles =
      ListUserProfilesResponse
  request :: ListUserProfiles -> Request ListUserProfiles
request = Service -> ListUserProfiles -> Request ListUserProfiles
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListUserProfiles
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListUserProfiles)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListUserProfiles))
-> Logger
-> Service
-> Proxy ListUserProfiles
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListUserProfiles)))
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 [UserProfileDetails]
-> Maybe Text -> Int -> ListUserProfilesResponse
ListUserProfilesResponse'
            (Maybe [UserProfileDetails]
 -> Maybe Text -> Int -> ListUserProfilesResponse)
-> Either String (Maybe [UserProfileDetails])
-> Either String (Maybe Text -> Int -> ListUserProfilesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Either String (Maybe (Maybe [UserProfileDetails]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"UserProfiles" Either String (Maybe (Maybe [UserProfileDetails]))
-> Maybe [UserProfileDetails]
-> Either String (Maybe [UserProfileDetails])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [UserProfileDetails]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Maybe Text -> Int -> ListUserProfilesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListUserProfilesResponse)
forall (f :: * -> *) a b. Applicative f => 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 (Int -> ListUserProfilesResponse)
-> Either String Int -> Either String ListUserProfilesResponse
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 ListUserProfiles

instance Prelude.NFData ListUserProfiles

instance Core.ToHeaders ListUserProfiles where
  toHeaders :: ListUserProfiles -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListUserProfiles -> 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
"SageMaker.ListUserProfiles" :: 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 ListUserProfiles where
  toJSON :: ListUserProfiles -> Value
toJSON ListUserProfiles' {Maybe Natural
Maybe Text
Maybe SortOrder
Maybe UserProfileSortKey
sortBy :: Maybe UserProfileSortKey
maxResults :: Maybe Natural
sortOrder :: Maybe SortOrder
nextToken :: Maybe Text
userProfileNameContains :: Maybe Text
domainIdEquals :: Maybe Text
$sel:sortBy:ListUserProfiles' :: ListUserProfiles -> Maybe UserProfileSortKey
$sel:maxResults:ListUserProfiles' :: ListUserProfiles -> Maybe Natural
$sel:sortOrder:ListUserProfiles' :: ListUserProfiles -> Maybe SortOrder
$sel:nextToken:ListUserProfiles' :: ListUserProfiles -> Maybe Text
$sel:userProfileNameContains:ListUserProfiles' :: ListUserProfiles -> Maybe Text
$sel:domainIdEquals:ListUserProfiles' :: ListUserProfiles -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"DomainIdEquals" 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
domainIdEquals,
            (Text
"UserProfileNameContains" 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
userProfileNameContains,
            (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
"SortOrder" Text -> SortOrder -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SortOrder -> Pair) -> Maybe SortOrder -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SortOrder
sortOrder,
            (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,
            (Text
"SortBy" Text -> UserProfileSortKey -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (UserProfileSortKey -> Pair)
-> Maybe UserProfileSortKey -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe UserProfileSortKey
sortBy
          ]
      )

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

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

-- | /See:/ 'newListUserProfilesResponse' smart constructor.
data ListUserProfilesResponse = ListUserProfilesResponse'
  { -- | The list of user profiles.
    ListUserProfilesResponse -> Maybe [UserProfileDetails]
userProfiles :: Prelude.Maybe [UserProfileDetails],
    -- | If the previous response was truncated, you will receive this token. Use
    -- it in your next request to receive the next set of results.
    ListUserProfilesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListUserProfilesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListUserProfilesResponse -> ListUserProfilesResponse -> Bool
(ListUserProfilesResponse -> ListUserProfilesResponse -> Bool)
-> (ListUserProfilesResponse -> ListUserProfilesResponse -> Bool)
-> Eq ListUserProfilesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListUserProfilesResponse -> ListUserProfilesResponse -> Bool
$c/= :: ListUserProfilesResponse -> ListUserProfilesResponse -> Bool
== :: ListUserProfilesResponse -> ListUserProfilesResponse -> Bool
$c== :: ListUserProfilesResponse -> ListUserProfilesResponse -> Bool
Prelude.Eq, ReadPrec [ListUserProfilesResponse]
ReadPrec ListUserProfilesResponse
Int -> ReadS ListUserProfilesResponse
ReadS [ListUserProfilesResponse]
(Int -> ReadS ListUserProfilesResponse)
-> ReadS [ListUserProfilesResponse]
-> ReadPrec ListUserProfilesResponse
-> ReadPrec [ListUserProfilesResponse]
-> Read ListUserProfilesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListUserProfilesResponse]
$creadListPrec :: ReadPrec [ListUserProfilesResponse]
readPrec :: ReadPrec ListUserProfilesResponse
$creadPrec :: ReadPrec ListUserProfilesResponse
readList :: ReadS [ListUserProfilesResponse]
$creadList :: ReadS [ListUserProfilesResponse]
readsPrec :: Int -> ReadS ListUserProfilesResponse
$creadsPrec :: Int -> ReadS ListUserProfilesResponse
Prelude.Read, Int -> ListUserProfilesResponse -> ShowS
[ListUserProfilesResponse] -> ShowS
ListUserProfilesResponse -> String
(Int -> ListUserProfilesResponse -> ShowS)
-> (ListUserProfilesResponse -> String)
-> ([ListUserProfilesResponse] -> ShowS)
-> Show ListUserProfilesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListUserProfilesResponse] -> ShowS
$cshowList :: [ListUserProfilesResponse] -> ShowS
show :: ListUserProfilesResponse -> String
$cshow :: ListUserProfilesResponse -> String
showsPrec :: Int -> ListUserProfilesResponse -> ShowS
$cshowsPrec :: Int -> ListUserProfilesResponse -> ShowS
Prelude.Show, (forall x.
 ListUserProfilesResponse -> Rep ListUserProfilesResponse x)
-> (forall x.
    Rep ListUserProfilesResponse x -> ListUserProfilesResponse)
-> Generic ListUserProfilesResponse
forall x.
Rep ListUserProfilesResponse x -> ListUserProfilesResponse
forall x.
ListUserProfilesResponse -> Rep ListUserProfilesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListUserProfilesResponse x -> ListUserProfilesResponse
$cfrom :: forall x.
ListUserProfilesResponse -> Rep ListUserProfilesResponse x
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:
--
-- 'userProfiles', 'listUserProfilesResponse_userProfiles' - The list of user profiles.
--
-- 'nextToken', 'listUserProfilesResponse_nextToken' - If the previous response was truncated, you will receive this token. Use
-- it in your next request to receive the next set of results.
--
-- 'httpStatus', 'listUserProfilesResponse_httpStatus' - The response's http status code.
newListUserProfilesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListUserProfilesResponse
newListUserProfilesResponse :: Int -> ListUserProfilesResponse
newListUserProfilesResponse Int
pHttpStatus_ =
  ListUserProfilesResponse' :: Maybe [UserProfileDetails]
-> Maybe Text -> Int -> ListUserProfilesResponse
ListUserProfilesResponse'
    { $sel:userProfiles:ListUserProfilesResponse' :: Maybe [UserProfileDetails]
userProfiles =
        Maybe [UserProfileDetails]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListUserProfilesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListUserProfilesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The list of user profiles.
listUserProfilesResponse_userProfiles :: Lens.Lens' ListUserProfilesResponse (Prelude.Maybe [UserProfileDetails])
listUserProfilesResponse_userProfiles :: (Maybe [UserProfileDetails] -> f (Maybe [UserProfileDetails]))
-> ListUserProfilesResponse -> f ListUserProfilesResponse
listUserProfilesResponse_userProfiles = (ListUserProfilesResponse -> Maybe [UserProfileDetails])
-> (ListUserProfilesResponse
    -> Maybe [UserProfileDetails] -> ListUserProfilesResponse)
-> Lens' ListUserProfilesResponse (Maybe [UserProfileDetails])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUserProfilesResponse' {Maybe [UserProfileDetails]
userProfiles :: Maybe [UserProfileDetails]
$sel:userProfiles:ListUserProfilesResponse' :: ListUserProfilesResponse -> Maybe [UserProfileDetails]
userProfiles} -> Maybe [UserProfileDetails]
userProfiles) (\s :: ListUserProfilesResponse
s@ListUserProfilesResponse' {} Maybe [UserProfileDetails]
a -> ListUserProfilesResponse
s {$sel:userProfiles:ListUserProfilesResponse' :: Maybe [UserProfileDetails]
userProfiles = Maybe [UserProfileDetails]
a} :: ListUserProfilesResponse) ((Maybe [UserProfileDetails] -> f (Maybe [UserProfileDetails]))
 -> ListUserProfilesResponse -> f ListUserProfilesResponse)
-> ((Maybe [UserProfileDetails] -> f (Maybe [UserProfileDetails]))
    -> Maybe [UserProfileDetails] -> f (Maybe [UserProfileDetails]))
-> (Maybe [UserProfileDetails] -> f (Maybe [UserProfileDetails]))
-> ListUserProfilesResponse
-> f ListUserProfilesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [UserProfileDetails]
  [UserProfileDetails]
  [UserProfileDetails]
  [UserProfileDetails]
-> Iso
     (Maybe [UserProfileDetails])
     (Maybe [UserProfileDetails])
     (Maybe [UserProfileDetails])
     (Maybe [UserProfileDetails])
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
  [UserProfileDetails]
  [UserProfileDetails]
  [UserProfileDetails]
  [UserProfileDetails]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If the previous response was truncated, you will receive this token. Use
-- it in your next request to receive the next set of results.
listUserProfilesResponse_nextToken :: Lens.Lens' ListUserProfilesResponse (Prelude.Maybe Prelude.Text)
listUserProfilesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListUserProfilesResponse -> f ListUserProfilesResponse
listUserProfilesResponse_nextToken = (ListUserProfilesResponse -> Maybe Text)
-> (ListUserProfilesResponse
    -> Maybe Text -> ListUserProfilesResponse)
-> Lens' ListUserProfilesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUserProfilesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListUserProfilesResponse' :: ListUserProfilesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListUserProfilesResponse
s@ListUserProfilesResponse' {} Maybe Text
a -> ListUserProfilesResponse
s {$sel:nextToken:ListUserProfilesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListUserProfilesResponse)

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

instance Prelude.NFData ListUserProfilesResponse