{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RecordWildCards       #-}
{-# LANGUAGE TypeFamilies          #-}
module Aws.Iam.Commands.PutGroupPolicy
    ( PutGroupPolicy(..)
    , PutGroupPolicyResponse(..)
    ) where

import           Aws.Core
import           Aws.Iam.Core
import           Aws.Iam.Internal
import           Data.Text        (Text)
import           Data.Typeable

-- | Adds a policy document with the specified name, associated with the
-- specified group.
--
-- <http://docs.aws.amazon.com/IAM/latest/APIReference/API_PutGroupPolicy.html>
data PutGroupPolicy
    = PutGroupPolicy {
        PutGroupPolicy -> Text
pgpPolicyDocument :: Text
      -- ^ The policy document.
      , PutGroupPolicy -> Text
pgpPolicyName     :: Text
      -- ^ Name of the policy.
      , PutGroupPolicy -> Text
pgpGroupName       :: Text
      -- ^ Name of the group with whom this policy is associated.
      }
    deriving (PutGroupPolicy -> PutGroupPolicy -> Bool
(PutGroupPolicy -> PutGroupPolicy -> Bool)
-> (PutGroupPolicy -> PutGroupPolicy -> Bool) -> Eq PutGroupPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PutGroupPolicy -> PutGroupPolicy -> Bool
== :: PutGroupPolicy -> PutGroupPolicy -> Bool
$c/= :: PutGroupPolicy -> PutGroupPolicy -> Bool
/= :: PutGroupPolicy -> PutGroupPolicy -> Bool
Eq, Eq PutGroupPolicy
Eq PutGroupPolicy =>
(PutGroupPolicy -> PutGroupPolicy -> Ordering)
-> (PutGroupPolicy -> PutGroupPolicy -> Bool)
-> (PutGroupPolicy -> PutGroupPolicy -> Bool)
-> (PutGroupPolicy -> PutGroupPolicy -> Bool)
-> (PutGroupPolicy -> PutGroupPolicy -> Bool)
-> (PutGroupPolicy -> PutGroupPolicy -> PutGroupPolicy)
-> (PutGroupPolicy -> PutGroupPolicy -> PutGroupPolicy)
-> Ord PutGroupPolicy
PutGroupPolicy -> PutGroupPolicy -> Bool
PutGroupPolicy -> PutGroupPolicy -> Ordering
PutGroupPolicy -> PutGroupPolicy -> PutGroupPolicy
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: PutGroupPolicy -> PutGroupPolicy -> Ordering
compare :: PutGroupPolicy -> PutGroupPolicy -> Ordering
$c< :: PutGroupPolicy -> PutGroupPolicy -> Bool
< :: PutGroupPolicy -> PutGroupPolicy -> Bool
$c<= :: PutGroupPolicy -> PutGroupPolicy -> Bool
<= :: PutGroupPolicy -> PutGroupPolicy -> Bool
$c> :: PutGroupPolicy -> PutGroupPolicy -> Bool
> :: PutGroupPolicy -> PutGroupPolicy -> Bool
$c>= :: PutGroupPolicy -> PutGroupPolicy -> Bool
>= :: PutGroupPolicy -> PutGroupPolicy -> Bool
$cmax :: PutGroupPolicy -> PutGroupPolicy -> PutGroupPolicy
max :: PutGroupPolicy -> PutGroupPolicy -> PutGroupPolicy
$cmin :: PutGroupPolicy -> PutGroupPolicy -> PutGroupPolicy
min :: PutGroupPolicy -> PutGroupPolicy -> PutGroupPolicy
Ord, Int -> PutGroupPolicy -> ShowS
[PutGroupPolicy] -> ShowS
PutGroupPolicy -> String
(Int -> PutGroupPolicy -> ShowS)
-> (PutGroupPolicy -> String)
-> ([PutGroupPolicy] -> ShowS)
-> Show PutGroupPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PutGroupPolicy -> ShowS
showsPrec :: Int -> PutGroupPolicy -> ShowS
$cshow :: PutGroupPolicy -> String
show :: PutGroupPolicy -> String
$cshowList :: [PutGroupPolicy] -> ShowS
showList :: [PutGroupPolicy] -> ShowS
Show, Typeable)

instance SignQuery PutGroupPolicy where
    type ServiceConfiguration PutGroupPolicy = IamConfiguration
    signQuery :: forall queryType.
PutGroupPolicy
-> ServiceConfiguration PutGroupPolicy queryType
-> SignatureData
-> SignedQuery
signQuery PutGroupPolicy{Text
pgpPolicyDocument :: PutGroupPolicy -> Text
pgpPolicyName :: PutGroupPolicy -> Text
pgpGroupName :: PutGroupPolicy -> Text
pgpPolicyDocument :: Text
pgpPolicyName :: Text
pgpGroupName :: Text
..}
        = ByteString
-> [(ByteString, Text)]
-> IamConfiguration queryType
-> SignatureData
-> SignedQuery
forall qt.
ByteString
-> [(ByteString, Text)]
-> IamConfiguration qt
-> SignatureData
-> SignedQuery
iamAction ByteString
"PutGroupPolicy" [
              (ByteString
"PolicyDocument", Text
pgpPolicyDocument)
            , (ByteString
"PolicyName"    , Text
pgpPolicyName)
            , (ByteString
"GroupName"      , Text
pgpGroupName)
            ]

data PutGroupPolicyResponse = PutGroupPolicyResponse
    deriving (PutGroupPolicyResponse -> PutGroupPolicyResponse -> Bool
(PutGroupPolicyResponse -> PutGroupPolicyResponse -> Bool)
-> (PutGroupPolicyResponse -> PutGroupPolicyResponse -> Bool)
-> Eq PutGroupPolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PutGroupPolicyResponse -> PutGroupPolicyResponse -> Bool
== :: PutGroupPolicyResponse -> PutGroupPolicyResponse -> Bool
$c/= :: PutGroupPolicyResponse -> PutGroupPolicyResponse -> Bool
/= :: PutGroupPolicyResponse -> PutGroupPolicyResponse -> Bool
Eq, Eq PutGroupPolicyResponse
Eq PutGroupPolicyResponse =>
(PutGroupPolicyResponse -> PutGroupPolicyResponse -> Ordering)
-> (PutGroupPolicyResponse -> PutGroupPolicyResponse -> Bool)
-> (PutGroupPolicyResponse -> PutGroupPolicyResponse -> Bool)
-> (PutGroupPolicyResponse -> PutGroupPolicyResponse -> Bool)
-> (PutGroupPolicyResponse -> PutGroupPolicyResponse -> Bool)
-> (PutGroupPolicyResponse
    -> PutGroupPolicyResponse -> PutGroupPolicyResponse)
-> (PutGroupPolicyResponse
    -> PutGroupPolicyResponse -> PutGroupPolicyResponse)
-> Ord PutGroupPolicyResponse
PutGroupPolicyResponse -> PutGroupPolicyResponse -> Bool
PutGroupPolicyResponse -> PutGroupPolicyResponse -> Ordering
PutGroupPolicyResponse
-> PutGroupPolicyResponse -> PutGroupPolicyResponse
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: PutGroupPolicyResponse -> PutGroupPolicyResponse -> Ordering
compare :: PutGroupPolicyResponse -> PutGroupPolicyResponse -> Ordering
$c< :: PutGroupPolicyResponse -> PutGroupPolicyResponse -> Bool
< :: PutGroupPolicyResponse -> PutGroupPolicyResponse -> Bool
$c<= :: PutGroupPolicyResponse -> PutGroupPolicyResponse -> Bool
<= :: PutGroupPolicyResponse -> PutGroupPolicyResponse -> Bool
$c> :: PutGroupPolicyResponse -> PutGroupPolicyResponse -> Bool
> :: PutGroupPolicyResponse -> PutGroupPolicyResponse -> Bool
$c>= :: PutGroupPolicyResponse -> PutGroupPolicyResponse -> Bool
>= :: PutGroupPolicyResponse -> PutGroupPolicyResponse -> Bool
$cmax :: PutGroupPolicyResponse
-> PutGroupPolicyResponse -> PutGroupPolicyResponse
max :: PutGroupPolicyResponse
-> PutGroupPolicyResponse -> PutGroupPolicyResponse
$cmin :: PutGroupPolicyResponse
-> PutGroupPolicyResponse -> PutGroupPolicyResponse
min :: PutGroupPolicyResponse
-> PutGroupPolicyResponse -> PutGroupPolicyResponse
Ord, Int -> PutGroupPolicyResponse -> ShowS
[PutGroupPolicyResponse] -> ShowS
PutGroupPolicyResponse -> String
(Int -> PutGroupPolicyResponse -> ShowS)
-> (PutGroupPolicyResponse -> String)
-> ([PutGroupPolicyResponse] -> ShowS)
-> Show PutGroupPolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PutGroupPolicyResponse -> ShowS
showsPrec :: Int -> PutGroupPolicyResponse -> ShowS
$cshow :: PutGroupPolicyResponse -> String
show :: PutGroupPolicyResponse -> String
$cshowList :: [PutGroupPolicyResponse] -> ShowS
showList :: [PutGroupPolicyResponse] -> ShowS
Show, Typeable)

instance ResponseConsumer PutGroupPolicy PutGroupPolicyResponse where
    type ResponseMetadata PutGroupPolicyResponse = IamMetadata
    responseConsumer :: Request
-> PutGroupPolicy
-> IORef (ResponseMetadata PutGroupPolicyResponse)
-> HTTPResponseConsumer PutGroupPolicyResponse
responseConsumer Request
_ PutGroupPolicy
_
        = (Cursor -> Response IamMetadata PutGroupPolicyResponse)
-> IORef IamMetadata -> HTTPResponseConsumer PutGroupPolicyResponse
forall a.
(Cursor -> Response IamMetadata a)
-> IORef IamMetadata -> HTTPResponseConsumer a
iamResponseConsumer (Response IamMetadata PutGroupPolicyResponse
-> Cursor -> Response IamMetadata PutGroupPolicyResponse
forall a b. a -> b -> a
const (Response IamMetadata PutGroupPolicyResponse
 -> Cursor -> Response IamMetadata PutGroupPolicyResponse)
-> Response IamMetadata PutGroupPolicyResponse
-> Cursor
-> Response IamMetadata PutGroupPolicyResponse
forall a b. (a -> b) -> a -> b
$ PutGroupPolicyResponse
-> Response IamMetadata PutGroupPolicyResponse
forall a. a -> Response IamMetadata a
forall (m :: * -> *) a. Monad m => a -> m a
return PutGroupPolicyResponse
PutGroupPolicyResponse)

instance Transaction PutGroupPolicy PutGroupPolicyResponse

instance AsMemoryResponse PutGroupPolicyResponse where
    type MemoryResponse PutGroupPolicyResponse = PutGroupPolicyResponse
    loadToMemory :: PutGroupPolicyResponse
-> ResourceT IO (MemoryResponse PutGroupPolicyResponse)
loadToMemory = PutGroupPolicyResponse
-> ResourceT IO (MemoryResponse PutGroupPolicyResponse)
PutGroupPolicyResponse -> ResourceT IO PutGroupPolicyResponse
forall a. a -> ResourceT IO a
forall (m :: * -> *) a. Monad m => a -> m a
return