{-# 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.EC2.CopyImage
(
copyImage
, CopyImage
, ciClientToken
, ciEncrypted
, ciKMSKeyId
, ciDescription
, ciDryRun
, ciSourceRegion
, ciSourceImageId
, ciName
, copyImageResponse
, CopyImageResponse
, coprsImageId
, coprsResponseStatus
) where
import Network.AWS.EC2.Types
import Network.AWS.EC2.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CopyImage = CopyImage'
{ _ciClientToken :: !(Maybe Text)
, _ciEncrypted :: !(Maybe Bool)
, _ciKMSKeyId :: !(Maybe Text)
, _ciDescription :: !(Maybe Text)
, _ciDryRun :: !(Maybe Bool)
, _ciSourceRegion :: !Text
, _ciSourceImageId :: !Text
, _ciName :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
copyImage
:: Text
-> Text
-> Text
-> CopyImage
copyImage pSourceRegion_ pSourceImageId_ pName_ =
CopyImage'
{ _ciClientToken = Nothing
, _ciEncrypted = Nothing
, _ciKMSKeyId = Nothing
, _ciDescription = Nothing
, _ciDryRun = Nothing
, _ciSourceRegion = pSourceRegion_
, _ciSourceImageId = pSourceImageId_
, _ciName = pName_
}
ciClientToken :: Lens' CopyImage (Maybe Text)
ciClientToken = lens _ciClientToken (\ s a -> s{_ciClientToken = a});
ciEncrypted :: Lens' CopyImage (Maybe Bool)
ciEncrypted = lens _ciEncrypted (\ s a -> s{_ciEncrypted = a});
ciKMSKeyId :: Lens' CopyImage (Maybe Text)
ciKMSKeyId = lens _ciKMSKeyId (\ s a -> s{_ciKMSKeyId = a});
ciDescription :: Lens' CopyImage (Maybe Text)
ciDescription = lens _ciDescription (\ s a -> s{_ciDescription = a});
ciDryRun :: Lens' CopyImage (Maybe Bool)
ciDryRun = lens _ciDryRun (\ s a -> s{_ciDryRun = a});
ciSourceRegion :: Lens' CopyImage Text
ciSourceRegion = lens _ciSourceRegion (\ s a -> s{_ciSourceRegion = a});
ciSourceImageId :: Lens' CopyImage Text
ciSourceImageId = lens _ciSourceImageId (\ s a -> s{_ciSourceImageId = a});
ciName :: Lens' CopyImage Text
ciName = lens _ciName (\ s a -> s{_ciName = a});
instance AWSRequest CopyImage where
type Rs CopyImage = CopyImageResponse
request = postQuery ec2
response
= receiveXML
(\ s h x ->
CopyImageResponse' <$>
(x .@? "imageId") <*> (pure (fromEnum s)))
instance Hashable CopyImage
instance NFData CopyImage
instance ToHeaders CopyImage where
toHeaders = const mempty
instance ToPath CopyImage where
toPath = const "/"
instance ToQuery CopyImage where
toQuery CopyImage'{..}
= mconcat
["Action" =: ("CopyImage" :: ByteString),
"Version" =: ("2016-04-01" :: ByteString),
"ClientToken" =: _ciClientToken,
"Encrypted" =: _ciEncrypted,
"KmsKeyId" =: _ciKMSKeyId,
"Description" =: _ciDescription,
"DryRun" =: _ciDryRun,
"SourceRegion" =: _ciSourceRegion,
"SourceImageId" =: _ciSourceImageId,
"Name" =: _ciName]
data CopyImageResponse = CopyImageResponse'
{ _coprsImageId :: !(Maybe Text)
, _coprsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
copyImageResponse
:: Int
-> CopyImageResponse
copyImageResponse pResponseStatus_ =
CopyImageResponse'
{ _coprsImageId = Nothing
, _coprsResponseStatus = pResponseStatus_
}
coprsImageId :: Lens' CopyImageResponse (Maybe Text)
coprsImageId = lens _coprsImageId (\ s a -> s{_coprsImageId = a});
coprsResponseStatus :: Lens' CopyImageResponse Int
coprsResponseStatus = lens _coprsResponseStatus (\ s a -> s{_coprsResponseStatus = a});
instance NFData CopyImageResponse