{-# 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.APIGateway.PutGatewayResponse
(
putGatewayResponse
, PutGatewayResponse
, pgResponseTemplates
, pgStatusCode
, pgResponseParameters
, pgRestAPIId
, pgResponseType
, gatewayResponse
, GatewayResponse
, gDefaultResponse
, gResponseTemplates
, gResponseType
, gStatusCode
, gResponseParameters
) 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 PutGatewayResponse = PutGatewayResponse'
{ _pgResponseTemplates :: !(Maybe (Map Text Text))
, _pgStatusCode :: !(Maybe Text)
, _pgResponseParameters :: !(Maybe (Map Text Text))
, _pgRestAPIId :: !Text
, _pgResponseType :: !GatewayResponseType
} deriving (Eq, Read, Show, Data, Typeable, Generic)
putGatewayResponse
:: Text
-> GatewayResponseType
-> PutGatewayResponse
putGatewayResponse pRestAPIId_ pResponseType_ =
PutGatewayResponse'
{ _pgResponseTemplates = Nothing
, _pgStatusCode = Nothing
, _pgResponseParameters = Nothing
, _pgRestAPIId = pRestAPIId_
, _pgResponseType = pResponseType_
}
pgResponseTemplates :: Lens' PutGatewayResponse (HashMap Text Text)
pgResponseTemplates = lens _pgResponseTemplates (\ s a -> s{_pgResponseTemplates = a}) . _Default . _Map
pgStatusCode :: Lens' PutGatewayResponse (Maybe Text)
pgStatusCode = lens _pgStatusCode (\ s a -> s{_pgStatusCode = a})
pgResponseParameters :: Lens' PutGatewayResponse (HashMap Text Text)
pgResponseParameters = lens _pgResponseParameters (\ s a -> s{_pgResponseParameters = a}) . _Default . _Map
pgRestAPIId :: Lens' PutGatewayResponse Text
pgRestAPIId = lens _pgRestAPIId (\ s a -> s{_pgRestAPIId = a})
pgResponseType :: Lens' PutGatewayResponse GatewayResponseType
pgResponseType = lens _pgResponseType (\ s a -> s{_pgResponseType = a})
instance AWSRequest PutGatewayResponse where
type Rs PutGatewayResponse = GatewayResponse
request = putJSON apiGateway
response = receiveJSON (\ s h x -> eitherParseJSON x)
instance Hashable PutGatewayResponse where
instance NFData PutGatewayResponse where
instance ToHeaders PutGatewayResponse where
toHeaders
= const
(mconcat
["Accept" =# ("application/json" :: ByteString)])
instance ToJSON PutGatewayResponse where
toJSON PutGatewayResponse'{..}
= object
(catMaybes
[("responseTemplates" .=) <$> _pgResponseTemplates,
("statusCode" .=) <$> _pgStatusCode,
("responseParameters" .=) <$> _pgResponseParameters])
instance ToPath PutGatewayResponse where
toPath PutGatewayResponse'{..}
= mconcat
["/restapis/", toBS _pgRestAPIId,
"/gatewayresponses/", toBS _pgResponseType]
instance ToQuery PutGatewayResponse where
toQuery = const mempty