{-# 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 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 AttachUserPolicy = AttachUserPolicy'
{
AttachUserPolicy -> Text
userName :: Prelude.Text,
AttachUserPolicy -> Text
policyArn :: Prelude.Text
}
deriving (AttachUserPolicy -> AttachUserPolicy -> Bool
(AttachUserPolicy -> AttachUserPolicy -> Bool)
-> (AttachUserPolicy -> AttachUserPolicy -> Bool)
-> Eq AttachUserPolicy
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]
(Int -> ReadS AttachUserPolicy)
-> ReadS [AttachUserPolicy]
-> ReadPrec AttachUserPolicy
-> ReadPrec [AttachUserPolicy]
-> Read 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
(Int -> AttachUserPolicy -> ShowS)
-> (AttachUserPolicy -> String)
-> ([AttachUserPolicy] -> ShowS)
-> Show AttachUserPolicy
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. AttachUserPolicy -> Rep AttachUserPolicy x)
-> (forall x. Rep AttachUserPolicy x -> AttachUserPolicy)
-> Generic AttachUserPolicy
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' :: Text -> Text -> AttachUserPolicy
AttachUserPolicy'
{ $sel:userName:AttachUserPolicy' :: Text
userName = Text
pUserName_,
$sel:policyArn:AttachUserPolicy' :: Text
policyArn = Text
pPolicyArn_
}
attachUserPolicy_userName :: Lens.Lens' AttachUserPolicy Prelude.Text
attachUserPolicy_userName :: (Text -> f Text) -> AttachUserPolicy -> f AttachUserPolicy
attachUserPolicy_userName = (AttachUserPolicy -> Text)
-> (AttachUserPolicy -> Text -> AttachUserPolicy)
-> Lens AttachUserPolicy AttachUserPolicy Text Text
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 :: (Text -> f Text) -> AttachUserPolicy -> f AttachUserPolicy
attachUserPolicy_policyArn = (AttachUserPolicy -> Text)
-> (AttachUserPolicy -> Text -> AttachUserPolicy)
-> Lens AttachUserPolicy AttachUserPolicy Text Text
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 :: AttachUserPolicy -> Request AttachUserPolicy
request = Service -> AttachUserPolicy -> Request AttachUserPolicy
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy AttachUserPolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AttachUserPolicy)))
response =
AWSResponse AttachUserPolicy
-> Logger
-> Service
-> Proxy AttachUserPolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AttachUserPolicy)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse AttachUserPolicy
AttachUserPolicyResponse
AttachUserPolicyResponse'
instance Prelude.Hashable AttachUserPolicy
instance Prelude.NFData AttachUserPolicy
instance Core.ToHeaders AttachUserPolicy where
toHeaders :: AttachUserPolicy -> [Header]
toHeaders = [Header] -> AttachUserPolicy -> [Header]
forall a b. a -> b -> a
Prelude.const [Header]
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath AttachUserPolicy where
toPath :: AttachUserPolicy -> ByteString
toPath = ByteString -> AttachUserPolicy -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AttachUserPolicy where
toQuery :: AttachUserPolicy -> QueryString
toQuery AttachUserPolicy' {Text
policyArn :: Text
userName :: Text
$sel:policyArn:AttachUserPolicy' :: AttachUserPolicy -> Text
$sel:userName:AttachUserPolicy' :: AttachUserPolicy -> 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
"AttachUserPolicy" :: 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
"PolicyArn" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
policyArn
]
data AttachUserPolicyResponse = AttachUserPolicyResponse'
{
}
deriving (AttachUserPolicyResponse -> AttachUserPolicyResponse -> Bool
(AttachUserPolicyResponse -> AttachUserPolicyResponse -> Bool)
-> (AttachUserPolicyResponse -> AttachUserPolicyResponse -> Bool)
-> Eq AttachUserPolicyResponse
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]
(Int -> ReadS AttachUserPolicyResponse)
-> ReadS [AttachUserPolicyResponse]
-> ReadPrec AttachUserPolicyResponse
-> ReadPrec [AttachUserPolicyResponse]
-> Read 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
(Int -> AttachUserPolicyResponse -> ShowS)
-> (AttachUserPolicyResponse -> String)
-> ([AttachUserPolicyResponse] -> ShowS)
-> Show AttachUserPolicyResponse
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.
AttachUserPolicyResponse -> Rep AttachUserPolicyResponse x)
-> (forall x.
Rep AttachUserPolicyResponse x -> AttachUserPolicyResponse)
-> Generic AttachUserPolicyResponse
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