module Network.AWS.ImportExport.UpdateJob
(
UpdateJob
, updateJob
, ujAPIVersion
, ujJobId
, ujJobType
, ujManifest
, ujValidateOnly
, UpdateJobResponse
, updateJobResponse
, ujrArtifactList
, ujrSuccess
, ujrWarningMessage
) where
import Network.AWS.Prelude
import Network.AWS.Request.Query
import Network.AWS.ImportExport.Types
import qualified GHC.Exts
data UpdateJob = UpdateJob
{ _ujAPIVersion :: Maybe Text
, _ujJobId :: Text
, _ujJobType :: JobType
, _ujManifest :: Text
, _ujValidateOnly :: Bool
} deriving (Eq, Read, Show)
updateJob :: Text
-> Text
-> JobType
-> Bool
-> UpdateJob
updateJob p1 p2 p3 p4 = UpdateJob
{ _ujJobId = p1
, _ujManifest = p2
, _ujJobType = p3
, _ujValidateOnly = p4
, _ujAPIVersion = Nothing
}
ujAPIVersion :: Lens' UpdateJob (Maybe Text)
ujAPIVersion = lens _ujAPIVersion (\s a -> s { _ujAPIVersion = a })
ujJobId :: Lens' UpdateJob Text
ujJobId = lens _ujJobId (\s a -> s { _ujJobId = a })
ujJobType :: Lens' UpdateJob JobType
ujJobType = lens _ujJobType (\s a -> s { _ujJobType = a })
ujManifest :: Lens' UpdateJob Text
ujManifest = lens _ujManifest (\s a -> s { _ujManifest = a })
ujValidateOnly :: Lens' UpdateJob Bool
ujValidateOnly = lens _ujValidateOnly (\s a -> s { _ujValidateOnly = a })
data UpdateJobResponse = UpdateJobResponse
{ _ujrArtifactList :: List "member" Artifact
, _ujrSuccess :: Maybe Bool
, _ujrWarningMessage :: Maybe Text
} deriving (Eq, Read, Show)
updateJobResponse :: UpdateJobResponse
updateJobResponse = UpdateJobResponse
{ _ujrSuccess = Nothing
, _ujrWarningMessage = Nothing
, _ujrArtifactList = mempty
}
ujrArtifactList :: Lens' UpdateJobResponse [Artifact]
ujrArtifactList = lens _ujrArtifactList (\s a -> s { _ujrArtifactList = a }) . _List
ujrSuccess :: Lens' UpdateJobResponse (Maybe Bool)
ujrSuccess = lens _ujrSuccess (\s a -> s { _ujrSuccess = a })
ujrWarningMessage :: Lens' UpdateJobResponse (Maybe Text)
ujrWarningMessage =
lens _ujrWarningMessage (\s a -> s { _ujrWarningMessage = a })
instance ToPath UpdateJob where
toPath = const "/"
instance ToQuery UpdateJob where
toQuery UpdateJob{..} = mconcat
[ "APIVersion" =? _ujAPIVersion
, "JobId" =? _ujJobId
, "JobType" =? _ujJobType
, "Manifest" =? _ujManifest
, "ValidateOnly" =? _ujValidateOnly
]
instance ToHeaders UpdateJob
instance AWSRequest UpdateJob where
type Sv UpdateJob = ImportExport
type Rs UpdateJob = UpdateJobResponse
request = post "UpdateJob"
response = xmlResponse
instance FromXML UpdateJobResponse where
parseXML = withElement "UpdateJobResult" $ \x -> UpdateJobResponse
<$> x .@? "ArtifactList" .!@ mempty
<*> x .@? "Success"
<*> x .@? "WarningMessage"