{-# 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.GetUsagePlanKeys
(
getUsagePlanKeys
, GetUsagePlanKeys
, gupkNameQuery
, gupkLimit
, gupkPosition
, gupkUsagePlanId
, getUsagePlanKeysResponse
, GetUsagePlanKeysResponse
, gupkrsItems
, gupkrsPosition
, gupkrsResponseStatus
) 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 GetUsagePlanKeys = GetUsagePlanKeys'
{ _gupkNameQuery :: !(Maybe Text)
, _gupkLimit :: !(Maybe Int)
, _gupkPosition :: !(Maybe Text)
, _gupkUsagePlanId :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getUsagePlanKeys
:: Text
-> GetUsagePlanKeys
getUsagePlanKeys pUsagePlanId_ =
GetUsagePlanKeys'
{ _gupkNameQuery = Nothing
, _gupkLimit = Nothing
, _gupkPosition = Nothing
, _gupkUsagePlanId = pUsagePlanId_
}
gupkNameQuery :: Lens' GetUsagePlanKeys (Maybe Text)
gupkNameQuery = lens _gupkNameQuery (\ s a -> s{_gupkNameQuery = a});
gupkLimit :: Lens' GetUsagePlanKeys (Maybe Int)
gupkLimit = lens _gupkLimit (\ s a -> s{_gupkLimit = a});
gupkPosition :: Lens' GetUsagePlanKeys (Maybe Text)
gupkPosition = lens _gupkPosition (\ s a -> s{_gupkPosition = a});
gupkUsagePlanId :: Lens' GetUsagePlanKeys Text
gupkUsagePlanId = lens _gupkUsagePlanId (\ s a -> s{_gupkUsagePlanId = a});
instance AWSRequest GetUsagePlanKeys where
type Rs GetUsagePlanKeys = GetUsagePlanKeysResponse
request = get apiGateway
response
= receiveJSON
(\ s h x ->
GetUsagePlanKeysResponse' <$>
(x .?> "item" .!@ mempty) <*> (x .?> "position") <*>
(pure (fromEnum s)))
instance Hashable GetUsagePlanKeys
instance NFData GetUsagePlanKeys
instance ToHeaders GetUsagePlanKeys where
toHeaders
= const
(mconcat
["Accept" =# ("application/json" :: ByteString)])
instance ToPath GetUsagePlanKeys where
toPath GetUsagePlanKeys'{..}
= mconcat
["/usageplans/", toBS _gupkUsagePlanId, "/keys"]
instance ToQuery GetUsagePlanKeys where
toQuery GetUsagePlanKeys'{..}
= mconcat
["name" =: _gupkNameQuery, "limit" =: _gupkLimit,
"position" =: _gupkPosition]
data GetUsagePlanKeysResponse = GetUsagePlanKeysResponse'
{ _gupkrsItems :: !(Maybe [UsagePlanKey])
, _gupkrsPosition :: !(Maybe Text)
, _gupkrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getUsagePlanKeysResponse
:: Int
-> GetUsagePlanKeysResponse
getUsagePlanKeysResponse pResponseStatus_ =
GetUsagePlanKeysResponse'
{ _gupkrsItems = Nothing
, _gupkrsPosition = Nothing
, _gupkrsResponseStatus = pResponseStatus_
}
gupkrsItems :: Lens' GetUsagePlanKeysResponse [UsagePlanKey]
gupkrsItems = lens _gupkrsItems (\ s a -> s{_gupkrsItems = a}) . _Default . _Coerce;
gupkrsPosition :: Lens' GetUsagePlanKeysResponse (Maybe Text)
gupkrsPosition = lens _gupkrsPosition (\ s a -> s{_gupkrsPosition = a});
gupkrsResponseStatus :: Lens' GetUsagePlanKeysResponse Int
gupkrsResponseStatus = lens _gupkrsResponseStatus (\ s a -> s{_gupkrsResponseStatus = a});
instance NFData GetUsagePlanKeysResponse