{-# 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.ListGroupsForUser
(
ListGroupsForUser (..),
newListGroupsForUser,
listGroupsForUser_marker,
listGroupsForUser_maxItems,
listGroupsForUser_userName,
ListGroupsForUserResponse (..),
newListGroupsForUserResponse,
listGroupsForUserResponse_isTruncated,
listGroupsForUserResponse_marker,
listGroupsForUserResponse_httpStatus,
listGroupsForUserResponse_groups,
)
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 ListGroupsForUser = ListGroupsForUser'
{
ListGroupsForUser -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
ListGroupsForUser -> Maybe Natural
maxItems :: Prelude.Maybe Prelude.Natural,
ListGroupsForUser -> Text
userName :: Prelude.Text
}
deriving (ListGroupsForUser -> ListGroupsForUser -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListGroupsForUser -> ListGroupsForUser -> Bool
$c/= :: ListGroupsForUser -> ListGroupsForUser -> Bool
== :: ListGroupsForUser -> ListGroupsForUser -> Bool
$c== :: ListGroupsForUser -> ListGroupsForUser -> Bool
Prelude.Eq, ReadPrec [ListGroupsForUser]
ReadPrec ListGroupsForUser
Int -> ReadS ListGroupsForUser
ReadS [ListGroupsForUser]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListGroupsForUser]
$creadListPrec :: ReadPrec [ListGroupsForUser]
readPrec :: ReadPrec ListGroupsForUser
$creadPrec :: ReadPrec ListGroupsForUser
readList :: ReadS [ListGroupsForUser]
$creadList :: ReadS [ListGroupsForUser]
readsPrec :: Int -> ReadS ListGroupsForUser
$creadsPrec :: Int -> ReadS ListGroupsForUser
Prelude.Read, Int -> ListGroupsForUser -> ShowS
[ListGroupsForUser] -> ShowS
ListGroupsForUser -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListGroupsForUser] -> ShowS
$cshowList :: [ListGroupsForUser] -> ShowS
show :: ListGroupsForUser -> String
$cshow :: ListGroupsForUser -> String
showsPrec :: Int -> ListGroupsForUser -> ShowS
$cshowsPrec :: Int -> ListGroupsForUser -> ShowS
Prelude.Show, forall x. Rep ListGroupsForUser x -> ListGroupsForUser
forall x. ListGroupsForUser -> Rep ListGroupsForUser x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListGroupsForUser x -> ListGroupsForUser
$cfrom :: forall x. ListGroupsForUser -> Rep ListGroupsForUser x
Prelude.Generic)
newListGroupsForUser ::
Prelude.Text ->
ListGroupsForUser
newListGroupsForUser :: Text -> ListGroupsForUser
newListGroupsForUser Text
pUserName_ =
ListGroupsForUser'
{ $sel:marker:ListGroupsForUser' :: Maybe Text
marker = forall a. Maybe a
Prelude.Nothing,
$sel:maxItems:ListGroupsForUser' :: Maybe Natural
maxItems = forall a. Maybe a
Prelude.Nothing,
$sel:userName:ListGroupsForUser' :: Text
userName = Text
pUserName_
}
listGroupsForUser_marker :: Lens.Lens' ListGroupsForUser (Prelude.Maybe Prelude.Text)
listGroupsForUser_marker :: Lens' ListGroupsForUser (Maybe Text)
listGroupsForUser_marker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGroupsForUser' {Maybe Text
marker :: Maybe Text
$sel:marker:ListGroupsForUser' :: ListGroupsForUser -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListGroupsForUser
s@ListGroupsForUser' {} Maybe Text
a -> ListGroupsForUser
s {$sel:marker:ListGroupsForUser' :: Maybe Text
marker = Maybe Text
a} :: ListGroupsForUser)
listGroupsForUser_maxItems :: Lens.Lens' ListGroupsForUser (Prelude.Maybe Prelude.Natural)
listGroupsForUser_maxItems :: Lens' ListGroupsForUser (Maybe Natural)
listGroupsForUser_maxItems = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGroupsForUser' {Maybe Natural
maxItems :: Maybe Natural
$sel:maxItems:ListGroupsForUser' :: ListGroupsForUser -> Maybe Natural
maxItems} -> Maybe Natural
maxItems) (\s :: ListGroupsForUser
s@ListGroupsForUser' {} Maybe Natural
a -> ListGroupsForUser
s {$sel:maxItems:ListGroupsForUser' :: Maybe Natural
maxItems = Maybe Natural
a} :: ListGroupsForUser)
listGroupsForUser_userName :: Lens.Lens' ListGroupsForUser Prelude.Text
listGroupsForUser_userName :: Lens' ListGroupsForUser Text
listGroupsForUser_userName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGroupsForUser' {Text
userName :: Text
$sel:userName:ListGroupsForUser' :: ListGroupsForUser -> Text
userName} -> Text
userName) (\s :: ListGroupsForUser
s@ListGroupsForUser' {} Text
a -> ListGroupsForUser
s {$sel:userName:ListGroupsForUser' :: Text
userName = Text
a} :: ListGroupsForUser)
instance Core.AWSPager ListGroupsForUser where
page :: ListGroupsForUser
-> AWSResponse ListGroupsForUser -> Maybe ListGroupsForUser
page ListGroupsForUser
rq AWSResponse ListGroupsForUser
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListGroupsForUser
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListGroupsForUserResponse (Maybe Bool)
listGroupsForUserResponse_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 ListGroupsForUser
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListGroupsForUserResponse (Maybe Text)
listGroupsForUserResponse_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.$ ListGroupsForUser
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListGroupsForUser (Maybe Text)
listGroupsForUser_marker
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListGroupsForUser
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListGroupsForUserResponse (Maybe Text)
listGroupsForUserResponse_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 ListGroupsForUser where
type
AWSResponse ListGroupsForUser =
ListGroupsForUserResponse
request :: (Service -> Service)
-> ListGroupsForUser -> Request ListGroupsForUser
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 ListGroupsForUser
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListGroupsForUser)))
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
"ListGroupsForUserResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Bool
-> Maybe Text -> Int -> [Group] -> ListGroupsForUserResponse
ListGroupsForUserResponse'
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
"Groups"
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 ListGroupsForUser where
hashWithSalt :: Int -> ListGroupsForUser -> Int
hashWithSalt Int
_salt ListGroupsForUser' {Maybe Natural
Maybe Text
Text
userName :: Text
maxItems :: Maybe Natural
marker :: Maybe Text
$sel:userName:ListGroupsForUser' :: ListGroupsForUser -> Text
$sel:maxItems:ListGroupsForUser' :: ListGroupsForUser -> Maybe Natural
$sel:marker:ListGroupsForUser' :: ListGroupsForUser -> 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 ListGroupsForUser where
rnf :: ListGroupsForUser -> ()
rnf ListGroupsForUser' {Maybe Natural
Maybe Text
Text
userName :: Text
maxItems :: Maybe Natural
marker :: Maybe Text
$sel:userName:ListGroupsForUser' :: ListGroupsForUser -> Text
$sel:maxItems:ListGroupsForUser' :: ListGroupsForUser -> Maybe Natural
$sel:marker:ListGroupsForUser' :: ListGroupsForUser -> 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 ListGroupsForUser where
toHeaders :: ListGroupsForUser -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath ListGroupsForUser where
toPath :: ListGroupsForUser -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListGroupsForUser where
toQuery :: ListGroupsForUser -> QueryString
toQuery ListGroupsForUser' {Maybe Natural
Maybe Text
Text
userName :: Text
maxItems :: Maybe Natural
marker :: Maybe Text
$sel:userName:ListGroupsForUser' :: ListGroupsForUser -> Text
$sel:maxItems:ListGroupsForUser' :: ListGroupsForUser -> Maybe Natural
$sel:marker:ListGroupsForUser' :: ListGroupsForUser -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"ListGroupsForUser" :: 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 ListGroupsForUserResponse = ListGroupsForUserResponse'
{
ListGroupsForUserResponse -> Maybe Bool
isTruncated :: Prelude.Maybe Prelude.Bool,
ListGroupsForUserResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
ListGroupsForUserResponse -> Int
httpStatus :: Prelude.Int,
ListGroupsForUserResponse -> [Group]
groups :: [Group]
}
deriving (ListGroupsForUserResponse -> ListGroupsForUserResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListGroupsForUserResponse -> ListGroupsForUserResponse -> Bool
$c/= :: ListGroupsForUserResponse -> ListGroupsForUserResponse -> Bool
== :: ListGroupsForUserResponse -> ListGroupsForUserResponse -> Bool
$c== :: ListGroupsForUserResponse -> ListGroupsForUserResponse -> Bool
Prelude.Eq, ReadPrec [ListGroupsForUserResponse]
ReadPrec ListGroupsForUserResponse
Int -> ReadS ListGroupsForUserResponse
ReadS [ListGroupsForUserResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListGroupsForUserResponse]
$creadListPrec :: ReadPrec [ListGroupsForUserResponse]
readPrec :: ReadPrec ListGroupsForUserResponse
$creadPrec :: ReadPrec ListGroupsForUserResponse
readList :: ReadS [ListGroupsForUserResponse]
$creadList :: ReadS [ListGroupsForUserResponse]
readsPrec :: Int -> ReadS ListGroupsForUserResponse
$creadsPrec :: Int -> ReadS ListGroupsForUserResponse
Prelude.Read, Int -> ListGroupsForUserResponse -> ShowS
[ListGroupsForUserResponse] -> ShowS
ListGroupsForUserResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListGroupsForUserResponse] -> ShowS
$cshowList :: [ListGroupsForUserResponse] -> ShowS
show :: ListGroupsForUserResponse -> String
$cshow :: ListGroupsForUserResponse -> String
showsPrec :: Int -> ListGroupsForUserResponse -> ShowS
$cshowsPrec :: Int -> ListGroupsForUserResponse -> ShowS
Prelude.Show, forall x.
Rep ListGroupsForUserResponse x -> ListGroupsForUserResponse
forall x.
ListGroupsForUserResponse -> Rep ListGroupsForUserResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListGroupsForUserResponse x -> ListGroupsForUserResponse
$cfrom :: forall x.
ListGroupsForUserResponse -> Rep ListGroupsForUserResponse x
Prelude.Generic)
newListGroupsForUserResponse ::
Prelude.Int ->
ListGroupsForUserResponse
newListGroupsForUserResponse :: Int -> ListGroupsForUserResponse
newListGroupsForUserResponse Int
pHttpStatus_ =
ListGroupsForUserResponse'
{ $sel:isTruncated:ListGroupsForUserResponse' :: Maybe Bool
isTruncated =
forall a. Maybe a
Prelude.Nothing,
$sel:marker:ListGroupsForUserResponse' :: Maybe Text
marker = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListGroupsForUserResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:groups:ListGroupsForUserResponse' :: [Group]
groups = forall a. Monoid a => a
Prelude.mempty
}
listGroupsForUserResponse_isTruncated :: Lens.Lens' ListGroupsForUserResponse (Prelude.Maybe Prelude.Bool)
listGroupsForUserResponse_isTruncated :: Lens' ListGroupsForUserResponse (Maybe Bool)
listGroupsForUserResponse_isTruncated = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGroupsForUserResponse' {Maybe Bool
isTruncated :: Maybe Bool
$sel:isTruncated:ListGroupsForUserResponse' :: ListGroupsForUserResponse -> Maybe Bool
isTruncated} -> Maybe Bool
isTruncated) (\s :: ListGroupsForUserResponse
s@ListGroupsForUserResponse' {} Maybe Bool
a -> ListGroupsForUserResponse
s {$sel:isTruncated:ListGroupsForUserResponse' :: Maybe Bool
isTruncated = Maybe Bool
a} :: ListGroupsForUserResponse)
listGroupsForUserResponse_marker :: Lens.Lens' ListGroupsForUserResponse (Prelude.Maybe Prelude.Text)
listGroupsForUserResponse_marker :: Lens' ListGroupsForUserResponse (Maybe Text)
listGroupsForUserResponse_marker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGroupsForUserResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:ListGroupsForUserResponse' :: ListGroupsForUserResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListGroupsForUserResponse
s@ListGroupsForUserResponse' {} Maybe Text
a -> ListGroupsForUserResponse
s {$sel:marker:ListGroupsForUserResponse' :: Maybe Text
marker = Maybe Text
a} :: ListGroupsForUserResponse)
listGroupsForUserResponse_httpStatus :: Lens.Lens' ListGroupsForUserResponse Prelude.Int
listGroupsForUserResponse_httpStatus :: Lens' ListGroupsForUserResponse Int
listGroupsForUserResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGroupsForUserResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListGroupsForUserResponse' :: ListGroupsForUserResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListGroupsForUserResponse
s@ListGroupsForUserResponse' {} Int
a -> ListGroupsForUserResponse
s {$sel:httpStatus:ListGroupsForUserResponse' :: Int
httpStatus = Int
a} :: ListGroupsForUserResponse)
listGroupsForUserResponse_groups :: Lens.Lens' ListGroupsForUserResponse [Group]
listGroupsForUserResponse_groups :: Lens' ListGroupsForUserResponse [Group]
listGroupsForUserResponse_groups = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGroupsForUserResponse' {[Group]
groups :: [Group]
$sel:groups:ListGroupsForUserResponse' :: ListGroupsForUserResponse -> [Group]
groups} -> [Group]
groups) (\s :: ListGroupsForUserResponse
s@ListGroupsForUserResponse' {} [Group]
a -> ListGroupsForUserResponse
s {$sel:groups:ListGroupsForUserResponse' :: [Group]
groups = [Group]
a} :: ListGroupsForUserResponse) 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 ListGroupsForUserResponse where
rnf :: ListGroupsForUserResponse -> ()
rnf ListGroupsForUserResponse' {Int
[Group]
Maybe Bool
Maybe Text
groups :: [Group]
httpStatus :: Int
marker :: Maybe Text
isTruncated :: Maybe Bool
$sel:groups:ListGroupsForUserResponse' :: ListGroupsForUserResponse -> [Group]
$sel:httpStatus:ListGroupsForUserResponse' :: ListGroupsForUserResponse -> Int
$sel:marker:ListGroupsForUserResponse' :: ListGroupsForUserResponse -> Maybe Text
$sel:isTruncated:ListGroupsForUserResponse' :: ListGroupsForUserResponse -> 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 [Group]
groups