{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# OPTIONS_GHC -fno-warn-duplicate-exports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
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" Multipart :>
MultipartRelated '[JSON] Job :> 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
type Scopes JobsInsert =
'["https://www.googleapis.com/auth/bigquery",
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/devstorage.read_write"]
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
type Scopes (MediaUpload JobsInsert) =
Scopes JobsInsert
requestClient (MediaUpload JobsInsert'{..} body)
= go _jiProjectId (Just AltJSON) (Just Multipart)
_jiPayload
body
bigQueryService
where _ :<|> go
= buildClient (Proxy :: Proxy JobsInsertResource)
mempty