{-# 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.DescribeProduct
(
describeProduct
, DescribeProduct
, dpAcceptLanguage
, dpId
, describeProductResponse
, DescribeProductResponse
, ddrsProductViewSummary
, ddrsProvisioningArtifacts
, ddrsResponseStatus
) 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 DescribeProduct = DescribeProduct'
{ _dpAcceptLanguage :: !(Maybe Text)
, _dpId :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeProduct
:: Text
-> DescribeProduct
describeProduct pId_ =
DescribeProduct'
{ _dpAcceptLanguage = Nothing
, _dpId = pId_
}
dpAcceptLanguage :: Lens' DescribeProduct (Maybe Text)
dpAcceptLanguage = lens _dpAcceptLanguage (\ s a -> s{_dpAcceptLanguage = a});
dpId :: Lens' DescribeProduct Text
dpId = lens _dpId (\ s a -> s{_dpId = a});
instance AWSRequest DescribeProduct where
type Rs DescribeProduct = DescribeProductResponse
request = postJSON serviceCatalog
response
= receiveJSON
(\ s h x ->
DescribeProductResponse' <$>
(x .?> "ProductViewSummary") <*>
(x .?> "ProvisioningArtifacts" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable DescribeProduct
instance NFData DescribeProduct
instance ToHeaders DescribeProduct where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWS242ServiceCatalogService.DescribeProduct" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON DescribeProduct where
toJSON DescribeProduct'{..}
= object
(catMaybes
[("AcceptLanguage" .=) <$> _dpAcceptLanguage,
Just ("Id" .= _dpId)])
instance ToPath DescribeProduct where
toPath = const "/"
instance ToQuery DescribeProduct where
toQuery = const mempty
data DescribeProductResponse = DescribeProductResponse'
{ _ddrsProductViewSummary :: !(Maybe ProductViewSummary)
, _ddrsProvisioningArtifacts :: !(Maybe [ProvisioningArtifact])
, _ddrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeProductResponse
:: Int
-> DescribeProductResponse
describeProductResponse pResponseStatus_ =
DescribeProductResponse'
{ _ddrsProductViewSummary = Nothing
, _ddrsProvisioningArtifacts = Nothing
, _ddrsResponseStatus = pResponseStatus_
}
ddrsProductViewSummary :: Lens' DescribeProductResponse (Maybe ProductViewSummary)
ddrsProductViewSummary = lens _ddrsProductViewSummary (\ s a -> s{_ddrsProductViewSummary = a});
ddrsProvisioningArtifacts :: Lens' DescribeProductResponse [ProvisioningArtifact]
ddrsProvisioningArtifacts = lens _ddrsProvisioningArtifacts (\ s a -> s{_ddrsProvisioningArtifacts = a}) . _Default . _Coerce;
ddrsResponseStatus :: Lens' DescribeProductResponse Int
ddrsResponseStatus = lens _ddrsResponseStatus (\ s a -> s{_ddrsResponseStatus = a});
instance NFData DescribeProductResponse