{-# 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.Greengrass.CreateSoftwareUpdateJob
(
createSoftwareUpdateJob
, CreateSoftwareUpdateJob
, csujUpdateAgentLogLevel
, csujAmznClientToken
, csujSoftwareToUpdate
, csujUpdateTargetsOperatingSystem
, csujS3URLSignerRole
, csujUpdateTargets
, csujUpdateTargetsArchitecture
, createSoftwareUpdateJobResponse
, CreateSoftwareUpdateJobResponse
, csujrsIotJobARN
, csujrsIotJobId
, csujrsResponseStatus
) where
import Network.AWS.Greengrass.Types
import Network.AWS.Greengrass.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateSoftwareUpdateJob = CreateSoftwareUpdateJob'
{ _csujUpdateAgentLogLevel :: !(Maybe UpdateAgentLogLevel)
, _csujAmznClientToken :: !(Maybe Text)
, _csujSoftwareToUpdate :: !(Maybe SoftwareToUpdate)
, _csujUpdateTargetsOperatingSystem :: !(Maybe UpdateTargetsOperatingSystem)
, _csujS3URLSignerRole :: !(Maybe Text)
, _csujUpdateTargets :: !(Maybe [Text])
, _csujUpdateTargetsArchitecture :: !(Maybe UpdateTargetsArchitecture)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createSoftwareUpdateJob
:: CreateSoftwareUpdateJob
createSoftwareUpdateJob =
CreateSoftwareUpdateJob'
{ _csujUpdateAgentLogLevel = Nothing
, _csujAmznClientToken = Nothing
, _csujSoftwareToUpdate = Nothing
, _csujUpdateTargetsOperatingSystem = Nothing
, _csujS3URLSignerRole = Nothing
, _csujUpdateTargets = Nothing
, _csujUpdateTargetsArchitecture = Nothing
}
csujUpdateAgentLogLevel :: Lens' CreateSoftwareUpdateJob (Maybe UpdateAgentLogLevel)
csujUpdateAgentLogLevel = lens _csujUpdateAgentLogLevel (\ s a -> s{_csujUpdateAgentLogLevel = a})
csujAmznClientToken :: Lens' CreateSoftwareUpdateJob (Maybe Text)
csujAmznClientToken = lens _csujAmznClientToken (\ s a -> s{_csujAmznClientToken = a})
csujSoftwareToUpdate :: Lens' CreateSoftwareUpdateJob (Maybe SoftwareToUpdate)
csujSoftwareToUpdate = lens _csujSoftwareToUpdate (\ s a -> s{_csujSoftwareToUpdate = a})
csujUpdateTargetsOperatingSystem :: Lens' CreateSoftwareUpdateJob (Maybe UpdateTargetsOperatingSystem)
csujUpdateTargetsOperatingSystem = lens _csujUpdateTargetsOperatingSystem (\ s a -> s{_csujUpdateTargetsOperatingSystem = a})
csujS3URLSignerRole :: Lens' CreateSoftwareUpdateJob (Maybe Text)
csujS3URLSignerRole = lens _csujS3URLSignerRole (\ s a -> s{_csujS3URLSignerRole = a})
csujUpdateTargets :: Lens' CreateSoftwareUpdateJob [Text]
csujUpdateTargets = lens _csujUpdateTargets (\ s a -> s{_csujUpdateTargets = a}) . _Default . _Coerce
csujUpdateTargetsArchitecture :: Lens' CreateSoftwareUpdateJob (Maybe UpdateTargetsArchitecture)
csujUpdateTargetsArchitecture = lens _csujUpdateTargetsArchitecture (\ s a -> s{_csujUpdateTargetsArchitecture = a})
instance AWSRequest CreateSoftwareUpdateJob where
type Rs CreateSoftwareUpdateJob =
CreateSoftwareUpdateJobResponse
request = postJSON greengrass
response
= receiveJSON
(\ s h x ->
CreateSoftwareUpdateJobResponse' <$>
(x .?> "IotJobArn") <*> (x .?> "IotJobId") <*>
(pure (fromEnum s)))
instance Hashable CreateSoftwareUpdateJob where
instance NFData CreateSoftwareUpdateJob where
instance ToHeaders CreateSoftwareUpdateJob where
toHeaders CreateSoftwareUpdateJob'{..}
= mconcat
["X-Amzn-Client-Token" =# _csujAmznClientToken,
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)]
instance ToJSON CreateSoftwareUpdateJob where
toJSON CreateSoftwareUpdateJob'{..}
= object
(catMaybes
[("UpdateAgentLogLevel" .=) <$>
_csujUpdateAgentLogLevel,
("SoftwareToUpdate" .=) <$> _csujSoftwareToUpdate,
("UpdateTargetsOperatingSystem" .=) <$>
_csujUpdateTargetsOperatingSystem,
("S3UrlSignerRole" .=) <$> _csujS3URLSignerRole,
("UpdateTargets" .=) <$> _csujUpdateTargets,
("UpdateTargetsArchitecture" .=) <$>
_csujUpdateTargetsArchitecture])
instance ToPath CreateSoftwareUpdateJob where
toPath = const "/greengrass/updates"
instance ToQuery CreateSoftwareUpdateJob where
toQuery = const mempty
data CreateSoftwareUpdateJobResponse = CreateSoftwareUpdateJobResponse'
{ _csujrsIotJobARN :: !(Maybe Text)
, _csujrsIotJobId :: !(Maybe Text)
, _csujrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createSoftwareUpdateJobResponse
:: Int
-> CreateSoftwareUpdateJobResponse
createSoftwareUpdateJobResponse pResponseStatus_ =
CreateSoftwareUpdateJobResponse'
{ _csujrsIotJobARN = Nothing
, _csujrsIotJobId = Nothing
, _csujrsResponseStatus = pResponseStatus_
}
csujrsIotJobARN :: Lens' CreateSoftwareUpdateJobResponse (Maybe Text)
csujrsIotJobARN = lens _csujrsIotJobARN (\ s a -> s{_csujrsIotJobARN = a})
csujrsIotJobId :: Lens' CreateSoftwareUpdateJobResponse (Maybe Text)
csujrsIotJobId = lens _csujrsIotJobId (\ s a -> s{_csujrsIotJobId = a})
csujrsResponseStatus :: Lens' CreateSoftwareUpdateJobResponse Int
csujrsResponseStatus = lens _csujrsResponseStatus (\ s a -> s{_csujrsResponseStatus = a})
instance NFData CreateSoftwareUpdateJobResponse where