{-# 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.Transfer.ListUsers
(
ListUsers (..),
newListUsers,
listUsers_nextToken,
listUsers_maxResults,
listUsers_serverId,
ListUsersResponse (..),
newListUsersResponse,
listUsersResponse_nextToken,
listUsersResponse_httpStatus,
listUsersResponse_serverId,
listUsersResponse_users,
)
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.Transfer.Types
data ListUsers = ListUsers'
{
ListUsers -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListUsers -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListUsers -> Text
serverId :: Prelude.Text
}
deriving (ListUsers -> ListUsers -> Bool
(ListUsers -> ListUsers -> Bool)
-> (ListUsers -> ListUsers -> Bool) -> Eq ListUsers
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListUsers -> ListUsers -> Bool
$c/= :: ListUsers -> ListUsers -> Bool
== :: ListUsers -> ListUsers -> Bool
$c== :: ListUsers -> ListUsers -> Bool
Prelude.Eq, ReadPrec [ListUsers]
ReadPrec ListUsers
Int -> ReadS ListUsers
ReadS [ListUsers]
(Int -> ReadS ListUsers)
-> ReadS [ListUsers]
-> ReadPrec ListUsers
-> ReadPrec [ListUsers]
-> Read ListUsers
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListUsers]
$creadListPrec :: ReadPrec [ListUsers]
readPrec :: ReadPrec ListUsers
$creadPrec :: ReadPrec ListUsers
readList :: ReadS [ListUsers]
$creadList :: ReadS [ListUsers]
readsPrec :: Int -> ReadS ListUsers
$creadsPrec :: Int -> ReadS ListUsers
Prelude.Read, Int -> ListUsers -> ShowS
[ListUsers] -> ShowS
ListUsers -> String
(Int -> ListUsers -> ShowS)
-> (ListUsers -> String)
-> ([ListUsers] -> ShowS)
-> Show ListUsers
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListUsers] -> ShowS
$cshowList :: [ListUsers] -> ShowS
show :: ListUsers -> String
$cshow :: ListUsers -> String
showsPrec :: Int -> ListUsers -> ShowS
$cshowsPrec :: Int -> ListUsers -> ShowS
Prelude.Show, (forall x. ListUsers -> Rep ListUsers x)
-> (forall x. Rep ListUsers x -> ListUsers) -> Generic ListUsers
forall x. Rep ListUsers x -> ListUsers
forall x. ListUsers -> Rep ListUsers x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListUsers x -> ListUsers
$cfrom :: forall x. ListUsers -> Rep ListUsers x
Prelude.Generic)
newListUsers ::
Prelude.Text ->
ListUsers
newListUsers :: Text -> ListUsers
newListUsers Text
pServerId_ =
ListUsers' :: Maybe Text -> Maybe Natural -> Text -> ListUsers
ListUsers'
{ $sel:nextToken:ListUsers' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListUsers' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:serverId:ListUsers' :: Text
serverId = Text
pServerId_
}
listUsers_nextToken :: Lens.Lens' ListUsers (Prelude.Maybe Prelude.Text)
listUsers_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListUsers -> f ListUsers
listUsers_nextToken = (ListUsers -> Maybe Text)
-> (ListUsers -> Maybe Text -> ListUsers)
-> Lens ListUsers ListUsers (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUsers' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListUsers' :: ListUsers -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListUsers
s@ListUsers' {} Maybe Text
a -> ListUsers
s {$sel:nextToken:ListUsers' :: Maybe Text
nextToken = Maybe Text
a} :: ListUsers)
listUsers_maxResults :: Lens.Lens' ListUsers (Prelude.Maybe Prelude.Natural)
listUsers_maxResults :: (Maybe Natural -> f (Maybe Natural)) -> ListUsers -> f ListUsers
listUsers_maxResults = (ListUsers -> Maybe Natural)
-> (ListUsers -> Maybe Natural -> ListUsers)
-> Lens ListUsers ListUsers (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUsers' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListUsers' :: ListUsers -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListUsers
s@ListUsers' {} Maybe Natural
a -> ListUsers
s {$sel:maxResults:ListUsers' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListUsers)
listUsers_serverId :: Lens.Lens' ListUsers Prelude.Text
listUsers_serverId :: (Text -> f Text) -> ListUsers -> f ListUsers
listUsers_serverId = (ListUsers -> Text)
-> (ListUsers -> Text -> ListUsers)
-> Lens ListUsers ListUsers Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUsers' {Text
serverId :: Text
$sel:serverId:ListUsers' :: ListUsers -> Text
serverId} -> Text
serverId) (\s :: ListUsers
s@ListUsers' {} Text
a -> ListUsers
s {$sel:serverId:ListUsers' :: Text
serverId = Text
a} :: ListUsers)
instance Core.AWSRequest ListUsers where
type AWSResponse ListUsers = ListUsersResponse
request :: ListUsers -> Request ListUsers
request = Service -> ListUsers -> Request ListUsers
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListUsers
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListUsers)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListUsers))
-> Logger
-> Service
-> Proxy ListUsers
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListUsers)))
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 -> Text -> [ListedUser] -> ListUsersResponse
ListUsersResponse'
(Maybe Text -> Int -> Text -> [ListedUser] -> ListUsersResponse)
-> Either String (Maybe Text)
-> Either String (Int -> Text -> [ListedUser] -> ListUsersResponse)
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 -> Text -> [ListedUser] -> ListUsersResponse)
-> Either String Int
-> Either String (Text -> [ListedUser] -> ListUsersResponse)
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 (Text -> [ListedUser] -> ListUsersResponse)
-> Either String Text
-> Either String ([ListedUser] -> ListUsersResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"ServerId")
Either String ([ListedUser] -> ListUsersResponse)
-> Either String [ListedUser] -> Either String ListUsersResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [ListedUser])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Users" Either String (Maybe [ListedUser])
-> [ListedUser] -> Either String [ListedUser]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [ListedUser]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ListUsers
instance Prelude.NFData ListUsers
instance Core.ToHeaders ListUsers where
toHeaders :: ListUsers -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListUsers -> 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
"TransferService.ListUsers" :: 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 ListUsers where
toJSON :: ListUsers -> Value
toJSON ListUsers' {Maybe Natural
Maybe Text
Text
serverId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:serverId:ListUsers' :: ListUsers -> Text
$sel:maxResults:ListUsers' :: ListUsers -> Maybe Natural
$sel:nextToken:ListUsers' :: ListUsers -> 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,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ServerId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
serverId)
]
)
instance Core.ToPath ListUsers where
toPath :: ListUsers -> ByteString
toPath = ByteString -> ListUsers -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ListUsers where
toQuery :: ListUsers -> QueryString
toQuery = QueryString -> ListUsers -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ListUsersResponse = ListUsersResponse'
{
ListUsersResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListUsersResponse -> Int
httpStatus :: Prelude.Int,
ListUsersResponse -> Text
serverId :: Prelude.Text,
ListUsersResponse -> [ListedUser]
users :: [ListedUser]
}
deriving (ListUsersResponse -> ListUsersResponse -> Bool
(ListUsersResponse -> ListUsersResponse -> Bool)
-> (ListUsersResponse -> ListUsersResponse -> Bool)
-> Eq ListUsersResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListUsersResponse -> ListUsersResponse -> Bool
$c/= :: ListUsersResponse -> ListUsersResponse -> Bool
== :: ListUsersResponse -> ListUsersResponse -> Bool
$c== :: ListUsersResponse -> ListUsersResponse -> Bool
Prelude.Eq, ReadPrec [ListUsersResponse]
ReadPrec ListUsersResponse
Int -> ReadS ListUsersResponse
ReadS [ListUsersResponse]
(Int -> ReadS ListUsersResponse)
-> ReadS [ListUsersResponse]
-> ReadPrec ListUsersResponse
-> ReadPrec [ListUsersResponse]
-> Read ListUsersResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListUsersResponse]
$creadListPrec :: ReadPrec [ListUsersResponse]
readPrec :: ReadPrec ListUsersResponse
$creadPrec :: ReadPrec ListUsersResponse
readList :: ReadS [ListUsersResponse]
$creadList :: ReadS [ListUsersResponse]
readsPrec :: Int -> ReadS ListUsersResponse
$creadsPrec :: Int -> ReadS ListUsersResponse
Prelude.Read, Int -> ListUsersResponse -> ShowS
[ListUsersResponse] -> ShowS
ListUsersResponse -> String
(Int -> ListUsersResponse -> ShowS)
-> (ListUsersResponse -> String)
-> ([ListUsersResponse] -> ShowS)
-> Show ListUsersResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListUsersResponse] -> ShowS
$cshowList :: [ListUsersResponse] -> ShowS
show :: ListUsersResponse -> String
$cshow :: ListUsersResponse -> String
showsPrec :: Int -> ListUsersResponse -> ShowS
$cshowsPrec :: Int -> ListUsersResponse -> ShowS
Prelude.Show, (forall x. ListUsersResponse -> Rep ListUsersResponse x)
-> (forall x. Rep ListUsersResponse x -> ListUsersResponse)
-> Generic ListUsersResponse
forall x. Rep ListUsersResponse x -> ListUsersResponse
forall x. ListUsersResponse -> Rep ListUsersResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListUsersResponse x -> ListUsersResponse
$cfrom :: forall x. ListUsersResponse -> Rep ListUsersResponse x
Prelude.Generic)
newListUsersResponse ::
Prelude.Int ->
Prelude.Text ->
ListUsersResponse
newListUsersResponse :: Int -> Text -> ListUsersResponse
newListUsersResponse Int
pHttpStatus_ Text
pServerId_ =
ListUsersResponse' :: Maybe Text -> Int -> Text -> [ListedUser] -> ListUsersResponse
ListUsersResponse'
{ $sel:nextToken:ListUsersResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListUsersResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:serverId:ListUsersResponse' :: Text
serverId = Text
pServerId_,
$sel:users:ListUsersResponse' :: [ListedUser]
users = [ListedUser]
forall a. Monoid a => a
Prelude.mempty
}
listUsersResponse_nextToken :: Lens.Lens' ListUsersResponse (Prelude.Maybe Prelude.Text)
listUsersResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListUsersResponse -> f ListUsersResponse
listUsersResponse_nextToken = (ListUsersResponse -> Maybe Text)
-> (ListUsersResponse -> Maybe Text -> ListUsersResponse)
-> Lens
ListUsersResponse ListUsersResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUsersResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListUsersResponse' :: ListUsersResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListUsersResponse
s@ListUsersResponse' {} Maybe Text
a -> ListUsersResponse
s {$sel:nextToken:ListUsersResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListUsersResponse)
listUsersResponse_httpStatus :: Lens.Lens' ListUsersResponse Prelude.Int
listUsersResponse_httpStatus :: (Int -> f Int) -> ListUsersResponse -> f ListUsersResponse
listUsersResponse_httpStatus = (ListUsersResponse -> Int)
-> (ListUsersResponse -> Int -> ListUsersResponse)
-> Lens ListUsersResponse ListUsersResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUsersResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListUsersResponse' :: ListUsersResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListUsersResponse
s@ListUsersResponse' {} Int
a -> ListUsersResponse
s {$sel:httpStatus:ListUsersResponse' :: Int
httpStatus = Int
a} :: ListUsersResponse)
listUsersResponse_serverId :: Lens.Lens' ListUsersResponse Prelude.Text
listUsersResponse_serverId :: (Text -> f Text) -> ListUsersResponse -> f ListUsersResponse
listUsersResponse_serverId = (ListUsersResponse -> Text)
-> (ListUsersResponse -> Text -> ListUsersResponse)
-> Lens ListUsersResponse ListUsersResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUsersResponse' {Text
serverId :: Text
$sel:serverId:ListUsersResponse' :: ListUsersResponse -> Text
serverId} -> Text
serverId) (\s :: ListUsersResponse
s@ListUsersResponse' {} Text
a -> ListUsersResponse
s {$sel:serverId:ListUsersResponse' :: Text
serverId = Text
a} :: ListUsersResponse)
listUsersResponse_users :: Lens.Lens' ListUsersResponse [ListedUser]
listUsersResponse_users :: ([ListedUser] -> f [ListedUser])
-> ListUsersResponse -> f ListUsersResponse
listUsersResponse_users = (ListUsersResponse -> [ListedUser])
-> (ListUsersResponse -> [ListedUser] -> ListUsersResponse)
-> Lens
ListUsersResponse ListUsersResponse [ListedUser] [ListedUser]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUsersResponse' {[ListedUser]
users :: [ListedUser]
$sel:users:ListUsersResponse' :: ListUsersResponse -> [ListedUser]
users} -> [ListedUser]
users) (\s :: ListUsersResponse
s@ListUsersResponse' {} [ListedUser]
a -> ListUsersResponse
s {$sel:users:ListUsersResponse' :: [ListedUser]
users = [ListedUser]
a} :: ListUsersResponse) (([ListedUser] -> f [ListedUser])
-> ListUsersResponse -> f ListUsersResponse)
-> (([ListedUser] -> f [ListedUser])
-> [ListedUser] -> f [ListedUser])
-> ([ListedUser] -> f [ListedUser])
-> ListUsersResponse
-> f ListUsersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ListedUser] -> f [ListedUser]) -> [ListedUser] -> f [ListedUser]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData ListUsersResponse