{-# 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.IoT.ListJobs
(
listJobs
, ListJobs
, ljStatus
, ljThingGroupId
, ljNextToken
, ljThingGroupName
, ljMaxResults
, ljTargetSelection
, listJobsResponse
, ListJobsResponse
, ljrsJobs
, ljrsNextToken
, ljrsResponseStatus
) where
import Network.AWS.IoT.Types
import Network.AWS.IoT.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data ListJobs = ListJobs'
{ _ljStatus :: !(Maybe JobStatus)
, _ljThingGroupId :: !(Maybe Text)
, _ljNextToken :: !(Maybe Text)
, _ljThingGroupName :: !(Maybe Text)
, _ljMaxResults :: !(Maybe Nat)
, _ljTargetSelection :: !(Maybe TargetSelection)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listJobs
:: ListJobs
listJobs =
ListJobs'
{ _ljStatus = Nothing
, _ljThingGroupId = Nothing
, _ljNextToken = Nothing
, _ljThingGroupName = Nothing
, _ljMaxResults = Nothing
, _ljTargetSelection = Nothing
}
ljStatus :: Lens' ListJobs (Maybe JobStatus)
ljStatus = lens _ljStatus (\ s a -> s{_ljStatus = a})
ljThingGroupId :: Lens' ListJobs (Maybe Text)
ljThingGroupId = lens _ljThingGroupId (\ s a -> s{_ljThingGroupId = a})
ljNextToken :: Lens' ListJobs (Maybe Text)
ljNextToken = lens _ljNextToken (\ s a -> s{_ljNextToken = a})
ljThingGroupName :: Lens' ListJobs (Maybe Text)
ljThingGroupName = lens _ljThingGroupName (\ s a -> s{_ljThingGroupName = a})
ljMaxResults :: Lens' ListJobs (Maybe Natural)
ljMaxResults = lens _ljMaxResults (\ s a -> s{_ljMaxResults = a}) . mapping _Nat
ljTargetSelection :: Lens' ListJobs (Maybe TargetSelection)
ljTargetSelection = lens _ljTargetSelection (\ s a -> s{_ljTargetSelection = a})
instance AWSRequest ListJobs where
type Rs ListJobs = ListJobsResponse
request = get ioT
response
= receiveJSON
(\ s h x ->
ListJobsResponse' <$>
(x .?> "jobs" .!@ mempty) <*> (x .?> "nextToken") <*>
(pure (fromEnum s)))
instance Hashable ListJobs where
instance NFData ListJobs where
instance ToHeaders ListJobs where
toHeaders = const mempty
instance ToPath ListJobs where
toPath = const "/jobs"
instance ToQuery ListJobs where
toQuery ListJobs'{..}
= mconcat
["status" =: _ljStatus,
"thingGroupId" =: _ljThingGroupId,
"nextToken" =: _ljNextToken,
"thingGroupName" =: _ljThingGroupName,
"maxResults" =: _ljMaxResults,
"targetSelection" =: _ljTargetSelection]
data ListJobsResponse = ListJobsResponse'
{ _ljrsJobs :: !(Maybe [JobSummary])
, _ljrsNextToken :: !(Maybe Text)
, _ljrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listJobsResponse
:: Int
-> ListJobsResponse
listJobsResponse pResponseStatus_ =
ListJobsResponse'
{ _ljrsJobs = Nothing
, _ljrsNextToken = Nothing
, _ljrsResponseStatus = pResponseStatus_
}
ljrsJobs :: Lens' ListJobsResponse [JobSummary]
ljrsJobs = lens _ljrsJobs (\ s a -> s{_ljrsJobs = a}) . _Default . _Coerce
ljrsNextToken :: Lens' ListJobsResponse (Maybe Text)
ljrsNextToken = lens _ljrsNextToken (\ s a -> s{_ljrsNextToken = a})
ljrsResponseStatus :: Lens' ListJobsResponse Int
ljrsResponseStatus = lens _ljrsResponseStatus (\ s a -> s{_ljrsResponseStatus = a})
instance NFData ListJobsResponse where