{-# 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.FMS.PutPolicy
(
putPolicy
, PutPolicy
, ppPolicy
, putPolicyResponse
, PutPolicyResponse
, pprsPolicyARN
, pprsPolicy
, pprsResponseStatus
) where
import Network.AWS.FMS.Types
import Network.AWS.FMS.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
newtype PutPolicy = PutPolicy'
{ _ppPolicy :: Policy
} deriving (Eq, Read, Show, Data, Typeable, Generic)
putPolicy
:: Policy
-> PutPolicy
putPolicy pPolicy_ = PutPolicy' {_ppPolicy = pPolicy_}
ppPolicy :: Lens' PutPolicy Policy
ppPolicy = lens _ppPolicy (\ s a -> s{_ppPolicy = a})
instance AWSRequest PutPolicy where
type Rs PutPolicy = PutPolicyResponse
request = postJSON fms
response
= receiveJSON
(\ s h x ->
PutPolicyResponse' <$>
(x .?> "PolicyArn") <*> (x .?> "Policy") <*>
(pure (fromEnum s)))
instance Hashable PutPolicy where
instance NFData PutPolicy where
instance ToHeaders PutPolicy where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSFMS_20180101.PutPolicy" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON PutPolicy where
toJSON PutPolicy'{..}
= object (catMaybes [Just ("Policy" .= _ppPolicy)])
instance ToPath PutPolicy where
toPath = const "/"
instance ToQuery PutPolicy where
toQuery = const mempty
data PutPolicyResponse = PutPolicyResponse'
{ _pprsPolicyARN :: !(Maybe Text)
, _pprsPolicy :: !(Maybe Policy)
, _pprsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
putPolicyResponse
:: Int
-> PutPolicyResponse
putPolicyResponse pResponseStatus_ =
PutPolicyResponse'
{ _pprsPolicyARN = Nothing
, _pprsPolicy = Nothing
, _pprsResponseStatus = pResponseStatus_
}
pprsPolicyARN :: Lens' PutPolicyResponse (Maybe Text)
pprsPolicyARN = lens _pprsPolicyARN (\ s a -> s{_pprsPolicyARN = a})
pprsPolicy :: Lens' PutPolicyResponse (Maybe Policy)
pprsPolicy = lens _pprsPolicy (\ s a -> s{_pprsPolicy = a})
pprsResponseStatus :: Lens' PutPolicyResponse Int
pprsResponseStatus = lens _pprsResponseStatus (\ s a -> s{_pprsResponseStatus = a})
instance NFData PutPolicyResponse where