{-# 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 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 PutUserPolicy = PutUserPolicy'
{
PutUserPolicy -> Text
userName :: Prelude.Text,
PutUserPolicy -> Text
policyName :: Prelude.Text,
PutUserPolicy -> Text
policyDocument :: Prelude.Text
}
deriving (PutUserPolicy -> PutUserPolicy -> Bool
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]
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
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. 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'
{ $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 :: Lens' PutUserPolicy Text
putUserPolicy_userName = 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 :: Lens' PutUserPolicy Text
putUserPolicy_policyName = 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 :: Lens' PutUserPolicy Text
putUserPolicy_policyDocument = 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 :: (Service -> Service) -> PutUserPolicy -> Request PutUserPolicy
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 PutUserPolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutUserPolicy)))
response =
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull PutUserPolicyResponse
PutUserPolicyResponse'
instance Prelude.Hashable PutUserPolicy where
hashWithSalt :: Int -> PutUserPolicy -> Int
hashWithSalt Int
_salt PutUserPolicy' {Text
policyDocument :: Text
policyName :: Text
userName :: Text
$sel:policyDocument:PutUserPolicy' :: PutUserPolicy -> Text
$sel:policyName:PutUserPolicy' :: PutUserPolicy -> Text
$sel:userName:PutUserPolicy' :: PutUserPolicy -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
userName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
policyName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
policyDocument
instance Prelude.NFData PutUserPolicy where
rnf :: PutUserPolicy -> ()
rnf PutUserPolicy' {Text
policyDocument :: Text
policyName :: Text
userName :: Text
$sel:policyDocument:PutUserPolicy' :: PutUserPolicy -> Text
$sel:policyName:PutUserPolicy' :: PutUserPolicy -> Text
$sel:userName:PutUserPolicy' :: PutUserPolicy -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
userName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
policyName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
policyDocument
instance Data.ToHeaders PutUserPolicy where
toHeaders :: PutUserPolicy -> [Header]
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath PutUserPolicy where
toPath :: PutUserPolicy -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.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
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"PutUserPolicy" :: Prelude.ByteString),
ByteString
"Version"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2010-05-08" :: Prelude.ByteString),
ByteString
"UserName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
userName,
ByteString
"PolicyName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
policyName,
ByteString
"PolicyDocument" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
policyDocument
]
data PutUserPolicyResponse = PutUserPolicyResponse'
{
}
deriving (PutUserPolicyResponse -> PutUserPolicyResponse -> Bool
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]
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
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. 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 where
rnf :: PutUserPolicyResponse -> ()
rnf PutUserPolicyResponse
_ = ()