module Network.AWS.APIGateway.PutIntegration
(
putIntegration
, PutIntegration
, pRequestTemplates
, pCredentials
, pRequestParameters
, pUri
, pCacheNamespace
, pIntegrationHTTPMethod
, pCacheKeyParameters
, pRestAPIId
, pResourceId
, pHttpMethod
, pType
, integration
, Integration
, iHttpMethod
, iRequestTemplates
, iCredentials
, iRequestParameters
, iUri
, iIntegrationResponses
, iCacheNamespace
, iType
, iCacheKeyParameters
) where
import Network.AWS.APIGateway.Types
import Network.AWS.APIGateway.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data PutIntegration = PutIntegration'
{ _pRequestTemplates :: !(Maybe (Map Text Text))
, _pCredentials :: !(Maybe Text)
, _pRequestParameters :: !(Maybe (Map Text Text))
, _pUri :: !(Maybe Text)
, _pCacheNamespace :: !(Maybe Text)
, _pIntegrationHTTPMethod :: !(Maybe Text)
, _pCacheKeyParameters :: !(Maybe [Text])
, _pRestAPIId :: !Text
, _pResourceId :: !Text
, _pHttpMethod :: !Text
, _pType :: !IntegrationType
} deriving (Eq,Read,Show,Data,Typeable,Generic)
putIntegration
:: Text
-> Text
-> Text
-> IntegrationType
-> PutIntegration
putIntegration pRestAPIId_ pResourceId_ pHttpMethod_ pType_ =
PutIntegration'
{ _pRequestTemplates = Nothing
, _pCredentials = Nothing
, _pRequestParameters = Nothing
, _pUri = Nothing
, _pCacheNamespace = Nothing
, _pIntegrationHTTPMethod = Nothing
, _pCacheKeyParameters = Nothing
, _pRestAPIId = pRestAPIId_
, _pResourceId = pResourceId_
, _pHttpMethod = pHttpMethod_
, _pType = pType_
}
pRequestTemplates :: Lens' PutIntegration (HashMap Text Text)
pRequestTemplates = lens _pRequestTemplates (\ s a -> s{_pRequestTemplates = a}) . _Default . _Map;
pCredentials :: Lens' PutIntegration (Maybe Text)
pCredentials = lens _pCredentials (\ s a -> s{_pCredentials = a});
pRequestParameters :: Lens' PutIntegration (HashMap Text Text)
pRequestParameters = lens _pRequestParameters (\ s a -> s{_pRequestParameters = a}) . _Default . _Map;
pUri :: Lens' PutIntegration (Maybe Text)
pUri = lens _pUri (\ s a -> s{_pUri = a});
pCacheNamespace :: Lens' PutIntegration (Maybe Text)
pCacheNamespace = lens _pCacheNamespace (\ s a -> s{_pCacheNamespace = a});
pIntegrationHTTPMethod :: Lens' PutIntegration (Maybe Text)
pIntegrationHTTPMethod = lens _pIntegrationHTTPMethod (\ s a -> s{_pIntegrationHTTPMethod = a});
pCacheKeyParameters :: Lens' PutIntegration [Text]
pCacheKeyParameters = lens _pCacheKeyParameters (\ s a -> s{_pCacheKeyParameters = a}) . _Default . _Coerce;
pRestAPIId :: Lens' PutIntegration Text
pRestAPIId = lens _pRestAPIId (\ s a -> s{_pRestAPIId = a});
pResourceId :: Lens' PutIntegration Text
pResourceId = lens _pResourceId (\ s a -> s{_pResourceId = a});
pHttpMethod :: Lens' PutIntegration Text
pHttpMethod = lens _pHttpMethod (\ s a -> s{_pHttpMethod = a});
pType :: Lens' PutIntegration IntegrationType
pType = lens _pType (\ s a -> s{_pType = a});
instance AWSRequest PutIntegration where
type Rs PutIntegration = Integration
request = putJSON apiGateway
response = receiveJSON (\ s h x -> eitherParseJSON x)
instance Hashable PutIntegration
instance ToHeaders PutIntegration where
toHeaders
= const
(mconcat
["Accept" =# ("application/json" :: ByteString)])
instance ToJSON PutIntegration where
toJSON PutIntegration'{..}
= object
(catMaybes
[("requestTemplates" .=) <$> _pRequestTemplates,
("credentials" .=) <$> _pCredentials,
("requestParameters" .=) <$> _pRequestParameters,
("uri" .=) <$> _pUri,
("cacheNamespace" .=) <$> _pCacheNamespace,
("httpMethod" .=) <$> _pIntegrationHTTPMethod,
("cacheKeyParameters" .=) <$> _pCacheKeyParameters,
Just ("type" .= _pType)])
instance ToPath PutIntegration where
toPath PutIntegration'{..}
= mconcat
["/restapis/", toBS _pRestAPIId, "/resources/",
toBS _pResourceId, "/methods/", toBS _pHttpMethod,
"/integration"]
instance ToQuery PutIntegration where
toQuery = const mempty