{-# 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.GetUsagePlans
(
getUsagePlans
, GetUsagePlans
, gupKeyId
, gupLimit
, gupPosition
, getUsagePlansResponse
, GetUsagePlansResponse
, guprsItems
, guprsPosition
, guprsResponseStatus
) 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 GetUsagePlans = GetUsagePlans'
{ _gupKeyId :: !(Maybe Text)
, _gupLimit :: !(Maybe Int)
, _gupPosition :: !(Maybe Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getUsagePlans
:: GetUsagePlans
getUsagePlans =
GetUsagePlans'
{ _gupKeyId = Nothing
, _gupLimit = Nothing
, _gupPosition = Nothing
}
gupKeyId :: Lens' GetUsagePlans (Maybe Text)
gupKeyId = lens _gupKeyId (\ s a -> s{_gupKeyId = a});
gupLimit :: Lens' GetUsagePlans (Maybe Int)
gupLimit = lens _gupLimit (\ s a -> s{_gupLimit = a});
gupPosition :: Lens' GetUsagePlans (Maybe Text)
gupPosition = lens _gupPosition (\ s a -> s{_gupPosition = a});
instance AWSRequest GetUsagePlans where
type Rs GetUsagePlans = GetUsagePlansResponse
request = get apiGateway
response
= receiveJSON
(\ s h x ->
GetUsagePlansResponse' <$>
(x .?> "item" .!@ mempty) <*> (x .?> "position") <*>
(pure (fromEnum s)))
instance Hashable GetUsagePlans
instance NFData GetUsagePlans
instance ToHeaders GetUsagePlans where
toHeaders
= const
(mconcat
["Accept" =# ("application/json" :: ByteString)])
instance ToPath GetUsagePlans where
toPath = const "/usageplans"
instance ToQuery GetUsagePlans where
toQuery GetUsagePlans'{..}
= mconcat
["keyId" =: _gupKeyId, "limit" =: _gupLimit,
"position" =: _gupPosition]
data GetUsagePlansResponse = GetUsagePlansResponse'
{ _guprsItems :: !(Maybe [UsagePlan])
, _guprsPosition :: !(Maybe Text)
, _guprsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getUsagePlansResponse
:: Int
-> GetUsagePlansResponse
getUsagePlansResponse pResponseStatus_ =
GetUsagePlansResponse'
{ _guprsItems = Nothing
, _guprsPosition = Nothing
, _guprsResponseStatus = pResponseStatus_
}
guprsItems :: Lens' GetUsagePlansResponse [UsagePlan]
guprsItems = lens _guprsItems (\ s a -> s{_guprsItems = a}) . _Default . _Coerce;
guprsPosition :: Lens' GetUsagePlansResponse (Maybe Text)
guprsPosition = lens _guprsPosition (\ s a -> s{_guprsPosition = a});
guprsResponseStatus :: Lens' GetUsagePlansResponse Int
guprsResponseStatus = lens _guprsResponseStatus (\ s a -> s{_guprsResponseStatus = a});
instance NFData GetUsagePlansResponse