{-# 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.ListClusterJobs
(
listClusterJobs
, ListClusterJobs
, lcjNextToken
, lcjMaxResults
, lcjClusterId
, listClusterJobsResponse
, ListClusterJobsResponse
, lcjrsJobListEntries
, lcjrsNextToken
, lcjrsResponseStatus
) 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 ListClusterJobs = ListClusterJobs'
{ _lcjNextToken :: !(Maybe Text)
, _lcjMaxResults :: !(Maybe Nat)
, _lcjClusterId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listClusterJobs
:: Text
-> ListClusterJobs
listClusterJobs pClusterId_ =
ListClusterJobs'
{ _lcjNextToken = Nothing
, _lcjMaxResults = Nothing
, _lcjClusterId = pClusterId_
}
lcjNextToken :: Lens' ListClusterJobs (Maybe Text)
lcjNextToken = lens _lcjNextToken (\ s a -> s{_lcjNextToken = a})
lcjMaxResults :: Lens' ListClusterJobs (Maybe Natural)
lcjMaxResults = lens _lcjMaxResults (\ s a -> s{_lcjMaxResults = a}) . mapping _Nat
lcjClusterId :: Lens' ListClusterJobs Text
lcjClusterId = lens _lcjClusterId (\ s a -> s{_lcjClusterId = a})
instance AWSRequest ListClusterJobs where
type Rs ListClusterJobs = ListClusterJobsResponse
request = postJSON snowball
response
= receiveJSON
(\ s h x ->
ListClusterJobsResponse' <$>
(x .?> "JobListEntries" .!@ mempty) <*>
(x .?> "NextToken")
<*> (pure (fromEnum s)))
instance Hashable ListClusterJobs where
instance NFData ListClusterJobs where
instance ToHeaders ListClusterJobs where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSIESnowballJobManagementService.ListClusterJobs"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListClusterJobs where
toJSON ListClusterJobs'{..}
= object
(catMaybes
[("NextToken" .=) <$> _lcjNextToken,
("MaxResults" .=) <$> _lcjMaxResults,
Just ("ClusterId" .= _lcjClusterId)])
instance ToPath ListClusterJobs where
toPath = const "/"
instance ToQuery ListClusterJobs where
toQuery = const mempty
data ListClusterJobsResponse = ListClusterJobsResponse'
{ _lcjrsJobListEntries :: !(Maybe [JobListEntry])
, _lcjrsNextToken :: !(Maybe Text)
, _lcjrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listClusterJobsResponse
:: Int
-> ListClusterJobsResponse
listClusterJobsResponse pResponseStatus_ =
ListClusterJobsResponse'
{ _lcjrsJobListEntries = Nothing
, _lcjrsNextToken = Nothing
, _lcjrsResponseStatus = pResponseStatus_
}
lcjrsJobListEntries :: Lens' ListClusterJobsResponse [JobListEntry]
lcjrsJobListEntries = lens _lcjrsJobListEntries (\ s a -> s{_lcjrsJobListEntries = a}) . _Default . _Coerce
lcjrsNextToken :: Lens' ListClusterJobsResponse (Maybe Text)
lcjrsNextToken = lens _lcjrsNextToken (\ s a -> s{_lcjrsNextToken = a})
lcjrsResponseStatus :: Lens' ListClusterJobsResponse Int
lcjrsResponseStatus = lens _lcjrsResponseStatus (\ s a -> s{_lcjrsResponseStatus = a})
instance NFData ListClusterJobsResponse where