{-# 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.IoT.GetPolicyVersion
(
getPolicyVersion
, GetPolicyVersion
, gpvPolicyName
, gpvPolicyVersionId
, getPolicyVersionResponse
, GetPolicyVersionResponse
, gpvrsLastModifiedDate
, gpvrsPolicyName
, gpvrsPolicyDocument
, gpvrsPolicyVersionId
, gpvrsPolicyARN
, gpvrsCreationDate
, gpvrsGenerationId
, gpvrsIsDefaultVersion
, gpvrsResponseStatus
) where
import Network.AWS.IoT.Types
import Network.AWS.IoT.Types.Product
import Network.AWS.Lens
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 .?> "lastModifiedDate") <*> (x .?> "policyName")
<*> (x .?> "policyDocument")
<*> (x .?> "policyVersionId")
<*> (x .?> "policyArn")
<*> (x .?> "creationDate")
<*> (x .?> "generationId")
<*> (x .?> "isDefaultVersion")
<*> (pure (fromEnum s)))
instance Hashable GetPolicyVersion where
instance NFData GetPolicyVersion where
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'
{ _gpvrsLastModifiedDate :: !(Maybe POSIX)
, _gpvrsPolicyName :: !(Maybe Text)
, _gpvrsPolicyDocument :: !(Maybe Text)
, _gpvrsPolicyVersionId :: !(Maybe Text)
, _gpvrsPolicyARN :: !(Maybe Text)
, _gpvrsCreationDate :: !(Maybe POSIX)
, _gpvrsGenerationId :: !(Maybe Text)
, _gpvrsIsDefaultVersion :: !(Maybe Bool)
, _gpvrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getPolicyVersionResponse
:: Int
-> GetPolicyVersionResponse
getPolicyVersionResponse pResponseStatus_ =
GetPolicyVersionResponse'
{ _gpvrsLastModifiedDate = Nothing
, _gpvrsPolicyName = Nothing
, _gpvrsPolicyDocument = Nothing
, _gpvrsPolicyVersionId = Nothing
, _gpvrsPolicyARN = Nothing
, _gpvrsCreationDate = Nothing
, _gpvrsGenerationId = Nothing
, _gpvrsIsDefaultVersion = Nothing
, _gpvrsResponseStatus = pResponseStatus_
}
gpvrsLastModifiedDate :: Lens' GetPolicyVersionResponse (Maybe UTCTime)
gpvrsLastModifiedDate = lens _gpvrsLastModifiedDate (\ s a -> s{_gpvrsLastModifiedDate = a}) . mapping _Time
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})
gpvrsCreationDate :: Lens' GetPolicyVersionResponse (Maybe UTCTime)
gpvrsCreationDate = lens _gpvrsCreationDate (\ s a -> s{_gpvrsCreationDate = a}) . mapping _Time
gpvrsGenerationId :: Lens' GetPolicyVersionResponse (Maybe Text)
gpvrsGenerationId = lens _gpvrsGenerationId (\ s a -> s{_gpvrsGenerationId = 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})
instance NFData GetPolicyVersionResponse where