    {-# LANGUAGE MultiParamTypeClasses #-}
    {-# LANGUAGE RecordWildCards       #-}
    {-# LANGUAGE TupleSections         #-}
    {-# LANGUAGE TypeFamilies          #-}
    module Aws.Iam.Commands.ListUsers
        ( ListUsers(..)
        , ListUsersResponse(..)
        , User(..)
        ) where

    import           Aws.Core
    import           Aws.Iam.Core
    import           Aws.Iam.Internal
    import           Control.Applicative
    import           Data.Text           (Text)
    import           Data.Typeable
    import           Prelude
    import           Text.XML.Cursor     (laxElement, ($//), (&|))

    -- | Lists users that have the specified path prefix.
    --
    -- <http://docs.aws.amazon.com/IAM/latest/APIReference/API_ListUsers.html>
    data ListUsers
        = ListUsers {
            ListUsers -> Maybe Text
    luPathPrefix :: Maybe Text
          -- ^ Users defined under this path will be listed. If omitted, defaults
          -- to @/@, which lists all users.
          , ListUsers -> Maybe Text
    luMarker     :: Maybe Text
          -- ^ Used for paginating requests. Marks the position of the last
          -- request.
          , ListUsers -> Maybe Integer
    luMaxItems   :: Maybe Integer
          -- ^ Used for paginating requests. Specifies the maximum number of items
          -- to return in the response. Defaults to 100.
          }
        deriving (ListUsers -> ListUsers -> Bool
    (ListUsers -> ListUsers -> Bool)
    -> (ListUsers -> ListUsers -> Bool) -> Eq ListUsers
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: ListUsers -> ListUsers -> Bool
    == :: ListUsers -> ListUsers -> Bool
    $c/= :: ListUsers -> ListUsers -> Bool
    /= :: ListUsers -> ListUsers -> Bool
    Eq, Eq ListUsers
    Eq ListUsers =>
    (ListUsers -> ListUsers -> Ordering)
    -> (ListUsers -> ListUsers -> Bool)
    -> (ListUsers -> ListUsers -> Bool)
    -> (ListUsers -> ListUsers -> Bool)
    -> (ListUsers -> ListUsers -> Bool)
    -> (ListUsers -> ListUsers -> ListUsers)
    -> (ListUsers -> ListUsers -> ListUsers)
    -> Ord ListUsers
    ListUsers -> ListUsers -> Bool
    ListUsers -> ListUsers -> Ordering
    ListUsers -> ListUsers -> ListUsers
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: ListUsers -> ListUsers -> Ordering
    compare :: ListUsers -> ListUsers -> Ordering
    $c< :: ListUsers -> ListUsers -> Bool
    < :: ListUsers -> ListUsers -> Bool
    $c<= :: ListUsers -> ListUsers -> Bool
    <= :: ListUsers -> ListUsers -> Bool
    $c> :: ListUsers -> ListUsers -> Bool
    > :: ListUsers -> ListUsers -> Bool
    $c>= :: ListUsers -> ListUsers -> Bool
    >= :: ListUsers -> ListUsers -> Bool
    $cmax :: ListUsers -> ListUsers -> ListUsers
    max :: ListUsers -> ListUsers -> ListUsers
    $cmin :: ListUsers -> ListUsers -> ListUsers
    min :: ListUsers -> ListUsers -> ListUsers
    Ord, 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
    $cshowsPrec :: Int -> ListUsers -> ShowS
    showsPrec :: Int -> ListUsers -> ShowS
    $cshow :: ListUsers -> String
    show :: ListUsers -> String
    $cshowList :: [ListUsers] -> ShowS
    showList :: [ListUsers] -> ShowS
    Show, Typeable)

    instance SignQuery ListUsers where
        type ServiceConfiguration ListUsers = IamConfiguration
        signQuery :: forall queryType.
    ListUsers
    -> ServiceConfiguration ListUsers queryType
    -> SignatureData
    -> SignedQuery
    signQuery ListUsers{Maybe Integer
    Maybe Text
    luPathPrefix :: ListUsers -> Maybe Text
    luMarker :: ListUsers -> Maybe Text
    luMaxItems :: ListUsers -> Maybe Integer
    luPathPrefix :: Maybe Text
    luMarker :: Maybe Text
    luMaxItems :: Maybe Integer
    ..}
            = ByteString
    -> [Maybe (ByteString, Text)]
    -> IamConfiguration queryType
    -> SignatureData
    -> SignedQuery
    forall qt.
    ByteString
    -> [Maybe (ByteString, Text)]
    -> IamConfiguration qt
    -> SignatureData
    -> SignedQuery
    iamAction' ByteString
    "ListUsers" ([Maybe (ByteString, Text)]
     -> IamConfiguration queryType -> SignatureData -> SignedQuery)
    -> [Maybe (ByteString, Text)]
    -> IamConfiguration queryType
    -> SignatureData
    -> SignedQuery
    forall a b. (a -> b) -> a -> b
    $ [
                  (ByteString
    "PathPrefix",) (Text -> (ByteString, Text))
    -> Maybe Text -> Maybe (ByteString, Text)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Maybe Text
    luPathPrefix
                ] [Maybe (ByteString, Text)]
    -> [Maybe (ByteString, Text)] -> [Maybe (ByteString, Text)]
    forall a. Semigroup a => a -> a -> a
    <> Maybe Text -> Maybe Integer -> [Maybe (ByteString, Text)]
    markedIter Maybe Text
    luMarker Maybe Integer
    luMaxItems

    data ListUsersResponse
        = ListUsersResponse {
            ListUsersResponse -> [User]
    lurUsers       :: [User]
          -- ^ List of 'User's.
          , ListUsersResponse -> Bool
    lurIsTruncated :: Bool
          -- ^ @True@ if the request was truncated because of too many items.
          , ListUsersResponse -> Maybe Text
    lurMarker      :: Maybe Text
          -- ^ Marks the position at which the request was truncated. This value
          -- must be passed with the next request to continue listing from the
          -- last position.
          }
        deriving (ListUsersResponse -> ListUsersResponse -> Bool
    (ListUsersResponse -> ListUsersResponse -> Bool)
    -> (ListUsersResponse -> ListUsersResponse -> Bool)
    -> Eq ListUsersResponse
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: ListUsersResponse -> ListUsersResponse -> Bool
    == :: ListUsersResponse -> ListUsersResponse -> Bool
    $c/= :: ListUsersResponse -> ListUsersResponse -> Bool
    /= :: ListUsersResponse -> ListUsersResponse -> Bool
    Eq, Eq ListUsersResponse
    Eq ListUsersResponse =>
    (ListUsersResponse -> ListUsersResponse -> Ordering)
    -> (ListUsersResponse -> ListUsersResponse -> Bool)
    -> (ListUsersResponse -> ListUsersResponse -> Bool)
    -> (ListUsersResponse -> ListUsersResponse -> Bool)
    -> (ListUsersResponse -> ListUsersResponse -> Bool)
    -> (ListUsersResponse -> ListUsersResponse -> ListUsersResponse)
    -> (ListUsersResponse -> ListUsersResponse -> ListUsersResponse)
    -> Ord ListUsersResponse
    ListUsersResponse -> ListUsersResponse -> Bool
    ListUsersResponse -> ListUsersResponse -> Ordering
    ListUsersResponse -> ListUsersResponse -> ListUsersResponse
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: ListUsersResponse -> ListUsersResponse -> Ordering
    compare :: ListUsersResponse -> ListUsersResponse -> Ordering
    $c< :: ListUsersResponse -> ListUsersResponse -> Bool
    < :: ListUsersResponse -> ListUsersResponse -> Bool
    $c<= :: ListUsersResponse -> ListUsersResponse -> Bool
    <= :: ListUsersResponse -> ListUsersResponse -> Bool
    $c> :: ListUsersResponse -> ListUsersResponse -> Bool
    > :: ListUsersResponse -> ListUsersResponse -> Bool
    $c>= :: ListUsersResponse -> ListUsersResponse -> Bool
    >= :: ListUsersResponse -> ListUsersResponse -> Bool
    $cmax :: ListUsersResponse -> ListUsersResponse -> ListUsersResponse
    max :: ListUsersResponse -> ListUsersResponse -> ListUsersResponse
    $cmin :: ListUsersResponse -> ListUsersResponse -> ListUsersResponse
    min :: ListUsersResponse -> ListUsersResponse -> ListUsersResponse
    Ord, 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
    $cshowsPrec :: Int -> ListUsersResponse -> ShowS
    showsPrec :: Int -> ListUsersResponse -> ShowS
    $cshow :: ListUsersResponse -> String
    show :: ListUsersResponse -> String
    $cshowList :: [ListUsersResponse] -> ShowS
    showList :: [ListUsersResponse] -> ShowS
    Show, Typeable)

    instance ResponseConsumer ListUsers ListUsersResponse where
        type ResponseMetadata ListUsersResponse = IamMetadata
        responseConsumer :: Request
    -> ListUsers
    -> IORef (ResponseMetadata ListUsersResponse)
    -> HTTPResponseConsumer ListUsersResponse
    responseConsumer Request
    _ ListUsers
    _
            = (Cursor -> Response IamMetadata ListUsersResponse)
    -> IORef IamMetadata -> HTTPResponseConsumer ListUsersResponse
    forall a.
    (Cursor -> Response IamMetadata a)
    -> IORef IamMetadata -> HTTPResponseConsumer a
    iamResponseConsumer ((Cursor -> Response IamMetadata ListUsersResponse)
     -> IORef IamMetadata -> HTTPResponseConsumer ListUsersResponse)
    -> (Cursor -> Response IamMetadata ListUsersResponse)
    -> IORef IamMetadata
    -> HTTPResponseConsumer ListUsersResponse
    forall a b. (a -> b) -> a -> b
    $ \Cursor
    cursor -> do
                (lurIsTruncated, lurMarker) <- Cursor -> Response IamMetadata (Bool, Maybe Text)
    forall (m :: * -> *).
    MonadThrow m =>
    Cursor -> m (Bool, Maybe Text)
    markedIterResponse Cursor
    cursor
                lurUsers <- sequence $
                    cursor $// laxElement "member" &| parseUser
                return ListUsersResponse{..}

    instance Transaction ListUsers ListUsersResponse

    instance IteratedTransaction ListUsers ListUsersResponse where
        nextIteratedRequest :: ListUsers -> ListUsersResponse -> Maybe ListUsers
    nextIteratedRequest ListUsers
    request ListUsersResponse
    response
            = case ListUsersResponse -> Maybe Text
    lurMarker ListUsersResponse
    response of
                Maybe Text
    Nothing     -> Maybe ListUsers
    forall a. Maybe a
    Nothing
                Just Text
    marker -> ListUsers -> Maybe ListUsers
    forall a. a -> Maybe a
    Just (ListUsers -> Maybe ListUsers) -> ListUsers -> Maybe ListUsers
    forall a b. (a -> b) -> a -> b
    $ ListUsers
    request { luMarker = Just marker }

    instance AsMemoryResponse ListUsersResponse where
        type MemoryResponse ListUsersResponse = ListUsersResponse
        loadToMemory :: ListUsersResponse
    -> ResourceT IO (MemoryResponse ListUsersResponse)
    loadToMemory = ListUsersResponse
    -> ResourceT IO (MemoryResponse ListUsersResponse)
    ListUsersResponse -> ResourceT IO ListUsersResponse
    forall a. a -> ResourceT IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return