{-# 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.GetPolicy
(
getPolicy
, GetPolicy
, gpPolicyId
, getPolicyResponse
, GetPolicyResponse
, gprsPolicyARN
, gprsPolicy
, gprsResponseStatus
) 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 GetPolicy = GetPolicy'
{ _gpPolicyId :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getPolicy
:: Text
-> GetPolicy
getPolicy pPolicyId_ = GetPolicy' {_gpPolicyId = pPolicyId_}
gpPolicyId :: Lens' GetPolicy Text
gpPolicyId = lens _gpPolicyId (\ s a -> s{_gpPolicyId = a})
instance AWSRequest GetPolicy where
type Rs GetPolicy = GetPolicyResponse
request = postJSON fms
response
= receiveJSON
(\ s h x ->
GetPolicyResponse' <$>
(x .?> "PolicyArn") <*> (x .?> "Policy") <*>
(pure (fromEnum s)))
instance Hashable GetPolicy where
instance NFData GetPolicy where
instance ToHeaders GetPolicy where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSFMS_20180101.GetPolicy" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetPolicy where
toJSON GetPolicy'{..}
= object
(catMaybes [Just ("PolicyId" .= _gpPolicyId)])
instance ToPath GetPolicy where
toPath = const "/"
instance ToQuery GetPolicy where
toQuery = const mempty
data GetPolicyResponse = GetPolicyResponse'
{ _gprsPolicyARN :: !(Maybe Text)
, _gprsPolicy :: !(Maybe Policy)
, _gprsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getPolicyResponse
:: Int
-> GetPolicyResponse
getPolicyResponse pResponseStatus_ =
GetPolicyResponse'
{ _gprsPolicyARN = Nothing
, _gprsPolicy = Nothing
, _gprsResponseStatus = pResponseStatus_
}
gprsPolicyARN :: Lens' GetPolicyResponse (Maybe Text)
gprsPolicyARN = lens _gprsPolicyARN (\ s a -> s{_gprsPolicyARN = a})
gprsPolicy :: Lens' GetPolicyResponse (Maybe Policy)
gprsPolicy = lens _gprsPolicy (\ s a -> s{_gprsPolicy = a})
gprsResponseStatus :: Lens' GetPolicyResponse Int
gprsResponseStatus = lens _gprsResponseStatus (\ s a -> s{_gprsResponseStatus = a})
instance NFData GetPolicyResponse where