amazonka-sqs-1.2.0: gen/Network/AWS/SQS/ListQueues.hs
{-# 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 #-}
-- Derived from AWS service descriptions, licensed under Apache 2.0.
-- |
-- Module : Network.AWS.SQS.ListQueues
-- Copyright : (c) 2013-2015 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
-- Stability : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns a list of your queues. The maximum number of queues that can be
-- returned is 1000. If you specify a value for the optional
-- 'QueueNamePrefix' parameter, only queues with a name beginning with the
-- specified value are returned.
--
-- /See:/ <http://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ListQueues.html AWS API Reference> for ListQueues.
module Network.AWS.SQS.ListQueues
(
-- * Creating a Request
listQueues
, ListQueues
-- * Request Lenses
, lqQueueNamePrefix
-- * Destructuring the Response
, listQueuesResponse
, ListQueuesResponse
-- * Response Lenses
, lqrsQueueURLs
, lqrsStatus
) where
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.SQS.Types
import Network.AWS.SQS.Types.Product
-- | /See:/ 'listQueues' smart constructor.
newtype ListQueues = ListQueues'
{ _lqQueueNamePrefix :: Maybe Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
-- | Creates a value of 'ListQueues' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'lqQueueNamePrefix'
listQueues
:: ListQueues
listQueues =
ListQueues'
{ _lqQueueNamePrefix = Nothing
}
-- | A string to use for filtering the list results. Only those queues whose
-- name begins with the specified string are returned.
lqQueueNamePrefix :: Lens' ListQueues (Maybe Text)
lqQueueNamePrefix = lens _lqQueueNamePrefix (\ s a -> s{_lqQueueNamePrefix = a});
instance AWSRequest ListQueues where
type Rs ListQueues = ListQueuesResponse
request = postQuery sQS
response
= receiveXMLWrapper "ListQueuesResult"
(\ s h x ->
ListQueuesResponse' <$>
(may (parseXMLList "QueueUrl") x) <*>
(pure (fromEnum s)))
instance ToHeaders ListQueues where
toHeaders = const mempty
instance ToPath ListQueues where
toPath = const "/"
instance ToQuery ListQueues where
toQuery ListQueues'{..}
= mconcat
["Action" =: ("ListQueues" :: ByteString),
"Version" =: ("2012-11-05" :: ByteString),
"QueueNamePrefix" =: _lqQueueNamePrefix]
-- | A list of your queues.
--
-- /See:/ 'listQueuesResponse' smart constructor.
data ListQueuesResponse = ListQueuesResponse'
{ _lqrsQueueURLs :: !(Maybe [Text])
, _lqrsStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
-- | Creates a value of 'ListQueuesResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'lqrsQueueURLs'
--
-- * 'lqrsStatus'
listQueuesResponse
:: Int -- ^ 'lqrsStatus'
-> ListQueuesResponse
listQueuesResponse pStatus_ =
ListQueuesResponse'
{ _lqrsQueueURLs = Nothing
, _lqrsStatus = pStatus_
}
-- | A list of queue URLs, up to 1000 entries.
lqrsQueueURLs :: Lens' ListQueuesResponse [Text]
lqrsQueueURLs = lens _lqrsQueueURLs (\ s a -> s{_lqrsQueueURLs = a}) . _Default . _Coerce;
-- | The response status code.
lqrsStatus :: Lens' ListQueuesResponse Int
lqrsStatus = lens _lqrsStatus (\ s a -> s{_lqrsStatus = a});