module Network.AWS.APIGateway.CreateRestAPI
(
createRestAPI
, CreateRestAPI
, craBinaryMediaTypes
, craVersion
, craCloneFrom
, craEndpointConfiguration
, craDescription
, craName
, restAPI
, RestAPI
, raBinaryMediaTypes
, raWarnings
, raCreatedDate
, raName
, raVersion
, raId
, raEndpointConfiguration
, raDescription
) 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 CreateRestAPI = CreateRestAPI'
{ _craBinaryMediaTypes :: !(Maybe [Text])
, _craVersion :: !(Maybe Text)
, _craCloneFrom :: !(Maybe Text)
, _craEndpointConfiguration :: !(Maybe EndpointConfiguration)
, _craDescription :: !(Maybe Text)
, _craName :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createRestAPI
:: Text
-> CreateRestAPI
createRestAPI pName_ =
CreateRestAPI'
{ _craBinaryMediaTypes = Nothing
, _craVersion = Nothing
, _craCloneFrom = Nothing
, _craEndpointConfiguration = Nothing
, _craDescription = Nothing
, _craName = pName_
}
craBinaryMediaTypes :: Lens' CreateRestAPI [Text]
craBinaryMediaTypes = lens _craBinaryMediaTypes (\ s a -> s{_craBinaryMediaTypes = a}) . _Default . _Coerce;
craVersion :: Lens' CreateRestAPI (Maybe Text)
craVersion = lens _craVersion (\ s a -> s{_craVersion = a});
craCloneFrom :: Lens' CreateRestAPI (Maybe Text)
craCloneFrom = lens _craCloneFrom (\ s a -> s{_craCloneFrom = a});
craEndpointConfiguration :: Lens' CreateRestAPI (Maybe EndpointConfiguration)
craEndpointConfiguration = lens _craEndpointConfiguration (\ s a -> s{_craEndpointConfiguration = a});
craDescription :: Lens' CreateRestAPI (Maybe Text)
craDescription = lens _craDescription (\ s a -> s{_craDescription = a});
craName :: Lens' CreateRestAPI Text
craName = lens _craName (\ s a -> s{_craName = a});
instance AWSRequest CreateRestAPI where
type Rs CreateRestAPI = RestAPI
request = postJSON apiGateway
response = receiveJSON (\ s h x -> eitherParseJSON x)
instance Hashable CreateRestAPI where
instance NFData CreateRestAPI where
instance ToHeaders CreateRestAPI where
toHeaders
= const
(mconcat
["Accept" =# ("application/json" :: ByteString)])
instance ToJSON CreateRestAPI where
toJSON CreateRestAPI'{..}
= object
(catMaybes
[("binaryMediaTypes" .=) <$> _craBinaryMediaTypes,
("version" .=) <$> _craVersion,
("cloneFrom" .=) <$> _craCloneFrom,
("endpointConfiguration" .=) <$>
_craEndpointConfiguration,
("description" .=) <$> _craDescription,
Just ("name" .= _craName)])
instance ToPath CreateRestAPI where
toPath = const "/restapis"
instance ToQuery CreateRestAPI where
toQuery = const mempty