{-# 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.GetGroupPolicy
(
GetGroupPolicy (..),
newGetGroupPolicy,
getGroupPolicy_groupName,
getGroupPolicy_policyName,
GetGroupPolicyResponse (..),
newGetGroupPolicyResponse,
getGroupPolicyResponse_httpStatus,
getGroupPolicyResponse_groupName,
getGroupPolicyResponse_policyName,
getGroupPolicyResponse_policyDocument,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IAM.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetGroupPolicy = GetGroupPolicy'
{
GetGroupPolicy -> Text
groupName :: Prelude.Text,
GetGroupPolicy -> Text
policyName :: Prelude.Text
}
deriving (GetGroupPolicy -> GetGroupPolicy -> Bool
(GetGroupPolicy -> GetGroupPolicy -> Bool)
-> (GetGroupPolicy -> GetGroupPolicy -> Bool) -> Eq GetGroupPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetGroupPolicy -> GetGroupPolicy -> Bool
$c/= :: GetGroupPolicy -> GetGroupPolicy -> Bool
== :: GetGroupPolicy -> GetGroupPolicy -> Bool
$c== :: GetGroupPolicy -> GetGroupPolicy -> Bool
Prelude.Eq, ReadPrec [GetGroupPolicy]
ReadPrec GetGroupPolicy
Int -> ReadS GetGroupPolicy
ReadS [GetGroupPolicy]
(Int -> ReadS GetGroupPolicy)
-> ReadS [GetGroupPolicy]
-> ReadPrec GetGroupPolicy
-> ReadPrec [GetGroupPolicy]
-> Read GetGroupPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetGroupPolicy]
$creadListPrec :: ReadPrec [GetGroupPolicy]
readPrec :: ReadPrec GetGroupPolicy
$creadPrec :: ReadPrec GetGroupPolicy
readList :: ReadS [GetGroupPolicy]
$creadList :: ReadS [GetGroupPolicy]
readsPrec :: Int -> ReadS GetGroupPolicy
$creadsPrec :: Int -> ReadS GetGroupPolicy
Prelude.Read, Int -> GetGroupPolicy -> ShowS
[GetGroupPolicy] -> ShowS
GetGroupPolicy -> String
(Int -> GetGroupPolicy -> ShowS)
-> (GetGroupPolicy -> String)
-> ([GetGroupPolicy] -> ShowS)
-> Show GetGroupPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetGroupPolicy] -> ShowS
$cshowList :: [GetGroupPolicy] -> ShowS
show :: GetGroupPolicy -> String
$cshow :: GetGroupPolicy -> String
showsPrec :: Int -> GetGroupPolicy -> ShowS
$cshowsPrec :: Int -> GetGroupPolicy -> ShowS
Prelude.Show, (forall x. GetGroupPolicy -> Rep GetGroupPolicy x)
-> (forall x. Rep GetGroupPolicy x -> GetGroupPolicy)
-> Generic GetGroupPolicy
forall x. Rep GetGroupPolicy x -> GetGroupPolicy
forall x. GetGroupPolicy -> Rep GetGroupPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetGroupPolicy x -> GetGroupPolicy
$cfrom :: forall x. GetGroupPolicy -> Rep GetGroupPolicy x
Prelude.Generic)
newGetGroupPolicy ::
Prelude.Text ->
Prelude.Text ->
GetGroupPolicy
newGetGroupPolicy :: Text -> Text -> GetGroupPolicy
newGetGroupPolicy Text
pGroupName_ Text
pPolicyName_ =
GetGroupPolicy' :: Text -> Text -> GetGroupPolicy
GetGroupPolicy'
{ $sel:groupName:GetGroupPolicy' :: Text
groupName = Text
pGroupName_,
$sel:policyName:GetGroupPolicy' :: Text
policyName = Text
pPolicyName_
}
getGroupPolicy_groupName :: Lens.Lens' GetGroupPolicy Prelude.Text
getGroupPolicy_groupName :: (Text -> f Text) -> GetGroupPolicy -> f GetGroupPolicy
getGroupPolicy_groupName = (GetGroupPolicy -> Text)
-> (GetGroupPolicy -> Text -> GetGroupPolicy)
-> Lens GetGroupPolicy GetGroupPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGroupPolicy' {Text
groupName :: Text
$sel:groupName:GetGroupPolicy' :: GetGroupPolicy -> Text
groupName} -> Text
groupName) (\s :: GetGroupPolicy
s@GetGroupPolicy' {} Text
a -> GetGroupPolicy
s {$sel:groupName:GetGroupPolicy' :: Text
groupName = Text
a} :: GetGroupPolicy)
getGroupPolicy_policyName :: Lens.Lens' GetGroupPolicy Prelude.Text
getGroupPolicy_policyName :: (Text -> f Text) -> GetGroupPolicy -> f GetGroupPolicy
getGroupPolicy_policyName = (GetGroupPolicy -> Text)
-> (GetGroupPolicy -> Text -> GetGroupPolicy)
-> Lens GetGroupPolicy GetGroupPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGroupPolicy' {Text
policyName :: Text
$sel:policyName:GetGroupPolicy' :: GetGroupPolicy -> Text
policyName} -> Text
policyName) (\s :: GetGroupPolicy
s@GetGroupPolicy' {} Text
a -> GetGroupPolicy
s {$sel:policyName:GetGroupPolicy' :: Text
policyName = Text
a} :: GetGroupPolicy)
instance Core.AWSRequest GetGroupPolicy where
type
AWSResponse GetGroupPolicy =
GetGroupPolicyResponse
request :: GetGroupPolicy -> Request GetGroupPolicy
request = Service -> GetGroupPolicy -> Request GetGroupPolicy
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy GetGroupPolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetGroupPolicy)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse GetGroupPolicy))
-> Logger
-> Service
-> Proxy GetGroupPolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetGroupPolicy)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"GetGroupPolicyResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Int -> Text -> Text -> Text -> GetGroupPolicyResponse
GetGroupPolicyResponse'
(Int -> Text -> Text -> Text -> GetGroupPolicyResponse)
-> Either String Int
-> Either String (Text -> Text -> Text -> GetGroupPolicyResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
Either String (Text -> Text -> Text -> GetGroupPolicyResponse)
-> Either String Text
-> Either String (Text -> Text -> GetGroupPolicyResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"GroupName")
Either String (Text -> Text -> GetGroupPolicyResponse)
-> Either String Text
-> Either String (Text -> GetGroupPolicyResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"PolicyName")
Either String (Text -> GetGroupPolicyResponse)
-> Either String Text -> Either String GetGroupPolicyResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"PolicyDocument")
)
instance Prelude.Hashable GetGroupPolicy
instance Prelude.NFData GetGroupPolicy
instance Core.ToHeaders GetGroupPolicy where
toHeaders :: GetGroupPolicy -> ResponseHeaders
toHeaders = ResponseHeaders -> GetGroupPolicy -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetGroupPolicy where
toPath :: GetGroupPolicy -> ByteString
toPath = ByteString -> GetGroupPolicy -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetGroupPolicy where
toQuery :: GetGroupPolicy -> QueryString
toQuery GetGroupPolicy' {Text
policyName :: Text
groupName :: Text
$sel:policyName:GetGroupPolicy' :: GetGroupPolicy -> Text
$sel:groupName:GetGroupPolicy' :: GetGroupPolicy -> Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"GetGroupPolicy" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-05-08" :: Prelude.ByteString),
ByteString
"GroupName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
groupName,
ByteString
"PolicyName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
policyName
]
data GetGroupPolicyResponse = GetGroupPolicyResponse'
{
GetGroupPolicyResponse -> Int
httpStatus :: Prelude.Int,
GetGroupPolicyResponse -> Text
groupName :: Prelude.Text,
GetGroupPolicyResponse -> Text
policyName :: Prelude.Text,
GetGroupPolicyResponse -> Text
policyDocument :: Prelude.Text
}
deriving (GetGroupPolicyResponse -> GetGroupPolicyResponse -> Bool
(GetGroupPolicyResponse -> GetGroupPolicyResponse -> Bool)
-> (GetGroupPolicyResponse -> GetGroupPolicyResponse -> Bool)
-> Eq GetGroupPolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetGroupPolicyResponse -> GetGroupPolicyResponse -> Bool
$c/= :: GetGroupPolicyResponse -> GetGroupPolicyResponse -> Bool
== :: GetGroupPolicyResponse -> GetGroupPolicyResponse -> Bool
$c== :: GetGroupPolicyResponse -> GetGroupPolicyResponse -> Bool
Prelude.Eq, ReadPrec [GetGroupPolicyResponse]
ReadPrec GetGroupPolicyResponse
Int -> ReadS GetGroupPolicyResponse
ReadS [GetGroupPolicyResponse]
(Int -> ReadS GetGroupPolicyResponse)
-> ReadS [GetGroupPolicyResponse]
-> ReadPrec GetGroupPolicyResponse
-> ReadPrec [GetGroupPolicyResponse]
-> Read GetGroupPolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetGroupPolicyResponse]
$creadListPrec :: ReadPrec [GetGroupPolicyResponse]
readPrec :: ReadPrec GetGroupPolicyResponse
$creadPrec :: ReadPrec GetGroupPolicyResponse
readList :: ReadS [GetGroupPolicyResponse]
$creadList :: ReadS [GetGroupPolicyResponse]
readsPrec :: Int -> ReadS GetGroupPolicyResponse
$creadsPrec :: Int -> ReadS GetGroupPolicyResponse
Prelude.Read, Int -> GetGroupPolicyResponse -> ShowS
[GetGroupPolicyResponse] -> ShowS
GetGroupPolicyResponse -> String
(Int -> GetGroupPolicyResponse -> ShowS)
-> (GetGroupPolicyResponse -> String)
-> ([GetGroupPolicyResponse] -> ShowS)
-> Show GetGroupPolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetGroupPolicyResponse] -> ShowS
$cshowList :: [GetGroupPolicyResponse] -> ShowS
show :: GetGroupPolicyResponse -> String
$cshow :: GetGroupPolicyResponse -> String
showsPrec :: Int -> GetGroupPolicyResponse -> ShowS
$cshowsPrec :: Int -> GetGroupPolicyResponse -> ShowS
Prelude.Show, (forall x. GetGroupPolicyResponse -> Rep GetGroupPolicyResponse x)
-> (forall x.
Rep GetGroupPolicyResponse x -> GetGroupPolicyResponse)
-> Generic GetGroupPolicyResponse
forall x. Rep GetGroupPolicyResponse x -> GetGroupPolicyResponse
forall x. GetGroupPolicyResponse -> Rep GetGroupPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetGroupPolicyResponse x -> GetGroupPolicyResponse
$cfrom :: forall x. GetGroupPolicyResponse -> Rep GetGroupPolicyResponse x
Prelude.Generic)
newGetGroupPolicyResponse ::
Prelude.Int ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
GetGroupPolicyResponse
newGetGroupPolicyResponse :: Int -> Text -> Text -> Text -> GetGroupPolicyResponse
newGetGroupPolicyResponse
Int
pHttpStatus_
Text
pGroupName_
Text
pPolicyName_
Text
pPolicyDocument_ =
GetGroupPolicyResponse' :: Int -> Text -> Text -> Text -> GetGroupPolicyResponse
GetGroupPolicyResponse'
{ $sel:httpStatus:GetGroupPolicyResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:groupName:GetGroupPolicyResponse' :: Text
groupName = Text
pGroupName_,
$sel:policyName:GetGroupPolicyResponse' :: Text
policyName = Text
pPolicyName_,
$sel:policyDocument:GetGroupPolicyResponse' :: Text
policyDocument = Text
pPolicyDocument_
}
getGroupPolicyResponse_httpStatus :: Lens.Lens' GetGroupPolicyResponse Prelude.Int
getGroupPolicyResponse_httpStatus :: (Int -> f Int)
-> GetGroupPolicyResponse -> f GetGroupPolicyResponse
getGroupPolicyResponse_httpStatus = (GetGroupPolicyResponse -> Int)
-> (GetGroupPolicyResponse -> Int -> GetGroupPolicyResponse)
-> Lens GetGroupPolicyResponse GetGroupPolicyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGroupPolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetGroupPolicyResponse' :: GetGroupPolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetGroupPolicyResponse
s@GetGroupPolicyResponse' {} Int
a -> GetGroupPolicyResponse
s {$sel:httpStatus:GetGroupPolicyResponse' :: Int
httpStatus = Int
a} :: GetGroupPolicyResponse)
getGroupPolicyResponse_groupName :: Lens.Lens' GetGroupPolicyResponse Prelude.Text
getGroupPolicyResponse_groupName :: (Text -> f Text)
-> GetGroupPolicyResponse -> f GetGroupPolicyResponse
getGroupPolicyResponse_groupName = (GetGroupPolicyResponse -> Text)
-> (GetGroupPolicyResponse -> Text -> GetGroupPolicyResponse)
-> Lens GetGroupPolicyResponse GetGroupPolicyResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGroupPolicyResponse' {Text
groupName :: Text
$sel:groupName:GetGroupPolicyResponse' :: GetGroupPolicyResponse -> Text
groupName} -> Text
groupName) (\s :: GetGroupPolicyResponse
s@GetGroupPolicyResponse' {} Text
a -> GetGroupPolicyResponse
s {$sel:groupName:GetGroupPolicyResponse' :: Text
groupName = Text
a} :: GetGroupPolicyResponse)
getGroupPolicyResponse_policyName :: Lens.Lens' GetGroupPolicyResponse Prelude.Text
getGroupPolicyResponse_policyName :: (Text -> f Text)
-> GetGroupPolicyResponse -> f GetGroupPolicyResponse
getGroupPolicyResponse_policyName = (GetGroupPolicyResponse -> Text)
-> (GetGroupPolicyResponse -> Text -> GetGroupPolicyResponse)
-> Lens GetGroupPolicyResponse GetGroupPolicyResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGroupPolicyResponse' {Text
policyName :: Text
$sel:policyName:GetGroupPolicyResponse' :: GetGroupPolicyResponse -> Text
policyName} -> Text
policyName) (\s :: GetGroupPolicyResponse
s@GetGroupPolicyResponse' {} Text
a -> GetGroupPolicyResponse
s {$sel:policyName:GetGroupPolicyResponse' :: Text
policyName = Text
a} :: GetGroupPolicyResponse)
getGroupPolicyResponse_policyDocument :: Lens.Lens' GetGroupPolicyResponse Prelude.Text
getGroupPolicyResponse_policyDocument :: (Text -> f Text)
-> GetGroupPolicyResponse -> f GetGroupPolicyResponse
getGroupPolicyResponse_policyDocument = (GetGroupPolicyResponse -> Text)
-> (GetGroupPolicyResponse -> Text -> GetGroupPolicyResponse)
-> Lens GetGroupPolicyResponse GetGroupPolicyResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGroupPolicyResponse' {Text
policyDocument :: Text
$sel:policyDocument:GetGroupPolicyResponse' :: GetGroupPolicyResponse -> Text
policyDocument} -> Text
policyDocument) (\s :: GetGroupPolicyResponse
s@GetGroupPolicyResponse' {} Text
a -> GetGroupPolicyResponse
s {$sel:policyDocument:GetGroupPolicyResponse' :: Text
policyDocument = Text
a} :: GetGroupPolicyResponse)
instance Prelude.NFData GetGroupPolicyResponse