{-# 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.GetRolePolicy
(
GetRolePolicy (..),
newGetRolePolicy,
getRolePolicy_roleName,
getRolePolicy_policyName,
GetRolePolicyResponse (..),
newGetRolePolicyResponse,
getRolePolicyResponse_httpStatus,
getRolePolicyResponse_roleName,
getRolePolicyResponse_policyName,
getRolePolicyResponse_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 GetRolePolicy = GetRolePolicy'
{
GetRolePolicy -> Text
roleName :: Prelude.Text,
GetRolePolicy -> Text
policyName :: Prelude.Text
}
deriving (GetRolePolicy -> GetRolePolicy -> Bool
(GetRolePolicy -> GetRolePolicy -> Bool)
-> (GetRolePolicy -> GetRolePolicy -> Bool) -> Eq GetRolePolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRolePolicy -> GetRolePolicy -> Bool
$c/= :: GetRolePolicy -> GetRolePolicy -> Bool
== :: GetRolePolicy -> GetRolePolicy -> Bool
$c== :: GetRolePolicy -> GetRolePolicy -> Bool
Prelude.Eq, ReadPrec [GetRolePolicy]
ReadPrec GetRolePolicy
Int -> ReadS GetRolePolicy
ReadS [GetRolePolicy]
(Int -> ReadS GetRolePolicy)
-> ReadS [GetRolePolicy]
-> ReadPrec GetRolePolicy
-> ReadPrec [GetRolePolicy]
-> Read GetRolePolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRolePolicy]
$creadListPrec :: ReadPrec [GetRolePolicy]
readPrec :: ReadPrec GetRolePolicy
$creadPrec :: ReadPrec GetRolePolicy
readList :: ReadS [GetRolePolicy]
$creadList :: ReadS [GetRolePolicy]
readsPrec :: Int -> ReadS GetRolePolicy
$creadsPrec :: Int -> ReadS GetRolePolicy
Prelude.Read, Int -> GetRolePolicy -> ShowS
[GetRolePolicy] -> ShowS
GetRolePolicy -> String
(Int -> GetRolePolicy -> ShowS)
-> (GetRolePolicy -> String)
-> ([GetRolePolicy] -> ShowS)
-> Show GetRolePolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRolePolicy] -> ShowS
$cshowList :: [GetRolePolicy] -> ShowS
show :: GetRolePolicy -> String
$cshow :: GetRolePolicy -> String
showsPrec :: Int -> GetRolePolicy -> ShowS
$cshowsPrec :: Int -> GetRolePolicy -> ShowS
Prelude.Show, (forall x. GetRolePolicy -> Rep GetRolePolicy x)
-> (forall x. Rep GetRolePolicy x -> GetRolePolicy)
-> Generic GetRolePolicy
forall x. Rep GetRolePolicy x -> GetRolePolicy
forall x. GetRolePolicy -> Rep GetRolePolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRolePolicy x -> GetRolePolicy
$cfrom :: forall x. GetRolePolicy -> Rep GetRolePolicy x
Prelude.Generic)
newGetRolePolicy ::
Prelude.Text ->
Prelude.Text ->
GetRolePolicy
newGetRolePolicy :: Text -> Text -> GetRolePolicy
newGetRolePolicy Text
pRoleName_ Text
pPolicyName_ =
GetRolePolicy' :: Text -> Text -> GetRolePolicy
GetRolePolicy'
{ $sel:roleName:GetRolePolicy' :: Text
roleName = Text
pRoleName_,
$sel:policyName:GetRolePolicy' :: Text
policyName = Text
pPolicyName_
}
getRolePolicy_roleName :: Lens.Lens' GetRolePolicy Prelude.Text
getRolePolicy_roleName :: (Text -> f Text) -> GetRolePolicy -> f GetRolePolicy
getRolePolicy_roleName = (GetRolePolicy -> Text)
-> (GetRolePolicy -> Text -> GetRolePolicy)
-> Lens GetRolePolicy GetRolePolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRolePolicy' {Text
roleName :: Text
$sel:roleName:GetRolePolicy' :: GetRolePolicy -> Text
roleName} -> Text
roleName) (\s :: GetRolePolicy
s@GetRolePolicy' {} Text
a -> GetRolePolicy
s {$sel:roleName:GetRolePolicy' :: Text
roleName = Text
a} :: GetRolePolicy)
getRolePolicy_policyName :: Lens.Lens' GetRolePolicy Prelude.Text
getRolePolicy_policyName :: (Text -> f Text) -> GetRolePolicy -> f GetRolePolicy
getRolePolicy_policyName = (GetRolePolicy -> Text)
-> (GetRolePolicy -> Text -> GetRolePolicy)
-> Lens GetRolePolicy GetRolePolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRolePolicy' {Text
policyName :: Text
$sel:policyName:GetRolePolicy' :: GetRolePolicy -> Text
policyName} -> Text
policyName) (\s :: GetRolePolicy
s@GetRolePolicy' {} Text
a -> GetRolePolicy
s {$sel:policyName:GetRolePolicy' :: Text
policyName = Text
a} :: GetRolePolicy)
instance Core.AWSRequest GetRolePolicy where
type
AWSResponse GetRolePolicy =
GetRolePolicyResponse
request :: GetRolePolicy -> Request GetRolePolicy
request = Service -> GetRolePolicy -> Request GetRolePolicy
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy GetRolePolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetRolePolicy)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse GetRolePolicy))
-> Logger
-> Service
-> Proxy GetRolePolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetRolePolicy)))
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
"GetRolePolicyResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Int -> Text -> Text -> Text -> GetRolePolicyResponse
GetRolePolicyResponse'
(Int -> Text -> Text -> Text -> GetRolePolicyResponse)
-> Either String Int
-> Either String (Text -> Text -> Text -> GetRolePolicyResponse)
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 -> GetRolePolicyResponse)
-> Either String Text
-> Either String (Text -> Text -> GetRolePolicyResponse)
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
"RoleName")
Either String (Text -> Text -> GetRolePolicyResponse)
-> Either String Text
-> Either String (Text -> GetRolePolicyResponse)
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 -> GetRolePolicyResponse)
-> Either String Text -> Either String GetRolePolicyResponse
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 GetRolePolicy
instance Prelude.NFData GetRolePolicy
instance Core.ToHeaders GetRolePolicy where
toHeaders :: GetRolePolicy -> ResponseHeaders
toHeaders = ResponseHeaders -> GetRolePolicy -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetRolePolicy where
toPath :: GetRolePolicy -> ByteString
toPath = ByteString -> GetRolePolicy -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetRolePolicy where
toQuery :: GetRolePolicy -> QueryString
toQuery GetRolePolicy' {Text
policyName :: Text
roleName :: Text
$sel:policyName:GetRolePolicy' :: GetRolePolicy -> Text
$sel:roleName:GetRolePolicy' :: GetRolePolicy -> 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
"GetRolePolicy" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-05-08" :: Prelude.ByteString),
ByteString
"RoleName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
roleName,
ByteString
"PolicyName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
policyName
]
data GetRolePolicyResponse = GetRolePolicyResponse'
{
GetRolePolicyResponse -> Int
httpStatus :: Prelude.Int,
GetRolePolicyResponse -> Text
roleName :: Prelude.Text,
GetRolePolicyResponse -> Text
policyName :: Prelude.Text,
GetRolePolicyResponse -> Text
policyDocument :: Prelude.Text
}
deriving (GetRolePolicyResponse -> GetRolePolicyResponse -> Bool
(GetRolePolicyResponse -> GetRolePolicyResponse -> Bool)
-> (GetRolePolicyResponse -> GetRolePolicyResponse -> Bool)
-> Eq GetRolePolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRolePolicyResponse -> GetRolePolicyResponse -> Bool
$c/= :: GetRolePolicyResponse -> GetRolePolicyResponse -> Bool
== :: GetRolePolicyResponse -> GetRolePolicyResponse -> Bool
$c== :: GetRolePolicyResponse -> GetRolePolicyResponse -> Bool
Prelude.Eq, ReadPrec [GetRolePolicyResponse]
ReadPrec GetRolePolicyResponse
Int -> ReadS GetRolePolicyResponse
ReadS [GetRolePolicyResponse]
(Int -> ReadS GetRolePolicyResponse)
-> ReadS [GetRolePolicyResponse]
-> ReadPrec GetRolePolicyResponse
-> ReadPrec [GetRolePolicyResponse]
-> Read GetRolePolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRolePolicyResponse]
$creadListPrec :: ReadPrec [GetRolePolicyResponse]
readPrec :: ReadPrec GetRolePolicyResponse
$creadPrec :: ReadPrec GetRolePolicyResponse
readList :: ReadS [GetRolePolicyResponse]
$creadList :: ReadS [GetRolePolicyResponse]
readsPrec :: Int -> ReadS GetRolePolicyResponse
$creadsPrec :: Int -> ReadS GetRolePolicyResponse
Prelude.Read, Int -> GetRolePolicyResponse -> ShowS
[GetRolePolicyResponse] -> ShowS
GetRolePolicyResponse -> String
(Int -> GetRolePolicyResponse -> ShowS)
-> (GetRolePolicyResponse -> String)
-> ([GetRolePolicyResponse] -> ShowS)
-> Show GetRolePolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRolePolicyResponse] -> ShowS
$cshowList :: [GetRolePolicyResponse] -> ShowS
show :: GetRolePolicyResponse -> String
$cshow :: GetRolePolicyResponse -> String
showsPrec :: Int -> GetRolePolicyResponse -> ShowS
$cshowsPrec :: Int -> GetRolePolicyResponse -> ShowS
Prelude.Show, (forall x. GetRolePolicyResponse -> Rep GetRolePolicyResponse x)
-> (forall x. Rep GetRolePolicyResponse x -> GetRolePolicyResponse)
-> Generic GetRolePolicyResponse
forall x. Rep GetRolePolicyResponse x -> GetRolePolicyResponse
forall x. GetRolePolicyResponse -> Rep GetRolePolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRolePolicyResponse x -> GetRolePolicyResponse
$cfrom :: forall x. GetRolePolicyResponse -> Rep GetRolePolicyResponse x
Prelude.Generic)
newGetRolePolicyResponse ::
Prelude.Int ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
GetRolePolicyResponse
newGetRolePolicyResponse :: Int -> Text -> Text -> Text -> GetRolePolicyResponse
newGetRolePolicyResponse
Int
pHttpStatus_
Text
pRoleName_
Text
pPolicyName_
Text
pPolicyDocument_ =
GetRolePolicyResponse' :: Int -> Text -> Text -> Text -> GetRolePolicyResponse
GetRolePolicyResponse'
{ $sel:httpStatus:GetRolePolicyResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:roleName:GetRolePolicyResponse' :: Text
roleName = Text
pRoleName_,
$sel:policyName:GetRolePolicyResponse' :: Text
policyName = Text
pPolicyName_,
$sel:policyDocument:GetRolePolicyResponse' :: Text
policyDocument = Text
pPolicyDocument_
}
getRolePolicyResponse_httpStatus :: Lens.Lens' GetRolePolicyResponse Prelude.Int
getRolePolicyResponse_httpStatus :: (Int -> f Int) -> GetRolePolicyResponse -> f GetRolePolicyResponse
getRolePolicyResponse_httpStatus = (GetRolePolicyResponse -> Int)
-> (GetRolePolicyResponse -> Int -> GetRolePolicyResponse)
-> Lens GetRolePolicyResponse GetRolePolicyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRolePolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetRolePolicyResponse' :: GetRolePolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetRolePolicyResponse
s@GetRolePolicyResponse' {} Int
a -> GetRolePolicyResponse
s {$sel:httpStatus:GetRolePolicyResponse' :: Int
httpStatus = Int
a} :: GetRolePolicyResponse)
getRolePolicyResponse_roleName :: Lens.Lens' GetRolePolicyResponse Prelude.Text
getRolePolicyResponse_roleName :: (Text -> f Text)
-> GetRolePolicyResponse -> f GetRolePolicyResponse
getRolePolicyResponse_roleName = (GetRolePolicyResponse -> Text)
-> (GetRolePolicyResponse -> Text -> GetRolePolicyResponse)
-> Lens GetRolePolicyResponse GetRolePolicyResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRolePolicyResponse' {Text
roleName :: Text
$sel:roleName:GetRolePolicyResponse' :: GetRolePolicyResponse -> Text
roleName} -> Text
roleName) (\s :: GetRolePolicyResponse
s@GetRolePolicyResponse' {} Text
a -> GetRolePolicyResponse
s {$sel:roleName:GetRolePolicyResponse' :: Text
roleName = Text
a} :: GetRolePolicyResponse)
getRolePolicyResponse_policyName :: Lens.Lens' GetRolePolicyResponse Prelude.Text
getRolePolicyResponse_policyName :: (Text -> f Text)
-> GetRolePolicyResponse -> f GetRolePolicyResponse
getRolePolicyResponse_policyName = (GetRolePolicyResponse -> Text)
-> (GetRolePolicyResponse -> Text -> GetRolePolicyResponse)
-> Lens GetRolePolicyResponse GetRolePolicyResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRolePolicyResponse' {Text
policyName :: Text
$sel:policyName:GetRolePolicyResponse' :: GetRolePolicyResponse -> Text
policyName} -> Text
policyName) (\s :: GetRolePolicyResponse
s@GetRolePolicyResponse' {} Text
a -> GetRolePolicyResponse
s {$sel:policyName:GetRolePolicyResponse' :: Text
policyName = Text
a} :: GetRolePolicyResponse)
getRolePolicyResponse_policyDocument :: Lens.Lens' GetRolePolicyResponse Prelude.Text
getRolePolicyResponse_policyDocument :: (Text -> f Text)
-> GetRolePolicyResponse -> f GetRolePolicyResponse
getRolePolicyResponse_policyDocument = (GetRolePolicyResponse -> Text)
-> (GetRolePolicyResponse -> Text -> GetRolePolicyResponse)
-> Lens GetRolePolicyResponse GetRolePolicyResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRolePolicyResponse' {Text
policyDocument :: Text
$sel:policyDocument:GetRolePolicyResponse' :: GetRolePolicyResponse -> Text
policyDocument} -> Text
policyDocument) (\s :: GetRolePolicyResponse
s@GetRolePolicyResponse' {} Text
a -> GetRolePolicyResponse
s {$sel:policyDocument:GetRolePolicyResponse' :: Text
policyDocument = Text
a} :: GetRolePolicyResponse)
instance Prelude.NFData GetRolePolicyResponse