{-# 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.ListJobExecutionsForThing
(
listJobExecutionsForThing
, ListJobExecutionsForThing
, ljeftStatus
, ljeftNextToken
, ljeftMaxResults
, ljeftThingName
, listJobExecutionsForThingResponse
, ListJobExecutionsForThingResponse
, ljeftrsExecutionSummaries
, ljeftrsNextToken
, ljeftrsResponseStatus
) 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 ListJobExecutionsForThing = ListJobExecutionsForThing'
{ _ljeftStatus :: !(Maybe JobExecutionStatus)
, _ljeftNextToken :: !(Maybe Text)
, _ljeftMaxResults :: !(Maybe Nat)
, _ljeftThingName :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listJobExecutionsForThing
:: Text
-> ListJobExecutionsForThing
listJobExecutionsForThing pThingName_ =
ListJobExecutionsForThing'
{ _ljeftStatus = Nothing
, _ljeftNextToken = Nothing
, _ljeftMaxResults = Nothing
, _ljeftThingName = pThingName_
}
ljeftStatus :: Lens' ListJobExecutionsForThing (Maybe JobExecutionStatus)
ljeftStatus = lens _ljeftStatus (\ s a -> s{_ljeftStatus = a})
ljeftNextToken :: Lens' ListJobExecutionsForThing (Maybe Text)
ljeftNextToken = lens _ljeftNextToken (\ s a -> s{_ljeftNextToken = a})
ljeftMaxResults :: Lens' ListJobExecutionsForThing (Maybe Natural)
ljeftMaxResults = lens _ljeftMaxResults (\ s a -> s{_ljeftMaxResults = a}) . mapping _Nat
ljeftThingName :: Lens' ListJobExecutionsForThing Text
ljeftThingName = lens _ljeftThingName (\ s a -> s{_ljeftThingName = a})
instance AWSRequest ListJobExecutionsForThing where
type Rs ListJobExecutionsForThing =
ListJobExecutionsForThingResponse
request = get ioT
response
= receiveJSON
(\ s h x ->
ListJobExecutionsForThingResponse' <$>
(x .?> "executionSummaries" .!@ mempty) <*>
(x .?> "nextToken")
<*> (pure (fromEnum s)))
instance Hashable ListJobExecutionsForThing where
instance NFData ListJobExecutionsForThing where
instance ToHeaders ListJobExecutionsForThing where
toHeaders = const mempty
instance ToPath ListJobExecutionsForThing where
toPath ListJobExecutionsForThing'{..}
= mconcat ["/things/", toBS _ljeftThingName, "/jobs"]
instance ToQuery ListJobExecutionsForThing where
toQuery ListJobExecutionsForThing'{..}
= mconcat
["status" =: _ljeftStatus,
"nextToken" =: _ljeftNextToken,
"maxResults" =: _ljeftMaxResults]
data ListJobExecutionsForThingResponse = ListJobExecutionsForThingResponse'
{ _ljeftrsExecutionSummaries :: !(Maybe [JobExecutionSummaryForThing])
, _ljeftrsNextToken :: !(Maybe Text)
, _ljeftrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listJobExecutionsForThingResponse
:: Int
-> ListJobExecutionsForThingResponse
listJobExecutionsForThingResponse pResponseStatus_ =
ListJobExecutionsForThingResponse'
{ _ljeftrsExecutionSummaries = Nothing
, _ljeftrsNextToken = Nothing
, _ljeftrsResponseStatus = pResponseStatus_
}
ljeftrsExecutionSummaries :: Lens' ListJobExecutionsForThingResponse [JobExecutionSummaryForThing]
ljeftrsExecutionSummaries = lens _ljeftrsExecutionSummaries (\ s a -> s{_ljeftrsExecutionSummaries = a}) . _Default . _Coerce
ljeftrsNextToken :: Lens' ListJobExecutionsForThingResponse (Maybe Text)
ljeftrsNextToken = lens _ljeftrsNextToken (\ s a -> s{_ljeftrsNextToken = a})
ljeftrsResponseStatus :: Lens' ListJobExecutionsForThingResponse Int
ljeftrsResponseStatus = lens _ljeftrsResponseStatus (\ s a -> s{_ljeftrsResponseStatus = a})
instance NFData ListJobExecutionsForThingResponse
where