module Network.AWS.IoT.GetPolicyVersion
(
getPolicyVersion
, GetPolicyVersion
, gpvPolicyName
, gpvPolicyVersionId
, getPolicyVersionResponse
, GetPolicyVersionResponse
, gpvrsPolicyName
, gpvrsPolicyDocument
, gpvrsPolicyVersionId
, gpvrsPolicyARN
, gpvrsIsDefaultVersion
, gpvrsResponseStatus
) where
import Network.AWS.IoT.Types
import Network.AWS.IoT.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data GetPolicyVersion = GetPolicyVersion'
{ _gpvPolicyName :: !Text
, _gpvPolicyVersionId :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getPolicyVersion
:: Text
-> Text
-> GetPolicyVersion
getPolicyVersion pPolicyName_ pPolicyVersionId_ =
GetPolicyVersion'
{ _gpvPolicyName = pPolicyName_
, _gpvPolicyVersionId = pPolicyVersionId_
}
gpvPolicyName :: Lens' GetPolicyVersion Text
gpvPolicyName = lens _gpvPolicyName (\ s a -> s{_gpvPolicyName = a});
gpvPolicyVersionId :: Lens' GetPolicyVersion Text
gpvPolicyVersionId = lens _gpvPolicyVersionId (\ s a -> s{_gpvPolicyVersionId = a});
instance AWSRequest GetPolicyVersion where
type Rs GetPolicyVersion = GetPolicyVersionResponse
request = get ioT
response
= receiveJSON
(\ s h x ->
GetPolicyVersionResponse' <$>
(x .?> "policyName") <*> (x .?> "policyDocument") <*>
(x .?> "policyVersionId")
<*> (x .?> "policyArn")
<*> (x .?> "isDefaultVersion")
<*> (pure (fromEnum s)))
instance ToHeaders GetPolicyVersion where
toHeaders = const mempty
instance ToPath GetPolicyVersion where
toPath GetPolicyVersion'{..}
= mconcat
["/policies/", toBS _gpvPolicyName, "/version/",
toBS _gpvPolicyVersionId]
instance ToQuery GetPolicyVersion where
toQuery = const mempty
data GetPolicyVersionResponse = GetPolicyVersionResponse'
{ _gpvrsPolicyName :: !(Maybe Text)
, _gpvrsPolicyDocument :: !(Maybe Text)
, _gpvrsPolicyVersionId :: !(Maybe Text)
, _gpvrsPolicyARN :: !(Maybe Text)
, _gpvrsIsDefaultVersion :: !(Maybe Bool)
, _gpvrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getPolicyVersionResponse
:: Int
-> GetPolicyVersionResponse
getPolicyVersionResponse pResponseStatus_ =
GetPolicyVersionResponse'
{ _gpvrsPolicyName = Nothing
, _gpvrsPolicyDocument = Nothing
, _gpvrsPolicyVersionId = Nothing
, _gpvrsPolicyARN = Nothing
, _gpvrsIsDefaultVersion = Nothing
, _gpvrsResponseStatus = pResponseStatus_
}
gpvrsPolicyName :: Lens' GetPolicyVersionResponse (Maybe Text)
gpvrsPolicyName = lens _gpvrsPolicyName (\ s a -> s{_gpvrsPolicyName = a});
gpvrsPolicyDocument :: Lens' GetPolicyVersionResponse (Maybe Text)
gpvrsPolicyDocument = lens _gpvrsPolicyDocument (\ s a -> s{_gpvrsPolicyDocument = a});
gpvrsPolicyVersionId :: Lens' GetPolicyVersionResponse (Maybe Text)
gpvrsPolicyVersionId = lens _gpvrsPolicyVersionId (\ s a -> s{_gpvrsPolicyVersionId = a});
gpvrsPolicyARN :: Lens' GetPolicyVersionResponse (Maybe Text)
gpvrsPolicyARN = lens _gpvrsPolicyARN (\ s a -> s{_gpvrsPolicyARN = a});
gpvrsIsDefaultVersion :: Lens' GetPolicyVersionResponse (Maybe Bool)
gpvrsIsDefaultVersion = lens _gpvrsIsDefaultVersion (\ s a -> s{_gpvrsIsDefaultVersion = a});
gpvrsResponseStatus :: Lens' GetPolicyVersionResponse Int
gpvrsResponseStatus = lens _gpvrsResponseStatus (\ s a -> s{_gpvrsResponseStatus = a});