{-# 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.Snowball.ListClusters
(
listClusters
, ListClusters
, lcNextToken
, lcMaxResults
, listClustersResponse
, ListClustersResponse
, lcrsClusterListEntries
, lcrsNextToken
, lcrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.Snowball.Types
import Network.AWS.Snowball.Types.Product
data ListClusters = ListClusters'
{ _lcNextToken :: !(Maybe Text)
, _lcMaxResults :: !(Maybe Nat)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listClusters
:: ListClusters
listClusters = ListClusters' {_lcNextToken = Nothing, _lcMaxResults = Nothing}
lcNextToken :: Lens' ListClusters (Maybe Text)
lcNextToken = lens _lcNextToken (\ s a -> s{_lcNextToken = a})
lcMaxResults :: Lens' ListClusters (Maybe Natural)
lcMaxResults = lens _lcMaxResults (\ s a -> s{_lcMaxResults = a}) . mapping _Nat
instance AWSRequest ListClusters where
type Rs ListClusters = ListClustersResponse
request = postJSON snowball
response
= receiveJSON
(\ s h x ->
ListClustersResponse' <$>
(x .?> "ClusterListEntries" .!@ mempty) <*>
(x .?> "NextToken")
<*> (pure (fromEnum s)))
instance Hashable ListClusters where
instance NFData ListClusters where
instance ToHeaders ListClusters where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSIESnowballJobManagementService.ListClusters" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListClusters where
toJSON ListClusters'{..}
= object
(catMaybes
[("NextToken" .=) <$> _lcNextToken,
("MaxResults" .=) <$> _lcMaxResults])
instance ToPath ListClusters where
toPath = const "/"
instance ToQuery ListClusters where
toQuery = const mempty
data ListClustersResponse = ListClustersResponse'
{ _lcrsClusterListEntries :: !(Maybe [ClusterListEntry])
, _lcrsNextToken :: !(Maybe Text)
, _lcrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listClustersResponse
:: Int
-> ListClustersResponse
listClustersResponse pResponseStatus_ =
ListClustersResponse'
{ _lcrsClusterListEntries = Nothing
, _lcrsNextToken = Nothing
, _lcrsResponseStatus = pResponseStatus_
}
lcrsClusterListEntries :: Lens' ListClustersResponse [ClusterListEntry]
lcrsClusterListEntries = lens _lcrsClusterListEntries (\ s a -> s{_lcrsClusterListEntries = a}) . _Default . _Coerce
lcrsNextToken :: Lens' ListClustersResponse (Maybe Text)
lcrsNextToken = lens _lcrsNextToken (\ s a -> s{_lcrsNextToken = a})
lcrsResponseStatus :: Lens' ListClustersResponse Int
lcrsResponseStatus = lens _lcrsResponseStatus (\ s a -> s{_lcrsResponseStatus = a})
instance NFData ListClustersResponse where