{-# 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.ElasticTranscoder.CreateJob
(
createJob
, CreateJob
, cjUserMetadata
, cjOutputs
, cjOutput
, cjPlaylists
, cjOutputKeyPrefix
, cjPipelineId
, cjInput
, createJobResponse
, CreateJobResponse
, cjrsJob
, cjrsResponseStatus
) where
import Network.AWS.ElasticTranscoder.Types
import Network.AWS.ElasticTranscoder.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateJob = CreateJob'
{ _cjUserMetadata :: !(Maybe (Map Text Text))
, _cjOutputs :: !(Maybe [CreateJobOutput])
, _cjOutput :: !(Maybe CreateJobOutput)
, _cjPlaylists :: !(Maybe [CreateJobPlaylist])
, _cjOutputKeyPrefix :: !(Maybe Text)
, _cjPipelineId :: !Text
, _cjInput :: !JobInput
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createJob
:: Text
-> JobInput
-> CreateJob
createJob pPipelineId_ pInput_ =
CreateJob'
{ _cjUserMetadata = Nothing
, _cjOutputs = Nothing
, _cjOutput = Nothing
, _cjPlaylists = Nothing
, _cjOutputKeyPrefix = Nothing
, _cjPipelineId = pPipelineId_
, _cjInput = pInput_
}
cjUserMetadata :: Lens' CreateJob (HashMap Text Text)
cjUserMetadata = lens _cjUserMetadata (\ s a -> s{_cjUserMetadata = a}) . _Default . _Map;
cjOutputs :: Lens' CreateJob [CreateJobOutput]
cjOutputs = lens _cjOutputs (\ s a -> s{_cjOutputs = a}) . _Default . _Coerce;
cjOutput :: Lens' CreateJob (Maybe CreateJobOutput)
cjOutput = lens _cjOutput (\ s a -> s{_cjOutput = a});
cjPlaylists :: Lens' CreateJob [CreateJobPlaylist]
cjPlaylists = lens _cjPlaylists (\ s a -> s{_cjPlaylists = a}) . _Default . _Coerce;
cjOutputKeyPrefix :: Lens' CreateJob (Maybe Text)
cjOutputKeyPrefix = lens _cjOutputKeyPrefix (\ s a -> s{_cjOutputKeyPrefix = a});
cjPipelineId :: Lens' CreateJob Text
cjPipelineId = lens _cjPipelineId (\ s a -> s{_cjPipelineId = a});
cjInput :: Lens' CreateJob JobInput
cjInput = lens _cjInput (\ s a -> s{_cjInput = a});
instance AWSRequest CreateJob where
type Rs CreateJob = CreateJobResponse
request = postJSON elasticTranscoder
response
= receiveJSON
(\ s h x ->
CreateJobResponse' <$>
(x .?> "Job") <*> (pure (fromEnum s)))
instance Hashable CreateJob
instance NFData CreateJob
instance ToHeaders CreateJob where
toHeaders = const mempty
instance ToJSON CreateJob where
toJSON CreateJob'{..}
= object
(catMaybes
[("UserMetadata" .=) <$> _cjUserMetadata,
("Outputs" .=) <$> _cjOutputs,
("Output" .=) <$> _cjOutput,
("Playlists" .=) <$> _cjPlaylists,
("OutputKeyPrefix" .=) <$> _cjOutputKeyPrefix,
Just ("PipelineId" .= _cjPipelineId),
Just ("Input" .= _cjInput)])
instance ToPath CreateJob where
toPath = const "/2012-09-25/jobs"
instance ToQuery CreateJob where
toQuery = const mempty
data CreateJobResponse = CreateJobResponse'
{ _cjrsJob :: !(Maybe Job')
, _cjrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createJobResponse
:: Int
-> CreateJobResponse
createJobResponse pResponseStatus_ =
CreateJobResponse'
{ _cjrsJob = Nothing
, _cjrsResponseStatus = pResponseStatus_
}
cjrsJob :: Lens' CreateJobResponse (Maybe Job')
cjrsJob = lens _cjrsJob (\ s a -> s{_cjrsJob = a});
cjrsResponseStatus :: Lens' CreateJobResponse Int
cjrsResponseStatus = lens _cjrsResponseStatus (\ s a -> s{_cjrsResponseStatus = a});
instance NFData CreateJobResponse