{-# 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.AppStream.CopyImage
(
copyImage
, CopyImage
, ciDestinationImageDescription
, ciSourceImageName
, ciDestinationImageName
, ciDestinationRegion
, copyImageResponse
, CopyImageResponse
, cirsDestinationImageName
, cirsResponseStatus
) where
import Network.AWS.AppStream.Types
import Network.AWS.AppStream.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CopyImage = CopyImage'
{ _ciDestinationImageDescription :: !(Maybe Text)
, _ciSourceImageName :: !Text
, _ciDestinationImageName :: !Text
, _ciDestinationRegion :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
copyImage
:: Text
-> Text
-> Text
-> CopyImage
copyImage pSourceImageName_ pDestinationImageName_ pDestinationRegion_ =
CopyImage'
{ _ciDestinationImageDescription = Nothing
, _ciSourceImageName = pSourceImageName_
, _ciDestinationImageName = pDestinationImageName_
, _ciDestinationRegion = pDestinationRegion_
}
ciDestinationImageDescription :: Lens' CopyImage (Maybe Text)
ciDestinationImageDescription = lens _ciDestinationImageDescription (\ s a -> s{_ciDestinationImageDescription = a})
ciSourceImageName :: Lens' CopyImage Text
ciSourceImageName = lens _ciSourceImageName (\ s a -> s{_ciSourceImageName = a})
ciDestinationImageName :: Lens' CopyImage Text
ciDestinationImageName = lens _ciDestinationImageName (\ s a -> s{_ciDestinationImageName = a})
ciDestinationRegion :: Lens' CopyImage Text
ciDestinationRegion = lens _ciDestinationRegion (\ s a -> s{_ciDestinationRegion = a})
instance AWSRequest CopyImage where
type Rs CopyImage = CopyImageResponse
request = postJSON appStream
response
= receiveJSON
(\ s h x ->
CopyImageResponse' <$>
(x .?> "DestinationImageName") <*>
(pure (fromEnum s)))
instance Hashable CopyImage where
instance NFData CopyImage where
instance ToHeaders CopyImage where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("PhotonAdminProxyService.CopyImage" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CopyImage where
toJSON CopyImage'{..}
= object
(catMaybes
[("DestinationImageDescription" .=) <$>
_ciDestinationImageDescription,
Just ("SourceImageName" .= _ciSourceImageName),
Just
("DestinationImageName" .= _ciDestinationImageName),
Just ("DestinationRegion" .= _ciDestinationRegion)])
instance ToPath CopyImage where
toPath = const "/"
instance ToQuery CopyImage where
toQuery = const mempty
data CopyImageResponse = CopyImageResponse'
{ _cirsDestinationImageName :: !(Maybe Text)
, _cirsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
copyImageResponse
:: Int
-> CopyImageResponse
copyImageResponse pResponseStatus_ =
CopyImageResponse'
{ _cirsDestinationImageName = Nothing
, _cirsResponseStatus = pResponseStatus_
}
cirsDestinationImageName :: Lens' CopyImageResponse (Maybe Text)
cirsDestinationImageName = lens _cirsDestinationImageName (\ s a -> s{_cirsDestinationImageName = a})
cirsResponseStatus :: Lens' CopyImageResponse Int
cirsResponseStatus = lens _cirsResponseStatus (\ s a -> s{_cirsResponseStatus = a})
instance NFData CopyImageResponse where