{-# 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.GetAuthorizers
(
getAuthorizers
, GetAuthorizers
, gaLimit
, gaPosition
, gaRestAPIId
, getAuthorizersResponse
, GetAuthorizersResponse
, garsItems
, garsPosition
, garsResponseStatus
) 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 GetAuthorizers = GetAuthorizers'
{ _gaLimit :: !(Maybe Int)
, _gaPosition :: !(Maybe Text)
, _gaRestAPIId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getAuthorizers
:: Text
-> GetAuthorizers
getAuthorizers pRestAPIId_ =
GetAuthorizers'
{_gaLimit = Nothing, _gaPosition = Nothing, _gaRestAPIId = pRestAPIId_}
gaLimit :: Lens' GetAuthorizers (Maybe Int)
gaLimit = lens _gaLimit (\ s a -> s{_gaLimit = a})
gaPosition :: Lens' GetAuthorizers (Maybe Text)
gaPosition = lens _gaPosition (\ s a -> s{_gaPosition = a})
gaRestAPIId :: Lens' GetAuthorizers Text
gaRestAPIId = lens _gaRestAPIId (\ s a -> s{_gaRestAPIId = a})
instance AWSRequest GetAuthorizers where
type Rs GetAuthorizers = GetAuthorizersResponse
request = get apiGateway
response
= receiveJSON
(\ s h x ->
GetAuthorizersResponse' <$>
(x .?> "item" .!@ mempty) <*> (x .?> "position") <*>
(pure (fromEnum s)))
instance Hashable GetAuthorizers where
instance NFData GetAuthorizers where
instance ToHeaders GetAuthorizers where
toHeaders
= const
(mconcat
["Accept" =# ("application/json" :: ByteString)])
instance ToPath GetAuthorizers where
toPath GetAuthorizers'{..}
= mconcat
["/restapis/", toBS _gaRestAPIId, "/authorizers"]
instance ToQuery GetAuthorizers where
toQuery GetAuthorizers'{..}
= mconcat
["limit" =: _gaLimit, "position" =: _gaPosition]
data GetAuthorizersResponse = GetAuthorizersResponse'
{ _garsItems :: !(Maybe [Authorizer])
, _garsPosition :: !(Maybe Text)
, _garsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getAuthorizersResponse
:: Int
-> GetAuthorizersResponse
getAuthorizersResponse pResponseStatus_ =
GetAuthorizersResponse'
{ _garsItems = Nothing
, _garsPosition = Nothing
, _garsResponseStatus = pResponseStatus_
}
garsItems :: Lens' GetAuthorizersResponse [Authorizer]
garsItems = lens _garsItems (\ s a -> s{_garsItems = a}) . _Default . _Coerce
garsPosition :: Lens' GetAuthorizersResponse (Maybe Text)
garsPosition = lens _garsPosition (\ s a -> s{_garsPosition = a})
garsResponseStatus :: Lens' GetAuthorizersResponse Int
garsResponseStatus = lens _garsResponseStatus (\ s a -> s{_garsResponseStatus = a})
instance NFData GetAuthorizersResponse where