{-# 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.CreateConstraint
(
createConstraint
, CreateConstraint
, ccAcceptLanguage
, ccDescription
, ccPortfolioId
, ccProductId
, ccParameters
, ccType
, ccIdempotencyToken
, createConstraintResponse
, CreateConstraintResponse
, ccrsStatus
, ccrsConstraintDetail
, ccrsConstraintParameters
, ccrsResponseStatus
) 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 CreateConstraint = CreateConstraint'
{ _ccAcceptLanguage :: !(Maybe Text)
, _ccDescription :: !(Maybe Text)
, _ccPortfolioId :: !Text
, _ccProductId :: !Text
, _ccParameters :: !Text
, _ccType :: !Text
, _ccIdempotencyToken :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createConstraint
:: Text
-> Text
-> Text
-> Text
-> Text
-> CreateConstraint
createConstraint pPortfolioId_ pProductId_ pParameters_ pType_ pIdempotencyToken_ =
CreateConstraint'
{ _ccAcceptLanguage = Nothing
, _ccDescription = Nothing
, _ccPortfolioId = pPortfolioId_
, _ccProductId = pProductId_
, _ccParameters = pParameters_
, _ccType = pType_
, _ccIdempotencyToken = pIdempotencyToken_
}
ccAcceptLanguage :: Lens' CreateConstraint (Maybe Text)
ccAcceptLanguage = lens _ccAcceptLanguage (\ s a -> s{_ccAcceptLanguage = a});
ccDescription :: Lens' CreateConstraint (Maybe Text)
ccDescription = lens _ccDescription (\ s a -> s{_ccDescription = a});
ccPortfolioId :: Lens' CreateConstraint Text
ccPortfolioId = lens _ccPortfolioId (\ s a -> s{_ccPortfolioId = a});
ccProductId :: Lens' CreateConstraint Text
ccProductId = lens _ccProductId (\ s a -> s{_ccProductId = a});
ccParameters :: Lens' CreateConstraint Text
ccParameters = lens _ccParameters (\ s a -> s{_ccParameters = a});
ccType :: Lens' CreateConstraint Text
ccType = lens _ccType (\ s a -> s{_ccType = a});
ccIdempotencyToken :: Lens' CreateConstraint Text
ccIdempotencyToken = lens _ccIdempotencyToken (\ s a -> s{_ccIdempotencyToken = a});
instance AWSRequest CreateConstraint where
type Rs CreateConstraint = CreateConstraintResponse
request = postJSON serviceCatalog
response
= receiveJSON
(\ s h x ->
CreateConstraintResponse' <$>
(x .?> "Status") <*> (x .?> "ConstraintDetail") <*>
(x .?> "ConstraintParameters")
<*> (pure (fromEnum s)))
instance Hashable CreateConstraint
instance NFData CreateConstraint
instance ToHeaders CreateConstraint where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWS242ServiceCatalogService.CreateConstraint" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateConstraint where
toJSON CreateConstraint'{..}
= object
(catMaybes
[("AcceptLanguage" .=) <$> _ccAcceptLanguage,
("Description" .=) <$> _ccDescription,
Just ("PortfolioId" .= _ccPortfolioId),
Just ("ProductId" .= _ccProductId),
Just ("Parameters" .= _ccParameters),
Just ("Type" .= _ccType),
Just ("IdempotencyToken" .= _ccIdempotencyToken)])
instance ToPath CreateConstraint where
toPath = const "/"
instance ToQuery CreateConstraint where
toQuery = const mempty
data CreateConstraintResponse = CreateConstraintResponse'
{ _ccrsStatus :: !(Maybe RequestStatus)
, _ccrsConstraintDetail :: !(Maybe ConstraintDetail)
, _ccrsConstraintParameters :: !(Maybe Text)
, _ccrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createConstraintResponse
:: Int
-> CreateConstraintResponse
createConstraintResponse pResponseStatus_ =
CreateConstraintResponse'
{ _ccrsStatus = Nothing
, _ccrsConstraintDetail = Nothing
, _ccrsConstraintParameters = Nothing
, _ccrsResponseStatus = pResponseStatus_
}
ccrsStatus :: Lens' CreateConstraintResponse (Maybe RequestStatus)
ccrsStatus = lens _ccrsStatus (\ s a -> s{_ccrsStatus = a});
ccrsConstraintDetail :: Lens' CreateConstraintResponse (Maybe ConstraintDetail)
ccrsConstraintDetail = lens _ccrsConstraintDetail (\ s a -> s{_ccrsConstraintDetail = a});
ccrsConstraintParameters :: Lens' CreateConstraintResponse (Maybe Text)
ccrsConstraintParameters = lens _ccrsConstraintParameters (\ s a -> s{_ccrsConstraintParameters = a});
ccrsResponseStatus :: Lens' CreateConstraintResponse Int
ccrsResponseStatus = lens _ccrsResponseStatus (\ s a -> s{_ccrsResponseStatus = a});
instance NFData CreateConstraintResponse