{-# 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.ServiceCatalog.CopyProduct
(
copyProduct
, CopyProduct
, cTargetProductId
, cSourceProvisioningArtifactIdentifiers
, cTargetProductName
, cCopyOptions
, cAcceptLanguage
, cSourceProductARN
, cIdempotencyToken
, copyProductResponse
, CopyProductResponse
, coprsCopyProductToken
, coprsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.ServiceCatalog.Types
import Network.AWS.ServiceCatalog.Types.Product
data CopyProduct = CopyProduct'
{ _cTargetProductId :: !(Maybe Text)
, _cSourceProvisioningArtifactIdentifiers :: !(Maybe [Map ProvisioningArtifactPropertyName Text])
, _cTargetProductName :: !(Maybe Text)
, _cCopyOptions :: !(Maybe [CopyOption])
, _cAcceptLanguage :: !(Maybe Text)
, _cSourceProductARN :: !Text
, _cIdempotencyToken :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
copyProduct
:: Text
-> Text
-> CopyProduct
copyProduct pSourceProductARN_ pIdempotencyToken_ =
CopyProduct'
{ _cTargetProductId = Nothing
, _cSourceProvisioningArtifactIdentifiers = Nothing
, _cTargetProductName = Nothing
, _cCopyOptions = Nothing
, _cAcceptLanguage = Nothing
, _cSourceProductARN = pSourceProductARN_
, _cIdempotencyToken = pIdempotencyToken_
}
cTargetProductId :: Lens' CopyProduct (Maybe Text)
cTargetProductId = lens _cTargetProductId (\ s a -> s{_cTargetProductId = a})
cSourceProvisioningArtifactIdentifiers :: Lens' CopyProduct [HashMap ProvisioningArtifactPropertyName Text]
cSourceProvisioningArtifactIdentifiers = lens _cSourceProvisioningArtifactIdentifiers (\ s a -> s{_cSourceProvisioningArtifactIdentifiers = a}) . _Default . _Coerce
cTargetProductName :: Lens' CopyProduct (Maybe Text)
cTargetProductName = lens _cTargetProductName (\ s a -> s{_cTargetProductName = a})
cCopyOptions :: Lens' CopyProduct [CopyOption]
cCopyOptions = lens _cCopyOptions (\ s a -> s{_cCopyOptions = a}) . _Default . _Coerce
cAcceptLanguage :: Lens' CopyProduct (Maybe Text)
cAcceptLanguage = lens _cAcceptLanguage (\ s a -> s{_cAcceptLanguage = a})
cSourceProductARN :: Lens' CopyProduct Text
cSourceProductARN = lens _cSourceProductARN (\ s a -> s{_cSourceProductARN = a})
cIdempotencyToken :: Lens' CopyProduct Text
cIdempotencyToken = lens _cIdempotencyToken (\ s a -> s{_cIdempotencyToken = a})
instance AWSRequest CopyProduct where
type Rs CopyProduct = CopyProductResponse
request = postJSON serviceCatalog
response
= receiveJSON
(\ s h x ->
CopyProductResponse' <$>
(x .?> "CopyProductToken") <*> (pure (fromEnum s)))
instance Hashable CopyProduct where
instance NFData CopyProduct where
instance ToHeaders CopyProduct where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWS242ServiceCatalogService.CopyProduct" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CopyProduct where
toJSON CopyProduct'{..}
= object
(catMaybes
[("TargetProductId" .=) <$> _cTargetProductId,
("SourceProvisioningArtifactIdentifiers" .=) <$>
_cSourceProvisioningArtifactIdentifiers,
("TargetProductName" .=) <$> _cTargetProductName,
("CopyOptions" .=) <$> _cCopyOptions,
("AcceptLanguage" .=) <$> _cAcceptLanguage,
Just ("SourceProductArn" .= _cSourceProductARN),
Just ("IdempotencyToken" .= _cIdempotencyToken)])
instance ToPath CopyProduct where
toPath = const "/"
instance ToQuery CopyProduct where
toQuery = const mempty
data CopyProductResponse = CopyProductResponse'
{ _coprsCopyProductToken :: !(Maybe Text)
, _coprsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
copyProductResponse
:: Int
-> CopyProductResponse
copyProductResponse pResponseStatus_ =
CopyProductResponse'
{_coprsCopyProductToken = Nothing, _coprsResponseStatus = pResponseStatus_}
coprsCopyProductToken :: Lens' CopyProductResponse (Maybe Text)
coprsCopyProductToken = lens _coprsCopyProductToken (\ s a -> s{_coprsCopyProductToken = a})
coprsResponseStatus :: Lens' CopyProductResponse Int
coprsResponseStatus = lens _coprsResponseStatus (\ s a -> s{_coprsResponseStatus = a})
instance NFData CopyProductResponse where