{-# 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.GetDomainNames
(
getDomainNames
, GetDomainNames
, gdnLimit
, gdnPosition
, getDomainNamesResponse
, GetDomainNamesResponse
, gdnrsItems
, gdnrsPosition
, gdnrsResponseStatus
) where
import Network.AWS.APIGateway.Types
import Network.AWS.APIGateway.Types.Product
import Network.AWS.Lens
import Network.AWS.Pager
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data GetDomainNames = GetDomainNames'
{ _gdnLimit :: !(Maybe Int)
, _gdnPosition :: !(Maybe Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getDomainNames
:: GetDomainNames
getDomainNames =
GetDomainNames'
{ _gdnLimit = Nothing
, _gdnPosition = Nothing
}
gdnLimit :: Lens' GetDomainNames (Maybe Int)
gdnLimit = lens _gdnLimit (\ s a -> s{_gdnLimit = a});
gdnPosition :: Lens' GetDomainNames (Maybe Text)
gdnPosition = lens _gdnPosition (\ s a -> s{_gdnPosition = a});
instance AWSPager GetDomainNames where
page rq rs
| stop (rs ^. gdnrsPosition) = Nothing
| stop (rs ^. gdnrsItems) = Nothing
| otherwise =
Just $ rq & gdnPosition .~ rs ^. gdnrsPosition
instance AWSRequest GetDomainNames where
type Rs GetDomainNames = GetDomainNamesResponse
request = get apiGateway
response
= receiveJSON
(\ s h x ->
GetDomainNamesResponse' <$>
(x .?> "item" .!@ mempty) <*> (x .?> "position") <*>
(pure (fromEnum s)))
instance Hashable GetDomainNames
instance NFData GetDomainNames
instance ToHeaders GetDomainNames where
toHeaders
= const
(mconcat
["Accept" =# ("application/json" :: ByteString)])
instance ToPath GetDomainNames where
toPath = const "/domainnames"
instance ToQuery GetDomainNames where
toQuery GetDomainNames'{..}
= mconcat
["limit" =: _gdnLimit, "position" =: _gdnPosition]
data GetDomainNamesResponse = GetDomainNamesResponse'
{ _gdnrsItems :: !(Maybe [DomainName])
, _gdnrsPosition :: !(Maybe Text)
, _gdnrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getDomainNamesResponse
:: Int
-> GetDomainNamesResponse
getDomainNamesResponse pResponseStatus_ =
GetDomainNamesResponse'
{ _gdnrsItems = Nothing
, _gdnrsPosition = Nothing
, _gdnrsResponseStatus = pResponseStatus_
}
gdnrsItems :: Lens' GetDomainNamesResponse [DomainName]
gdnrsItems = lens _gdnrsItems (\ s a -> s{_gdnrsItems = a}) . _Default . _Coerce;
gdnrsPosition :: Lens' GetDomainNamesResponse (Maybe Text)
gdnrsPosition = lens _gdnrsPosition (\ s a -> s{_gdnrsPosition = a});
gdnrsResponseStatus :: Lens' GetDomainNamesResponse Int
gdnrsResponseStatus = lens _gdnrsResponseStatus (\ s a -> s{_gdnrsResponseStatus = a});
instance NFData GetDomainNamesResponse