{-# 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.GetGroup
(
GetGroup (..),
newGetGroup,
getGroup_marker,
getGroup_maxItems,
getGroup_groupName,
GetGroupResponse (..),
newGetGroupResponse,
getGroupResponse_isTruncated,
getGroupResponse_marker,
getGroupResponse_httpStatus,
getGroupResponse_group,
getGroupResponse_users,
)
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 GetGroup = GetGroup'
{
GetGroup -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
GetGroup -> Maybe Natural
maxItems :: Prelude.Maybe Prelude.Natural,
GetGroup -> Text
groupName :: Prelude.Text
}
deriving (GetGroup -> GetGroup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetGroup -> GetGroup -> Bool
$c/= :: GetGroup -> GetGroup -> Bool
== :: GetGroup -> GetGroup -> Bool
$c== :: GetGroup -> GetGroup -> Bool
Prelude.Eq, ReadPrec [GetGroup]
ReadPrec GetGroup
Int -> ReadS GetGroup
ReadS [GetGroup]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetGroup]
$creadListPrec :: ReadPrec [GetGroup]
readPrec :: ReadPrec GetGroup
$creadPrec :: ReadPrec GetGroup
readList :: ReadS [GetGroup]
$creadList :: ReadS [GetGroup]
readsPrec :: Int -> ReadS GetGroup
$creadsPrec :: Int -> ReadS GetGroup
Prelude.Read, Int -> GetGroup -> ShowS
[GetGroup] -> ShowS
GetGroup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetGroup] -> ShowS
$cshowList :: [GetGroup] -> ShowS
show :: GetGroup -> String
$cshow :: GetGroup -> String
showsPrec :: Int -> GetGroup -> ShowS
$cshowsPrec :: Int -> GetGroup -> ShowS
Prelude.Show, forall x. Rep GetGroup x -> GetGroup
forall x. GetGroup -> Rep GetGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetGroup x -> GetGroup
$cfrom :: forall x. GetGroup -> Rep GetGroup x
Prelude.Generic)
newGetGroup ::
Prelude.Text ->
GetGroup
newGetGroup :: Text -> GetGroup
newGetGroup Text
pGroupName_ =
GetGroup'
{ $sel:marker:GetGroup' :: Maybe Text
marker = forall a. Maybe a
Prelude.Nothing,
$sel:maxItems:GetGroup' :: Maybe Natural
maxItems = forall a. Maybe a
Prelude.Nothing,
$sel:groupName:GetGroup' :: Text
groupName = Text
pGroupName_
}
getGroup_marker :: Lens.Lens' GetGroup (Prelude.Maybe Prelude.Text)
getGroup_marker :: Lens' GetGroup (Maybe Text)
getGroup_marker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGroup' {Maybe Text
marker :: Maybe Text
$sel:marker:GetGroup' :: GetGroup -> Maybe Text
marker} -> Maybe Text
marker) (\s :: GetGroup
s@GetGroup' {} Maybe Text
a -> GetGroup
s {$sel:marker:GetGroup' :: Maybe Text
marker = Maybe Text
a} :: GetGroup)
getGroup_maxItems :: Lens.Lens' GetGroup (Prelude.Maybe Prelude.Natural)
getGroup_maxItems :: Lens' GetGroup (Maybe Natural)
getGroup_maxItems = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGroup' {Maybe Natural
maxItems :: Maybe Natural
$sel:maxItems:GetGroup' :: GetGroup -> Maybe Natural
maxItems} -> Maybe Natural
maxItems) (\s :: GetGroup
s@GetGroup' {} Maybe Natural
a -> GetGroup
s {$sel:maxItems:GetGroup' :: Maybe Natural
maxItems = Maybe Natural
a} :: GetGroup)
getGroup_groupName :: Lens.Lens' GetGroup Prelude.Text
getGroup_groupName :: Lens' GetGroup Text
getGroup_groupName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGroup' {Text
groupName :: Text
$sel:groupName:GetGroup' :: GetGroup -> Text
groupName} -> Text
groupName) (\s :: GetGroup
s@GetGroup' {} Text
a -> GetGroup
s {$sel:groupName:GetGroup' :: Text
groupName = Text
a} :: GetGroup)
instance Core.AWSPager GetGroup where
page :: GetGroup -> AWSResponse GetGroup -> Maybe GetGroup
page GetGroup
rq AWSResponse GetGroup
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetGroup
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetGroupResponse (Maybe Bool)
getGroupResponse_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 GetGroup
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetGroupResponse (Maybe Text)
getGroupResponse_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.$ GetGroup
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' GetGroup (Maybe Text)
getGroup_marker
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetGroup
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetGroupResponse (Maybe Text)
getGroupResponse_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 GetGroup where
type AWSResponse GetGroup = GetGroupResponse
request :: (Service -> Service) -> GetGroup -> Request GetGroup
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 GetGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetGroup)))
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
"GetGroupResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Bool
-> Maybe Text -> Int -> Group -> [User] -> GetGroupResponse
GetGroupResponse'
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 a
Data..@ Text
"Group")
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
"Users"
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 GetGroup where
hashWithSalt :: Int -> GetGroup -> Int
hashWithSalt Int
_salt GetGroup' {Maybe Natural
Maybe Text
Text
groupName :: Text
maxItems :: Maybe Natural
marker :: Maybe Text
$sel:groupName:GetGroup' :: GetGroup -> Text
$sel:maxItems:GetGroup' :: GetGroup -> Maybe Natural
$sel:marker:GetGroup' :: GetGroup -> 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
groupName
instance Prelude.NFData GetGroup where
rnf :: GetGroup -> ()
rnf GetGroup' {Maybe Natural
Maybe Text
Text
groupName :: Text
maxItems :: Maybe Natural
marker :: Maybe Text
$sel:groupName:GetGroup' :: GetGroup -> Text
$sel:maxItems:GetGroup' :: GetGroup -> Maybe Natural
$sel:marker:GetGroup' :: GetGroup -> 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
groupName
instance Data.ToHeaders GetGroup where
toHeaders :: GetGroup -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath GetGroup where
toPath :: GetGroup -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetGroup where
toQuery :: GetGroup -> QueryString
toQuery GetGroup' {Maybe Natural
Maybe Text
Text
groupName :: Text
maxItems :: Maybe Natural
marker :: Maybe Text
$sel:groupName:GetGroup' :: GetGroup -> Text
$sel:maxItems:GetGroup' :: GetGroup -> Maybe Natural
$sel:marker:GetGroup' :: GetGroup -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"GetGroup" :: 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
"GroupName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
groupName
]
data GetGroupResponse = GetGroupResponse'
{
GetGroupResponse -> Maybe Bool
isTruncated :: Prelude.Maybe Prelude.Bool,
GetGroupResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
GetGroupResponse -> Int
httpStatus :: Prelude.Int,
GetGroupResponse -> Group
group' :: Group,
GetGroupResponse -> [User]
users :: [User]
}
deriving (GetGroupResponse -> GetGroupResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetGroupResponse -> GetGroupResponse -> Bool
$c/= :: GetGroupResponse -> GetGroupResponse -> Bool
== :: GetGroupResponse -> GetGroupResponse -> Bool
$c== :: GetGroupResponse -> GetGroupResponse -> Bool
Prelude.Eq, ReadPrec [GetGroupResponse]
ReadPrec GetGroupResponse
Int -> ReadS GetGroupResponse
ReadS [GetGroupResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetGroupResponse]
$creadListPrec :: ReadPrec [GetGroupResponse]
readPrec :: ReadPrec GetGroupResponse
$creadPrec :: ReadPrec GetGroupResponse
readList :: ReadS [GetGroupResponse]
$creadList :: ReadS [GetGroupResponse]
readsPrec :: Int -> ReadS GetGroupResponse
$creadsPrec :: Int -> ReadS GetGroupResponse
Prelude.Read, Int -> GetGroupResponse -> ShowS
[GetGroupResponse] -> ShowS
GetGroupResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetGroupResponse] -> ShowS
$cshowList :: [GetGroupResponse] -> ShowS
show :: GetGroupResponse -> String
$cshow :: GetGroupResponse -> String
showsPrec :: Int -> GetGroupResponse -> ShowS
$cshowsPrec :: Int -> GetGroupResponse -> ShowS
Prelude.Show, forall x. Rep GetGroupResponse x -> GetGroupResponse
forall x. GetGroupResponse -> Rep GetGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetGroupResponse x -> GetGroupResponse
$cfrom :: forall x. GetGroupResponse -> Rep GetGroupResponse x
Prelude.Generic)
newGetGroupResponse ::
Prelude.Int ->
Group ->
GetGroupResponse
newGetGroupResponse :: Int -> Group -> GetGroupResponse
newGetGroupResponse Int
pHttpStatus_ Group
pGroup_ =
GetGroupResponse'
{ $sel:isTruncated:GetGroupResponse' :: Maybe Bool
isTruncated = forall a. Maybe a
Prelude.Nothing,
$sel:marker:GetGroupResponse' :: Maybe Text
marker = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetGroupResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:group':GetGroupResponse' :: Group
group' = Group
pGroup_,
$sel:users:GetGroupResponse' :: [User]
users = forall a. Monoid a => a
Prelude.mempty
}
getGroupResponse_isTruncated :: Lens.Lens' GetGroupResponse (Prelude.Maybe Prelude.Bool)
getGroupResponse_isTruncated :: Lens' GetGroupResponse (Maybe Bool)
getGroupResponse_isTruncated = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGroupResponse' {Maybe Bool
isTruncated :: Maybe Bool
$sel:isTruncated:GetGroupResponse' :: GetGroupResponse -> Maybe Bool
isTruncated} -> Maybe Bool
isTruncated) (\s :: GetGroupResponse
s@GetGroupResponse' {} Maybe Bool
a -> GetGroupResponse
s {$sel:isTruncated:GetGroupResponse' :: Maybe Bool
isTruncated = Maybe Bool
a} :: GetGroupResponse)
getGroupResponse_marker :: Lens.Lens' GetGroupResponse (Prelude.Maybe Prelude.Text)
getGroupResponse_marker :: Lens' GetGroupResponse (Maybe Text)
getGroupResponse_marker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGroupResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:GetGroupResponse' :: GetGroupResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: GetGroupResponse
s@GetGroupResponse' {} Maybe Text
a -> GetGroupResponse
s {$sel:marker:GetGroupResponse' :: Maybe Text
marker = Maybe Text
a} :: GetGroupResponse)
getGroupResponse_httpStatus :: Lens.Lens' GetGroupResponse Prelude.Int
getGroupResponse_httpStatus :: Lens' GetGroupResponse Int
getGroupResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetGroupResponse' :: GetGroupResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetGroupResponse
s@GetGroupResponse' {} Int
a -> GetGroupResponse
s {$sel:httpStatus:GetGroupResponse' :: Int
httpStatus = Int
a} :: GetGroupResponse)
getGroupResponse_group :: Lens.Lens' GetGroupResponse Group
getGroupResponse_group :: Lens' GetGroupResponse Group
getGroupResponse_group = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGroupResponse' {Group
group' :: Group
$sel:group':GetGroupResponse' :: GetGroupResponse -> Group
group'} -> Group
group') (\s :: GetGroupResponse
s@GetGroupResponse' {} Group
a -> GetGroupResponse
s {$sel:group':GetGroupResponse' :: Group
group' = Group
a} :: GetGroupResponse)
getGroupResponse_users :: Lens.Lens' GetGroupResponse [User]
getGroupResponse_users :: Lens' GetGroupResponse [User]
getGroupResponse_users = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGroupResponse' {[User]
users :: [User]
$sel:users:GetGroupResponse' :: GetGroupResponse -> [User]
users} -> [User]
users) (\s :: GetGroupResponse
s@GetGroupResponse' {} [User]
a -> GetGroupResponse
s {$sel:users:GetGroupResponse' :: [User]
users = [User]
a} :: GetGroupResponse) 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 GetGroupResponse where
rnf :: GetGroupResponse -> ()
rnf GetGroupResponse' {Int
[User]
Maybe Bool
Maybe Text
Group
users :: [User]
group' :: Group
httpStatus :: Int
marker :: Maybe Text
isTruncated :: Maybe Bool
$sel:users:GetGroupResponse' :: GetGroupResponse -> [User]
$sel:group':GetGroupResponse' :: GetGroupResponse -> Group
$sel:httpStatus:GetGroupResponse' :: GetGroupResponse -> Int
$sel:marker:GetGroupResponse' :: GetGroupResponse -> Maybe Text
$sel:isTruncated:GetGroupResponse' :: GetGroupResponse -> 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
group'
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [User]
users