module Network.Google.Resource.BigQuery.Jobs.Insert
(
JobsInsertResource
, jobsInsert
, JobsInsert
, jiPayload
, jiProjectId
) where
import Network.Google.BigQuery.Types
import Network.Google.Prelude
type JobsInsertResource =
"bigquery" :>
"v2" :>
"projects" :>
Capture "projectId" Text :>
"jobs" :>
QueryParam "alt" AltJSON :>
ReqBody '[JSON] Job :> Post '[JSON] Job
:<|>
"upload" :>
"bigquery" :>
"v2" :>
"projects" :>
Capture "projectId" Text :>
"jobs" :>
QueryParam "alt" AltJSON :>
QueryParam "uploadType" AltMedia :>
MultipartRelated '[JSON] Job RequestBody :>
Post '[JSON] Job
data JobsInsert = JobsInsert
{ _jiPayload :: !Job
, _jiProjectId :: !Text
} deriving (Eq,Show,Data,Typeable,Generic)
jobsInsert
:: Job
-> Text
-> JobsInsert
jobsInsert pJiPayload_ pJiProjectId_ =
JobsInsert
{ _jiPayload = pJiPayload_
, _jiProjectId = pJiProjectId_
}
jiPayload :: Lens' JobsInsert Job
jiPayload
= lens _jiPayload (\ s a -> s{_jiPayload = a})
jiProjectId :: Lens' JobsInsert Text
jiProjectId
= lens _jiProjectId (\ s a -> s{_jiProjectId = a})
instance GoogleRequest JobsInsert where
type Rs JobsInsert = Job
requestClient JobsInsert{..}
= go _jiProjectId (Just AltJSON) _jiPayload
bigQueryService
where go :<|> _
= buildClient (Proxy :: Proxy JobsInsertResource)
mempty
instance GoogleRequest (MediaUpload JobsInsert) where
type Rs (MediaUpload JobsInsert) = Job
requestClient (MediaUpload JobsInsert{..} body)
= go _jiProjectId (Just AltJSON) (Just AltMedia)
_jiPayload
body
bigQueryService
where _ :<|> go
= buildClient (Proxy :: Proxy JobsInsertResource)
mempty