{-# 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.ListUserPolicies
(
ListUserPolicies (..),
newListUserPolicies,
listUserPolicies_marker,
listUserPolicies_maxItems,
listUserPolicies_userName,
ListUserPoliciesResponse (..),
newListUserPoliciesResponse,
listUserPoliciesResponse_isTruncated,
listUserPoliciesResponse_marker,
listUserPoliciesResponse_httpStatus,
listUserPoliciesResponse_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 ListUserPolicies = ListUserPolicies'
{
ListUserPolicies -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
ListUserPolicies -> Maybe Natural
maxItems :: Prelude.Maybe Prelude.Natural,
ListUserPolicies -> Text
userName :: Prelude.Text
}
deriving (ListUserPolicies -> ListUserPolicies -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListUserPolicies -> ListUserPolicies -> Bool
$c/= :: ListUserPolicies -> ListUserPolicies -> Bool
== :: ListUserPolicies -> ListUserPolicies -> Bool
$c== :: ListUserPolicies -> ListUserPolicies -> Bool
Prelude.Eq, ReadPrec [ListUserPolicies]
ReadPrec ListUserPolicies
Int -> ReadS ListUserPolicies
ReadS [ListUserPolicies]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListUserPolicies]
$creadListPrec :: ReadPrec [ListUserPolicies]
readPrec :: ReadPrec ListUserPolicies
$creadPrec :: ReadPrec ListUserPolicies
readList :: ReadS [ListUserPolicies]
$creadList :: ReadS [ListUserPolicies]
readsPrec :: Int -> ReadS ListUserPolicies
$creadsPrec :: Int -> ReadS ListUserPolicies
Prelude.Read, Int -> ListUserPolicies -> ShowS
[ListUserPolicies] -> ShowS
ListUserPolicies -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListUserPolicies] -> ShowS
$cshowList :: [ListUserPolicies] -> ShowS
show :: ListUserPolicies -> String
$cshow :: ListUserPolicies -> String
showsPrec :: Int -> ListUserPolicies -> ShowS
$cshowsPrec :: Int -> ListUserPolicies -> ShowS
Prelude.Show, forall x. Rep ListUserPolicies x -> ListUserPolicies
forall x. ListUserPolicies -> Rep ListUserPolicies x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListUserPolicies x -> ListUserPolicies
$cfrom :: forall x. ListUserPolicies -> Rep ListUserPolicies x
Prelude.Generic)
newListUserPolicies ::
Prelude.Text ->
ListUserPolicies
newListUserPolicies :: Text -> ListUserPolicies
newListUserPolicies Text
pUserName_ =
ListUserPolicies'
{ $sel:marker:ListUserPolicies' :: Maybe Text
marker = forall a. Maybe a
Prelude.Nothing,
$sel:maxItems:ListUserPolicies' :: Maybe Natural
maxItems = forall a. Maybe a
Prelude.Nothing,
$sel:userName:ListUserPolicies' :: Text
userName = Text
pUserName_
}
listUserPolicies_marker :: Lens.Lens' ListUserPolicies (Prelude.Maybe Prelude.Text)
listUserPolicies_marker :: Lens' ListUserPolicies (Maybe Text)
listUserPolicies_marker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUserPolicies' {Maybe Text
marker :: Maybe Text
$sel:marker:ListUserPolicies' :: ListUserPolicies -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListUserPolicies
s@ListUserPolicies' {} Maybe Text
a -> ListUserPolicies
s {$sel:marker:ListUserPolicies' :: Maybe Text
marker = Maybe Text
a} :: ListUserPolicies)
listUserPolicies_maxItems :: Lens.Lens' ListUserPolicies (Prelude.Maybe Prelude.Natural)
listUserPolicies_maxItems :: Lens' ListUserPolicies (Maybe Natural)
listUserPolicies_maxItems = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUserPolicies' {Maybe Natural
maxItems :: Maybe Natural
$sel:maxItems:ListUserPolicies' :: ListUserPolicies -> Maybe Natural
maxItems} -> Maybe Natural
maxItems) (\s :: ListUserPolicies
s@ListUserPolicies' {} Maybe Natural
a -> ListUserPolicies
s {$sel:maxItems:ListUserPolicies' :: Maybe Natural
maxItems = Maybe Natural
a} :: ListUserPolicies)
listUserPolicies_userName :: Lens.Lens' ListUserPolicies Prelude.Text
listUserPolicies_userName :: Lens' ListUserPolicies Text
listUserPolicies_userName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUserPolicies' {Text
userName :: Text
$sel:userName:ListUserPolicies' :: ListUserPolicies -> Text
userName} -> Text
userName) (\s :: ListUserPolicies
s@ListUserPolicies' {} Text
a -> ListUserPolicies
s {$sel:userName:ListUserPolicies' :: Text
userName = Text
a} :: ListUserPolicies)
instance Core.AWSPager ListUserPolicies where
page :: ListUserPolicies
-> AWSResponse ListUserPolicies -> Maybe ListUserPolicies
page ListUserPolicies
rq AWSResponse ListUserPolicies
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListUserPolicies
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListUserPoliciesResponse (Maybe Bool)
listUserPoliciesResponse_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 ListUserPolicies
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListUserPoliciesResponse (Maybe Text)
listUserPoliciesResponse_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.$ ListUserPolicies
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListUserPolicies (Maybe Text)
listUserPolicies_marker
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListUserPolicies
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListUserPoliciesResponse (Maybe Text)
listUserPoliciesResponse_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 ListUserPolicies where
type
AWSResponse ListUserPolicies =
ListUserPoliciesResponse
request :: (Service -> Service)
-> ListUserPolicies -> Request ListUserPolicies
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 ListUserPolicies
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListUserPolicies)))
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
"ListUserPoliciesResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Bool
-> Maybe Text -> Int -> [Text] -> ListUserPoliciesResponse
ListUserPoliciesResponse'
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 ListUserPolicies where
hashWithSalt :: Int -> ListUserPolicies -> Int
hashWithSalt Int
_salt ListUserPolicies' {Maybe Natural
Maybe Text
Text
userName :: Text
maxItems :: Maybe Natural
marker :: Maybe Text
$sel:userName:ListUserPolicies' :: ListUserPolicies -> Text
$sel:maxItems:ListUserPolicies' :: ListUserPolicies -> Maybe Natural
$sel:marker:ListUserPolicies' :: ListUserPolicies -> 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
userName
instance Prelude.NFData ListUserPolicies where
rnf :: ListUserPolicies -> ()
rnf ListUserPolicies' {Maybe Natural
Maybe Text
Text
userName :: Text
maxItems :: Maybe Natural
marker :: Maybe Text
$sel:userName:ListUserPolicies' :: ListUserPolicies -> Text
$sel:maxItems:ListUserPolicies' :: ListUserPolicies -> Maybe Natural
$sel:marker:ListUserPolicies' :: ListUserPolicies -> 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
userName
instance Data.ToHeaders ListUserPolicies where
toHeaders :: ListUserPolicies -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath ListUserPolicies where
toPath :: ListUserPolicies -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListUserPolicies where
toQuery :: ListUserPolicies -> QueryString
toQuery ListUserPolicies' {Maybe Natural
Maybe Text
Text
userName :: Text
maxItems :: Maybe Natural
marker :: Maybe Text
$sel:userName:ListUserPolicies' :: ListUserPolicies -> Text
$sel:maxItems:ListUserPolicies' :: ListUserPolicies -> Maybe Natural
$sel:marker:ListUserPolicies' :: ListUserPolicies -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"ListUserPolicies" :: 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
"UserName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
userName
]
data ListUserPoliciesResponse = ListUserPoliciesResponse'
{
ListUserPoliciesResponse -> Maybe Bool
isTruncated :: Prelude.Maybe Prelude.Bool,
ListUserPoliciesResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
ListUserPoliciesResponse -> Int
httpStatus :: Prelude.Int,
ListUserPoliciesResponse -> [Text]
policyNames :: [Prelude.Text]
}
deriving (ListUserPoliciesResponse -> ListUserPoliciesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListUserPoliciesResponse -> ListUserPoliciesResponse -> Bool
$c/= :: ListUserPoliciesResponse -> ListUserPoliciesResponse -> Bool
== :: ListUserPoliciesResponse -> ListUserPoliciesResponse -> Bool
$c== :: ListUserPoliciesResponse -> ListUserPoliciesResponse -> Bool
Prelude.Eq, ReadPrec [ListUserPoliciesResponse]
ReadPrec ListUserPoliciesResponse
Int -> ReadS ListUserPoliciesResponse
ReadS [ListUserPoliciesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListUserPoliciesResponse]
$creadListPrec :: ReadPrec [ListUserPoliciesResponse]
readPrec :: ReadPrec ListUserPoliciesResponse
$creadPrec :: ReadPrec ListUserPoliciesResponse
readList :: ReadS [ListUserPoliciesResponse]
$creadList :: ReadS [ListUserPoliciesResponse]
readsPrec :: Int -> ReadS ListUserPoliciesResponse
$creadsPrec :: Int -> ReadS ListUserPoliciesResponse
Prelude.Read, Int -> ListUserPoliciesResponse -> ShowS
[ListUserPoliciesResponse] -> ShowS
ListUserPoliciesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListUserPoliciesResponse] -> ShowS
$cshowList :: [ListUserPoliciesResponse] -> ShowS
show :: ListUserPoliciesResponse -> String
$cshow :: ListUserPoliciesResponse -> String
showsPrec :: Int -> ListUserPoliciesResponse -> ShowS
$cshowsPrec :: Int -> ListUserPoliciesResponse -> ShowS
Prelude.Show, forall x.
Rep ListUserPoliciesResponse x -> ListUserPoliciesResponse
forall x.
ListUserPoliciesResponse -> Rep ListUserPoliciesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListUserPoliciesResponse x -> ListUserPoliciesResponse
$cfrom :: forall x.
ListUserPoliciesResponse -> Rep ListUserPoliciesResponse x
Prelude.Generic)
newListUserPoliciesResponse ::
Prelude.Int ->
ListUserPoliciesResponse
newListUserPoliciesResponse :: Int -> ListUserPoliciesResponse
newListUserPoliciesResponse Int
pHttpStatus_ =
ListUserPoliciesResponse'
{ $sel:isTruncated:ListUserPoliciesResponse' :: Maybe Bool
isTruncated =
forall a. Maybe a
Prelude.Nothing,
$sel:marker:ListUserPoliciesResponse' :: Maybe Text
marker = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListUserPoliciesResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:policyNames:ListUserPoliciesResponse' :: [Text]
policyNames = forall a. Monoid a => a
Prelude.mempty
}
listUserPoliciesResponse_isTruncated :: Lens.Lens' ListUserPoliciesResponse (Prelude.Maybe Prelude.Bool)
listUserPoliciesResponse_isTruncated :: Lens' ListUserPoliciesResponse (Maybe Bool)
listUserPoliciesResponse_isTruncated = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUserPoliciesResponse' {Maybe Bool
isTruncated :: Maybe Bool
$sel:isTruncated:ListUserPoliciesResponse' :: ListUserPoliciesResponse -> Maybe Bool
isTruncated} -> Maybe Bool
isTruncated) (\s :: ListUserPoliciesResponse
s@ListUserPoliciesResponse' {} Maybe Bool
a -> ListUserPoliciesResponse
s {$sel:isTruncated:ListUserPoliciesResponse' :: Maybe Bool
isTruncated = Maybe Bool
a} :: ListUserPoliciesResponse)
listUserPoliciesResponse_marker :: Lens.Lens' ListUserPoliciesResponse (Prelude.Maybe Prelude.Text)
listUserPoliciesResponse_marker :: Lens' ListUserPoliciesResponse (Maybe Text)
listUserPoliciesResponse_marker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUserPoliciesResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:ListUserPoliciesResponse' :: ListUserPoliciesResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListUserPoliciesResponse
s@ListUserPoliciesResponse' {} Maybe Text
a -> ListUserPoliciesResponse
s {$sel:marker:ListUserPoliciesResponse' :: Maybe Text
marker = Maybe Text
a} :: ListUserPoliciesResponse)
listUserPoliciesResponse_httpStatus :: Lens.Lens' ListUserPoliciesResponse Prelude.Int
listUserPoliciesResponse_httpStatus :: Lens' ListUserPoliciesResponse Int
listUserPoliciesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUserPoliciesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListUserPoliciesResponse' :: ListUserPoliciesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListUserPoliciesResponse
s@ListUserPoliciesResponse' {} Int
a -> ListUserPoliciesResponse
s {$sel:httpStatus:ListUserPoliciesResponse' :: Int
httpStatus = Int
a} :: ListUserPoliciesResponse)
listUserPoliciesResponse_policyNames :: Lens.Lens' ListUserPoliciesResponse [Prelude.Text]
listUserPoliciesResponse_policyNames :: Lens' ListUserPoliciesResponse [Text]
listUserPoliciesResponse_policyNames = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListUserPoliciesResponse' {[Text]
policyNames :: [Text]
$sel:policyNames:ListUserPoliciesResponse' :: ListUserPoliciesResponse -> [Text]
policyNames} -> [Text]
policyNames) (\s :: ListUserPoliciesResponse
s@ListUserPoliciesResponse' {} [Text]
a -> ListUserPoliciesResponse
s {$sel:policyNames:ListUserPoliciesResponse' :: [Text]
policyNames = [Text]
a} :: ListUserPoliciesResponse) 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 ListUserPoliciesResponse where
rnf :: ListUserPoliciesResponse -> ()
rnf ListUserPoliciesResponse' {Int
[Text]
Maybe Bool
Maybe Text
policyNames :: [Text]
httpStatus :: Int
marker :: Maybe Text
isTruncated :: Maybe Bool
$sel:policyNames:ListUserPoliciesResponse' :: ListUserPoliciesResponse -> [Text]
$sel:httpStatus:ListUserPoliciesResponse' :: ListUserPoliciesResponse -> Int
$sel:marker:ListUserPoliciesResponse' :: ListUserPoliciesResponse -> Maybe Text
$sel:isTruncated:ListUserPoliciesResponse' :: ListUserPoliciesResponse -> 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