{-# 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.PutRolePolicy
(
PutRolePolicy (..),
newPutRolePolicy,
putRolePolicy_roleName,
putRolePolicy_policyName,
putRolePolicy_policyDocument,
PutRolePolicyResponse (..),
newPutRolePolicyResponse,
)
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 PutRolePolicy = PutRolePolicy'
{
PutRolePolicy -> Text
roleName :: Prelude.Text,
PutRolePolicy -> Text
policyName :: Prelude.Text,
PutRolePolicy -> Text
policyDocument :: Prelude.Text
}
deriving (PutRolePolicy -> PutRolePolicy -> Bool
(PutRolePolicy -> PutRolePolicy -> Bool)
-> (PutRolePolicy -> PutRolePolicy -> Bool) -> Eq PutRolePolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutRolePolicy -> PutRolePolicy -> Bool
$c/= :: PutRolePolicy -> PutRolePolicy -> Bool
== :: PutRolePolicy -> PutRolePolicy -> Bool
$c== :: PutRolePolicy -> PutRolePolicy -> Bool
Prelude.Eq, ReadPrec [PutRolePolicy]
ReadPrec PutRolePolicy
Int -> ReadS PutRolePolicy
ReadS [PutRolePolicy]
(Int -> ReadS PutRolePolicy)
-> ReadS [PutRolePolicy]
-> ReadPrec PutRolePolicy
-> ReadPrec [PutRolePolicy]
-> Read PutRolePolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutRolePolicy]
$creadListPrec :: ReadPrec [PutRolePolicy]
readPrec :: ReadPrec PutRolePolicy
$creadPrec :: ReadPrec PutRolePolicy
readList :: ReadS [PutRolePolicy]
$creadList :: ReadS [PutRolePolicy]
readsPrec :: Int -> ReadS PutRolePolicy
$creadsPrec :: Int -> ReadS PutRolePolicy
Prelude.Read, Int -> PutRolePolicy -> ShowS
[PutRolePolicy] -> ShowS
PutRolePolicy -> String
(Int -> PutRolePolicy -> ShowS)
-> (PutRolePolicy -> String)
-> ([PutRolePolicy] -> ShowS)
-> Show PutRolePolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutRolePolicy] -> ShowS
$cshowList :: [PutRolePolicy] -> ShowS
show :: PutRolePolicy -> String
$cshow :: PutRolePolicy -> String
showsPrec :: Int -> PutRolePolicy -> ShowS
$cshowsPrec :: Int -> PutRolePolicy -> ShowS
Prelude.Show, (forall x. PutRolePolicy -> Rep PutRolePolicy x)
-> (forall x. Rep PutRolePolicy x -> PutRolePolicy)
-> Generic PutRolePolicy
forall x. Rep PutRolePolicy x -> PutRolePolicy
forall x. PutRolePolicy -> Rep PutRolePolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutRolePolicy x -> PutRolePolicy
$cfrom :: forall x. PutRolePolicy -> Rep PutRolePolicy x
Prelude.Generic)
newPutRolePolicy ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
PutRolePolicy
newPutRolePolicy :: Text -> Text -> Text -> PutRolePolicy
newPutRolePolicy
Text
pRoleName_
Text
pPolicyName_
Text
pPolicyDocument_ =
PutRolePolicy' :: Text -> Text -> Text -> PutRolePolicy
PutRolePolicy'
{ $sel:roleName:PutRolePolicy' :: Text
roleName = Text
pRoleName_,
$sel:policyName:PutRolePolicy' :: Text
policyName = Text
pPolicyName_,
$sel:policyDocument:PutRolePolicy' :: Text
policyDocument = Text
pPolicyDocument_
}
putRolePolicy_roleName :: Lens.Lens' PutRolePolicy Prelude.Text
putRolePolicy_roleName :: (Text -> f Text) -> PutRolePolicy -> f PutRolePolicy
putRolePolicy_roleName = (PutRolePolicy -> Text)
-> (PutRolePolicy -> Text -> PutRolePolicy)
-> Lens PutRolePolicy PutRolePolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutRolePolicy' {Text
roleName :: Text
$sel:roleName:PutRolePolicy' :: PutRolePolicy -> Text
roleName} -> Text
roleName) (\s :: PutRolePolicy
s@PutRolePolicy' {} Text
a -> PutRolePolicy
s {$sel:roleName:PutRolePolicy' :: Text
roleName = Text
a} :: PutRolePolicy)
putRolePolicy_policyName :: Lens.Lens' PutRolePolicy Prelude.Text
putRolePolicy_policyName :: (Text -> f Text) -> PutRolePolicy -> f PutRolePolicy
putRolePolicy_policyName = (PutRolePolicy -> Text)
-> (PutRolePolicy -> Text -> PutRolePolicy)
-> Lens PutRolePolicy PutRolePolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutRolePolicy' {Text
policyName :: Text
$sel:policyName:PutRolePolicy' :: PutRolePolicy -> Text
policyName} -> Text
policyName) (\s :: PutRolePolicy
s@PutRolePolicy' {} Text
a -> PutRolePolicy
s {$sel:policyName:PutRolePolicy' :: Text
policyName = Text
a} :: PutRolePolicy)
putRolePolicy_policyDocument :: Lens.Lens' PutRolePolicy Prelude.Text
putRolePolicy_policyDocument :: (Text -> f Text) -> PutRolePolicy -> f PutRolePolicy
putRolePolicy_policyDocument = (PutRolePolicy -> Text)
-> (PutRolePolicy -> Text -> PutRolePolicy)
-> Lens PutRolePolicy PutRolePolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutRolePolicy' {Text
policyDocument :: Text
$sel:policyDocument:PutRolePolicy' :: PutRolePolicy -> Text
policyDocument} -> Text
policyDocument) (\s :: PutRolePolicy
s@PutRolePolicy' {} Text
a -> PutRolePolicy
s {$sel:policyDocument:PutRolePolicy' :: Text
policyDocument = Text
a} :: PutRolePolicy)
instance Core.AWSRequest PutRolePolicy where
type
AWSResponse PutRolePolicy =
PutRolePolicyResponse
request :: PutRolePolicy -> Request PutRolePolicy
request = Service -> PutRolePolicy -> Request PutRolePolicy
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy PutRolePolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutRolePolicy)))
response =
AWSResponse PutRolePolicy
-> Logger
-> Service
-> Proxy PutRolePolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutRolePolicy)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse PutRolePolicy
PutRolePolicyResponse
PutRolePolicyResponse'
instance Prelude.Hashable PutRolePolicy
instance Prelude.NFData PutRolePolicy
instance Core.ToHeaders PutRolePolicy where
toHeaders :: PutRolePolicy -> [Header]
toHeaders = [Header] -> PutRolePolicy -> [Header]
forall a b. a -> b -> a
Prelude.const [Header]
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath PutRolePolicy where
toPath :: PutRolePolicy -> ByteString
toPath = ByteString -> PutRolePolicy -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PutRolePolicy where
toQuery :: PutRolePolicy -> QueryString
toQuery PutRolePolicy' {Text
policyDocument :: Text
policyName :: Text
roleName :: Text
$sel:policyDocument:PutRolePolicy' :: PutRolePolicy -> Text
$sel:policyName:PutRolePolicy' :: PutRolePolicy -> Text
$sel:roleName:PutRolePolicy' :: PutRolePolicy -> 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
"PutRolePolicy" :: 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,
ByteString
"PolicyDocument" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
policyDocument
]
data PutRolePolicyResponse = PutRolePolicyResponse'
{
}
deriving (PutRolePolicyResponse -> PutRolePolicyResponse -> Bool
(PutRolePolicyResponse -> PutRolePolicyResponse -> Bool)
-> (PutRolePolicyResponse -> PutRolePolicyResponse -> Bool)
-> Eq PutRolePolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutRolePolicyResponse -> PutRolePolicyResponse -> Bool
$c/= :: PutRolePolicyResponse -> PutRolePolicyResponse -> Bool
== :: PutRolePolicyResponse -> PutRolePolicyResponse -> Bool
$c== :: PutRolePolicyResponse -> PutRolePolicyResponse -> Bool
Prelude.Eq, ReadPrec [PutRolePolicyResponse]
ReadPrec PutRolePolicyResponse
Int -> ReadS PutRolePolicyResponse
ReadS [PutRolePolicyResponse]
(Int -> ReadS PutRolePolicyResponse)
-> ReadS [PutRolePolicyResponse]
-> ReadPrec PutRolePolicyResponse
-> ReadPrec [PutRolePolicyResponse]
-> Read PutRolePolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutRolePolicyResponse]
$creadListPrec :: ReadPrec [PutRolePolicyResponse]
readPrec :: ReadPrec PutRolePolicyResponse
$creadPrec :: ReadPrec PutRolePolicyResponse
readList :: ReadS [PutRolePolicyResponse]
$creadList :: ReadS [PutRolePolicyResponse]
readsPrec :: Int -> ReadS PutRolePolicyResponse
$creadsPrec :: Int -> ReadS PutRolePolicyResponse
Prelude.Read, Int -> PutRolePolicyResponse -> ShowS
[PutRolePolicyResponse] -> ShowS
PutRolePolicyResponse -> String
(Int -> PutRolePolicyResponse -> ShowS)
-> (PutRolePolicyResponse -> String)
-> ([PutRolePolicyResponse] -> ShowS)
-> Show PutRolePolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutRolePolicyResponse] -> ShowS
$cshowList :: [PutRolePolicyResponse] -> ShowS
show :: PutRolePolicyResponse -> String
$cshow :: PutRolePolicyResponse -> String
showsPrec :: Int -> PutRolePolicyResponse -> ShowS
$cshowsPrec :: Int -> PutRolePolicyResponse -> ShowS
Prelude.Show, (forall x. PutRolePolicyResponse -> Rep PutRolePolicyResponse x)
-> (forall x. Rep PutRolePolicyResponse x -> PutRolePolicyResponse)
-> Generic PutRolePolicyResponse
forall x. Rep PutRolePolicyResponse x -> PutRolePolicyResponse
forall x. PutRolePolicyResponse -> Rep PutRolePolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutRolePolicyResponse x -> PutRolePolicyResponse
$cfrom :: forall x. PutRolePolicyResponse -> Rep PutRolePolicyResponse x
Prelude.Generic)
newPutRolePolicyResponse ::
PutRolePolicyResponse
newPutRolePolicyResponse :: PutRolePolicyResponse
newPutRolePolicyResponse = PutRolePolicyResponse
PutRolePolicyResponse'
instance Prelude.NFData PutRolePolicyResponse