{-# 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.IoTAnalytics.ListDatastores
(
listDatastores
, ListDatastores
, ldNextToken
, ldMaxResults
, listDatastoresResponse
, ListDatastoresResponse
, ldrsNextToken
, ldrsDatastoreSummaries
, ldrsResponseStatus
) where
import Network.AWS.IoTAnalytics.Types
import Network.AWS.IoTAnalytics.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data ListDatastores = ListDatastores'
{ _ldNextToken :: !(Maybe Text)
, _ldMaxResults :: !(Maybe Nat)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listDatastores
:: ListDatastores
listDatastores =
ListDatastores' {_ldNextToken = Nothing, _ldMaxResults = Nothing}
ldNextToken :: Lens' ListDatastores (Maybe Text)
ldNextToken = lens _ldNextToken (\ s a -> s{_ldNextToken = a})
ldMaxResults :: Lens' ListDatastores (Maybe Natural)
ldMaxResults = lens _ldMaxResults (\ s a -> s{_ldMaxResults = a}) . mapping _Nat
instance AWSRequest ListDatastores where
type Rs ListDatastores = ListDatastoresResponse
request = get ioTAnalytics
response
= receiveJSON
(\ s h x ->
ListDatastoresResponse' <$>
(x .?> "nextToken") <*>
(x .?> "datastoreSummaries" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable ListDatastores where
instance NFData ListDatastores where
instance ToHeaders ListDatastores where
toHeaders = const mempty
instance ToPath ListDatastores where
toPath = const "/datastores"
instance ToQuery ListDatastores where
toQuery ListDatastores'{..}
= mconcat
["nextToken" =: _ldNextToken,
"maxResults" =: _ldMaxResults]
data ListDatastoresResponse = ListDatastoresResponse'
{ _ldrsNextToken :: !(Maybe Text)
, _ldrsDatastoreSummaries :: !(Maybe [DatastoreSummary])
, _ldrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listDatastoresResponse
:: Int
-> ListDatastoresResponse
listDatastoresResponse pResponseStatus_ =
ListDatastoresResponse'
{ _ldrsNextToken = Nothing
, _ldrsDatastoreSummaries = Nothing
, _ldrsResponseStatus = pResponseStatus_
}
ldrsNextToken :: Lens' ListDatastoresResponse (Maybe Text)
ldrsNextToken = lens _ldrsNextToken (\ s a -> s{_ldrsNextToken = a})
ldrsDatastoreSummaries :: Lens' ListDatastoresResponse [DatastoreSummary]
ldrsDatastoreSummaries = lens _ldrsDatastoreSummaries (\ s a -> s{_ldrsDatastoreSummaries = a}) . _Default . _Coerce
ldrsResponseStatus :: Lens' ListDatastoresResponse Int
ldrsResponseStatus = lens _ldrsResponseStatus (\ s a -> s{_ldrsResponseStatus = a})
instance NFData ListDatastoresResponse where