module Network.AWS.ImportExport.CreateJob
(
CreateJob
, createJob
, cjAPIVersion
, cjJobType
, cjManifest
, cjManifestAddendum
, cjValidateOnly
, CreateJobResponse
, createJobResponse
, cjrArtifactList
, cjrJobId
, cjrJobType
, cjrSignature
, cjrSignatureFileContents
, cjrWarningMessage
) where
import Network.AWS.Prelude
import Network.AWS.Request.Query
import Network.AWS.ImportExport.Types
import qualified GHC.Exts
data CreateJob = CreateJob
{ _cjAPIVersion :: Maybe Text
, _cjJobType :: JobType
, _cjManifest :: Text
, _cjManifestAddendum :: Maybe Text
, _cjValidateOnly :: Bool
} deriving (Eq, Read, Show)
createJob :: JobType
-> Text
-> Bool
-> CreateJob
createJob p1 p2 p3 = CreateJob
{ _cjJobType = p1
, _cjManifest = p2
, _cjValidateOnly = p3
, _cjManifestAddendum = Nothing
, _cjAPIVersion = Nothing
}
cjAPIVersion :: Lens' CreateJob (Maybe Text)
cjAPIVersion = lens _cjAPIVersion (\s a -> s { _cjAPIVersion = a })
cjJobType :: Lens' CreateJob JobType
cjJobType = lens _cjJobType (\s a -> s { _cjJobType = a })
cjManifest :: Lens' CreateJob Text
cjManifest = lens _cjManifest (\s a -> s { _cjManifest = a })
cjManifestAddendum :: Lens' CreateJob (Maybe Text)
cjManifestAddendum =
lens _cjManifestAddendum (\s a -> s { _cjManifestAddendum = a })
cjValidateOnly :: Lens' CreateJob Bool
cjValidateOnly = lens _cjValidateOnly (\s a -> s { _cjValidateOnly = a })
data CreateJobResponse = CreateJobResponse
{ _cjrArtifactList :: List "member" Artifact
, _cjrJobId :: Maybe Text
, _cjrJobType :: Maybe JobType
, _cjrSignature :: Maybe Text
, _cjrSignatureFileContents :: Maybe Text
, _cjrWarningMessage :: Maybe Text
} deriving (Eq, Read, Show)
createJobResponse :: CreateJobResponse
createJobResponse = CreateJobResponse
{ _cjrJobId = Nothing
, _cjrJobType = Nothing
, _cjrSignature = Nothing
, _cjrSignatureFileContents = Nothing
, _cjrWarningMessage = Nothing
, _cjrArtifactList = mempty
}
cjrArtifactList :: Lens' CreateJobResponse [Artifact]
cjrArtifactList = lens _cjrArtifactList (\s a -> s { _cjrArtifactList = a }) . _List
cjrJobId :: Lens' CreateJobResponse (Maybe Text)
cjrJobId = lens _cjrJobId (\s a -> s { _cjrJobId = a })
cjrJobType :: Lens' CreateJobResponse (Maybe JobType)
cjrJobType = lens _cjrJobType (\s a -> s { _cjrJobType = a })
cjrSignature :: Lens' CreateJobResponse (Maybe Text)
cjrSignature = lens _cjrSignature (\s a -> s { _cjrSignature = a })
cjrSignatureFileContents :: Lens' CreateJobResponse (Maybe Text)
cjrSignatureFileContents =
lens _cjrSignatureFileContents
(\s a -> s { _cjrSignatureFileContents = a })
cjrWarningMessage :: Lens' CreateJobResponse (Maybe Text)
cjrWarningMessage =
lens _cjrWarningMessage (\s a -> s { _cjrWarningMessage = a })
instance ToPath CreateJob where
toPath = const "/"
instance ToQuery CreateJob where
toQuery CreateJob{..} = mconcat
[ "APIVersion" =? _cjAPIVersion
, "JobType" =? _cjJobType
, "Manifest" =? _cjManifest
, "ManifestAddendum" =? _cjManifestAddendum
, "ValidateOnly" =? _cjValidateOnly
]
instance ToHeaders CreateJob
instance AWSRequest CreateJob where
type Sv CreateJob = ImportExport
type Rs CreateJob = CreateJobResponse
request = post "CreateJob"
response = xmlResponse
instance FromXML CreateJobResponse where
parseXML = withElement "CreateJobResult" $ \x -> CreateJobResponse
<$> x .@? "ArtifactList" .!@ mempty
<*> x .@? "JobId"
<*> x .@? "JobType"
<*> x .@? "Signature"
<*> x .@? "SignatureFileContents"
<*> x .@? "WarningMessage"