{-# 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.AssociateTargetsWithJob
(
associateTargetsWithJob
, AssociateTargetsWithJob
, atwjComment
, atwjTargets
, atwjJobId
, associateTargetsWithJobResponse
, AssociateTargetsWithJobResponse
, atwjrsJobId
, atwjrsJobARN
, atwjrsDescription
, atwjrsResponseStatus
) 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 AssociateTargetsWithJob = AssociateTargetsWithJob'
{ _atwjComment :: !(Maybe Text)
, _atwjTargets :: !(List1 Text)
, _atwjJobId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
associateTargetsWithJob
:: NonEmpty Text
-> Text
-> AssociateTargetsWithJob
associateTargetsWithJob pTargets_ pJobId_ =
AssociateTargetsWithJob'
{ _atwjComment = Nothing
, _atwjTargets = _List1 # pTargets_
, _atwjJobId = pJobId_
}
atwjComment :: Lens' AssociateTargetsWithJob (Maybe Text)
atwjComment = lens _atwjComment (\ s a -> s{_atwjComment = a})
atwjTargets :: Lens' AssociateTargetsWithJob (NonEmpty Text)
atwjTargets = lens _atwjTargets (\ s a -> s{_atwjTargets = a}) . _List1
atwjJobId :: Lens' AssociateTargetsWithJob Text
atwjJobId = lens _atwjJobId (\ s a -> s{_atwjJobId = a})
instance AWSRequest AssociateTargetsWithJob where
type Rs AssociateTargetsWithJob =
AssociateTargetsWithJobResponse
request = postJSON ioT
response
= receiveJSON
(\ s h x ->
AssociateTargetsWithJobResponse' <$>
(x .?> "jobId") <*> (x .?> "jobArn") <*>
(x .?> "description")
<*> (pure (fromEnum s)))
instance Hashable AssociateTargetsWithJob where
instance NFData AssociateTargetsWithJob where
instance ToHeaders AssociateTargetsWithJob where
toHeaders = const mempty
instance ToJSON AssociateTargetsWithJob where
toJSON AssociateTargetsWithJob'{..}
= object
(catMaybes
[("comment" .=) <$> _atwjComment,
Just ("targets" .= _atwjTargets)])
instance ToPath AssociateTargetsWithJob where
toPath AssociateTargetsWithJob'{..}
= mconcat ["/jobs/", toBS _atwjJobId, "/targets"]
instance ToQuery AssociateTargetsWithJob where
toQuery = const mempty
data AssociateTargetsWithJobResponse = AssociateTargetsWithJobResponse'
{ _atwjrsJobId :: !(Maybe Text)
, _atwjrsJobARN :: !(Maybe Text)
, _atwjrsDescription :: !(Maybe Text)
, _atwjrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
associateTargetsWithJobResponse
:: Int
-> AssociateTargetsWithJobResponse
associateTargetsWithJobResponse pResponseStatus_ =
AssociateTargetsWithJobResponse'
{ _atwjrsJobId = Nothing
, _atwjrsJobARN = Nothing
, _atwjrsDescription = Nothing
, _atwjrsResponseStatus = pResponseStatus_
}
atwjrsJobId :: Lens' AssociateTargetsWithJobResponse (Maybe Text)
atwjrsJobId = lens _atwjrsJobId (\ s a -> s{_atwjrsJobId = a})
atwjrsJobARN :: Lens' AssociateTargetsWithJobResponse (Maybe Text)
atwjrsJobARN = lens _atwjrsJobARN (\ s a -> s{_atwjrsJobARN = a})
atwjrsDescription :: Lens' AssociateTargetsWithJobResponse (Maybe Text)
atwjrsDescription = lens _atwjrsDescription (\ s a -> s{_atwjrsDescription = a})
atwjrsResponseStatus :: Lens' AssociateTargetsWithJobResponse Int
atwjrsResponseStatus = lens _atwjrsResponseStatus (\ s a -> s{_atwjrsResponseStatus = a})
instance NFData AssociateTargetsWithJobResponse where