{-# 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.IAM.ListRoles
(
ListRoles (..),
newListRoles,
listRoles_marker,
listRoles_maxItems,
listRoles_pathPrefix,
ListRolesResponse (..),
newListRolesResponse,
listRolesResponse_isTruncated,
listRolesResponse_marker,
listRolesResponse_httpStatus,
listRolesResponse_roles,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IAM.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListRoles = ListRoles'
{
ListRoles -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
ListRoles -> Maybe Natural
maxItems :: Prelude.Maybe Prelude.Natural,
ListRoles -> Maybe Text
pathPrefix :: Prelude.Maybe Prelude.Text
}
deriving (ListRoles -> ListRoles -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRoles -> ListRoles -> Bool
$c/= :: ListRoles -> ListRoles -> Bool
== :: ListRoles -> ListRoles -> Bool
$c== :: ListRoles -> ListRoles -> Bool
Prelude.Eq, ReadPrec [ListRoles]
ReadPrec ListRoles
Int -> ReadS ListRoles
ReadS [ListRoles]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListRoles]
$creadListPrec :: ReadPrec [ListRoles]
readPrec :: ReadPrec ListRoles
$creadPrec :: ReadPrec ListRoles
readList :: ReadS [ListRoles]
$creadList :: ReadS [ListRoles]
readsPrec :: Int -> ReadS ListRoles
$creadsPrec :: Int -> ReadS ListRoles
Prelude.Read, Int -> ListRoles -> ShowS
[ListRoles] -> ShowS
ListRoles -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRoles] -> ShowS
$cshowList :: [ListRoles] -> ShowS
show :: ListRoles -> String
$cshow :: ListRoles -> String
showsPrec :: Int -> ListRoles -> ShowS
$cshowsPrec :: Int -> ListRoles -> ShowS
Prelude.Show, forall x. Rep ListRoles x -> ListRoles
forall x. ListRoles -> Rep ListRoles x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListRoles x -> ListRoles
$cfrom :: forall x. ListRoles -> Rep ListRoles x
Prelude.Generic)
newListRoles ::
ListRoles
newListRoles :: ListRoles
newListRoles =
ListRoles'
{ $sel:marker:ListRoles' :: Maybe Text
marker = forall a. Maybe a
Prelude.Nothing,
$sel:maxItems:ListRoles' :: Maybe Natural
maxItems = forall a. Maybe a
Prelude.Nothing,
$sel:pathPrefix:ListRoles' :: Maybe Text
pathPrefix = forall a. Maybe a
Prelude.Nothing
}
listRoles_marker :: Lens.Lens' ListRoles (Prelude.Maybe Prelude.Text)
listRoles_marker :: Lens' ListRoles (Maybe Text)
listRoles_marker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRoles' {Maybe Text
marker :: Maybe Text
$sel:marker:ListRoles' :: ListRoles -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListRoles
s@ListRoles' {} Maybe Text
a -> ListRoles
s {$sel:marker:ListRoles' :: Maybe Text
marker = Maybe Text
a} :: ListRoles)
listRoles_maxItems :: Lens.Lens' ListRoles (Prelude.Maybe Prelude.Natural)
listRoles_maxItems :: Lens' ListRoles (Maybe Natural)
listRoles_maxItems = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRoles' {Maybe Natural
maxItems :: Maybe Natural
$sel:maxItems:ListRoles' :: ListRoles -> Maybe Natural
maxItems} -> Maybe Natural
maxItems) (\s :: ListRoles
s@ListRoles' {} Maybe Natural
a -> ListRoles
s {$sel:maxItems:ListRoles' :: Maybe Natural
maxItems = Maybe Natural
a} :: ListRoles)
listRoles_pathPrefix :: Lens.Lens' ListRoles (Prelude.Maybe Prelude.Text)
listRoles_pathPrefix :: Lens' ListRoles (Maybe Text)
listRoles_pathPrefix = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRoles' {Maybe Text
pathPrefix :: Maybe Text
$sel:pathPrefix:ListRoles' :: ListRoles -> Maybe Text
pathPrefix} -> Maybe Text
pathPrefix) (\s :: ListRoles
s@ListRoles' {} Maybe Text
a -> ListRoles
s {$sel:pathPrefix:ListRoles' :: Maybe Text
pathPrefix = Maybe Text
a} :: ListRoles)
instance Core.AWSPager ListRoles where
page :: ListRoles -> AWSResponse ListRoles -> Maybe ListRoles
page ListRoles
rq AWSResponse ListRoles
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListRoles
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListRolesResponse (Maybe Bool)
listRolesResponse_isTruncated
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. Maybe a -> Bool
Prelude.isNothing
( AWSResponse ListRoles
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListRolesResponse (Maybe Text)
listRolesResponse_marker
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListRoles
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListRoles (Maybe Text)
listRoles_marker
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListRoles
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListRolesResponse (Maybe Text)
listRolesResponse_marker
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListRoles where
type AWSResponse ListRoles = ListRolesResponse
request :: (Service -> Service) -> ListRoles -> Request ListRoles
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListRoles
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListRoles)))
response =
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"ListRolesResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Bool -> Maybe Text -> Int -> [Role] -> ListRolesResponse
ListRolesResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"IsTruncated")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Marker")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Roles"
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"member"
)
)
instance Prelude.Hashable ListRoles where
hashWithSalt :: Int -> ListRoles -> Int
hashWithSalt Int
_salt ListRoles' {Maybe Natural
Maybe Text
pathPrefix :: Maybe Text
maxItems :: Maybe Natural
marker :: Maybe Text
$sel:pathPrefix:ListRoles' :: ListRoles -> Maybe Text
$sel:maxItems:ListRoles' :: ListRoles -> Maybe Natural
$sel:marker:ListRoles' :: ListRoles -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
marker
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxItems
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
pathPrefix
instance Prelude.NFData ListRoles where
rnf :: ListRoles -> ()
rnf ListRoles' {Maybe Natural
Maybe Text
pathPrefix :: Maybe Text
maxItems :: Maybe Natural
marker :: Maybe Text
$sel:pathPrefix:ListRoles' :: ListRoles -> Maybe Text
$sel:maxItems:ListRoles' :: ListRoles -> Maybe Natural
$sel:marker:ListRoles' :: ListRoles -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
marker
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxItems
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
pathPrefix
instance Data.ToHeaders ListRoles where
toHeaders :: ListRoles -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath ListRoles where
toPath :: ListRoles -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListRoles where
toQuery :: ListRoles -> QueryString
toQuery ListRoles' {Maybe Natural
Maybe Text
pathPrefix :: Maybe Text
maxItems :: Maybe Natural
marker :: Maybe Text
$sel:pathPrefix:ListRoles' :: ListRoles -> Maybe Text
$sel:maxItems:ListRoles' :: ListRoles -> Maybe Natural
$sel:marker:ListRoles' :: ListRoles -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"ListRoles" :: Prelude.ByteString),
ByteString
"Version"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2010-05-08" :: Prelude.ByteString),
ByteString
"Marker" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
marker,
ByteString
"MaxItems" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxItems,
ByteString
"PathPrefix" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
pathPrefix
]
data ListRolesResponse = ListRolesResponse'
{
ListRolesResponse -> Maybe Bool
isTruncated :: Prelude.Maybe Prelude.Bool,
ListRolesResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
ListRolesResponse -> Int
httpStatus :: Prelude.Int,
ListRolesResponse -> [Role]
roles :: [Role]
}
deriving (ListRolesResponse -> ListRolesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRolesResponse -> ListRolesResponse -> Bool
$c/= :: ListRolesResponse -> ListRolesResponse -> Bool
== :: ListRolesResponse -> ListRolesResponse -> Bool
$c== :: ListRolesResponse -> ListRolesResponse -> Bool
Prelude.Eq, ReadPrec [ListRolesResponse]
ReadPrec ListRolesResponse
Int -> ReadS ListRolesResponse
ReadS [ListRolesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListRolesResponse]
$creadListPrec :: ReadPrec [ListRolesResponse]
readPrec :: ReadPrec ListRolesResponse
$creadPrec :: ReadPrec ListRolesResponse
readList :: ReadS [ListRolesResponse]
$creadList :: ReadS [ListRolesResponse]
readsPrec :: Int -> ReadS ListRolesResponse
$creadsPrec :: Int -> ReadS ListRolesResponse
Prelude.Read, Int -> ListRolesResponse -> ShowS
[ListRolesResponse] -> ShowS
ListRolesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRolesResponse] -> ShowS
$cshowList :: [ListRolesResponse] -> ShowS
show :: ListRolesResponse -> String
$cshow :: ListRolesResponse -> String
showsPrec :: Int -> ListRolesResponse -> ShowS
$cshowsPrec :: Int -> ListRolesResponse -> ShowS
Prelude.Show, forall x. Rep ListRolesResponse x -> ListRolesResponse
forall x. ListRolesResponse -> Rep ListRolesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListRolesResponse x -> ListRolesResponse
$cfrom :: forall x. ListRolesResponse -> Rep ListRolesResponse x
Prelude.Generic)
newListRolesResponse ::
Prelude.Int ->
ListRolesResponse
newListRolesResponse :: Int -> ListRolesResponse
newListRolesResponse Int
pHttpStatus_ =
ListRolesResponse'
{ $sel:isTruncated:ListRolesResponse' :: Maybe Bool
isTruncated = forall a. Maybe a
Prelude.Nothing,
$sel:marker:ListRolesResponse' :: Maybe Text
marker = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListRolesResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:roles:ListRolesResponse' :: [Role]
roles = forall a. Monoid a => a
Prelude.mempty
}
listRolesResponse_isTruncated :: Lens.Lens' ListRolesResponse (Prelude.Maybe Prelude.Bool)
listRolesResponse_isTruncated :: Lens' ListRolesResponse (Maybe Bool)
listRolesResponse_isTruncated = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRolesResponse' {Maybe Bool
isTruncated :: Maybe Bool
$sel:isTruncated:ListRolesResponse' :: ListRolesResponse -> Maybe Bool
isTruncated} -> Maybe Bool
isTruncated) (\s :: ListRolesResponse
s@ListRolesResponse' {} Maybe Bool
a -> ListRolesResponse
s {$sel:isTruncated:ListRolesResponse' :: Maybe Bool
isTruncated = Maybe Bool
a} :: ListRolesResponse)
listRolesResponse_marker :: Lens.Lens' ListRolesResponse (Prelude.Maybe Prelude.Text)
listRolesResponse_marker :: Lens' ListRolesResponse (Maybe Text)
listRolesResponse_marker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRolesResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:ListRolesResponse' :: ListRolesResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListRolesResponse
s@ListRolesResponse' {} Maybe Text
a -> ListRolesResponse
s {$sel:marker:ListRolesResponse' :: Maybe Text
marker = Maybe Text
a} :: ListRolesResponse)
listRolesResponse_httpStatus :: Lens.Lens' ListRolesResponse Prelude.Int
listRolesResponse_httpStatus :: Lens' ListRolesResponse Int
listRolesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRolesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListRolesResponse' :: ListRolesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListRolesResponse
s@ListRolesResponse' {} Int
a -> ListRolesResponse
s {$sel:httpStatus:ListRolesResponse' :: Int
httpStatus = Int
a} :: ListRolesResponse)
listRolesResponse_roles :: Lens.Lens' ListRolesResponse [Role]
listRolesResponse_roles :: Lens' ListRolesResponse [Role]
listRolesResponse_roles = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRolesResponse' {[Role]
roles :: [Role]
$sel:roles:ListRolesResponse' :: ListRolesResponse -> [Role]
roles} -> [Role]
roles) (\s :: ListRolesResponse
s@ListRolesResponse' {} [Role]
a -> ListRolesResponse
s {$sel:roles:ListRolesResponse' :: [Role]
roles = [Role]
a} :: ListRolesResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData ListRolesResponse where
rnf :: ListRolesResponse -> ()
rnf ListRolesResponse' {Int
[Role]
Maybe Bool
Maybe Text
roles :: [Role]
httpStatus :: Int
marker :: Maybe Text
isTruncated :: Maybe Bool
$sel:roles:ListRolesResponse' :: ListRolesResponse -> [Role]
$sel:httpStatus:ListRolesResponse' :: ListRolesResponse -> Int
$sel:marker:ListRolesResponse' :: ListRolesResponse -> Maybe Text
$sel:isTruncated:ListRolesResponse' :: ListRolesResponse -> Maybe Bool
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
isTruncated
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
marker
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Role]
roles