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