{-# 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 #-}
module Amazonka.CodeStar.ListUserProfiles
(
ListUserProfiles (..),
newListUserProfiles,
listUserProfiles_nextToken,
listUserProfiles_maxResults,
ListUserProfilesResponse (..),
newListUserProfilesResponse,
listUserProfilesResponse_nextToken,
listUserProfilesResponse_httpStatus,
listUserProfilesResponse_userProfiles,
)
where
import Amazonka.CodeStar.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
data ListUserProfiles = ListUserProfiles'
{
ListUserProfiles -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListUserProfiles -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
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)
newListUserProfiles ::
ListUserProfiles
newListUserProfiles :: ListUserProfiles
newListUserProfiles =
ListUserProfiles' :: Maybe Text -> Maybe Natural -> ListUserProfiles
ListUserProfiles'
{ $sel:nextToken:ListUserProfiles' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListUserProfiles' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
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)
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)
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
| [UserProfileSummary] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
(AWSResponse ListUserProfiles
ListUserProfilesResponse
rs ListUserProfilesResponse
-> Getting
[UserProfileSummary] ListUserProfilesResponse [UserProfileSummary]
-> [UserProfileSummary]
forall s a. s -> Getting a s a -> a
Lens.^. Getting
[UserProfileSummary] ListUserProfilesResponse [UserProfileSummary]
Lens' ListUserProfilesResponse [UserProfileSummary]
listUserProfilesResponse_userProfiles) =
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 Text
-> Int -> [UserProfileSummary] -> ListUserProfilesResponse
ListUserProfilesResponse'
(Maybe Text
-> Int -> [UserProfileSummary] -> ListUserProfilesResponse)
-> Either String (Maybe Text)
-> Either
String (Int -> [UserProfileSummary] -> ListUserProfilesResponse)
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 (Int -> [UserProfileSummary] -> ListUserProfilesResponse)
-> Either String Int
-> Either String ([UserProfileSummary] -> 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))
Either String ([UserProfileSummary] -> ListUserProfilesResponse)
-> Either String [UserProfileSummary]
-> Either String ListUserProfilesResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [UserProfileSummary])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"userProfiles" Either String (Maybe [UserProfileSummary])
-> [UserProfileSummary] -> Either String [UserProfileSummary]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [UserProfileSummary]
forall a. Monoid a => a
Prelude.mempty)
)
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
"CodeStar_20170419.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
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListUserProfiles' :: ListUserProfiles -> Maybe Natural
$sel:nextToken:ListUserProfiles' :: ListUserProfiles -> 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
]
)
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
data ListUserProfilesResponse = ListUserProfilesResponse'
{
ListUserProfilesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListUserProfilesResponse -> Int
httpStatus :: Prelude.Int,
ListUserProfilesResponse -> [UserProfileSummary]
userProfiles :: [UserProfileSummary]
}
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, 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)
newListUserProfilesResponse ::
Prelude.Int ->
ListUserProfilesResponse
newListUserProfilesResponse :: Int -> ListUserProfilesResponse
newListUserProfilesResponse Int
pHttpStatus_ =
ListUserProfilesResponse' :: Maybe Text
-> Int -> [UserProfileSummary] -> ListUserProfilesResponse
ListUserProfilesResponse'
{ $sel:nextToken:ListUserProfilesResponse' :: Maybe Text
nextToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListUserProfilesResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:userProfiles:ListUserProfilesResponse' :: [UserProfileSummary]
userProfiles = [UserProfileSummary]
forall a. Monoid a => a
Prelude.mempty
}
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)
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)
listUserProfilesResponse_userProfiles :: Lens.Lens' ListUserProfilesResponse [UserProfileSummary]
listUserProfilesResponse_userProfiles :: ([UserProfileSummary] -> f [UserProfileSummary])
-> ListUserProfilesResponse -> f ListUserProfilesResponse
listUserProfilesResponse_userProfiles = (ListUserProfilesResponse -> [UserProfileSummary])
-> (ListUserProfilesResponse
-> [UserProfileSummary] -> ListUserProfilesResponse)
-> Lens' ListUserProfilesResponse [UserProfileSummary]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUserProfilesResponse' {[UserProfileSummary]
userProfiles :: [UserProfileSummary]
$sel:userProfiles:ListUserProfilesResponse' :: ListUserProfilesResponse -> [UserProfileSummary]
userProfiles} -> [UserProfileSummary]
userProfiles) (\s :: ListUserProfilesResponse
s@ListUserProfilesResponse' {} [UserProfileSummary]
a -> ListUserProfilesResponse
s {$sel:userProfiles:ListUserProfilesResponse' :: [UserProfileSummary]
userProfiles = [UserProfileSummary]
a} :: ListUserProfilesResponse) (([UserProfileSummary] -> f [UserProfileSummary])
-> ListUserProfilesResponse -> f ListUserProfilesResponse)
-> (([UserProfileSummary] -> f [UserProfileSummary])
-> [UserProfileSummary] -> f [UserProfileSummary])
-> ([UserProfileSummary] -> f [UserProfileSummary])
-> ListUserProfilesResponse
-> f ListUserProfilesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([UserProfileSummary] -> f [UserProfileSummary])
-> [UserProfileSummary] -> f [UserProfileSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData ListUserProfilesResponse