{-# 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.IoTJobsData.GetPendingJobExecutions
(
getPendingJobExecutions
, GetPendingJobExecutions
, gpjeThingName
, getPendingJobExecutionsResponse
, GetPendingJobExecutionsResponse
, gpjersInProgressJobs
, gpjersQueuedJobs
, gpjersResponseStatus
) where
import Network.AWS.IoTJobsData.Types
import Network.AWS.IoTJobsData.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
newtype GetPendingJobExecutions = GetPendingJobExecutions'
{ _gpjeThingName :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getPendingJobExecutions
:: Text
-> GetPendingJobExecutions
getPendingJobExecutions pThingName_ =
GetPendingJobExecutions' {_gpjeThingName = pThingName_}
gpjeThingName :: Lens' GetPendingJobExecutions Text
gpjeThingName = lens _gpjeThingName (\ s a -> s{_gpjeThingName = a})
instance AWSRequest GetPendingJobExecutions where
type Rs GetPendingJobExecutions =
GetPendingJobExecutionsResponse
request = get ioTJobsData
response
= receiveJSON
(\ s h x ->
GetPendingJobExecutionsResponse' <$>
(x .?> "inProgressJobs" .!@ mempty) <*>
(x .?> "queuedJobs" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable GetPendingJobExecutions where
instance NFData GetPendingJobExecutions where
instance ToHeaders GetPendingJobExecutions where
toHeaders = const mempty
instance ToPath GetPendingJobExecutions where
toPath GetPendingJobExecutions'{..}
= mconcat ["/things/", toBS _gpjeThingName, "/jobs"]
instance ToQuery GetPendingJobExecutions where
toQuery = const mempty
data GetPendingJobExecutionsResponse = GetPendingJobExecutionsResponse'
{ _gpjersInProgressJobs :: !(Maybe [JobExecutionSummary])
, _gpjersQueuedJobs :: !(Maybe [JobExecutionSummary])
, _gpjersResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getPendingJobExecutionsResponse
:: Int
-> GetPendingJobExecutionsResponse
getPendingJobExecutionsResponse pResponseStatus_ =
GetPendingJobExecutionsResponse'
{ _gpjersInProgressJobs = Nothing
, _gpjersQueuedJobs = Nothing
, _gpjersResponseStatus = pResponseStatus_
}
gpjersInProgressJobs :: Lens' GetPendingJobExecutionsResponse [JobExecutionSummary]
gpjersInProgressJobs = lens _gpjersInProgressJobs (\ s a -> s{_gpjersInProgressJobs = a}) . _Default . _Coerce
gpjersQueuedJobs :: Lens' GetPendingJobExecutionsResponse [JobExecutionSummary]
gpjersQueuedJobs = lens _gpjersQueuedJobs (\ s a -> s{_gpjersQueuedJobs = a}) . _Default . _Coerce
gpjersResponseStatus :: Lens' GetPendingJobExecutionsResponse Int
gpjersResponseStatus = lens _gpjersResponseStatus (\ s a -> s{_gpjersResponseStatus = a})
instance NFData GetPendingJobExecutionsResponse where