{-# 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.CreateProduct
(
createProduct
, CreateProduct
, cpSupportURL
, cpDistributor
, cpAcceptLanguage
, cpSupportEmail
, cpDescription
, cpTags
, cpSupportDescription
, cpName
, cpOwner
, cpProductType
, cpProvisioningArtifactParameters
, cpIdempotencyToken
, createProductResponse
, CreateProductResponse
, cprsProductViewDetail
, cprsProvisioningArtifactDetail
, cprsTags
, cprsResponseStatus
) 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 CreateProduct = CreateProduct'
{ _cpSupportURL :: !(Maybe Text)
, _cpDistributor :: !(Maybe Text)
, _cpAcceptLanguage :: !(Maybe Text)
, _cpSupportEmail :: !(Maybe Text)
, _cpDescription :: !(Maybe Text)
, _cpTags :: !(Maybe [Tag])
, _cpSupportDescription :: !(Maybe Text)
, _cpName :: !Text
, _cpOwner :: !Text
, _cpProductType :: !ProductType
, _cpProvisioningArtifactParameters :: !ProvisioningArtifactProperties
, _cpIdempotencyToken :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createProduct
:: Text
-> Text
-> ProductType
-> ProvisioningArtifactProperties
-> Text
-> CreateProduct
createProduct pName_ pOwner_ pProductType_ pProvisioningArtifactParameters_ pIdempotencyToken_ =
CreateProduct'
{ _cpSupportURL = Nothing
, _cpDistributor = Nothing
, _cpAcceptLanguage = Nothing
, _cpSupportEmail = Nothing
, _cpDescription = Nothing
, _cpTags = Nothing
, _cpSupportDescription = Nothing
, _cpName = pName_
, _cpOwner = pOwner_
, _cpProductType = pProductType_
, _cpProvisioningArtifactParameters = pProvisioningArtifactParameters_
, _cpIdempotencyToken = pIdempotencyToken_
}
cpSupportURL :: Lens' CreateProduct (Maybe Text)
cpSupportURL = lens _cpSupportURL (\ s a -> s{_cpSupportURL = a});
cpDistributor :: Lens' CreateProduct (Maybe Text)
cpDistributor = lens _cpDistributor (\ s a -> s{_cpDistributor = a});
cpAcceptLanguage :: Lens' CreateProduct (Maybe Text)
cpAcceptLanguage = lens _cpAcceptLanguage (\ s a -> s{_cpAcceptLanguage = a});
cpSupportEmail :: Lens' CreateProduct (Maybe Text)
cpSupportEmail = lens _cpSupportEmail (\ s a -> s{_cpSupportEmail = a});
cpDescription :: Lens' CreateProduct (Maybe Text)
cpDescription = lens _cpDescription (\ s a -> s{_cpDescription = a});
cpTags :: Lens' CreateProduct [Tag]
cpTags = lens _cpTags (\ s a -> s{_cpTags = a}) . _Default . _Coerce;
cpSupportDescription :: Lens' CreateProduct (Maybe Text)
cpSupportDescription = lens _cpSupportDescription (\ s a -> s{_cpSupportDescription = a});
cpName :: Lens' CreateProduct Text
cpName = lens _cpName (\ s a -> s{_cpName = a});
cpOwner :: Lens' CreateProduct Text
cpOwner = lens _cpOwner (\ s a -> s{_cpOwner = a});
cpProductType :: Lens' CreateProduct ProductType
cpProductType = lens _cpProductType (\ s a -> s{_cpProductType = a});
cpProvisioningArtifactParameters :: Lens' CreateProduct ProvisioningArtifactProperties
cpProvisioningArtifactParameters = lens _cpProvisioningArtifactParameters (\ s a -> s{_cpProvisioningArtifactParameters = a});
cpIdempotencyToken :: Lens' CreateProduct Text
cpIdempotencyToken = lens _cpIdempotencyToken (\ s a -> s{_cpIdempotencyToken = a});
instance AWSRequest CreateProduct where
type Rs CreateProduct = CreateProductResponse
request = postJSON serviceCatalog
response
= receiveJSON
(\ s h x ->
CreateProductResponse' <$>
(x .?> "ProductViewDetail") <*>
(x .?> "ProvisioningArtifactDetail")
<*> (x .?> "Tags" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable CreateProduct
instance NFData CreateProduct
instance ToHeaders CreateProduct where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWS242ServiceCatalogService.CreateProduct" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateProduct where
toJSON CreateProduct'{..}
= object
(catMaybes
[("SupportUrl" .=) <$> _cpSupportURL,
("Distributor" .=) <$> _cpDistributor,
("AcceptLanguage" .=) <$> _cpAcceptLanguage,
("SupportEmail" .=) <$> _cpSupportEmail,
("Description" .=) <$> _cpDescription,
("Tags" .=) <$> _cpTags,
("SupportDescription" .=) <$> _cpSupportDescription,
Just ("Name" .= _cpName), Just ("Owner" .= _cpOwner),
Just ("ProductType" .= _cpProductType),
Just
("ProvisioningArtifactParameters" .=
_cpProvisioningArtifactParameters),
Just ("IdempotencyToken" .= _cpIdempotencyToken)])
instance ToPath CreateProduct where
toPath = const "/"
instance ToQuery CreateProduct where
toQuery = const mempty
data CreateProductResponse = CreateProductResponse'
{ _cprsProductViewDetail :: !(Maybe ProductViewDetail)
, _cprsProvisioningArtifactDetail :: !(Maybe ProvisioningArtifactDetail)
, _cprsTags :: !(Maybe [Tag])
, _cprsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createProductResponse
:: Int
-> CreateProductResponse
createProductResponse pResponseStatus_ =
CreateProductResponse'
{ _cprsProductViewDetail = Nothing
, _cprsProvisioningArtifactDetail = Nothing
, _cprsTags = Nothing
, _cprsResponseStatus = pResponseStatus_
}
cprsProductViewDetail :: Lens' CreateProductResponse (Maybe ProductViewDetail)
cprsProductViewDetail = lens _cprsProductViewDetail (\ s a -> s{_cprsProductViewDetail = a});
cprsProvisioningArtifactDetail :: Lens' CreateProductResponse (Maybe ProvisioningArtifactDetail)
cprsProvisioningArtifactDetail = lens _cprsProvisioningArtifactDetail (\ s a -> s{_cprsProvisioningArtifactDetail = a});
cprsTags :: Lens' CreateProductResponse [Tag]
cprsTags = lens _cprsTags (\ s a -> s{_cprsTags = a}) . _Default . _Coerce;
cprsResponseStatus :: Lens' CreateProductResponse Int
cprsResponseStatus = lens _cprsResponseStatus (\ s a -> s{_cprsResponseStatus = a});
instance NFData CreateProductResponse