{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.WAF.PutPermissionPolicy
(
putPermissionPolicy
, PutPermissionPolicy
, pppResourceARN
, pppPolicy
, putPermissionPolicyResponse
, PutPermissionPolicyResponse
, ppprsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.WAF.Types
import Network.AWS.WAF.Types.Product
data PutPermissionPolicy = PutPermissionPolicy'
{ _pppResourceARN :: !Text
, _pppPolicy :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
putPermissionPolicy
:: Text
-> Text
-> PutPermissionPolicy
putPermissionPolicy pResourceARN_ pPolicy_ =
PutPermissionPolicy' {_pppResourceARN = pResourceARN_, _pppPolicy = pPolicy_}
pppResourceARN :: Lens' PutPermissionPolicy Text
pppResourceARN = lens _pppResourceARN (\ s a -> s{_pppResourceARN = a})
pppPolicy :: Lens' PutPermissionPolicy Text
pppPolicy = lens _pppPolicy (\ s a -> s{_pppPolicy = a})
instance AWSRequest PutPermissionPolicy where
type Rs PutPermissionPolicy =
PutPermissionPolicyResponse
request = postJSON waf
response
= receiveEmpty
(\ s h x ->
PutPermissionPolicyResponse' <$> (pure (fromEnum s)))
instance Hashable PutPermissionPolicy where
instance NFData PutPermissionPolicy where
instance ToHeaders PutPermissionPolicy where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSWAF_20150824.PutPermissionPolicy" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON PutPermissionPolicy where
toJSON PutPermissionPolicy'{..}
= object
(catMaybes
[Just ("ResourceArn" .= _pppResourceARN),
Just ("Policy" .= _pppPolicy)])
instance ToPath PutPermissionPolicy where
toPath = const "/"
instance ToQuery PutPermissionPolicy where
toQuery = const mempty
newtype PutPermissionPolicyResponse = PutPermissionPolicyResponse'
{ _ppprsResponseStatus :: Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
putPermissionPolicyResponse
:: Int
-> PutPermissionPolicyResponse
putPermissionPolicyResponse pResponseStatus_ =
PutPermissionPolicyResponse' {_ppprsResponseStatus = pResponseStatus_}
ppprsResponseStatus :: Lens' PutPermissionPolicyResponse Int
ppprsResponseStatus = lens _ppprsResponseStatus (\ s a -> s{_ppprsResponseStatus = a})
instance NFData PutPermissionPolicyResponse where