{-# 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.ListRolePolicies
(
ListRolePolicies (..),
newListRolePolicies,
listRolePolicies_marker,
listRolePolicies_maxItems,
listRolePolicies_roleName,
ListRolePoliciesResponse (..),
newListRolePoliciesResponse,
listRolePoliciesResponse_isTruncated,
listRolePoliciesResponse_marker,
listRolePoliciesResponse_httpStatus,
listRolePoliciesResponse_policyNames,
)
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 ListRolePolicies = ListRolePolicies'
{
ListRolePolicies -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
ListRolePolicies -> Maybe Natural
maxItems :: Prelude.Maybe Prelude.Natural,
ListRolePolicies -> Text
roleName :: Prelude.Text
}
deriving (ListRolePolicies -> ListRolePolicies -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRolePolicies -> ListRolePolicies -> Bool
$c/= :: ListRolePolicies -> ListRolePolicies -> Bool
== :: ListRolePolicies -> ListRolePolicies -> Bool
$c== :: ListRolePolicies -> ListRolePolicies -> Bool
Prelude.Eq, ReadPrec [ListRolePolicies]
ReadPrec ListRolePolicies
Int -> ReadS ListRolePolicies
ReadS [ListRolePolicies]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListRolePolicies]
$creadListPrec :: ReadPrec [ListRolePolicies]
readPrec :: ReadPrec ListRolePolicies
$creadPrec :: ReadPrec ListRolePolicies
readList :: ReadS [ListRolePolicies]
$creadList :: ReadS [ListRolePolicies]
readsPrec :: Int -> ReadS ListRolePolicies
$creadsPrec :: Int -> ReadS ListRolePolicies
Prelude.Read, Int -> ListRolePolicies -> ShowS
[ListRolePolicies] -> ShowS
ListRolePolicies -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRolePolicies] -> ShowS
$cshowList :: [ListRolePolicies] -> ShowS
show :: ListRolePolicies -> String
$cshow :: ListRolePolicies -> String
showsPrec :: Int -> ListRolePolicies -> ShowS
$cshowsPrec :: Int -> ListRolePolicies -> ShowS
Prelude.Show, forall x. Rep ListRolePolicies x -> ListRolePolicies
forall x. ListRolePolicies -> Rep ListRolePolicies x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListRolePolicies x -> ListRolePolicies
$cfrom :: forall x. ListRolePolicies -> Rep ListRolePolicies x
Prelude.Generic)
newListRolePolicies ::
Prelude.Text ->
ListRolePolicies
newListRolePolicies :: Text -> ListRolePolicies
newListRolePolicies Text
pRoleName_ =
ListRolePolicies'
{ $sel:marker:ListRolePolicies' :: Maybe Text
marker = forall a. Maybe a
Prelude.Nothing,
$sel:maxItems:ListRolePolicies' :: Maybe Natural
maxItems = forall a. Maybe a
Prelude.Nothing,
$sel:roleName:ListRolePolicies' :: Text
roleName = Text
pRoleName_
}
listRolePolicies_marker :: Lens.Lens' ListRolePolicies (Prelude.Maybe Prelude.Text)
listRolePolicies_marker :: Lens' ListRolePolicies (Maybe Text)
listRolePolicies_marker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRolePolicies' {Maybe Text
marker :: Maybe Text
$sel:marker:ListRolePolicies' :: ListRolePolicies -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListRolePolicies
s@ListRolePolicies' {} Maybe Text
a -> ListRolePolicies
s {$sel:marker:ListRolePolicies' :: Maybe Text
marker = Maybe Text
a} :: ListRolePolicies)
listRolePolicies_maxItems :: Lens.Lens' ListRolePolicies (Prelude.Maybe Prelude.Natural)
listRolePolicies_maxItems :: Lens' ListRolePolicies (Maybe Natural)
listRolePolicies_maxItems = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRolePolicies' {Maybe Natural
maxItems :: Maybe Natural
$sel:maxItems:ListRolePolicies' :: ListRolePolicies -> Maybe Natural
maxItems} -> Maybe Natural
maxItems) (\s :: ListRolePolicies
s@ListRolePolicies' {} Maybe Natural
a -> ListRolePolicies
s {$sel:maxItems:ListRolePolicies' :: Maybe Natural
maxItems = Maybe Natural
a} :: ListRolePolicies)
listRolePolicies_roleName :: Lens.Lens' ListRolePolicies Prelude.Text
listRolePolicies_roleName :: Lens' ListRolePolicies Text
listRolePolicies_roleName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRolePolicies' {Text
roleName :: Text
$sel:roleName:ListRolePolicies' :: ListRolePolicies -> Text
roleName} -> Text
roleName) (\s :: ListRolePolicies
s@ListRolePolicies' {} Text
a -> ListRolePolicies
s {$sel:roleName:ListRolePolicies' :: Text
roleName = Text
a} :: ListRolePolicies)
instance Core.AWSPager ListRolePolicies where
page :: ListRolePolicies
-> AWSResponse ListRolePolicies -> Maybe ListRolePolicies
page ListRolePolicies
rq AWSResponse ListRolePolicies
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListRolePolicies
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListRolePoliciesResponse (Maybe Bool)
listRolePoliciesResponse_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 ListRolePolicies
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListRolePoliciesResponse (Maybe Text)
listRolePoliciesResponse_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.$ ListRolePolicies
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListRolePolicies (Maybe Text)
listRolePolicies_marker
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListRolePolicies
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListRolePoliciesResponse (Maybe Text)
listRolePoliciesResponse_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 ListRolePolicies where
type
AWSResponse ListRolePolicies =
ListRolePoliciesResponse
request :: (Service -> Service)
-> ListRolePolicies -> Request ListRolePolicies
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 ListRolePolicies
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListRolePolicies)))
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
"ListRolePoliciesResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Bool
-> Maybe Text -> Int -> [Text] -> ListRolePoliciesResponse
ListRolePoliciesResponse'
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
"PolicyNames"
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 ListRolePolicies where
hashWithSalt :: Int -> ListRolePolicies -> Int
hashWithSalt Int
_salt ListRolePolicies' {Maybe Natural
Maybe Text
Text
roleName :: Text
maxItems :: Maybe Natural
marker :: Maybe Text
$sel:roleName:ListRolePolicies' :: ListRolePolicies -> Text
$sel:maxItems:ListRolePolicies' :: ListRolePolicies -> Maybe Natural
$sel:marker:ListRolePolicies' :: ListRolePolicies -> 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` Text
roleName
instance Prelude.NFData ListRolePolicies where
rnf :: ListRolePolicies -> ()
rnf ListRolePolicies' {Maybe Natural
Maybe Text
Text
roleName :: Text
maxItems :: Maybe Natural
marker :: Maybe Text
$sel:roleName:ListRolePolicies' :: ListRolePolicies -> Text
$sel:maxItems:ListRolePolicies' :: ListRolePolicies -> Maybe Natural
$sel:marker:ListRolePolicies' :: ListRolePolicies -> 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 Text
roleName
instance Data.ToHeaders ListRolePolicies where
toHeaders :: ListRolePolicies -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath ListRolePolicies where
toPath :: ListRolePolicies -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListRolePolicies where
toQuery :: ListRolePolicies -> QueryString
toQuery ListRolePolicies' {Maybe Natural
Maybe Text
Text
roleName :: Text
maxItems :: Maybe Natural
marker :: Maybe Text
$sel:roleName:ListRolePolicies' :: ListRolePolicies -> Text
$sel:maxItems:ListRolePolicies' :: ListRolePolicies -> Maybe Natural
$sel:marker:ListRolePolicies' :: ListRolePolicies -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"ListRolePolicies" :: 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
"RoleName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
roleName
]
data ListRolePoliciesResponse = ListRolePoliciesResponse'
{
ListRolePoliciesResponse -> Maybe Bool
isTruncated :: Prelude.Maybe Prelude.Bool,
ListRolePoliciesResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
ListRolePoliciesResponse -> Int
httpStatus :: Prelude.Int,
ListRolePoliciesResponse -> [Text]
policyNames :: [Prelude.Text]
}
deriving (ListRolePoliciesResponse -> ListRolePoliciesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRolePoliciesResponse -> ListRolePoliciesResponse -> Bool
$c/= :: ListRolePoliciesResponse -> ListRolePoliciesResponse -> Bool
== :: ListRolePoliciesResponse -> ListRolePoliciesResponse -> Bool
$c== :: ListRolePoliciesResponse -> ListRolePoliciesResponse -> Bool
Prelude.Eq, ReadPrec [ListRolePoliciesResponse]
ReadPrec ListRolePoliciesResponse
Int -> ReadS ListRolePoliciesResponse
ReadS [ListRolePoliciesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListRolePoliciesResponse]
$creadListPrec :: ReadPrec [ListRolePoliciesResponse]
readPrec :: ReadPrec ListRolePoliciesResponse
$creadPrec :: ReadPrec ListRolePoliciesResponse
readList :: ReadS [ListRolePoliciesResponse]
$creadList :: ReadS [ListRolePoliciesResponse]
readsPrec :: Int -> ReadS ListRolePoliciesResponse
$creadsPrec :: Int -> ReadS ListRolePoliciesResponse
Prelude.Read, Int -> ListRolePoliciesResponse -> ShowS
[ListRolePoliciesResponse] -> ShowS
ListRolePoliciesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRolePoliciesResponse] -> ShowS
$cshowList :: [ListRolePoliciesResponse] -> ShowS
show :: ListRolePoliciesResponse -> String
$cshow :: ListRolePoliciesResponse -> String
showsPrec :: Int -> ListRolePoliciesResponse -> ShowS
$cshowsPrec :: Int -> ListRolePoliciesResponse -> ShowS
Prelude.Show, forall x.
Rep ListRolePoliciesResponse x -> ListRolePoliciesResponse
forall x.
ListRolePoliciesResponse -> Rep ListRolePoliciesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListRolePoliciesResponse x -> ListRolePoliciesResponse
$cfrom :: forall x.
ListRolePoliciesResponse -> Rep ListRolePoliciesResponse x
Prelude.Generic)
newListRolePoliciesResponse ::
Prelude.Int ->
ListRolePoliciesResponse
newListRolePoliciesResponse :: Int -> ListRolePoliciesResponse
newListRolePoliciesResponse Int
pHttpStatus_ =
ListRolePoliciesResponse'
{ $sel:isTruncated:ListRolePoliciesResponse' :: Maybe Bool
isTruncated =
forall a. Maybe a
Prelude.Nothing,
$sel:marker:ListRolePoliciesResponse' :: Maybe Text
marker = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListRolePoliciesResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:policyNames:ListRolePoliciesResponse' :: [Text]
policyNames = forall a. Monoid a => a
Prelude.mempty
}
listRolePoliciesResponse_isTruncated :: Lens.Lens' ListRolePoliciesResponse (Prelude.Maybe Prelude.Bool)
listRolePoliciesResponse_isTruncated :: Lens' ListRolePoliciesResponse (Maybe Bool)
listRolePoliciesResponse_isTruncated = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRolePoliciesResponse' {Maybe Bool
isTruncated :: Maybe Bool
$sel:isTruncated:ListRolePoliciesResponse' :: ListRolePoliciesResponse -> Maybe Bool
isTruncated} -> Maybe Bool
isTruncated) (\s :: ListRolePoliciesResponse
s@ListRolePoliciesResponse' {} Maybe Bool
a -> ListRolePoliciesResponse
s {$sel:isTruncated:ListRolePoliciesResponse' :: Maybe Bool
isTruncated = Maybe Bool
a} :: ListRolePoliciesResponse)
listRolePoliciesResponse_marker :: Lens.Lens' ListRolePoliciesResponse (Prelude.Maybe Prelude.Text)
listRolePoliciesResponse_marker :: Lens' ListRolePoliciesResponse (Maybe Text)
listRolePoliciesResponse_marker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRolePoliciesResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:ListRolePoliciesResponse' :: ListRolePoliciesResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListRolePoliciesResponse
s@ListRolePoliciesResponse' {} Maybe Text
a -> ListRolePoliciesResponse
s {$sel:marker:ListRolePoliciesResponse' :: Maybe Text
marker = Maybe Text
a} :: ListRolePoliciesResponse)
listRolePoliciesResponse_httpStatus :: Lens.Lens' ListRolePoliciesResponse Prelude.Int
listRolePoliciesResponse_httpStatus :: Lens' ListRolePoliciesResponse Int
listRolePoliciesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRolePoliciesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListRolePoliciesResponse' :: ListRolePoliciesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListRolePoliciesResponse
s@ListRolePoliciesResponse' {} Int
a -> ListRolePoliciesResponse
s {$sel:httpStatus:ListRolePoliciesResponse' :: Int
httpStatus = Int
a} :: ListRolePoliciesResponse)
listRolePoliciesResponse_policyNames :: Lens.Lens' ListRolePoliciesResponse [Prelude.Text]
listRolePoliciesResponse_policyNames :: Lens' ListRolePoliciesResponse [Text]
listRolePoliciesResponse_policyNames = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRolePoliciesResponse' {[Text]
policyNames :: [Text]
$sel:policyNames:ListRolePoliciesResponse' :: ListRolePoliciesResponse -> [Text]
policyNames} -> [Text]
policyNames) (\s :: ListRolePoliciesResponse
s@ListRolePoliciesResponse' {} [Text]
a -> ListRolePoliciesResponse
s {$sel:policyNames:ListRolePoliciesResponse' :: [Text]
policyNames = [Text]
a} :: ListRolePoliciesResponse) 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 ListRolePoliciesResponse where
rnf :: ListRolePoliciesResponse -> ()
rnf ListRolePoliciesResponse' {Int
[Text]
Maybe Bool
Maybe Text
policyNames :: [Text]
httpStatus :: Int
marker :: Maybe Text
isTruncated :: Maybe Bool
$sel:policyNames:ListRolePoliciesResponse' :: ListRolePoliciesResponse -> [Text]
$sel:httpStatus:ListRolePoliciesResponse' :: ListRolePoliciesResponse -> Int
$sel:marker:ListRolePoliciesResponse' :: ListRolePoliciesResponse -> Maybe Text
$sel:isTruncated:ListRolePoliciesResponse' :: ListRolePoliciesResponse -> 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 [Text]
policyNames