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