{-# 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.AttachUserPolicy
(
AttachUserPolicy (..),
newAttachUserPolicy,
attachUserPolicy_userName,
attachUserPolicy_policyArn,
AttachUserPolicyResponse (..),
newAttachUserPolicyResponse,
)
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 AttachUserPolicy = AttachUserPolicy'
{
AttachUserPolicy -> Text
userName :: Prelude.Text,
AttachUserPolicy -> Text
policyArn :: Prelude.Text
}
deriving (AttachUserPolicy -> AttachUserPolicy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttachUserPolicy -> AttachUserPolicy -> Bool
$c/= :: AttachUserPolicy -> AttachUserPolicy -> Bool
== :: AttachUserPolicy -> AttachUserPolicy -> Bool
$c== :: AttachUserPolicy -> AttachUserPolicy -> Bool
Prelude.Eq, ReadPrec [AttachUserPolicy]
ReadPrec AttachUserPolicy
Int -> ReadS AttachUserPolicy
ReadS [AttachUserPolicy]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttachUserPolicy]
$creadListPrec :: ReadPrec [AttachUserPolicy]
readPrec :: ReadPrec AttachUserPolicy
$creadPrec :: ReadPrec AttachUserPolicy
readList :: ReadS [AttachUserPolicy]
$creadList :: ReadS [AttachUserPolicy]
readsPrec :: Int -> ReadS AttachUserPolicy
$creadsPrec :: Int -> ReadS AttachUserPolicy
Prelude.Read, Int -> AttachUserPolicy -> ShowS
[AttachUserPolicy] -> ShowS
AttachUserPolicy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttachUserPolicy] -> ShowS
$cshowList :: [AttachUserPolicy] -> ShowS
show :: AttachUserPolicy -> String
$cshow :: AttachUserPolicy -> String
showsPrec :: Int -> AttachUserPolicy -> ShowS
$cshowsPrec :: Int -> AttachUserPolicy -> ShowS
Prelude.Show, forall x. Rep AttachUserPolicy x -> AttachUserPolicy
forall x. AttachUserPolicy -> Rep AttachUserPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AttachUserPolicy x -> AttachUserPolicy
$cfrom :: forall x. AttachUserPolicy -> Rep AttachUserPolicy x
Prelude.Generic)
newAttachUserPolicy ::
Prelude.Text ->
Prelude.Text ->
AttachUserPolicy
newAttachUserPolicy :: Text -> Text -> AttachUserPolicy
newAttachUserPolicy Text
pUserName_ Text
pPolicyArn_ =
AttachUserPolicy'
{ $sel:userName:AttachUserPolicy' :: Text
userName = Text
pUserName_,
$sel:policyArn:AttachUserPolicy' :: Text
policyArn = Text
pPolicyArn_
}
attachUserPolicy_userName :: Lens.Lens' AttachUserPolicy Prelude.Text
attachUserPolicy_userName :: Lens' AttachUserPolicy Text
attachUserPolicy_userName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachUserPolicy' {Text
userName :: Text
$sel:userName:AttachUserPolicy' :: AttachUserPolicy -> Text
userName} -> Text
userName) (\s :: AttachUserPolicy
s@AttachUserPolicy' {} Text
a -> AttachUserPolicy
s {$sel:userName:AttachUserPolicy' :: Text
userName = Text
a} :: AttachUserPolicy)
attachUserPolicy_policyArn :: Lens.Lens' AttachUserPolicy Prelude.Text
attachUserPolicy_policyArn :: Lens' AttachUserPolicy Text
attachUserPolicy_policyArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachUserPolicy' {Text
policyArn :: Text
$sel:policyArn:AttachUserPolicy' :: AttachUserPolicy -> Text
policyArn} -> Text
policyArn) (\s :: AttachUserPolicy
s@AttachUserPolicy' {} Text
a -> AttachUserPolicy
s {$sel:policyArn:AttachUserPolicy' :: Text
policyArn = Text
a} :: AttachUserPolicy)
instance Core.AWSRequest AttachUserPolicy where
type
AWSResponse AttachUserPolicy =
AttachUserPolicyResponse
request :: (Service -> Service)
-> AttachUserPolicy -> Request AttachUserPolicy
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 AttachUserPolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AttachUserPolicy)))
response =
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AttachUserPolicyResponse
AttachUserPolicyResponse'
instance Prelude.Hashable AttachUserPolicy where
hashWithSalt :: Int -> AttachUserPolicy -> Int
hashWithSalt Int
_salt AttachUserPolicy' {Text
policyArn :: Text
userName :: Text
$sel:policyArn:AttachUserPolicy' :: AttachUserPolicy -> Text
$sel:userName:AttachUserPolicy' :: AttachUserPolicy -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
userName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
policyArn
instance Prelude.NFData AttachUserPolicy where
rnf :: AttachUserPolicy -> ()
rnf AttachUserPolicy' {Text
policyArn :: Text
userName :: Text
$sel:policyArn:AttachUserPolicy' :: AttachUserPolicy -> Text
$sel:userName:AttachUserPolicy' :: AttachUserPolicy -> 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
policyArn
instance Data.ToHeaders AttachUserPolicy where
toHeaders :: AttachUserPolicy -> [Header]
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath AttachUserPolicy where
toPath :: AttachUserPolicy -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery AttachUserPolicy where
toQuery :: AttachUserPolicy -> QueryString
toQuery AttachUserPolicy' {Text
policyArn :: Text
userName :: Text
$sel:policyArn:AttachUserPolicy' :: AttachUserPolicy -> Text
$sel:userName:AttachUserPolicy' :: AttachUserPolicy -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"AttachUserPolicy" :: 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
"PolicyArn" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
policyArn
]
data AttachUserPolicyResponse = AttachUserPolicyResponse'
{
}
deriving (AttachUserPolicyResponse -> AttachUserPolicyResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttachUserPolicyResponse -> AttachUserPolicyResponse -> Bool
$c/= :: AttachUserPolicyResponse -> AttachUserPolicyResponse -> Bool
== :: AttachUserPolicyResponse -> AttachUserPolicyResponse -> Bool
$c== :: AttachUserPolicyResponse -> AttachUserPolicyResponse -> Bool
Prelude.Eq, ReadPrec [AttachUserPolicyResponse]
ReadPrec AttachUserPolicyResponse
Int -> ReadS AttachUserPolicyResponse
ReadS [AttachUserPolicyResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttachUserPolicyResponse]
$creadListPrec :: ReadPrec [AttachUserPolicyResponse]
readPrec :: ReadPrec AttachUserPolicyResponse
$creadPrec :: ReadPrec AttachUserPolicyResponse
readList :: ReadS [AttachUserPolicyResponse]
$creadList :: ReadS [AttachUserPolicyResponse]
readsPrec :: Int -> ReadS AttachUserPolicyResponse
$creadsPrec :: Int -> ReadS AttachUserPolicyResponse
Prelude.Read, Int -> AttachUserPolicyResponse -> ShowS
[AttachUserPolicyResponse] -> ShowS
AttachUserPolicyResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttachUserPolicyResponse] -> ShowS
$cshowList :: [AttachUserPolicyResponse] -> ShowS
show :: AttachUserPolicyResponse -> String
$cshow :: AttachUserPolicyResponse -> String
showsPrec :: Int -> AttachUserPolicyResponse -> ShowS
$cshowsPrec :: Int -> AttachUserPolicyResponse -> ShowS
Prelude.Show, forall x.
Rep AttachUserPolicyResponse x -> AttachUserPolicyResponse
forall x.
AttachUserPolicyResponse -> Rep AttachUserPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AttachUserPolicyResponse x -> AttachUserPolicyResponse
$cfrom :: forall x.
AttachUserPolicyResponse -> Rep AttachUserPolicyResponse x
Prelude.Generic)
newAttachUserPolicyResponse ::
AttachUserPolicyResponse
newAttachUserPolicyResponse :: AttachUserPolicyResponse
newAttachUserPolicyResponse =
AttachUserPolicyResponse
AttachUserPolicyResponse'
instance Prelude.NFData AttachUserPolicyResponse where
rnf :: AttachUserPolicyResponse -> ()
rnf AttachUserPolicyResponse
_ = ()