{-# 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.GetStages
(
getStages
, GetStages
, gsDeploymentId
, gsRestAPIId
, getStagesResponse
, GetStagesResponse
, gsrsItem
, gsrsResponseStatus
) 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 GetStages = GetStages'
{ _gsDeploymentId :: !(Maybe Text)
, _gsRestAPIId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getStages
:: Text
-> GetStages
getStages pRestAPIId_ =
GetStages' {_gsDeploymentId = Nothing, _gsRestAPIId = pRestAPIId_}
gsDeploymentId :: Lens' GetStages (Maybe Text)
gsDeploymentId = lens _gsDeploymentId (\ s a -> s{_gsDeploymentId = a})
gsRestAPIId :: Lens' GetStages Text
gsRestAPIId = lens _gsRestAPIId (\ s a -> s{_gsRestAPIId = a})
instance AWSRequest GetStages where
type Rs GetStages = GetStagesResponse
request = get apiGateway
response
= receiveJSON
(\ s h x ->
GetStagesResponse' <$>
(x .?> "item" .!@ mempty) <*> (pure (fromEnum s)))
instance Hashable GetStages where
instance NFData GetStages where
instance ToHeaders GetStages where
toHeaders
= const
(mconcat
["Accept" =# ("application/json" :: ByteString)])
instance ToPath GetStages where
toPath GetStages'{..}
= mconcat
["/restapis/", toBS _gsRestAPIId, "/stages"]
instance ToQuery GetStages where
toQuery GetStages'{..}
= mconcat ["deploymentId" =: _gsDeploymentId]
data GetStagesResponse = GetStagesResponse'
{ _gsrsItem :: !(Maybe [Stage])
, _gsrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getStagesResponse
:: Int
-> GetStagesResponse
getStagesResponse pResponseStatus_ =
GetStagesResponse'
{_gsrsItem = Nothing, _gsrsResponseStatus = pResponseStatus_}
gsrsItem :: Lens' GetStagesResponse [Stage]
gsrsItem = lens _gsrsItem (\ s a -> s{_gsrsItem = a}) . _Default . _Coerce
gsrsResponseStatus :: Lens' GetStagesResponse Int
gsrsResponseStatus = lens _gsrsResponseStatus (\ s a -> s{_gsrsResponseStatus = a})
instance NFData GetStagesResponse where