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