25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

8084 lines
306 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package bigquery provides access to the BigQuery API.
  6. //
  7. // This package is DEPRECATED. Use package cloud.google.com/go/bigquery instead.
  8. //
  9. // For product documentation, see: https://cloud.google.com/bigquery/
  10. //
  11. // Creating a client
  12. //
  13. // Usage example:
  14. //
  15. // import "google.golang.org/api/bigquery/v2"
  16. // ...
  17. // ctx := context.Background()
  18. // bigqueryService, err := bigquery.NewService(ctx)
  19. //
  20. // In this example, Google Application Default Credentials are used for authentication.
  21. //
  22. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  23. //
  24. // Other authentication options
  25. //
  26. // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
  27. //
  28. // bigqueryService, err := bigquery.NewService(ctx, option.WithScopes(bigquery.DevstorageReadWriteScope))
  29. //
  30. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  31. //
  32. // bigqueryService, err := bigquery.NewService(ctx, option.WithAPIKey("AIza..."))
  33. //
  34. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  35. //
  36. // config := &oauth2.Config{...}
  37. // // ...
  38. // token, err := config.Exchange(ctx, ...)
  39. // bigqueryService, err := bigquery.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  40. //
  41. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  42. package bigquery // import "google.golang.org/api/bigquery/v2"
  43. import (
  44. "bytes"
  45. "context"
  46. "encoding/json"
  47. "errors"
  48. "fmt"
  49. "io"
  50. "net/http"
  51. "net/url"
  52. "strconv"
  53. "strings"
  54. gensupport "google.golang.org/api/gensupport"
  55. googleapi "google.golang.org/api/googleapi"
  56. option "google.golang.org/api/option"
  57. htransport "google.golang.org/api/transport/http"
  58. )
  59. // Always reference these packages, just in case the auto-generated code
  60. // below doesn't.
  61. var _ = bytes.NewBuffer
  62. var _ = strconv.Itoa
  63. var _ = fmt.Sprintf
  64. var _ = json.NewDecoder
  65. var _ = io.Copy
  66. var _ = url.Parse
  67. var _ = gensupport.MarshalJSON
  68. var _ = googleapi.Version
  69. var _ = errors.New
  70. var _ = strings.Replace
  71. var _ = context.Canceled
  72. const apiId = "bigquery:v2"
  73. const apiName = "bigquery"
  74. const apiVersion = "v2"
  75. const basePath = "https://www.googleapis.com/bigquery/v2/"
  76. // OAuth2 scopes used by this API.
  77. const (
  78. // View and manage your data in Google BigQuery
  79. BigqueryScope = "https://www.googleapis.com/auth/bigquery"
  80. // Insert data into Google BigQuery
  81. BigqueryInsertdataScope = "https://www.googleapis.com/auth/bigquery.insertdata"
  82. // View and manage your data across Google Cloud Platform services
  83. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  84. // View your data across Google Cloud Platform services
  85. CloudPlatformReadOnlyScope = "https://www.googleapis.com/auth/cloud-platform.read-only"
  86. // Manage your data and permissions in Google Cloud Storage
  87. DevstorageFullControlScope = "https://www.googleapis.com/auth/devstorage.full_control"
  88. // View your data in Google Cloud Storage
  89. DevstorageReadOnlyScope = "https://www.googleapis.com/auth/devstorage.read_only"
  90. // Manage your data in Google Cloud Storage
  91. DevstorageReadWriteScope = "https://www.googleapis.com/auth/devstorage.read_write"
  92. )
  93. // NewService creates a new Service.
  94. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  95. scopesOption := option.WithScopes(
  96. "https://www.googleapis.com/auth/bigquery",
  97. "https://www.googleapis.com/auth/bigquery.insertdata",
  98. "https://www.googleapis.com/auth/cloud-platform",
  99. "https://www.googleapis.com/auth/cloud-platform.read-only",
  100. "https://www.googleapis.com/auth/devstorage.full_control",
  101. "https://www.googleapis.com/auth/devstorage.read_only",
  102. "https://www.googleapis.com/auth/devstorage.read_write",
  103. )
  104. // NOTE: prepend, so we don't override user-specified scopes.
  105. opts = append([]option.ClientOption{scopesOption}, opts...)
  106. client, endpoint, err := htransport.NewClient(ctx, opts...)
  107. if err != nil {
  108. return nil, err
  109. }
  110. s, err := New(client)
  111. if err != nil {
  112. return nil, err
  113. }
  114. if endpoint != "" {
  115. s.BasePath = endpoint
  116. }
  117. return s, nil
  118. }
  119. // New creates a new Service. It uses the provided http.Client for requests.
  120. //
  121. // Deprecated: please use NewService instead.
  122. // To provide a custom HTTP client, use option.WithHTTPClient.
  123. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  124. func New(client *http.Client) (*Service, error) {
  125. if client == nil {
  126. return nil, errors.New("client is nil")
  127. }
  128. s := &Service{client: client, BasePath: basePath}
  129. s.Datasets = NewDatasetsService(s)
  130. s.Jobs = NewJobsService(s)
  131. s.Projects = NewProjectsService(s)
  132. s.Tabledata = NewTabledataService(s)
  133. s.Tables = NewTablesService(s)
  134. return s, nil
  135. }
  136. type Service struct {
  137. client *http.Client
  138. BasePath string // API endpoint base URL
  139. UserAgent string // optional additional User-Agent fragment
  140. Datasets *DatasetsService
  141. Jobs *JobsService
  142. Projects *ProjectsService
  143. Tabledata *TabledataService
  144. Tables *TablesService
  145. }
  146. func (s *Service) userAgent() string {
  147. if s.UserAgent == "" {
  148. return googleapi.UserAgent
  149. }
  150. return googleapi.UserAgent + " " + s.UserAgent
  151. }
  152. func NewDatasetsService(s *Service) *DatasetsService {
  153. rs := &DatasetsService{s: s}
  154. return rs
  155. }
  156. type DatasetsService struct {
  157. s *Service
  158. }
  159. func NewJobsService(s *Service) *JobsService {
  160. rs := &JobsService{s: s}
  161. return rs
  162. }
  163. type JobsService struct {
  164. s *Service
  165. }
  166. func NewProjectsService(s *Service) *ProjectsService {
  167. rs := &ProjectsService{s: s}
  168. return rs
  169. }
  170. type ProjectsService struct {
  171. s *Service
  172. }
  173. func NewTabledataService(s *Service) *TabledataService {
  174. rs := &TabledataService{s: s}
  175. return rs
  176. }
  177. type TabledataService struct {
  178. s *Service
  179. }
  180. func NewTablesService(s *Service) *TablesService {
  181. rs := &TablesService{s: s}
  182. return rs
  183. }
  184. type TablesService struct {
  185. s *Service
  186. }
  187. type BigQueryModelTraining struct {
  188. // CurrentIteration: [Output-only, Beta] Index of current ML training
  189. // iteration. Updated during create model query job to show job
  190. // progress.
  191. CurrentIteration int64 `json:"currentIteration,omitempty"`
  192. // ExpectedTotalIterations: [Output-only, Beta] Expected number of
  193. // iterations for the create model query job specified as num_iterations
  194. // in the input query. The actual total number of iterations may be less
  195. // than this number due to early stop.
  196. ExpectedTotalIterations int64 `json:"expectedTotalIterations,omitempty,string"`
  197. // ForceSendFields is a list of field names (e.g. "CurrentIteration") to
  198. // unconditionally include in API requests. By default, fields with
  199. // empty values are omitted from API requests. However, any non-pointer,
  200. // non-interface field appearing in ForceSendFields will be sent to the
  201. // server regardless of whether the field is empty or not. This may be
  202. // used to include empty fields in Patch requests.
  203. ForceSendFields []string `json:"-"`
  204. // NullFields is a list of field names (e.g. "CurrentIteration") to
  205. // include in API requests with the JSON null value. By default, fields
  206. // with empty values are omitted from API requests. However, any field
  207. // with an empty value appearing in NullFields will be sent to the
  208. // server as null. It is an error if a field in this list has a
  209. // non-empty value. This may be used to include null fields in Patch
  210. // requests.
  211. NullFields []string `json:"-"`
  212. }
  213. func (s *BigQueryModelTraining) MarshalJSON() ([]byte, error) {
  214. type NoMethod BigQueryModelTraining
  215. raw := NoMethod(*s)
  216. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  217. }
  218. type BigtableColumn struct {
  219. // Encoding: [Optional] The encoding of the values when the type is not
  220. // STRING. Acceptable encoding values are: TEXT - indicates values are
  221. // alphanumeric text strings. BINARY - indicates values are encoded
  222. // using HBase Bytes.toBytes family of functions. 'encoding' can also be
  223. // set at the column family level. However, the setting at this level
  224. // takes precedence if 'encoding' is set at both levels.
  225. Encoding string `json:"encoding,omitempty"`
  226. // FieldName: [Optional] If the qualifier is not a valid BigQuery field
  227. // identifier i.e. does not match [a-zA-Z][a-zA-Z0-9_]*, a valid
  228. // identifier must be provided as the column field name and is used as
  229. // field name in queries.
  230. FieldName string `json:"fieldName,omitempty"`
  231. // OnlyReadLatest: [Optional] If this is set, only the latest version of
  232. // value in this column are exposed. 'onlyReadLatest' can also be set at
  233. // the column family level. However, the setting at this level takes
  234. // precedence if 'onlyReadLatest' is set at both levels.
  235. OnlyReadLatest bool `json:"onlyReadLatest,omitempty"`
  236. // QualifierEncoded: [Required] Qualifier of the column. Columns in the
  237. // parent column family that has this exact qualifier are exposed as .
  238. // field. If the qualifier is valid UTF-8 string, it can be specified in
  239. // the qualifier_string field. Otherwise, a base-64 encoded value must
  240. // be set to qualifier_encoded. The column field name is the same as the
  241. // column qualifier. However, if the qualifier is not a valid BigQuery
  242. // field identifier i.e. does not match [a-zA-Z][a-zA-Z0-9_]*, a valid
  243. // identifier must be provided as field_name.
  244. QualifierEncoded string `json:"qualifierEncoded,omitempty"`
  245. QualifierString string `json:"qualifierString,omitempty"`
  246. // Type: [Optional] The type to convert the value in cells of this
  247. // column. The values are expected to be encoded using HBase
  248. // Bytes.toBytes function when using the BINARY encoding value.
  249. // Following BigQuery types are allowed (case-sensitive) - BYTES STRING
  250. // INTEGER FLOAT BOOLEAN Default type is BYTES. 'type' can also be set
  251. // at the column family level. However, the setting at this level takes
  252. // precedence if 'type' is set at both levels.
  253. Type string `json:"type,omitempty"`
  254. // ForceSendFields is a list of field names (e.g. "Encoding") to
  255. // unconditionally include in API requests. By default, fields with
  256. // empty values are omitted from API requests. However, any non-pointer,
  257. // non-interface field appearing in ForceSendFields will be sent to the
  258. // server regardless of whether the field is empty or not. This may be
  259. // used to include empty fields in Patch requests.
  260. ForceSendFields []string `json:"-"`
  261. // NullFields is a list of field names (e.g. "Encoding") to include in
  262. // API requests with the JSON null value. By default, fields with empty
  263. // values are omitted from API requests. However, any field with an
  264. // empty value appearing in NullFields will be sent to the server as
  265. // null. It is an error if a field in this list has a non-empty value.
  266. // This may be used to include null fields in Patch requests.
  267. NullFields []string `json:"-"`
  268. }
  269. func (s *BigtableColumn) MarshalJSON() ([]byte, error) {
  270. type NoMethod BigtableColumn
  271. raw := NoMethod(*s)
  272. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  273. }
  274. type BigtableColumnFamily struct {
  275. // Columns: [Optional] Lists of columns that should be exposed as
  276. // individual fields as opposed to a list of (column name, value) pairs.
  277. // All columns whose qualifier matches a qualifier in this list can be
  278. // accessed as .. Other columns can be accessed as a list through
  279. // .Column field.
  280. Columns []*BigtableColumn `json:"columns,omitempty"`
  281. // Encoding: [Optional] The encoding of the values when the type is not
  282. // STRING. Acceptable encoding values are: TEXT - indicates values are
  283. // alphanumeric text strings. BINARY - indicates values are encoded
  284. // using HBase Bytes.toBytes family of functions. This can be overridden
  285. // for a specific column by listing that column in 'columns' and
  286. // specifying an encoding for it.
  287. Encoding string `json:"encoding,omitempty"`
  288. // FamilyId: Identifier of the column family.
  289. FamilyId string `json:"familyId,omitempty"`
  290. // OnlyReadLatest: [Optional] If this is set only the latest version of
  291. // value are exposed for all columns in this column family. This can be
  292. // overridden for a specific column by listing that column in 'columns'
  293. // and specifying a different setting for that column.
  294. OnlyReadLatest bool `json:"onlyReadLatest,omitempty"`
  295. // Type: [Optional] The type to convert the value in cells of this
  296. // column family. The values are expected to be encoded using HBase
  297. // Bytes.toBytes function when using the BINARY encoding value.
  298. // Following BigQuery types are allowed (case-sensitive) - BYTES STRING
  299. // INTEGER FLOAT BOOLEAN Default type is BYTES. This can be overridden
  300. // for a specific column by listing that column in 'columns' and
  301. // specifying a type for it.
  302. Type string `json:"type,omitempty"`
  303. // ForceSendFields is a list of field names (e.g. "Columns") to
  304. // unconditionally include in API requests. By default, fields with
  305. // empty values are omitted from API requests. However, any non-pointer,
  306. // non-interface field appearing in ForceSendFields will be sent to the
  307. // server regardless of whether the field is empty or not. This may be
  308. // used to include empty fields in Patch requests.
  309. ForceSendFields []string `json:"-"`
  310. // NullFields is a list of field names (e.g. "Columns") to include in
  311. // API requests with the JSON null value. By default, fields with empty
  312. // values are omitted from API requests. However, any field with an
  313. // empty value appearing in NullFields will be sent to the server as
  314. // null. It is an error if a field in this list has a non-empty value.
  315. // This may be used to include null fields in Patch requests.
  316. NullFields []string `json:"-"`
  317. }
  318. func (s *BigtableColumnFamily) MarshalJSON() ([]byte, error) {
  319. type NoMethod BigtableColumnFamily
  320. raw := NoMethod(*s)
  321. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  322. }
  323. type BigtableOptions struct {
  324. // ColumnFamilies: [Optional] List of column families to expose in the
  325. // table schema along with their types. This list restricts the column
  326. // families that can be referenced in queries and specifies their value
  327. // types. You can use this list to do type conversions - see the 'type'
  328. // field for more details. If you leave this list empty, all column
  329. // families are present in the table schema and their values are read as
  330. // BYTES. During a query only the column families referenced in that
  331. // query are read from Bigtable.
  332. ColumnFamilies []*BigtableColumnFamily `json:"columnFamilies,omitempty"`
  333. // IgnoreUnspecifiedColumnFamilies: [Optional] If field is true, then
  334. // the column families that are not specified in columnFamilies list are
  335. // not exposed in the table schema. Otherwise, they are read with BYTES
  336. // type values. The default value is false.
  337. IgnoreUnspecifiedColumnFamilies bool `json:"ignoreUnspecifiedColumnFamilies,omitempty"`
  338. // ReadRowkeyAsString: [Optional] If field is true, then the rowkey
  339. // column families will be read and converted to string. Otherwise they
  340. // are read with BYTES type values and users need to manually cast them
  341. // with CAST if necessary. The default value is false.
  342. ReadRowkeyAsString bool `json:"readRowkeyAsString,omitempty"`
  343. // ForceSendFields is a list of field names (e.g. "ColumnFamilies") to
  344. // unconditionally include in API requests. By default, fields with
  345. // empty values are omitted from API requests. However, any non-pointer,
  346. // non-interface field appearing in ForceSendFields will be sent to the
  347. // server regardless of whether the field is empty or not. This may be
  348. // used to include empty fields in Patch requests.
  349. ForceSendFields []string `json:"-"`
  350. // NullFields is a list of field names (e.g. "ColumnFamilies") to
  351. // include in API requests with the JSON null value. By default, fields
  352. // with empty values are omitted from API requests. However, any field
  353. // with an empty value appearing in NullFields will be sent to the
  354. // server as null. It is an error if a field in this list has a
  355. // non-empty value. This may be used to include null fields in Patch
  356. // requests.
  357. NullFields []string `json:"-"`
  358. }
  359. func (s *BigtableOptions) MarshalJSON() ([]byte, error) {
  360. type NoMethod BigtableOptions
  361. raw := NoMethod(*s)
  362. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  363. }
  364. type BqmlIterationResult struct {
  365. // DurationMs: [Output-only, Beta] Time taken to run the training
  366. // iteration in milliseconds.
  367. DurationMs int64 `json:"durationMs,omitempty,string"`
  368. // EvalLoss: [Output-only, Beta] Eval loss computed on the eval data at
  369. // the end of the iteration. The eval loss is used for early stopping to
  370. // avoid overfitting. No eval loss if eval_split_method option is
  371. // specified as no_split or auto_split with input data size less than
  372. // 500 rows.
  373. EvalLoss float64 `json:"evalLoss,omitempty"`
  374. // Index: [Output-only, Beta] Index of the ML training iteration,
  375. // starting from zero for each training run.
  376. Index int64 `json:"index,omitempty"`
  377. // LearnRate: [Output-only, Beta] Learning rate used for this iteration,
  378. // it varies for different training iterations if learn_rate_strategy
  379. // option is not constant.
  380. LearnRate float64 `json:"learnRate,omitempty"`
  381. // TrainingLoss: [Output-only, Beta] Training loss computed on the
  382. // training data at the end of the iteration. The training loss function
  383. // is defined by model type.
  384. TrainingLoss float64 `json:"trainingLoss,omitempty"`
  385. // ForceSendFields is a list of field names (e.g. "DurationMs") to
  386. // unconditionally include in API requests. By default, fields with
  387. // empty values are omitted from API requests. However, any non-pointer,
  388. // non-interface field appearing in ForceSendFields will be sent to the
  389. // server regardless of whether the field is empty or not. This may be
  390. // used to include empty fields in Patch requests.
  391. ForceSendFields []string `json:"-"`
  392. // NullFields is a list of field names (e.g. "DurationMs") to include in
  393. // API requests with the JSON null value. By default, fields with empty
  394. // values are omitted from API requests. However, any field with an
  395. // empty value appearing in NullFields will be sent to the server as
  396. // null. It is an error if a field in this list has a non-empty value.
  397. // This may be used to include null fields in Patch requests.
  398. NullFields []string `json:"-"`
  399. }
  400. func (s *BqmlIterationResult) MarshalJSON() ([]byte, error) {
  401. type NoMethod BqmlIterationResult
  402. raw := NoMethod(*s)
  403. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  404. }
  405. func (s *BqmlIterationResult) UnmarshalJSON(data []byte) error {
  406. type NoMethod BqmlIterationResult
  407. var s1 struct {
  408. EvalLoss gensupport.JSONFloat64 `json:"evalLoss"`
  409. LearnRate gensupport.JSONFloat64 `json:"learnRate"`
  410. TrainingLoss gensupport.JSONFloat64 `json:"trainingLoss"`
  411. *NoMethod
  412. }
  413. s1.NoMethod = (*NoMethod)(s)
  414. if err := json.Unmarshal(data, &s1); err != nil {
  415. return err
  416. }
  417. s.EvalLoss = float64(s1.EvalLoss)
  418. s.LearnRate = float64(s1.LearnRate)
  419. s.TrainingLoss = float64(s1.TrainingLoss)
  420. return nil
  421. }
  422. type BqmlTrainingRun struct {
  423. // IterationResults: [Output-only, Beta] List of each iteration results.
  424. IterationResults []*BqmlIterationResult `json:"iterationResults,omitempty"`
  425. // StartTime: [Output-only, Beta] Training run start time in
  426. // milliseconds since the epoch.
  427. StartTime string `json:"startTime,omitempty"`
  428. // State: [Output-only, Beta] Different state applicable for a training
  429. // run. IN PROGRESS: Training run is in progress. FAILED: Training run
  430. // ended due to a non-retryable failure. SUCCEEDED: Training run
  431. // successfully completed. CANCELLED: Training run cancelled by the
  432. // user.
  433. State string `json:"state,omitempty"`
  434. // TrainingOptions: [Output-only, Beta] Training options used by this
  435. // training run. These options are mutable for subsequent training runs.
  436. // Default values are explicitly stored for options not specified in the
  437. // input query of the first training run. For subsequent training runs,
  438. // any option not explicitly specified in the input query will be copied
  439. // from the previous training run.
  440. TrainingOptions *BqmlTrainingRunTrainingOptions `json:"trainingOptions,omitempty"`
  441. // ForceSendFields is a list of field names (e.g. "IterationResults") to
  442. // unconditionally include in API requests. By default, fields with
  443. // empty values are omitted from API requests. However, any non-pointer,
  444. // non-interface field appearing in ForceSendFields will be sent to the
  445. // server regardless of whether the field is empty or not. This may be
  446. // used to include empty fields in Patch requests.
  447. ForceSendFields []string `json:"-"`
  448. // NullFields is a list of field names (e.g. "IterationResults") to
  449. // include in API requests with the JSON null value. By default, fields
  450. // with empty values are omitted from API requests. However, any field
  451. // with an empty value appearing in NullFields will be sent to the
  452. // server as null. It is an error if a field in this list has a
  453. // non-empty value. This may be used to include null fields in Patch
  454. // requests.
  455. NullFields []string `json:"-"`
  456. }
  457. func (s *BqmlTrainingRun) MarshalJSON() ([]byte, error) {
  458. type NoMethod BqmlTrainingRun
  459. raw := NoMethod(*s)
  460. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  461. }
  462. // BqmlTrainingRunTrainingOptions: [Output-only, Beta] Training options
  463. // used by this training run. These options are mutable for subsequent
  464. // training runs. Default values are explicitly stored for options not
  465. // specified in the input query of the first training run. For
  466. // subsequent training runs, any option not explicitly specified in the
  467. // input query will be copied from the previous training run.
  468. type BqmlTrainingRunTrainingOptions struct {
  469. EarlyStop bool `json:"earlyStop,omitempty"`
  470. L1Reg float64 `json:"l1Reg,omitempty"`
  471. L2Reg float64 `json:"l2Reg,omitempty"`
  472. LearnRate float64 `json:"learnRate,omitempty"`
  473. LearnRateStrategy string `json:"learnRateStrategy,omitempty"`
  474. LineSearchInitLearnRate float64 `json:"lineSearchInitLearnRate,omitempty"`
  475. MaxIteration int64 `json:"maxIteration,omitempty,string"`
  476. MinRelProgress float64 `json:"minRelProgress,omitempty"`
  477. WarmStart bool `json:"warmStart,omitempty"`
  478. // ForceSendFields is a list of field names (e.g. "EarlyStop") to
  479. // unconditionally include in API requests. By default, fields with
  480. // empty values are omitted from API requests. However, any non-pointer,
  481. // non-interface field appearing in ForceSendFields will be sent to the
  482. // server regardless of whether the field is empty or not. This may be
  483. // used to include empty fields in Patch requests.
  484. ForceSendFields []string `json:"-"`
  485. // NullFields is a list of field names (e.g. "EarlyStop") to include in
  486. // API requests with the JSON null value. By default, fields with empty
  487. // values are omitted from API requests. However, any field with an
  488. // empty value appearing in NullFields will be sent to the server as
  489. // null. It is an error if a field in this list has a non-empty value.
  490. // This may be used to include null fields in Patch requests.
  491. NullFields []string `json:"-"`
  492. }
  493. func (s *BqmlTrainingRunTrainingOptions) MarshalJSON() ([]byte, error) {
  494. type NoMethod BqmlTrainingRunTrainingOptions
  495. raw := NoMethod(*s)
  496. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  497. }
  498. func (s *BqmlTrainingRunTrainingOptions) UnmarshalJSON(data []byte) error {
  499. type NoMethod BqmlTrainingRunTrainingOptions
  500. var s1 struct {
  501. L1Reg gensupport.JSONFloat64 `json:"l1Reg"`
  502. L2Reg gensupport.JSONFloat64 `json:"l2Reg"`
  503. LearnRate gensupport.JSONFloat64 `json:"learnRate"`
  504. LineSearchInitLearnRate gensupport.JSONFloat64 `json:"lineSearchInitLearnRate"`
  505. MinRelProgress gensupport.JSONFloat64 `json:"minRelProgress"`
  506. *NoMethod
  507. }
  508. s1.NoMethod = (*NoMethod)(s)
  509. if err := json.Unmarshal(data, &s1); err != nil {
  510. return err
  511. }
  512. s.L1Reg = float64(s1.L1Reg)
  513. s.L2Reg = float64(s1.L2Reg)
  514. s.LearnRate = float64(s1.LearnRate)
  515. s.LineSearchInitLearnRate = float64(s1.LineSearchInitLearnRate)
  516. s.MinRelProgress = float64(s1.MinRelProgress)
  517. return nil
  518. }
  519. type Clustering struct {
  520. // Fields: [Repeated] One or more fields on which data should be
  521. // clustered. Only top-level, non-repeated, simple-type fields are
  522. // supported. When you cluster a table using multiple columns, the order
  523. // of columns you specify is important. The order of the specified
  524. // columns determines the sort order of the data.
  525. Fields []string `json:"fields,omitempty"`
  526. // ForceSendFields is a list of field names (e.g. "Fields") to
  527. // unconditionally include in API requests. By default, fields with
  528. // empty values are omitted from API requests. However, any non-pointer,
  529. // non-interface field appearing in ForceSendFields will be sent to the
  530. // server regardless of whether the field is empty or not. This may be
  531. // used to include empty fields in Patch requests.
  532. ForceSendFields []string `json:"-"`
  533. // NullFields is a list of field names (e.g. "Fields") to include in API
  534. // requests with the JSON null value. By default, fields with empty
  535. // values are omitted from API requests. However, any field with an
  536. // empty value appearing in NullFields will be sent to the server as
  537. // null. It is an error if a field in this list has a non-empty value.
  538. // This may be used to include null fields in Patch requests.
  539. NullFields []string `json:"-"`
  540. }
  541. func (s *Clustering) MarshalJSON() ([]byte, error) {
  542. type NoMethod Clustering
  543. raw := NoMethod(*s)
  544. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  545. }
  546. type CsvOptions struct {
  547. // AllowJaggedRows: [Optional] Indicates if BigQuery should accept rows
  548. // that are missing trailing optional columns. If true, BigQuery treats
  549. // missing trailing columns as null values. If false, records with
  550. // missing trailing columns are treated as bad records, and if there are
  551. // too many bad records, an invalid error is returned in the job result.
  552. // The default value is false.
  553. AllowJaggedRows bool `json:"allowJaggedRows,omitempty"`
  554. // AllowQuotedNewlines: [Optional] Indicates if BigQuery should allow
  555. // quoted data sections that contain newline characters in a CSV file.
  556. // The default value is false.
  557. AllowQuotedNewlines bool `json:"allowQuotedNewlines,omitempty"`
  558. // Encoding: [Optional] The character encoding of the data. The
  559. // supported values are UTF-8 or ISO-8859-1. The default value is UTF-8.
  560. // BigQuery decodes the data after the raw, binary data has been split
  561. // using the values of the quote and fieldDelimiter properties.
  562. Encoding string `json:"encoding,omitempty"`
  563. // FieldDelimiter: [Optional] The separator for fields in a CSV file.
  564. // BigQuery converts the string to ISO-8859-1 encoding, and then uses
  565. // the first byte of the encoded string to split the data in its raw,
  566. // binary state. BigQuery also supports the escape sequence "\t" to
  567. // specify a tab separator. The default value is a comma (',').
  568. FieldDelimiter string `json:"fieldDelimiter,omitempty"`
  569. // Quote: [Optional] The value that is used to quote data sections in a
  570. // CSV file. BigQuery converts the string to ISO-8859-1 encoding, and
  571. // then uses the first byte of the encoded string to split the data in
  572. // its raw, binary state. The default value is a double-quote ('"'). If
  573. // your data does not contain quoted sections, set the property value to
  574. // an empty string. If your data contains quoted newline characters, you
  575. // must also set the allowQuotedNewlines property to true.
  576. //
  577. // Default: "
  578. Quote *string `json:"quote,omitempty"`
  579. // SkipLeadingRows: [Optional] The number of rows at the top of a CSV
  580. // file that BigQuery will skip when reading the data. The default value
  581. // is 0. This property is useful if you have header rows in the file
  582. // that should be skipped.
  583. SkipLeadingRows int64 `json:"skipLeadingRows,omitempty,string"`
  584. // ForceSendFields is a list of field names (e.g. "AllowJaggedRows") to
  585. // unconditionally include in API requests. By default, fields with
  586. // empty values are omitted from API requests. However, any non-pointer,
  587. // non-interface field appearing in ForceSendFields will be sent to the
  588. // server regardless of whether the field is empty or not. This may be
  589. // used to include empty fields in Patch requests.
  590. ForceSendFields []string `json:"-"`
  591. // NullFields is a list of field names (e.g. "AllowJaggedRows") to
  592. // include in API requests with the JSON null value. By default, fields
  593. // with empty values are omitted from API requests. However, any field
  594. // with an empty value appearing in NullFields will be sent to the
  595. // server as null. It is an error if a field in this list has a
  596. // non-empty value. This may be used to include null fields in Patch
  597. // requests.
  598. NullFields []string `json:"-"`
  599. }
  600. func (s *CsvOptions) MarshalJSON() ([]byte, error) {
  601. type NoMethod CsvOptions
  602. raw := NoMethod(*s)
  603. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  604. }
  605. type Dataset struct {
  606. // Access: [Optional] An array of objects that define dataset access for
  607. // one or more entities. You can set this property when inserting or
  608. // updating a dataset in order to control who is allowed to access the
  609. // data. If unspecified at dataset creation time, BigQuery adds default
  610. // dataset access for the following entities: access.specialGroup:
  611. // projectReaders; access.role: READER; access.specialGroup:
  612. // projectWriters; access.role: WRITER; access.specialGroup:
  613. // projectOwners; access.role: OWNER; access.userByEmail: [dataset
  614. // creator email]; access.role: OWNER;
  615. Access []*DatasetAccess `json:"access,omitempty"`
  616. // CreationTime: [Output-only] The time when this dataset was created,
  617. // in milliseconds since the epoch.
  618. CreationTime int64 `json:"creationTime,omitempty,string"`
  619. // DatasetReference: [Required] A reference that identifies the dataset.
  620. DatasetReference *DatasetReference `json:"datasetReference,omitempty"`
  621. // DefaultPartitionExpirationMs: [Optional] The default partition
  622. // expiration for all partitioned tables in the dataset, in
  623. // milliseconds. Once this property is set, all newly-created
  624. // partitioned tables in the dataset will have an expirationMs property
  625. // in the timePartitioning settings set to this value, and changing the
  626. // value will only affect new tables, not existing ones. The storage in
  627. // a partition will have an expiration time of its partition time plus
  628. // this value. Setting this property overrides the use of
  629. // defaultTableExpirationMs for partitioned tables: only one of
  630. // defaultTableExpirationMs and defaultPartitionExpirationMs will be
  631. // used for any new partitioned table. If you provide an explicit
  632. // timePartitioning.expirationMs when creating or updating a partitioned
  633. // table, that value takes precedence over the default partition
  634. // expiration time indicated by this property.
  635. DefaultPartitionExpirationMs int64 `json:"defaultPartitionExpirationMs,omitempty,string"`
  636. // DefaultTableExpirationMs: [Optional] The default lifetime of all
  637. // tables in the dataset, in milliseconds. The minimum value is 3600000
  638. // milliseconds (one hour). Once this property is set, all newly-created
  639. // tables in the dataset will have an expirationTime property set to the
  640. // creation time plus the value in this property, and changing the value
  641. // will only affect new tables, not existing ones. When the
  642. // expirationTime for a given table is reached, that table will be
  643. // deleted automatically. If a table's expirationTime is modified or
  644. // removed before the table expires, or if you provide an explicit
  645. // expirationTime when creating a table, that value takes precedence
  646. // over the default expiration time indicated by this property.
  647. DefaultTableExpirationMs int64 `json:"defaultTableExpirationMs,omitempty,string"`
  648. // Description: [Optional] A user-friendly description of the dataset.
  649. Description string `json:"description,omitempty"`
  650. // Etag: [Output-only] A hash of the resource.
  651. Etag string `json:"etag,omitempty"`
  652. // FriendlyName: [Optional] A descriptive name for the dataset.
  653. FriendlyName string `json:"friendlyName,omitempty"`
  654. // Id: [Output-only] The fully-qualified unique name of the dataset in
  655. // the format projectId:datasetId. The dataset name without the project
  656. // name is given in the datasetId field. When creating a new dataset,
  657. // leave this field blank, and instead specify the datasetId field.
  658. Id string `json:"id,omitempty"`
  659. // Kind: [Output-only] The resource type.
  660. Kind string `json:"kind,omitempty"`
  661. // Labels: The labels associated with this dataset. You can use these to
  662. // organize and group your datasets. You can set this property when
  663. // inserting or updating a dataset. See Creating and Updating Dataset
  664. // Labels for more information.
  665. Labels map[string]string `json:"labels,omitempty"`
  666. // LastModifiedTime: [Output-only] The date when this dataset or any of
  667. // its tables was last modified, in milliseconds since the epoch.
  668. LastModifiedTime int64 `json:"lastModifiedTime,omitempty,string"`
  669. // Location: The geographic location where the dataset should reside.
  670. // The default value is US. See details at
  671. // https://cloud.google.com/bigquery/docs/locations.
  672. Location string `json:"location,omitempty"`
  673. // SelfLink: [Output-only] A URL that can be used to access the resource
  674. // again. You can use this URL in Get or Update requests to the
  675. // resource.
  676. SelfLink string `json:"selfLink,omitempty"`
  677. // ServerResponse contains the HTTP response code and headers from the
  678. // server.
  679. googleapi.ServerResponse `json:"-"`
  680. // ForceSendFields is a list of field names (e.g. "Access") to
  681. // unconditionally include in API requests. By default, fields with
  682. // empty values are omitted from API requests. However, any non-pointer,
  683. // non-interface field appearing in ForceSendFields will be sent to the
  684. // server regardless of whether the field is empty or not. This may be
  685. // used to include empty fields in Patch requests.
  686. ForceSendFields []string `json:"-"`
  687. // NullFields is a list of field names (e.g. "Access") to include in API
  688. // requests with the JSON null value. By default, fields with empty
  689. // values are omitted from API requests. However, any field with an
  690. // empty value appearing in NullFields will be sent to the server as
  691. // null. It is an error if a field in this list has a non-empty value.
  692. // This may be used to include null fields in Patch requests.
  693. NullFields []string `json:"-"`
  694. }
  695. func (s *Dataset) MarshalJSON() ([]byte, error) {
  696. type NoMethod Dataset
  697. raw := NoMethod(*s)
  698. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  699. }
  700. type DatasetAccess struct {
  701. // Domain: [Pick one] A domain to grant access to. Any users signed in
  702. // with the domain specified will be granted the specified access.
  703. // Example: "example.com". Maps to IAM policy member "domain:DOMAIN".
  704. Domain string `json:"domain,omitempty"`
  705. // GroupByEmail: [Pick one] An email address of a Google Group to grant
  706. // access to. Maps to IAM policy member "group:GROUP".
  707. GroupByEmail string `json:"groupByEmail,omitempty"`
  708. // IamMember: [Pick one] Some other type of member that appears in the
  709. // IAM Policy but isn't a user, group, domain, or special group.
  710. IamMember string `json:"iamMember,omitempty"`
  711. // Role: [Required] An IAM role ID that should be granted to the user,
  712. // group, or domain specified in this access entry. The following legacy
  713. // mappings will be applied: OWNER roles/bigquery.dataOwner WRITER
  714. // roles/bigquery.dataEditor READER roles/bigquery.dataViewer This
  715. // field will accept any of the above formats, but will return only the
  716. // legacy format. For example, if you set this field to
  717. // "roles/bigquery.dataOwner", it will be returned back as "OWNER".
  718. Role string `json:"role,omitempty"`
  719. // SpecialGroup: [Pick one] A special group to grant access to. Possible
  720. // values include: projectOwners: Owners of the enclosing project.
  721. // projectReaders: Readers of the enclosing project. projectWriters:
  722. // Writers of the enclosing project. allAuthenticatedUsers: All
  723. // authenticated BigQuery users. Maps to similarly-named IAM members.
  724. SpecialGroup string `json:"specialGroup,omitempty"`
  725. // UserByEmail: [Pick one] An email address of a user to grant access
  726. // to. For example: fred@example.com. Maps to IAM policy member
  727. // "user:EMAIL" or "serviceAccount:EMAIL".
  728. UserByEmail string `json:"userByEmail,omitempty"`
  729. // View: [Pick one] A view from a different dataset to grant access to.
  730. // Queries executed against that view will have read access to tables in
  731. // this dataset. The role field is not required when this field is set.
  732. // If that view is updated by any user, access to the view needs to be
  733. // granted again via an update operation.
  734. View *TableReference `json:"view,omitempty"`
  735. // ForceSendFields is a list of field names (e.g. "Domain") to
  736. // unconditionally include in API requests. By default, fields with
  737. // empty values are omitted from API requests. However, any non-pointer,
  738. // non-interface field appearing in ForceSendFields will be sent to the
  739. // server regardless of whether the field is empty or not. This may be
  740. // used to include empty fields in Patch requests.
  741. ForceSendFields []string `json:"-"`
  742. // NullFields is a list of field names (e.g. "Domain") to include in API
  743. // requests with the JSON null value. By default, fields with empty
  744. // values are omitted from API requests. However, any field with an
  745. // empty value appearing in NullFields will be sent to the server as
  746. // null. It is an error if a field in this list has a non-empty value.
  747. // This may be used to include null fields in Patch requests.
  748. NullFields []string `json:"-"`
  749. }
  750. func (s *DatasetAccess) MarshalJSON() ([]byte, error) {
  751. type NoMethod DatasetAccess
  752. raw := NoMethod(*s)
  753. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  754. }
  755. type DatasetList struct {
  756. // Datasets: An array of the dataset resources in the project. Each
  757. // resource contains basic information. For full information about a
  758. // particular dataset resource, use the Datasets: get method. This
  759. // property is omitted when there are no datasets in the project.
  760. Datasets []*DatasetListDatasets `json:"datasets,omitempty"`
  761. // Etag: A hash value of the results page. You can use this property to
  762. // determine if the page has changed since the last request.
  763. Etag string `json:"etag,omitempty"`
  764. // Kind: The list type. This property always returns the value
  765. // "bigquery#datasetList".
  766. Kind string `json:"kind,omitempty"`
  767. // NextPageToken: A token that can be used to request the next results
  768. // page. This property is omitted on the final results page.
  769. NextPageToken string `json:"nextPageToken,omitempty"`
  770. // ServerResponse contains the HTTP response code and headers from the
  771. // server.
  772. googleapi.ServerResponse `json:"-"`
  773. // ForceSendFields is a list of field names (e.g. "Datasets") to
  774. // unconditionally include in API requests. By default, fields with
  775. // empty values are omitted from API requests. However, any non-pointer,
  776. // non-interface field appearing in ForceSendFields will be sent to the
  777. // server regardless of whether the field is empty or not. This may be
  778. // used to include empty fields in Patch requests.
  779. ForceSendFields []string `json:"-"`
  780. // NullFields is a list of field names (e.g. "Datasets") to include in
  781. // API requests with the JSON null value. By default, fields with empty
  782. // values are omitted from API requests. However, any field with an
  783. // empty value appearing in NullFields will be sent to the server as
  784. // null. It is an error if a field in this list has a non-empty value.
  785. // This may be used to include null fields in Patch requests.
  786. NullFields []string `json:"-"`
  787. }
  788. func (s *DatasetList) MarshalJSON() ([]byte, error) {
  789. type NoMethod DatasetList
  790. raw := NoMethod(*s)
  791. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  792. }
  793. type DatasetListDatasets struct {
  794. // DatasetReference: The dataset reference. Use this property to access
  795. // specific parts of the dataset's ID, such as project ID or dataset ID.
  796. DatasetReference *DatasetReference `json:"datasetReference,omitempty"`
  797. // FriendlyName: A descriptive name for the dataset, if one exists.
  798. FriendlyName string `json:"friendlyName,omitempty"`
  799. // Id: The fully-qualified, unique, opaque ID of the dataset.
  800. Id string `json:"id,omitempty"`
  801. // Kind: The resource type. This property always returns the value
  802. // "bigquery#dataset".
  803. Kind string `json:"kind,omitempty"`
  804. // Labels: The labels associated with this dataset. You can use these to
  805. // organize and group your datasets.
  806. Labels map[string]string `json:"labels,omitempty"`
  807. // Location: The geographic location where the data resides.
  808. Location string `json:"location,omitempty"`
  809. // ForceSendFields is a list of field names (e.g. "DatasetReference") to
  810. // unconditionally include in API requests. By default, fields with
  811. // empty values are omitted from API requests. However, any non-pointer,
  812. // non-interface field appearing in ForceSendFields will be sent to the
  813. // server regardless of whether the field is empty or not. This may be
  814. // used to include empty fields in Patch requests.
  815. ForceSendFields []string `json:"-"`
  816. // NullFields is a list of field names (e.g. "DatasetReference") to
  817. // include in API requests with the JSON null value. By default, fields
  818. // with empty values are omitted from API requests. However, any field
  819. // with an empty value appearing in NullFields will be sent to the
  820. // server as null. It is an error if a field in this list has a
  821. // non-empty value. This may be used to include null fields in Patch
  822. // requests.
  823. NullFields []string `json:"-"`
  824. }
  825. func (s *DatasetListDatasets) MarshalJSON() ([]byte, error) {
  826. type NoMethod DatasetListDatasets
  827. raw := NoMethod(*s)
  828. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  829. }
  830. type DatasetReference struct {
  831. // DatasetId: [Required] A unique ID for this dataset, without the
  832. // project name. The ID must contain only letters (a-z, A-Z), numbers
  833. // (0-9), or underscores (_). The maximum length is 1,024 characters.
  834. DatasetId string `json:"datasetId,omitempty"`
  835. // ProjectId: [Optional] The ID of the project containing this dataset.
  836. ProjectId string `json:"projectId,omitempty"`
  837. // ForceSendFields is a list of field names (e.g. "DatasetId") to
  838. // unconditionally include in API requests. By default, fields with
  839. // empty values are omitted from API requests. However, any non-pointer,
  840. // non-interface field appearing in ForceSendFields will be sent to the
  841. // server regardless of whether the field is empty or not. This may be
  842. // used to include empty fields in Patch requests.
  843. ForceSendFields []string `json:"-"`
  844. // NullFields is a list of field names (e.g. "DatasetId") to include in
  845. // API requests with the JSON null value. By default, fields with empty
  846. // values are omitted from API requests. However, any field with an
  847. // empty value appearing in NullFields will be sent to the server as
  848. // null. It is an error if a field in this list has a non-empty value.
  849. // This may be used to include null fields in Patch requests.
  850. NullFields []string `json:"-"`
  851. }
  852. func (s *DatasetReference) MarshalJSON() ([]byte, error) {
  853. type NoMethod DatasetReference
  854. raw := NoMethod(*s)
  855. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  856. }
  857. type DestinationTableProperties struct {
  858. // Description: [Optional] The description for the destination table.
  859. // This will only be used if the destination table is newly created. If
  860. // the table already exists and a value different than the current
  861. // description is provided, the job will fail.
  862. Description string `json:"description,omitempty"`
  863. // FriendlyName: [Optional] The friendly name for the destination table.
  864. // This will only be used if the destination table is newly created. If
  865. // the table already exists and a value different than the current
  866. // friendly name is provided, the job will fail.
  867. FriendlyName string `json:"friendlyName,omitempty"`
  868. // Labels: [Optional] The labels associated with this table. You can use
  869. // these to organize and group your tables. This will only be used if
  870. // the destination table is newly created. If the table already exists
  871. // and labels are different than the current labels are provided, the
  872. // job will fail.
  873. Labels map[string]string `json:"labels,omitempty"`
  874. // ForceSendFields is a list of field names (e.g. "Description") to
  875. // unconditionally include in API requests. By default, fields with
  876. // empty values are omitted from API requests. However, any non-pointer,
  877. // non-interface field appearing in ForceSendFields will be sent to the
  878. // server regardless of whether the field is empty or not. This may be
  879. // used to include empty fields in Patch requests.
  880. ForceSendFields []string `json:"-"`
  881. // NullFields is a list of field names (e.g. "Description") to include
  882. // in API requests with the JSON null value. By default, fields with
  883. // empty values are omitted from API requests. However, any field with
  884. // an empty value appearing in NullFields will be sent to the server as
  885. // null. It is an error if a field in this list has a non-empty value.
  886. // This may be used to include null fields in Patch requests.
  887. NullFields []string `json:"-"`
  888. }
  889. func (s *DestinationTableProperties) MarshalJSON() ([]byte, error) {
  890. type NoMethod DestinationTableProperties
  891. raw := NoMethod(*s)
  892. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  893. }
  894. type EncryptionConfiguration struct {
  895. // KmsKeyName: [Optional] Describes the Cloud KMS encryption key that
  896. // will be used to protect destination BigQuery table. The BigQuery
  897. // Service Account associated with your project requires access to this
  898. // encryption key.
  899. KmsKeyName string `json:"kmsKeyName,omitempty"`
  900. // ForceSendFields is a list of field names (e.g. "KmsKeyName") to
  901. // unconditionally include in API requests. By default, fields with
  902. // empty values are omitted from API requests. However, any non-pointer,
  903. // non-interface field appearing in ForceSendFields will be sent to the
  904. // server regardless of whether the field is empty or not. This may be
  905. // used to include empty fields in Patch requests.
  906. ForceSendFields []string `json:"-"`
  907. // NullFields is a list of field names (e.g. "KmsKeyName") to include in
  908. // API requests with the JSON null value. By default, fields with empty
  909. // values are omitted from API requests. However, any field with an
  910. // empty value appearing in NullFields will be sent to the server as
  911. // null. It is an error if a field in this list has a non-empty value.
  912. // This may be used to include null fields in Patch requests.
  913. NullFields []string `json:"-"`
  914. }
  915. func (s *EncryptionConfiguration) MarshalJSON() ([]byte, error) {
  916. type NoMethod EncryptionConfiguration
  917. raw := NoMethod(*s)
  918. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  919. }
  920. type ErrorProto struct {
  921. // DebugInfo: Debugging information. This property is internal to Google
  922. // and should not be used.
  923. DebugInfo string `json:"debugInfo,omitempty"`
  924. // Location: Specifies where the error occurred, if present.
  925. Location string `json:"location,omitempty"`
  926. // Message: A human-readable description of the error.
  927. Message string `json:"message,omitempty"`
  928. // Reason: A short error code that summarizes the error.
  929. Reason string `json:"reason,omitempty"`
  930. // ForceSendFields is a list of field names (e.g. "DebugInfo") to
  931. // unconditionally include in API requests. By default, fields with
  932. // empty values are omitted from API requests. However, any non-pointer,
  933. // non-interface field appearing in ForceSendFields will be sent to the
  934. // server regardless of whether the field is empty or not. This may be
  935. // used to include empty fields in Patch requests.
  936. ForceSendFields []string `json:"-"`
  937. // NullFields is a list of field names (e.g. "DebugInfo") to include in
  938. // API requests with the JSON null value. By default, fields with empty
  939. // values are omitted from API requests. However, any field with an
  940. // empty value appearing in NullFields will be sent to the server as
  941. // null. It is an error if a field in this list has a non-empty value.
  942. // This may be used to include null fields in Patch requests.
  943. NullFields []string `json:"-"`
  944. }
  945. func (s *ErrorProto) MarshalJSON() ([]byte, error) {
  946. type NoMethod ErrorProto
  947. raw := NoMethod(*s)
  948. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  949. }
  950. type ExplainQueryStage struct {
  951. // CompletedParallelInputs: Number of parallel input segments completed.
  952. CompletedParallelInputs int64 `json:"completedParallelInputs,omitempty,string"`
  953. // ComputeMsAvg: Milliseconds the average shard spent on CPU-bound
  954. // tasks.
  955. ComputeMsAvg int64 `json:"computeMsAvg,omitempty,string"`
  956. // ComputeMsMax: Milliseconds the slowest shard spent on CPU-bound
  957. // tasks.
  958. ComputeMsMax int64 `json:"computeMsMax,omitempty,string"`
  959. // ComputeRatioAvg: Relative amount of time the average shard spent on
  960. // CPU-bound tasks.
  961. ComputeRatioAvg float64 `json:"computeRatioAvg,omitempty"`
  962. // ComputeRatioMax: Relative amount of time the slowest shard spent on
  963. // CPU-bound tasks.
  964. ComputeRatioMax float64 `json:"computeRatioMax,omitempty"`
  965. // EndMs: Stage end time represented as milliseconds since epoch.
  966. EndMs int64 `json:"endMs,omitempty,string"`
  967. // Id: Unique ID for stage within plan.
  968. Id int64 `json:"id,omitempty,string"`
  969. // InputStages: IDs for stages that are inputs to this stage.
  970. InputStages googleapi.Int64s `json:"inputStages,omitempty"`
  971. // Name: Human-readable name for stage.
  972. Name string `json:"name,omitempty"`
  973. // ParallelInputs: Number of parallel input segments to be processed.
  974. ParallelInputs int64 `json:"parallelInputs,omitempty,string"`
  975. // ReadMsAvg: Milliseconds the average shard spent reading input.
  976. ReadMsAvg int64 `json:"readMsAvg,omitempty,string"`
  977. // ReadMsMax: Milliseconds the slowest shard spent reading input.
  978. ReadMsMax int64 `json:"readMsMax,omitempty,string"`
  979. // ReadRatioAvg: Relative amount of time the average shard spent reading
  980. // input.
  981. ReadRatioAvg float64 `json:"readRatioAvg,omitempty"`
  982. // ReadRatioMax: Relative amount of time the slowest shard spent reading
  983. // input.
  984. ReadRatioMax float64 `json:"readRatioMax,omitempty"`
  985. // RecordsRead: Number of records read into the stage.
  986. RecordsRead int64 `json:"recordsRead,omitempty,string"`
  987. // RecordsWritten: Number of records written by the stage.
  988. RecordsWritten int64 `json:"recordsWritten,omitempty,string"`
  989. // ShuffleOutputBytes: Total number of bytes written to shuffle.
  990. ShuffleOutputBytes int64 `json:"shuffleOutputBytes,omitempty,string"`
  991. // ShuffleOutputBytesSpilled: Total number of bytes written to shuffle
  992. // and spilled to disk.
  993. ShuffleOutputBytesSpilled int64 `json:"shuffleOutputBytesSpilled,omitempty,string"`
  994. // StartMs: Stage start time represented as milliseconds since epoch.
  995. StartMs int64 `json:"startMs,omitempty,string"`
  996. // Status: Current status for the stage.
  997. Status string `json:"status,omitempty"`
  998. // Steps: List of operations within the stage in dependency order
  999. // (approximately chronological).
  1000. Steps []*ExplainQueryStep `json:"steps,omitempty"`
  1001. // WaitMsAvg: Milliseconds the average shard spent waiting to be
  1002. // scheduled.
  1003. WaitMsAvg int64 `json:"waitMsAvg,omitempty,string"`
  1004. // WaitMsMax: Milliseconds the slowest shard spent waiting to be
  1005. // scheduled.
  1006. WaitMsMax int64 `json:"waitMsMax,omitempty,string"`
  1007. // WaitRatioAvg: Relative amount of time the average shard spent waiting
  1008. // to be scheduled.
  1009. WaitRatioAvg float64 `json:"waitRatioAvg,omitempty"`
  1010. // WaitRatioMax: Relative amount of time the slowest shard spent waiting
  1011. // to be scheduled.
  1012. WaitRatioMax float64 `json:"waitRatioMax,omitempty"`
  1013. // WriteMsAvg: Milliseconds the average shard spent on writing output.
  1014. WriteMsAvg int64 `json:"writeMsAvg,omitempty,string"`
  1015. // WriteMsMax: Milliseconds the slowest shard spent on writing output.
  1016. WriteMsMax int64 `json:"writeMsMax,omitempty,string"`
  1017. // WriteRatioAvg: Relative amount of time the average shard spent on
  1018. // writing output.
  1019. WriteRatioAvg float64 `json:"writeRatioAvg,omitempty"`
  1020. // WriteRatioMax: Relative amount of time the slowest shard spent on
  1021. // writing output.
  1022. WriteRatioMax float64 `json:"writeRatioMax,omitempty"`
  1023. // ForceSendFields is a list of field names (e.g.
  1024. // "CompletedParallelInputs") to unconditionally include in API
  1025. // requests. By default, fields with empty values are omitted from API
  1026. // requests. However, any non-pointer, non-interface field appearing in
  1027. // ForceSendFields will be sent to the server regardless of whether the
  1028. // field is empty or not. This may be used to include empty fields in
  1029. // Patch requests.
  1030. ForceSendFields []string `json:"-"`
  1031. // NullFields is a list of field names (e.g. "CompletedParallelInputs")
  1032. // to include in API requests with the JSON null value. By default,
  1033. // fields with empty values are omitted from API requests. However, any
  1034. // field with an empty value appearing in NullFields will be sent to the
  1035. // server as null. It is an error if a field in this list has a
  1036. // non-empty value. This may be used to include null fields in Patch
  1037. // requests.
  1038. NullFields []string `json:"-"`
  1039. }
  1040. func (s *ExplainQueryStage) MarshalJSON() ([]byte, error) {
  1041. type NoMethod ExplainQueryStage
  1042. raw := NoMethod(*s)
  1043. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1044. }
  1045. func (s *ExplainQueryStage) UnmarshalJSON(data []byte) error {
  1046. type NoMethod ExplainQueryStage
  1047. var s1 struct {
  1048. ComputeRatioAvg gensupport.JSONFloat64 `json:"computeRatioAvg"`
  1049. ComputeRatioMax gensupport.JSONFloat64 `json:"computeRatioMax"`
  1050. ReadRatioAvg gensupport.JSONFloat64 `json:"readRatioAvg"`
  1051. ReadRatioMax gensupport.JSONFloat64 `json:"readRatioMax"`
  1052. WaitRatioAvg gensupport.JSONFloat64 `json:"waitRatioAvg"`
  1053. WaitRatioMax gensupport.JSONFloat64 `json:"waitRatioMax"`
  1054. WriteRatioAvg gensupport.JSONFloat64 `json:"writeRatioAvg"`
  1055. WriteRatioMax gensupport.JSONFloat64 `json:"writeRatioMax"`
  1056. *NoMethod
  1057. }
  1058. s1.NoMethod = (*NoMethod)(s)
  1059. if err := json.Unmarshal(data, &s1); err != nil {
  1060. return err
  1061. }
  1062. s.ComputeRatioAvg = float64(s1.ComputeRatioAvg)
  1063. s.ComputeRatioMax = float64(s1.ComputeRatioMax)
  1064. s.ReadRatioAvg = float64(s1.ReadRatioAvg)
  1065. s.ReadRatioMax = float64(s1.ReadRatioMax)
  1066. s.WaitRatioAvg = float64(s1.WaitRatioAvg)
  1067. s.WaitRatioMax = float64(s1.WaitRatioMax)
  1068. s.WriteRatioAvg = float64(s1.WriteRatioAvg)
  1069. s.WriteRatioMax = float64(s1.WriteRatioMax)
  1070. return nil
  1071. }
  1072. type ExplainQueryStep struct {
  1073. // Kind: Machine-readable operation type.
  1074. Kind string `json:"kind,omitempty"`
  1075. // Substeps: Human-readable stage descriptions.
  1076. Substeps []string `json:"substeps,omitempty"`
  1077. // ForceSendFields is a list of field names (e.g. "Kind") to
  1078. // unconditionally include in API requests. By default, fields with
  1079. // empty values are omitted from API requests. However, any non-pointer,
  1080. // non-interface field appearing in ForceSendFields will be sent to the
  1081. // server regardless of whether the field is empty or not. This may be
  1082. // used to include empty fields in Patch requests.
  1083. ForceSendFields []string `json:"-"`
  1084. // NullFields is a list of field names (e.g. "Kind") to include in API
  1085. // requests with the JSON null value. By default, fields with empty
  1086. // values are omitted from API requests. However, any field with an
  1087. // empty value appearing in NullFields will be sent to the server as
  1088. // null. It is an error if a field in this list has a non-empty value.
  1089. // This may be used to include null fields in Patch requests.
  1090. NullFields []string `json:"-"`
  1091. }
  1092. func (s *ExplainQueryStep) MarshalJSON() ([]byte, error) {
  1093. type NoMethod ExplainQueryStep
  1094. raw := NoMethod(*s)
  1095. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1096. }
  1097. type ExternalDataConfiguration struct {
  1098. // Autodetect: Try to detect schema and format options automatically.
  1099. // Any option specified explicitly will be honored.
  1100. Autodetect bool `json:"autodetect,omitempty"`
  1101. // BigtableOptions: [Optional] Additional options if sourceFormat is set
  1102. // to BIGTABLE.
  1103. BigtableOptions *BigtableOptions `json:"bigtableOptions,omitempty"`
  1104. // Compression: [Optional] The compression type of the data source.
  1105. // Possible values include GZIP and NONE. The default value is NONE.
  1106. // This setting is ignored for Google Cloud Bigtable, Google Cloud
  1107. // Datastore backups and Avro formats.
  1108. Compression string `json:"compression,omitempty"`
  1109. // CsvOptions: Additional properties to set if sourceFormat is set to
  1110. // CSV.
  1111. CsvOptions *CsvOptions `json:"csvOptions,omitempty"`
  1112. // GoogleSheetsOptions: [Optional] Additional options if sourceFormat is
  1113. // set to GOOGLE_SHEETS.
  1114. GoogleSheetsOptions *GoogleSheetsOptions `json:"googleSheetsOptions,omitempty"`
  1115. // HivePartitioningMode: [Optional, Experimental] If hive partitioning
  1116. // is enabled, which mode to use. Two modes are supported: - AUTO:
  1117. // automatically infer partition key name(s) and type(s). - STRINGS:
  1118. // automatic infer partition key name(s). All types are strings. Not all
  1119. // storage formats support hive partitioning -- requesting hive
  1120. // partitioning on an unsupported format will lead to an error.
  1121. HivePartitioningMode string `json:"hivePartitioningMode,omitempty"`
  1122. // IgnoreUnknownValues: [Optional] Indicates if BigQuery should allow
  1123. // extra values that are not represented in the table schema. If true,
  1124. // the extra values are ignored. If false, records with extra columns
  1125. // are treated as bad records, and if there are too many bad records, an
  1126. // invalid error is returned in the job result. The default value is
  1127. // false. The sourceFormat property determines what BigQuery treats as
  1128. // an extra value: CSV: Trailing columns JSON: Named values that don't
  1129. // match any column names Google Cloud Bigtable: This setting is
  1130. // ignored. Google Cloud Datastore backups: This setting is ignored.
  1131. // Avro: This setting is ignored.
  1132. IgnoreUnknownValues bool `json:"ignoreUnknownValues,omitempty"`
  1133. // MaxBadRecords: [Optional] The maximum number of bad records that
  1134. // BigQuery can ignore when reading data. If the number of bad records
  1135. // exceeds this value, an invalid error is returned in the job result.
  1136. // This is only valid for CSV, JSON, and Google Sheets. The default
  1137. // value is 0, which requires that all records are valid. This setting
  1138. // is ignored for Google Cloud Bigtable, Google Cloud Datastore backups
  1139. // and Avro formats.
  1140. MaxBadRecords int64 `json:"maxBadRecords,omitempty"`
  1141. // Schema: [Optional] The schema for the data. Schema is required for
  1142. // CSV and JSON formats. Schema is disallowed for Google Cloud Bigtable,
  1143. // Cloud Datastore backups, and Avro formats.
  1144. Schema *TableSchema `json:"schema,omitempty"`
  1145. // SourceFormat: [Required] The data format. For CSV files, specify
  1146. // "CSV". For Google sheets, specify "GOOGLE_SHEETS". For
  1147. // newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". For Avro
  1148. // files, specify "AVRO". For Google Cloud Datastore backups, specify
  1149. // "DATASTORE_BACKUP". [Beta] For Google Cloud Bigtable, specify
  1150. // "BIGTABLE".
  1151. SourceFormat string `json:"sourceFormat,omitempty"`
  1152. // SourceUris: [Required] The fully-qualified URIs that point to your
  1153. // data in Google Cloud. For Google Cloud Storage URIs: Each URI can
  1154. // contain one '*' wildcard character and it must come after the
  1155. // 'bucket' name. Size limits related to load jobs apply to external
  1156. // data sources. For Google Cloud Bigtable URIs: Exactly one URI can be
  1157. // specified and it has be a fully specified and valid HTTPS URL for a
  1158. // Google Cloud Bigtable table. For Google Cloud Datastore backups,
  1159. // exactly one URI can be specified. Also, the '*' wildcard character is
  1160. // not allowed.
  1161. SourceUris []string `json:"sourceUris,omitempty"`
  1162. // ForceSendFields is a list of field names (e.g. "Autodetect") to
  1163. // unconditionally include in API requests. By default, fields with
  1164. // empty values are omitted from API requests. However, any non-pointer,
  1165. // non-interface field appearing in ForceSendFields will be sent to the
  1166. // server regardless of whether the field is empty or not. This may be
  1167. // used to include empty fields in Patch requests.
  1168. ForceSendFields []string `json:"-"`
  1169. // NullFields is a list of field names (e.g. "Autodetect") to include in
  1170. // API requests with the JSON null value. By default, fields with empty
  1171. // values are omitted from API requests. However, any field with an
  1172. // empty value appearing in NullFields will be sent to the server as
  1173. // null. It is an error if a field in this list has a non-empty value.
  1174. // This may be used to include null fields in Patch requests.
  1175. NullFields []string `json:"-"`
  1176. }
  1177. func (s *ExternalDataConfiguration) MarshalJSON() ([]byte, error) {
  1178. type NoMethod ExternalDataConfiguration
  1179. raw := NoMethod(*s)
  1180. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1181. }
  1182. type GetQueryResultsResponse struct {
  1183. // CacheHit: Whether the query result was fetched from the query cache.
  1184. CacheHit bool `json:"cacheHit,omitempty"`
  1185. // Errors: [Output-only] The first errors or warnings encountered during
  1186. // the running of the job. The final message includes the number of
  1187. // errors that caused the process to stop. Errors here do not
  1188. // necessarily mean that the job has completed or was unsuccessful.
  1189. Errors []*ErrorProto `json:"errors,omitempty"`
  1190. // Etag: A hash of this response.
  1191. Etag string `json:"etag,omitempty"`
  1192. // JobComplete: Whether the query has completed or not. If rows or
  1193. // totalRows are present, this will always be true. If this is false,
  1194. // totalRows will not be available.
  1195. JobComplete bool `json:"jobComplete,omitempty"`
  1196. // JobReference: Reference to the BigQuery Job that was created to run
  1197. // the query. This field will be present even if the original request
  1198. // timed out, in which case GetQueryResults can be used to read the
  1199. // results once the query has completed. Since this API only returns the
  1200. // first page of results, subsequent pages can be fetched via the same
  1201. // mechanism (GetQueryResults).
  1202. JobReference *JobReference `json:"jobReference,omitempty"`
  1203. // Kind: The resource type of the response.
  1204. Kind string `json:"kind,omitempty"`
  1205. // NumDmlAffectedRows: [Output-only] The number of rows affected by a
  1206. // DML statement. Present only for DML statements INSERT, UPDATE or
  1207. // DELETE.
  1208. NumDmlAffectedRows int64 `json:"numDmlAffectedRows,omitempty,string"`
  1209. // PageToken: A token used for paging results.
  1210. PageToken string `json:"pageToken,omitempty"`
  1211. // Rows: An object with as many results as can be contained within the
  1212. // maximum permitted reply size. To get any additional rows, you can
  1213. // call GetQueryResults and specify the jobReference returned above.
  1214. // Present only when the query completes successfully.
  1215. Rows []*TableRow `json:"rows,omitempty"`
  1216. // Schema: The schema of the results. Present only when the query
  1217. // completes successfully.
  1218. Schema *TableSchema `json:"schema,omitempty"`
  1219. // TotalBytesProcessed: The total number of bytes processed for this
  1220. // query.
  1221. TotalBytesProcessed int64 `json:"totalBytesProcessed,omitempty,string"`
  1222. // TotalRows: The total number of rows in the complete query result set,
  1223. // which can be more than the number of rows in this single page of
  1224. // results. Present only when the query completes successfully.
  1225. TotalRows uint64 `json:"totalRows,omitempty,string"`
  1226. // ServerResponse contains the HTTP response code and headers from the
  1227. // server.
  1228. googleapi.ServerResponse `json:"-"`
  1229. // ForceSendFields is a list of field names (e.g. "CacheHit") to
  1230. // unconditionally include in API requests. By default, fields with
  1231. // empty values are omitted from API requests. However, any non-pointer,
  1232. // non-interface field appearing in ForceSendFields will be sent to the
  1233. // server regardless of whether the field is empty or not. This may be
  1234. // used to include empty fields in Patch requests.
  1235. ForceSendFields []string `json:"-"`
  1236. // NullFields is a list of field names (e.g. "CacheHit") to include in
  1237. // API requests with the JSON null value. By default, fields with empty
  1238. // values are omitted from API requests. However, any field with an
  1239. // empty value appearing in NullFields will be sent to the server as
  1240. // null. It is an error if a field in this list has a non-empty value.
  1241. // This may be used to include null fields in Patch requests.
  1242. NullFields []string `json:"-"`
  1243. }
  1244. func (s *GetQueryResultsResponse) MarshalJSON() ([]byte, error) {
  1245. type NoMethod GetQueryResultsResponse
  1246. raw := NoMethod(*s)
  1247. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1248. }
  1249. type GetServiceAccountResponse struct {
  1250. // Email: The service account email address.
  1251. Email string `json:"email,omitempty"`
  1252. // Kind: The resource type of the response.
  1253. Kind string `json:"kind,omitempty"`
  1254. // ServerResponse contains the HTTP response code and headers from the
  1255. // server.
  1256. googleapi.ServerResponse `json:"-"`
  1257. // ForceSendFields is a list of field names (e.g. "Email") to
  1258. // unconditionally include in API requests. By default, fields with
  1259. // empty values are omitted from API requests. However, any non-pointer,
  1260. // non-interface field appearing in ForceSendFields will be sent to the
  1261. // server regardless of whether the field is empty or not. This may be
  1262. // used to include empty fields in Patch requests.
  1263. ForceSendFields []string `json:"-"`
  1264. // NullFields is a list of field names (e.g. "Email") to include in API
  1265. // requests with the JSON null value. By default, fields with empty
  1266. // values are omitted from API requests. However, any field with an
  1267. // empty value appearing in NullFields will be sent to the server as
  1268. // null. It is an error if a field in this list has a non-empty value.
  1269. // This may be used to include null fields in Patch requests.
  1270. NullFields []string `json:"-"`
  1271. }
  1272. func (s *GetServiceAccountResponse) MarshalJSON() ([]byte, error) {
  1273. type NoMethod GetServiceAccountResponse
  1274. raw := NoMethod(*s)
  1275. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1276. }
  1277. type GoogleSheetsOptions struct {
  1278. // Range: [Beta] [Optional] Range of a sheet to query from. Only used
  1279. // when non-empty. Typical format:
  1280. // sheet_name!top_left_cell_id:bottom_right_cell_id For example:
  1281. // sheet1!A1:B20
  1282. Range string `json:"range,omitempty"`
  1283. // SkipLeadingRows: [Optional] The number of rows at the top of a sheet
  1284. // that BigQuery will skip when reading the data. The default value is
  1285. // 0. This property is useful if you have header rows that should be
  1286. // skipped. When autodetect is on, behavior is the following: *
  1287. // skipLeadingRows unspecified - Autodetect tries to detect headers in
  1288. // the first row. If they are not detected, the row is read as data.
  1289. // Otherwise data is read starting from the second row. *
  1290. // skipLeadingRows is 0 - Instructs autodetect that there are no headers
  1291. // and data should be read starting from the first row. *
  1292. // skipLeadingRows = N > 0 - Autodetect skips N-1 rows and tries to
  1293. // detect headers in row N. If headers are not detected, row N is just
  1294. // skipped. Otherwise row N is used to extract column names for the
  1295. // detected schema.
  1296. SkipLeadingRows int64 `json:"skipLeadingRows,omitempty,string"`
  1297. // ForceSendFields is a list of field names (e.g. "Range") to
  1298. // unconditionally include in API requests. By default, fields with
  1299. // empty values are omitted from API requests. However, any non-pointer,
  1300. // non-interface field appearing in ForceSendFields will be sent to the
  1301. // server regardless of whether the field is empty or not. This may be
  1302. // used to include empty fields in Patch requests.
  1303. ForceSendFields []string `json:"-"`
  1304. // NullFields is a list of field names (e.g. "Range") to include in API
  1305. // requests with the JSON null value. By default, fields with empty
  1306. // values are omitted from API requests. However, any field with an
  1307. // empty value appearing in NullFields will be sent to the server as
  1308. // null. It is an error if a field in this list has a non-empty value.
  1309. // This may be used to include null fields in Patch requests.
  1310. NullFields []string `json:"-"`
  1311. }
  1312. func (s *GoogleSheetsOptions) MarshalJSON() ([]byte, error) {
  1313. type NoMethod GoogleSheetsOptions
  1314. raw := NoMethod(*s)
  1315. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1316. }
  1317. type Job struct {
  1318. // Configuration: [Required] Describes the job configuration.
  1319. Configuration *JobConfiguration `json:"configuration,omitempty"`
  1320. // Etag: [Output-only] A hash of this resource.
  1321. Etag string `json:"etag,omitempty"`
  1322. // Id: [Output-only] Opaque ID field of the job
  1323. Id string `json:"id,omitempty"`
  1324. // JobReference: [Optional] Reference describing the unique-per-user
  1325. // name of the job.
  1326. JobReference *JobReference `json:"jobReference,omitempty"`
  1327. // Kind: [Output-only] The type of the resource.
  1328. Kind string `json:"kind,omitempty"`
  1329. // SelfLink: [Output-only] A URL that can be used to access this
  1330. // resource again.
  1331. SelfLink string `json:"selfLink,omitempty"`
  1332. // Statistics: [Output-only] Information about the job, including
  1333. // starting time and ending time of the job.
  1334. Statistics *JobStatistics `json:"statistics,omitempty"`
  1335. // Status: [Output-only] The status of this job. Examine this value when
  1336. // polling an asynchronous job to see if the job is complete.
  1337. Status *JobStatus `json:"status,omitempty"`
  1338. // UserEmail: [Output-only] Email address of the user who ran the job.
  1339. UserEmail string `json:"user_email,omitempty"`
  1340. // ServerResponse contains the HTTP response code and headers from the
  1341. // server.
  1342. googleapi.ServerResponse `json:"-"`
  1343. // ForceSendFields is a list of field names (e.g. "Configuration") to
  1344. // unconditionally include in API requests. By default, fields with
  1345. // empty values are omitted from API requests. However, any non-pointer,
  1346. // non-interface field appearing in ForceSendFields will be sent to the
  1347. // server regardless of whether the field is empty or not. This may be
  1348. // used to include empty fields in Patch requests.
  1349. ForceSendFields []string `json:"-"`
  1350. // NullFields is a list of field names (e.g. "Configuration") to include
  1351. // in API requests with the JSON null value. By default, fields with
  1352. // empty values are omitted from API requests. However, any field with
  1353. // an empty value appearing in NullFields will be sent to the server as
  1354. // null. It is an error if a field in this list has a non-empty value.
  1355. // This may be used to include null fields in Patch requests.
  1356. NullFields []string `json:"-"`
  1357. }
  1358. func (s *Job) MarshalJSON() ([]byte, error) {
  1359. type NoMethod Job
  1360. raw := NoMethod(*s)
  1361. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1362. }
  1363. type JobCancelResponse struct {
  1364. // Job: The final state of the job.
  1365. Job *Job `json:"job,omitempty"`
  1366. // Kind: The resource type of the response.
  1367. Kind string `json:"kind,omitempty"`
  1368. // ServerResponse contains the HTTP response code and headers from the
  1369. // server.
  1370. googleapi.ServerResponse `json:"-"`
  1371. // ForceSendFields is a list of field names (e.g. "Job") to
  1372. // unconditionally include in API requests. By default, fields with
  1373. // empty values are omitted from API requests. However, any non-pointer,
  1374. // non-interface field appearing in ForceSendFields will be sent to the
  1375. // server regardless of whether the field is empty or not. This may be
  1376. // used to include empty fields in Patch requests.
  1377. ForceSendFields []string `json:"-"`
  1378. // NullFields is a list of field names (e.g. "Job") to include in API
  1379. // requests with the JSON null value. By default, fields with empty
  1380. // values are omitted from API requests. However, any field with an
  1381. // empty value appearing in NullFields will be sent to the server as
  1382. // null. It is an error if a field in this list has a non-empty value.
  1383. // This may be used to include null fields in Patch requests.
  1384. NullFields []string `json:"-"`
  1385. }
  1386. func (s *JobCancelResponse) MarshalJSON() ([]byte, error) {
  1387. type NoMethod JobCancelResponse
  1388. raw := NoMethod(*s)
  1389. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1390. }
  1391. type JobConfiguration struct {
  1392. // Copy: [Pick one] Copies a table.
  1393. Copy *JobConfigurationTableCopy `json:"copy,omitempty"`
  1394. // DryRun: [Optional] If set, don't actually run this job. A valid query
  1395. // will return a mostly empty response with some processing statistics,
  1396. // while an invalid query will return the same error it would if it
  1397. // wasn't a dry run. Behavior of non-query jobs is undefined.
  1398. DryRun bool `json:"dryRun,omitempty"`
  1399. // Extract: [Pick one] Configures an extract job.
  1400. Extract *JobConfigurationExtract `json:"extract,omitempty"`
  1401. // JobTimeoutMs: [Optional] Job timeout in milliseconds. If this time
  1402. // limit is exceeded, BigQuery may attempt to terminate the job.
  1403. JobTimeoutMs int64 `json:"jobTimeoutMs,omitempty,string"`
  1404. // JobType: [Output-only] The type of the job. Can be QUERY, LOAD,
  1405. // EXTRACT, COPY or UNKNOWN.
  1406. JobType string `json:"jobType,omitempty"`
  1407. // Labels: The labels associated with this job. You can use these to
  1408. // organize and group your jobs. Label keys and values can be no longer
  1409. // than 63 characters, can only contain lowercase letters, numeric
  1410. // characters, underscores and dashes. International characters are
  1411. // allowed. Label values are optional. Label keys must start with a
  1412. // letter and each label in the list must have a different key.
  1413. Labels map[string]string `json:"labels,omitempty"`
  1414. // Load: [Pick one] Configures a load job.
  1415. Load *JobConfigurationLoad `json:"load,omitempty"`
  1416. // Query: [Pick one] Configures a query job.
  1417. Query *JobConfigurationQuery `json:"query,omitempty"`
  1418. // ForceSendFields is a list of field names (e.g. "Copy") to
  1419. // unconditionally include in API requests. By default, fields with
  1420. // empty values are omitted from API requests. However, any non-pointer,
  1421. // non-interface field appearing in ForceSendFields will be sent to the
  1422. // server regardless of whether the field is empty or not. This may be
  1423. // used to include empty fields in Patch requests.
  1424. ForceSendFields []string `json:"-"`
  1425. // NullFields is a list of field names (e.g. "Copy") to include in API
  1426. // requests with the JSON null value. By default, fields with empty
  1427. // values are omitted from API requests. However, any field with an
  1428. // empty value appearing in NullFields will be sent to the server as
  1429. // null. It is an error if a field in this list has a non-empty value.
  1430. // This may be used to include null fields in Patch requests.
  1431. NullFields []string `json:"-"`
  1432. }
  1433. func (s *JobConfiguration) MarshalJSON() ([]byte, error) {
  1434. type NoMethod JobConfiguration
  1435. raw := NoMethod(*s)
  1436. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1437. }
  1438. type JobConfigurationExtract struct {
  1439. // Compression: [Optional] The compression type to use for exported
  1440. // files. Possible values include GZIP, DEFLATE, SNAPPY, and NONE. The
  1441. // default value is NONE. DEFLATE and SNAPPY are only supported for
  1442. // Avro.
  1443. Compression string `json:"compression,omitempty"`
  1444. // DestinationFormat: [Optional] The exported file format. Possible
  1445. // values include CSV, NEWLINE_DELIMITED_JSON and AVRO. The default
  1446. // value is CSV. Tables with nested or repeated fields cannot be
  1447. // exported as CSV.
  1448. DestinationFormat string `json:"destinationFormat,omitempty"`
  1449. // DestinationUri: [Pick one] DEPRECATED: Use destinationUris instead,
  1450. // passing only one URI as necessary. The fully-qualified Google Cloud
  1451. // Storage URI where the extracted table should be written.
  1452. DestinationUri string `json:"destinationUri,omitempty"`
  1453. // DestinationUris: [Pick one] A list of fully-qualified Google Cloud
  1454. // Storage URIs where the extracted table should be written.
  1455. DestinationUris []string `json:"destinationUris,omitempty"`
  1456. // FieldDelimiter: [Optional] Delimiter to use between fields in the
  1457. // exported data. Default is ','
  1458. FieldDelimiter string `json:"fieldDelimiter,omitempty"`
  1459. // PrintHeader: [Optional] Whether to print out a header row in the
  1460. // results. Default is true.
  1461. //
  1462. // Default: true
  1463. PrintHeader *bool `json:"printHeader,omitempty"`
  1464. // SourceTable: [Required] A reference to the table being exported.
  1465. SourceTable *TableReference `json:"sourceTable,omitempty"`
  1466. // ForceSendFields is a list of field names (e.g. "Compression") to
  1467. // unconditionally include in API requests. By default, fields with
  1468. // empty values are omitted from API requests. However, any non-pointer,
  1469. // non-interface field appearing in ForceSendFields will be sent to the
  1470. // server regardless of whether the field is empty or not. This may be
  1471. // used to include empty fields in Patch requests.
  1472. ForceSendFields []string `json:"-"`
  1473. // NullFields is a list of field names (e.g. "Compression") to include
  1474. // in API requests with the JSON null value. By default, fields with
  1475. // empty values are omitted from API requests. However, any field with
  1476. // an empty value appearing in NullFields will be sent to the server as
  1477. // null. It is an error if a field in this list has a non-empty value.
  1478. // This may be used to include null fields in Patch requests.
  1479. NullFields []string `json:"-"`
  1480. }
  1481. func (s *JobConfigurationExtract) MarshalJSON() ([]byte, error) {
  1482. type NoMethod JobConfigurationExtract
  1483. raw := NoMethod(*s)
  1484. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1485. }
  1486. type JobConfigurationLoad struct {
  1487. // AllowJaggedRows: [Optional] Accept rows that are missing trailing
  1488. // optional columns. The missing values are treated as nulls. If false,
  1489. // records with missing trailing columns are treated as bad records, and
  1490. // if there are too many bad records, an invalid error is returned in
  1491. // the job result. The default value is false. Only applicable to CSV,
  1492. // ignored for other formats.
  1493. AllowJaggedRows bool `json:"allowJaggedRows,omitempty"`
  1494. // AllowQuotedNewlines: Indicates if BigQuery should allow quoted data
  1495. // sections that contain newline characters in a CSV file. The default
  1496. // value is false.
  1497. AllowQuotedNewlines bool `json:"allowQuotedNewlines,omitempty"`
  1498. // Autodetect: [Optional] Indicates if we should automatically infer the
  1499. // options and schema for CSV and JSON sources.
  1500. Autodetect bool `json:"autodetect,omitempty"`
  1501. // Clustering: [Beta] Clustering specification for the destination
  1502. // table. Must be specified with time-based partitioning, data in the
  1503. // table will be first partitioned and subsequently clustered.
  1504. Clustering *Clustering `json:"clustering,omitempty"`
  1505. // CreateDisposition: [Optional] Specifies whether the job is allowed to
  1506. // create new tables. The following values are supported:
  1507. // CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the
  1508. // table. CREATE_NEVER: The table must already exist. If it does not, a
  1509. // 'notFound' error is returned in the job result. The default value is
  1510. // CREATE_IF_NEEDED. Creation, truncation and append actions occur as
  1511. // one atomic update upon job completion.
  1512. CreateDisposition string `json:"createDisposition,omitempty"`
  1513. // DestinationEncryptionConfiguration: Custom encryption configuration
  1514. // (e.g., Cloud KMS keys).
  1515. DestinationEncryptionConfiguration *EncryptionConfiguration `json:"destinationEncryptionConfiguration,omitempty"`
  1516. // DestinationTable: [Required] The destination table to load the data
  1517. // into.
  1518. DestinationTable *TableReference `json:"destinationTable,omitempty"`
  1519. // DestinationTableProperties: [Beta] [Optional] Properties with which
  1520. // to create the destination table if it is new.
  1521. DestinationTableProperties *DestinationTableProperties `json:"destinationTableProperties,omitempty"`
  1522. // Encoding: [Optional] The character encoding of the data. The
  1523. // supported values are UTF-8 or ISO-8859-1. The default value is UTF-8.
  1524. // BigQuery decodes the data after the raw, binary data has been split
  1525. // using the values of the quote and fieldDelimiter properties.
  1526. Encoding string `json:"encoding,omitempty"`
  1527. // FieldDelimiter: [Optional] The separator for fields in a CSV file.
  1528. // The separator can be any ISO-8859-1 single-byte character. To use a
  1529. // character in the range 128-255, you must encode the character as
  1530. // UTF8. BigQuery converts the string to ISO-8859-1 encoding, and then
  1531. // uses the first byte of the encoded string to split the data in its
  1532. // raw, binary state. BigQuery also supports the escape sequence "\t" to
  1533. // specify a tab separator. The default value is a comma (',').
  1534. FieldDelimiter string `json:"fieldDelimiter,omitempty"`
  1535. // HivePartitioningMode: [Optional, Experimental] If hive partitioning
  1536. // is enabled, which mode to use. Two modes are supported: - AUTO:
  1537. // automatically infer partition key name(s) and type(s). - STRINGS:
  1538. // automatic infer partition key name(s). All types are strings. Not all
  1539. // storage formats support hive partitioning -- requesting hive
  1540. // partitioning on an unsupported format will lead to an error.
  1541. HivePartitioningMode string `json:"hivePartitioningMode,omitempty"`
  1542. // IgnoreUnknownValues: [Optional] Indicates if BigQuery should allow
  1543. // extra values that are not represented in the table schema. If true,
  1544. // the extra values are ignored. If false, records with extra columns
  1545. // are treated as bad records, and if there are too many bad records, an
  1546. // invalid error is returned in the job result. The default value is
  1547. // false. The sourceFormat property determines what BigQuery treats as
  1548. // an extra value: CSV: Trailing columns JSON: Named values that don't
  1549. // match any column names
  1550. IgnoreUnknownValues bool `json:"ignoreUnknownValues,omitempty"`
  1551. // MaxBadRecords: [Optional] The maximum number of bad records that
  1552. // BigQuery can ignore when running the job. If the number of bad
  1553. // records exceeds this value, an invalid error is returned in the job
  1554. // result. This is only valid for CSV and JSON. The default value is 0,
  1555. // which requires that all records are valid.
  1556. MaxBadRecords int64 `json:"maxBadRecords,omitempty"`
  1557. // NullMarker: [Optional] Specifies a string that represents a null
  1558. // value in a CSV file. For example, if you specify "\N", BigQuery
  1559. // interprets "\N" as a null value when loading a CSV file. The default
  1560. // value is the empty string. If you set this property to a custom
  1561. // value, BigQuery throws an error if an empty string is present for all
  1562. // data types except for STRING and BYTE. For STRING and BYTE columns,
  1563. // BigQuery interprets the empty string as an empty value.
  1564. NullMarker string `json:"nullMarker,omitempty"`
  1565. // ProjectionFields: If sourceFormat is set to "DATASTORE_BACKUP",
  1566. // indicates which entity properties to load into BigQuery from a Cloud
  1567. // Datastore backup. Property names are case sensitive and must be
  1568. // top-level properties. If no properties are specified, BigQuery loads
  1569. // all properties. If any named property isn't found in the Cloud
  1570. // Datastore backup, an invalid error is returned in the job result.
  1571. ProjectionFields []string `json:"projectionFields,omitempty"`
  1572. // Quote: [Optional] The value that is used to quote data sections in a
  1573. // CSV file. BigQuery converts the string to ISO-8859-1 encoding, and
  1574. // then uses the first byte of the encoded string to split the data in
  1575. // its raw, binary state. The default value is a double-quote ('"'). If
  1576. // your data does not contain quoted sections, set the property value to
  1577. // an empty string. If your data contains quoted newline characters, you
  1578. // must also set the allowQuotedNewlines property to true.
  1579. //
  1580. // Default: "
  1581. Quote *string `json:"quote,omitempty"`
  1582. // RangePartitioning: [TrustedTester] Range partitioning specification
  1583. // for this table. Only one of timePartitioning and rangePartitioning
  1584. // should be specified.
  1585. RangePartitioning *RangePartitioning `json:"rangePartitioning,omitempty"`
  1586. // Schema: [Optional] The schema for the destination table. The schema
  1587. // can be omitted if the destination table already exists, or if you're
  1588. // loading data from Google Cloud Datastore.
  1589. Schema *TableSchema `json:"schema,omitempty"`
  1590. // SchemaInline: [Deprecated] The inline schema. For CSV schemas,
  1591. // specify as "Field1:Type1[,Field2:Type2]*". For example, "foo:STRING,
  1592. // bar:INTEGER, baz:FLOAT".
  1593. SchemaInline string `json:"schemaInline,omitempty"`
  1594. // SchemaInlineFormat: [Deprecated] The format of the schemaInline
  1595. // property.
  1596. SchemaInlineFormat string `json:"schemaInlineFormat,omitempty"`
  1597. // SchemaUpdateOptions: Allows the schema of the destination table to be
  1598. // updated as a side effect of the load job if a schema is autodetected
  1599. // or supplied in the job configuration. Schema update options are
  1600. // supported in two cases: when writeDisposition is WRITE_APPEND; when
  1601. // writeDisposition is WRITE_TRUNCATE and the destination table is a
  1602. // partition of a table, specified by partition decorators. For normal
  1603. // tables, WRITE_TRUNCATE will always overwrite the schema. One or more
  1604. // of the following values are specified: ALLOW_FIELD_ADDITION: allow
  1605. // adding a nullable field to the schema. ALLOW_FIELD_RELAXATION: allow
  1606. // relaxing a required field in the original schema to nullable.
  1607. SchemaUpdateOptions []string `json:"schemaUpdateOptions,omitempty"`
  1608. // SkipLeadingRows: [Optional] The number of rows at the top of a CSV
  1609. // file that BigQuery will skip when loading the data. The default value
  1610. // is 0. This property is useful if you have header rows in the file
  1611. // that should be skipped.
  1612. SkipLeadingRows int64 `json:"skipLeadingRows,omitempty"`
  1613. // SourceFormat: [Optional] The format of the data files. For CSV files,
  1614. // specify "CSV". For datastore backups, specify "DATASTORE_BACKUP". For
  1615. // newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". For Avro,
  1616. // specify "AVRO". For parquet, specify "PARQUET". For orc, specify
  1617. // "ORC". The default value is CSV.
  1618. SourceFormat string `json:"sourceFormat,omitempty"`
  1619. // SourceUris: [Required] The fully-qualified URIs that point to your
  1620. // data in Google Cloud. For Google Cloud Storage URIs: Each URI can
  1621. // contain one '*' wildcard character and it must come after the
  1622. // 'bucket' name. Size limits related to load jobs apply to external
  1623. // data sources. For Google Cloud Bigtable URIs: Exactly one URI can be
  1624. // specified and it has be a fully specified and valid HTTPS URL for a
  1625. // Google Cloud Bigtable table. For Google Cloud Datastore backups:
  1626. // Exactly one URI can be specified. Also, the '*' wildcard character is
  1627. // not allowed.
  1628. SourceUris []string `json:"sourceUris,omitempty"`
  1629. // TimePartitioning: Time-based partitioning specification for the
  1630. // destination table. Only one of timePartitioning and rangePartitioning
  1631. // should be specified.
  1632. TimePartitioning *TimePartitioning `json:"timePartitioning,omitempty"`
  1633. // UseAvroLogicalTypes: [Optional] If sourceFormat is set to "AVRO",
  1634. // indicates whether to enable interpreting logical types into their
  1635. // corresponding types (ie. TIMESTAMP), instead of only using their raw
  1636. // types (ie. INTEGER).
  1637. UseAvroLogicalTypes bool `json:"useAvroLogicalTypes,omitempty"`
  1638. // WriteDisposition: [Optional] Specifies the action that occurs if the
  1639. // destination table already exists. The following values are supported:
  1640. // WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the
  1641. // table data. WRITE_APPEND: If the table already exists, BigQuery
  1642. // appends the data to the table. WRITE_EMPTY: If the table already
  1643. // exists and contains data, a 'duplicate' error is returned in the job
  1644. // result. The default value is WRITE_APPEND. Each action is atomic and
  1645. // only occurs if BigQuery is able to complete the job successfully.
  1646. // Creation, truncation and append actions occur as one atomic update
  1647. // upon job completion.
  1648. WriteDisposition string `json:"writeDisposition,omitempty"`
  1649. // ForceSendFields is a list of field names (e.g. "AllowJaggedRows") to
  1650. // unconditionally include in API requests. By default, fields with
  1651. // empty values are omitted from API requests. However, any non-pointer,
  1652. // non-interface field appearing in ForceSendFields will be sent to the
  1653. // server regardless of whether the field is empty or not. This may be
  1654. // used to include empty fields in Patch requests.
  1655. ForceSendFields []string `json:"-"`
  1656. // NullFields is a list of field names (e.g. "AllowJaggedRows") to
  1657. // include in API requests with the JSON null value. By default, fields
  1658. // with empty values are omitted from API requests. However, any field
  1659. // with an empty value appearing in NullFields will be sent to the
  1660. // server as null. It is an error if a field in this list has a
  1661. // non-empty value. This may be used to include null fields in Patch
  1662. // requests.
  1663. NullFields []string `json:"-"`
  1664. }
  1665. func (s *JobConfigurationLoad) MarshalJSON() ([]byte, error) {
  1666. type NoMethod JobConfigurationLoad
  1667. raw := NoMethod(*s)
  1668. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1669. }
  1670. type JobConfigurationQuery struct {
  1671. // AllowLargeResults: [Optional] If true and query uses legacy SQL
  1672. // dialect, allows the query to produce arbitrarily large result tables
  1673. // at a slight cost in performance. Requires destinationTable to be set.
  1674. // For standard SQL queries, this flag is ignored and large results are
  1675. // always allowed. However, you must still set destinationTable when
  1676. // result size exceeds the allowed maximum response size.
  1677. AllowLargeResults bool `json:"allowLargeResults,omitempty"`
  1678. // Clustering: [Beta] Clustering specification for the destination
  1679. // table. Must be specified with time-based partitioning, data in the
  1680. // table will be first partitioned and subsequently clustered.
  1681. Clustering *Clustering `json:"clustering,omitempty"`
  1682. // CreateDisposition: [Optional] Specifies whether the job is allowed to
  1683. // create new tables. The following values are supported:
  1684. // CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the
  1685. // table. CREATE_NEVER: The table must already exist. If it does not, a
  1686. // 'notFound' error is returned in the job result. The default value is
  1687. // CREATE_IF_NEEDED. Creation, truncation and append actions occur as
  1688. // one atomic update upon job completion.
  1689. CreateDisposition string `json:"createDisposition,omitempty"`
  1690. // DefaultDataset: [Optional] Specifies the default dataset to use for
  1691. // unqualified table names in the query. Note that this does not alter
  1692. // behavior of unqualified dataset names.
  1693. DefaultDataset *DatasetReference `json:"defaultDataset,omitempty"`
  1694. // DestinationEncryptionConfiguration: Custom encryption configuration
  1695. // (e.g., Cloud KMS keys).
  1696. DestinationEncryptionConfiguration *EncryptionConfiguration `json:"destinationEncryptionConfiguration,omitempty"`
  1697. // DestinationTable: [Optional] Describes the table where the query
  1698. // results should be stored. If not present, a new table will be created
  1699. // to store the results. This property must be set for large results
  1700. // that exceed the maximum response size.
  1701. DestinationTable *TableReference `json:"destinationTable,omitempty"`
  1702. // FlattenResults: [Optional] If true and query uses legacy SQL dialect,
  1703. // flattens all nested and repeated fields in the query results.
  1704. // allowLargeResults must be true if this is set to false. For standard
  1705. // SQL queries, this flag is ignored and results are never flattened.
  1706. //
  1707. // Default: true
  1708. FlattenResults *bool `json:"flattenResults,omitempty"`
  1709. // MaximumBillingTier: [Optional] Limits the billing tier for this job.
  1710. // Queries that have resource usage beyond this tier will fail (without
  1711. // incurring a charge). If unspecified, this will be set to your project
  1712. // default.
  1713. //
  1714. // Default: 1
  1715. MaximumBillingTier *int64 `json:"maximumBillingTier,omitempty"`
  1716. // MaximumBytesBilled: [Optional] Limits the bytes billed for this job.
  1717. // Queries that will have bytes billed beyond this limit will fail
  1718. // (without incurring a charge). If unspecified, this will be set to
  1719. // your project default.
  1720. MaximumBytesBilled int64 `json:"maximumBytesBilled,omitempty,string"`
  1721. // ParameterMode: Standard SQL only. Set to POSITIONAL to use positional
  1722. // (?) query parameters or to NAMED to use named (@myparam) query
  1723. // parameters in this query.
  1724. ParameterMode string `json:"parameterMode,omitempty"`
  1725. // PreserveNulls: [Deprecated] This property is deprecated.
  1726. PreserveNulls bool `json:"preserveNulls,omitempty"`
  1727. // Priority: [Optional] Specifies a priority for the query. Possible
  1728. // values include INTERACTIVE and BATCH. The default value is
  1729. // INTERACTIVE.
  1730. Priority string `json:"priority,omitempty"`
  1731. // Query: [Required] SQL query text to execute. The useLegacySql field
  1732. // can be used to indicate whether the query uses legacy SQL or standard
  1733. // SQL.
  1734. Query string `json:"query,omitempty"`
  1735. // QueryParameters: Query parameters for standard SQL queries.
  1736. QueryParameters []*QueryParameter `json:"queryParameters,omitempty"`
  1737. // RangePartitioning: [TrustedTester] Range partitioning specification
  1738. // for this table. Only one of timePartitioning and rangePartitioning
  1739. // should be specified.
  1740. RangePartitioning *RangePartitioning `json:"rangePartitioning,omitempty"`
  1741. // SchemaUpdateOptions: Allows the schema of the destination table to be
  1742. // updated as a side effect of the query job. Schema update options are
  1743. // supported in two cases: when writeDisposition is WRITE_APPEND; when
  1744. // writeDisposition is WRITE_TRUNCATE and the destination table is a
  1745. // partition of a table, specified by partition decorators. For normal
  1746. // tables, WRITE_TRUNCATE will always overwrite the schema. One or more
  1747. // of the following values are specified: ALLOW_FIELD_ADDITION: allow
  1748. // adding a nullable field to the schema. ALLOW_FIELD_RELAXATION: allow
  1749. // relaxing a required field in the original schema to nullable.
  1750. SchemaUpdateOptions []string `json:"schemaUpdateOptions,omitempty"`
  1751. // TableDefinitions: [Optional] If querying an external data source
  1752. // outside of BigQuery, describes the data format, location and other
  1753. // properties of the data source. By defining these properties, the data
  1754. // source can then be queried as if it were a standard BigQuery table.
  1755. TableDefinitions map[string]ExternalDataConfiguration `json:"tableDefinitions,omitempty"`
  1756. // TimePartitioning: Time-based partitioning specification for the
  1757. // destination table. Only one of timePartitioning and rangePartitioning
  1758. // should be specified.
  1759. TimePartitioning *TimePartitioning `json:"timePartitioning,omitempty"`
  1760. // UseLegacySql: Specifies whether to use BigQuery's legacy SQL dialect
  1761. // for this query. The default value is true. If set to false, the query
  1762. // will use BigQuery's standard SQL:
  1763. // https://cloud.google.com/bigquery/sql-reference/ When useLegacySql is
  1764. // set to false, the value of flattenResults is ignored; query will be
  1765. // run as if flattenResults is false.
  1766. //
  1767. // Default: true
  1768. UseLegacySql *bool `json:"useLegacySql,omitempty"`
  1769. // UseQueryCache: [Optional] Whether to look for the result in the query
  1770. // cache. The query cache is a best-effort cache that will be flushed
  1771. // whenever tables in the query are modified. Moreover, the query cache
  1772. // is only available when a query does not have a destination table
  1773. // specified. The default value is true.
  1774. //
  1775. // Default: true
  1776. UseQueryCache *bool `json:"useQueryCache,omitempty"`
  1777. // UserDefinedFunctionResources: Describes user-defined function
  1778. // resources used in the query.
  1779. UserDefinedFunctionResources []*UserDefinedFunctionResource `json:"userDefinedFunctionResources,omitempty"`
  1780. // WriteDisposition: [Optional] Specifies the action that occurs if the
  1781. // destination table already exists. The following values are supported:
  1782. // WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the
  1783. // table data and uses the schema from the query result. WRITE_APPEND:
  1784. // If the table already exists, BigQuery appends the data to the table.
  1785. // WRITE_EMPTY: If the table already exists and contains data, a
  1786. // 'duplicate' error is returned in the job result. The default value is
  1787. // WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is
  1788. // able to complete the job successfully. Creation, truncation and
  1789. // append actions occur as one atomic update upon job completion.
  1790. WriteDisposition string `json:"writeDisposition,omitempty"`
  1791. // ForceSendFields is a list of field names (e.g. "AllowLargeResults")
  1792. // to unconditionally include in API requests. By default, fields with
  1793. // empty values are omitted from API requests. However, any non-pointer,
  1794. // non-interface field appearing in ForceSendFields will be sent to the
  1795. // server regardless of whether the field is empty or not. This may be
  1796. // used to include empty fields in Patch requests.
  1797. ForceSendFields []string `json:"-"`
  1798. // NullFields is a list of field names (e.g. "AllowLargeResults") to
  1799. // include in API requests with the JSON null value. By default, fields
  1800. // with empty values are omitted from API requests. However, any field
  1801. // with an empty value appearing in NullFields will be sent to the
  1802. // server as null. It is an error if a field in this list has a
  1803. // non-empty value. This may be used to include null fields in Patch
  1804. // requests.
  1805. NullFields []string `json:"-"`
  1806. }
  1807. func (s *JobConfigurationQuery) MarshalJSON() ([]byte, error) {
  1808. type NoMethod JobConfigurationQuery
  1809. raw := NoMethod(*s)
  1810. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1811. }
  1812. type JobConfigurationTableCopy struct {
  1813. // CreateDisposition: [Optional] Specifies whether the job is allowed to
  1814. // create new tables. The following values are supported:
  1815. // CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the
  1816. // table. CREATE_NEVER: The table must already exist. If it does not, a
  1817. // 'notFound' error is returned in the job result. The default value is
  1818. // CREATE_IF_NEEDED. Creation, truncation and append actions occur as
  1819. // one atomic update upon job completion.
  1820. CreateDisposition string `json:"createDisposition,omitempty"`
  1821. // DestinationEncryptionConfiguration: Custom encryption configuration
  1822. // (e.g., Cloud KMS keys).
  1823. DestinationEncryptionConfiguration *EncryptionConfiguration `json:"destinationEncryptionConfiguration,omitempty"`
  1824. // DestinationTable: [Required] The destination table
  1825. DestinationTable *TableReference `json:"destinationTable,omitempty"`
  1826. // SourceTable: [Pick one] Source table to copy.
  1827. SourceTable *TableReference `json:"sourceTable,omitempty"`
  1828. // SourceTables: [Pick one] Source tables to copy.
  1829. SourceTables []*TableReference `json:"sourceTables,omitempty"`
  1830. // WriteDisposition: [Optional] Specifies the action that occurs if the
  1831. // destination table already exists. The following values are supported:
  1832. // WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the
  1833. // table data. WRITE_APPEND: If the table already exists, BigQuery
  1834. // appends the data to the table. WRITE_EMPTY: If the table already
  1835. // exists and contains data, a 'duplicate' error is returned in the job
  1836. // result. The default value is WRITE_EMPTY. Each action is atomic and
  1837. // only occurs if BigQuery is able to complete the job successfully.
  1838. // Creation, truncation and append actions occur as one atomic update
  1839. // upon job completion.
  1840. WriteDisposition string `json:"writeDisposition,omitempty"`
  1841. // ForceSendFields is a list of field names (e.g. "CreateDisposition")
  1842. // to unconditionally include in API requests. By default, fields with
  1843. // empty values are omitted from API requests. However, any non-pointer,
  1844. // non-interface field appearing in ForceSendFields will be sent to the
  1845. // server regardless of whether the field is empty or not. This may be
  1846. // used to include empty fields in Patch requests.
  1847. ForceSendFields []string `json:"-"`
  1848. // NullFields is a list of field names (e.g. "CreateDisposition") to
  1849. // include in API requests with the JSON null value. By default, fields
  1850. // with empty values are omitted from API requests. However, any field
  1851. // with an empty value appearing in NullFields will be sent to the
  1852. // server as null. It is an error if a field in this list has a
  1853. // non-empty value. This may be used to include null fields in Patch
  1854. // requests.
  1855. NullFields []string `json:"-"`
  1856. }
  1857. func (s *JobConfigurationTableCopy) MarshalJSON() ([]byte, error) {
  1858. type NoMethod JobConfigurationTableCopy
  1859. raw := NoMethod(*s)
  1860. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1861. }
  1862. type JobList struct {
  1863. // Etag: A hash of this page of results.
  1864. Etag string `json:"etag,omitempty"`
  1865. // Jobs: List of jobs that were requested.
  1866. Jobs []*JobListJobs `json:"jobs,omitempty"`
  1867. // Kind: The resource type of the response.
  1868. Kind string `json:"kind,omitempty"`
  1869. // NextPageToken: A token to request the next page of results.
  1870. NextPageToken string `json:"nextPageToken,omitempty"`
  1871. // ServerResponse contains the HTTP response code and headers from the
  1872. // server.
  1873. googleapi.ServerResponse `json:"-"`
  1874. // ForceSendFields is a list of field names (e.g. "Etag") to
  1875. // unconditionally include in API requests. By default, fields with
  1876. // empty values are omitted from API requests. However, any non-pointer,
  1877. // non-interface field appearing in ForceSendFields will be sent to the
  1878. // server regardless of whether the field is empty or not. This may be
  1879. // used to include empty fields in Patch requests.
  1880. ForceSendFields []string `json:"-"`
  1881. // NullFields is a list of field names (e.g. "Etag") to include in API
  1882. // requests with the JSON null value. By default, fields with empty
  1883. // values are omitted from API requests. However, any field with an
  1884. // empty value appearing in NullFields will be sent to the server as
  1885. // null. It is an error if a field in this list has a non-empty value.
  1886. // This may be used to include null fields in Patch requests.
  1887. NullFields []string `json:"-"`
  1888. }
  1889. func (s *JobList) MarshalJSON() ([]byte, error) {
  1890. type NoMethod JobList
  1891. raw := NoMethod(*s)
  1892. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1893. }
  1894. type JobListJobs struct {
  1895. // Configuration: [Full-projection-only] Specifies the job
  1896. // configuration.
  1897. Configuration *JobConfiguration `json:"configuration,omitempty"`
  1898. // ErrorResult: A result object that will be present only if the job has
  1899. // failed.
  1900. ErrorResult *ErrorProto `json:"errorResult,omitempty"`
  1901. // Id: Unique opaque ID of the job.
  1902. Id string `json:"id,omitempty"`
  1903. // JobReference: Job reference uniquely identifying the job.
  1904. JobReference *JobReference `json:"jobReference,omitempty"`
  1905. // Kind: The resource type.
  1906. Kind string `json:"kind,omitempty"`
  1907. // State: Running state of the job. When the state is DONE, errorResult
  1908. // can be checked to determine whether the job succeeded or failed.
  1909. State string `json:"state,omitempty"`
  1910. // Statistics: [Output-only] Information about the job, including
  1911. // starting time and ending time of the job.
  1912. Statistics *JobStatistics `json:"statistics,omitempty"`
  1913. // Status: [Full-projection-only] Describes the state of the job.
  1914. Status *JobStatus `json:"status,omitempty"`
  1915. // UserEmail: [Full-projection-only] Email address of the user who ran
  1916. // the job.
  1917. UserEmail string `json:"user_email,omitempty"`
  1918. // ForceSendFields is a list of field names (e.g. "Configuration") to
  1919. // unconditionally include in API requests. By default, fields with
  1920. // empty values are omitted from API requests. However, any non-pointer,
  1921. // non-interface field appearing in ForceSendFields will be sent to the
  1922. // server regardless of whether the field is empty or not. This may be
  1923. // used to include empty fields in Patch requests.
  1924. ForceSendFields []string `json:"-"`
  1925. // NullFields is a list of field names (e.g. "Configuration") to include
  1926. // in API requests with the JSON null value. By default, fields with
  1927. // empty values are omitted from API requests. However, any field with
  1928. // an empty value appearing in NullFields will be sent to the server as
  1929. // null. It is an error if a field in this list has a non-empty value.
  1930. // This may be used to include null fields in Patch requests.
  1931. NullFields []string `json:"-"`
  1932. }
  1933. func (s *JobListJobs) MarshalJSON() ([]byte, error) {
  1934. type NoMethod JobListJobs
  1935. raw := NoMethod(*s)
  1936. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1937. }
  1938. type JobReference struct {
  1939. // JobId: [Required] The ID of the job. The ID must contain only letters
  1940. // (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-). The
  1941. // maximum length is 1,024 characters.
  1942. JobId string `json:"jobId,omitempty"`
  1943. // Location: The geographic location of the job. See details at
  1944. // https://cloud.google.com/bigquery/docs/locations#specifying_your_location.
  1945. Location string `json:"location,omitempty"`
  1946. // ProjectId: [Required] The ID of the project containing this job.
  1947. ProjectId string `json:"projectId,omitempty"`
  1948. // ForceSendFields is a list of field names (e.g. "JobId") to
  1949. // unconditionally include in API requests. By default, fields with
  1950. // empty values are omitted from API requests. However, any non-pointer,
  1951. // non-interface field appearing in ForceSendFields will be sent to the
  1952. // server regardless of whether the field is empty or not. This may be
  1953. // used to include empty fields in Patch requests.
  1954. ForceSendFields []string `json:"-"`
  1955. // NullFields is a list of field names (e.g. "JobId") to include in API
  1956. // requests with the JSON null value. By default, fields with empty
  1957. // values are omitted from API requests. However, any field with an
  1958. // empty value appearing in NullFields will be sent to the server as
  1959. // null. It is an error if a field in this list has a non-empty value.
  1960. // This may be used to include null fields in Patch requests.
  1961. NullFields []string `json:"-"`
  1962. }
  1963. func (s *JobReference) MarshalJSON() ([]byte, error) {
  1964. type NoMethod JobReference
  1965. raw := NoMethod(*s)
  1966. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1967. }
  1968. type JobStatistics struct {
  1969. // CompletionRatio: [TrustedTester] [Output-only] Job progress (0.0 ->
  1970. // 1.0) for LOAD and EXTRACT jobs.
  1971. CompletionRatio float64 `json:"completionRatio,omitempty"`
  1972. // CreationTime: [Output-only] Creation time of this job, in
  1973. // milliseconds since the epoch. This field will be present on all jobs.
  1974. CreationTime int64 `json:"creationTime,omitempty,string"`
  1975. // EndTime: [Output-only] End time of this job, in milliseconds since
  1976. // the epoch. This field will be present whenever a job is in the DONE
  1977. // state.
  1978. EndTime int64 `json:"endTime,omitempty,string"`
  1979. // Extract: [Output-only] Statistics for an extract job.
  1980. Extract *JobStatistics4 `json:"extract,omitempty"`
  1981. // Load: [Output-only] Statistics for a load job.
  1982. Load *JobStatistics3 `json:"load,omitempty"`
  1983. // NumChildJobs: [Output-only] Number of child jobs executed.
  1984. NumChildJobs int64 `json:"numChildJobs,omitempty,string"`
  1985. // ParentJobId: [Output-only] If this is a child job, the id of the
  1986. // parent.
  1987. ParentJobId string `json:"parentJobId,omitempty"`
  1988. // Query: [Output-only] Statistics for a query job.
  1989. Query *JobStatistics2 `json:"query,omitempty"`
  1990. // QuotaDeferments: [Output-only] Quotas which delayed this job's start
  1991. // time.
  1992. QuotaDeferments []string `json:"quotaDeferments,omitempty"`
  1993. // ReservationUsage: [Output-only] Job resource usage breakdown by
  1994. // reservation.
  1995. ReservationUsage []*JobStatisticsReservationUsage `json:"reservationUsage,omitempty"`
  1996. // StartTime: [Output-only] Start time of this job, in milliseconds
  1997. // since the epoch. This field will be present when the job transitions
  1998. // from the PENDING state to either RUNNING or DONE.
  1999. StartTime int64 `json:"startTime,omitempty,string"`
  2000. // TotalBytesProcessed: [Output-only] [Deprecated] Use the bytes
  2001. // processed in the query statistics instead.
  2002. TotalBytesProcessed int64 `json:"totalBytesProcessed,omitempty,string"`
  2003. // TotalSlotMs: [Output-only] Slot-milliseconds for the job.
  2004. TotalSlotMs int64 `json:"totalSlotMs,omitempty,string"`
  2005. // ForceSendFields is a list of field names (e.g. "CompletionRatio") to
  2006. // unconditionally include in API requests. By default, fields with
  2007. // empty values are omitted from API requests. However, any non-pointer,
  2008. // non-interface field appearing in ForceSendFields will be sent to the
  2009. // server regardless of whether the field is empty or not. This may be
  2010. // used to include empty fields in Patch requests.
  2011. ForceSendFields []string `json:"-"`
  2012. // NullFields is a list of field names (e.g. "CompletionRatio") to
  2013. // include in API requests with the JSON null value. By default, fields
  2014. // with empty values are omitted from API requests. However, any field
  2015. // with an empty value appearing in NullFields will be sent to the
  2016. // server as null. It is an error if a field in this list has a
  2017. // non-empty value. This may be used to include null fields in Patch
  2018. // requests.
  2019. NullFields []string `json:"-"`
  2020. }
  2021. func (s *JobStatistics) MarshalJSON() ([]byte, error) {
  2022. type NoMethod JobStatistics
  2023. raw := NoMethod(*s)
  2024. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2025. }
  2026. func (s *JobStatistics) UnmarshalJSON(data []byte) error {
  2027. type NoMethod JobStatistics
  2028. var s1 struct {
  2029. CompletionRatio gensupport.JSONFloat64 `json:"completionRatio"`
  2030. *NoMethod
  2031. }
  2032. s1.NoMethod = (*NoMethod)(s)
  2033. if err := json.Unmarshal(data, &s1); err != nil {
  2034. return err
  2035. }
  2036. s.CompletionRatio = float64(s1.CompletionRatio)
  2037. return nil
  2038. }
  2039. type JobStatisticsReservationUsage struct {
  2040. // Name: [Output-only] Reservation name or "unreserved" for on-demand
  2041. // resources usage.
  2042. Name string `json:"name,omitempty"`
  2043. // SlotMs: [Output-only] Slot-milliseconds the job spent in the given
  2044. // reservation.
  2045. SlotMs int64 `json:"slotMs,omitempty,string"`
  2046. // ForceSendFields is a list of field names (e.g. "Name") to
  2047. // unconditionally include in API requests. By default, fields with
  2048. // empty values are omitted from API requests. However, any non-pointer,
  2049. // non-interface field appearing in ForceSendFields will be sent to the
  2050. // server regardless of whether the field is empty or not. This may be
  2051. // used to include empty fields in Patch requests.
  2052. ForceSendFields []string `json:"-"`
  2053. // NullFields is a list of field names (e.g. "Name") to include in API
  2054. // requests with the JSON null value. By default, fields with empty
  2055. // values are omitted from API requests. However, any field with an
  2056. // empty value appearing in NullFields will be sent to the server as
  2057. // null. It is an error if a field in this list has a non-empty value.
  2058. // This may be used to include null fields in Patch requests.
  2059. NullFields []string `json:"-"`
  2060. }
  2061. func (s *JobStatisticsReservationUsage) MarshalJSON() ([]byte, error) {
  2062. type NoMethod JobStatisticsReservationUsage
  2063. raw := NoMethod(*s)
  2064. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2065. }
  2066. type JobStatistics2 struct {
  2067. // BillingTier: [Output-only] Billing tier for the job.
  2068. BillingTier int64 `json:"billingTier,omitempty"`
  2069. // CacheHit: [Output-only] Whether the query result was fetched from the
  2070. // query cache.
  2071. CacheHit bool `json:"cacheHit,omitempty"`
  2072. // DdlOperationPerformed: The DDL operation performed, possibly
  2073. // dependent on the pre-existence of the DDL target. Possible values
  2074. // (new values might be added in the future): "CREATE": The query
  2075. // created the DDL target. "SKIP": No-op. Example cases: the query is
  2076. // CREATE TABLE IF NOT EXISTS while the table already exists, or the
  2077. // query is DROP TABLE IF EXISTS while the table does not exist.
  2078. // "REPLACE": The query replaced the DDL target. Example case: the query
  2079. // is CREATE OR REPLACE TABLE, and the table already exists. "DROP": The
  2080. // query deleted the DDL target.
  2081. DdlOperationPerformed string `json:"ddlOperationPerformed,omitempty"`
  2082. // DdlTargetRoutine: The DDL target routine. Present only for
  2083. // CREATE/DROP FUNCTION/PROCEDURE queries.
  2084. DdlTargetRoutine *RoutineReference `json:"ddlTargetRoutine,omitempty"`
  2085. // DdlTargetTable: The DDL target table. Present only for CREATE/DROP
  2086. // TABLE/VIEW queries.
  2087. DdlTargetTable *TableReference `json:"ddlTargetTable,omitempty"`
  2088. // EstimatedBytesProcessed: [Output-only] The original estimate of bytes
  2089. // processed for the job.
  2090. EstimatedBytesProcessed int64 `json:"estimatedBytesProcessed,omitempty,string"`
  2091. // ModelTraining: [Output-only, Beta] Information about create model
  2092. // query job progress.
  2093. ModelTraining *BigQueryModelTraining `json:"modelTraining,omitempty"`
  2094. // ModelTrainingCurrentIteration: [Output-only, Beta] Deprecated; do not
  2095. // use.
  2096. ModelTrainingCurrentIteration int64 `json:"modelTrainingCurrentIteration,omitempty"`
  2097. // ModelTrainingExpectedTotalIteration: [Output-only, Beta] Deprecated;
  2098. // do not use.
  2099. ModelTrainingExpectedTotalIteration int64 `json:"modelTrainingExpectedTotalIteration,omitempty,string"`
  2100. // NumDmlAffectedRows: [Output-only] The number of rows affected by a
  2101. // DML statement. Present only for DML statements INSERT, UPDATE or
  2102. // DELETE.
  2103. NumDmlAffectedRows int64 `json:"numDmlAffectedRows,omitempty,string"`
  2104. // QueryPlan: [Output-only] Describes execution plan for the query.
  2105. QueryPlan []*ExplainQueryStage `json:"queryPlan,omitempty"`
  2106. // ReferencedTables: [Output-only] Referenced tables for the job.
  2107. // Queries that reference more than 50 tables will not have a complete
  2108. // list.
  2109. ReferencedTables []*TableReference `json:"referencedTables,omitempty"`
  2110. // ReservationUsage: [Output-only] Job resource usage breakdown by
  2111. // reservation.
  2112. ReservationUsage []*JobStatistics2ReservationUsage `json:"reservationUsage,omitempty"`
  2113. // Schema: [Output-only] The schema of the results. Present only for
  2114. // successful dry run of non-legacy SQL queries.
  2115. Schema *TableSchema `json:"schema,omitempty"`
  2116. // StatementType: The type of query statement, if valid. Possible values
  2117. // (new values might be added in the future): "SELECT": SELECT query.
  2118. // "INSERT": INSERT query; see
  2119. // https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language. "UPDATE": UPDATE query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language. "DELETE": DELETE query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language. "MERGE": MERGE query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language. "CREATE_TABLE": CREATE [OR REPLACE] TABLE without AS SELECT. "CREATE_TABLE_AS_SELECT": CREATE [OR REPLACE] TABLE ... AS SELECT ... . "DROP_TABLE": DROP TABLE query. "CREATE_VIEW": CREATE [OR REPLACE] VIEW ... AS SELECT ... . "DROP_VIEW": DROP VIEW query. "CREATE_FUNCTION": CREATE FUNCTION query. "DROP_FUNCTION" : DROP FUNCTION query. "ALTER_TABLE": ALTER TABLE query. "ALTER_VIEW": ALTER VIEW
  2120. // query.
  2121. StatementType string `json:"statementType,omitempty"`
  2122. // Timeline: [Output-only] [Beta] Describes a timeline of job execution.
  2123. Timeline []*QueryTimelineSample `json:"timeline,omitempty"`
  2124. // TotalBytesBilled: [Output-only] Total bytes billed for the job.
  2125. TotalBytesBilled int64 `json:"totalBytesBilled,omitempty,string"`
  2126. // TotalBytesProcessed: [Output-only] Total bytes processed for the job.
  2127. TotalBytesProcessed int64 `json:"totalBytesProcessed,omitempty,string"`
  2128. // TotalBytesProcessedAccuracy: [Output-only] For dry-run jobs,
  2129. // totalBytesProcessed is an estimate and this field specifies the
  2130. // accuracy of the estimate. Possible values can be: UNKNOWN: accuracy
  2131. // of the estimate is unknown. PRECISE: estimate is precise.
  2132. // LOWER_BOUND: estimate is lower bound of what the query would cost.
  2133. // UPPER_BOUND: estimate is upper bound of what the query would cost.
  2134. TotalBytesProcessedAccuracy string `json:"totalBytesProcessedAccuracy,omitempty"`
  2135. // TotalPartitionsProcessed: [Output-only] Total number of partitions
  2136. // processed from all partitioned tables referenced in the job.
  2137. TotalPartitionsProcessed int64 `json:"totalPartitionsProcessed,omitempty,string"`
  2138. // TotalSlotMs: [Output-only] Slot-milliseconds for the job.
  2139. TotalSlotMs int64 `json:"totalSlotMs,omitempty,string"`
  2140. // UndeclaredQueryParameters: Standard SQL only: list of undeclared
  2141. // query parameters detected during a dry run validation.
  2142. UndeclaredQueryParameters []*QueryParameter `json:"undeclaredQueryParameters,omitempty"`
  2143. // ForceSendFields is a list of field names (e.g. "BillingTier") to
  2144. // unconditionally include in API requests. By default, fields with
  2145. // empty values are omitted from API requests. However, any non-pointer,
  2146. // non-interface field appearing in ForceSendFields will be sent to the
  2147. // server regardless of whether the field is empty or not. This may be
  2148. // used to include empty fields in Patch requests.
  2149. ForceSendFields []string `json:"-"`
  2150. // NullFields is a list of field names (e.g. "BillingTier") to include
  2151. // in API requests with the JSON null value. By default, fields with
  2152. // empty values are omitted from API requests. However, any field with
  2153. // an empty value appearing in NullFields will be sent to the server as
  2154. // null. It is an error if a field in this list has a non-empty value.
  2155. // This may be used to include null fields in Patch requests.
  2156. NullFields []string `json:"-"`
  2157. }
  2158. func (s *JobStatistics2) MarshalJSON() ([]byte, error) {
  2159. type NoMethod JobStatistics2
  2160. raw := NoMethod(*s)
  2161. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2162. }
  2163. type JobStatistics2ReservationUsage struct {
  2164. // Name: [Output-only] Reservation name or "unreserved" for on-demand
  2165. // resources usage.
  2166. Name string `json:"name,omitempty"`
  2167. // SlotMs: [Output-only] Slot-milliseconds the job spent in the given
  2168. // reservation.
  2169. SlotMs int64 `json:"slotMs,omitempty,string"`
  2170. // ForceSendFields is a list of field names (e.g. "Name") to
  2171. // unconditionally include in API requests. By default, fields with
  2172. // empty values are omitted from API requests. However, any non-pointer,
  2173. // non-interface field appearing in ForceSendFields will be sent to the
  2174. // server regardless of whether the field is empty or not. This may be
  2175. // used to include empty fields in Patch requests.
  2176. ForceSendFields []string `json:"-"`
  2177. // NullFields is a list of field names (e.g. "Name") to include in API
  2178. // requests with the JSON null value. By default, fields with empty
  2179. // values are omitted from API requests. However, any field with an
  2180. // empty value appearing in NullFields will be sent to the server as
  2181. // null. It is an error if a field in this list has a non-empty value.
  2182. // This may be used to include null fields in Patch requests.
  2183. NullFields []string `json:"-"`
  2184. }
  2185. func (s *JobStatistics2ReservationUsage) MarshalJSON() ([]byte, error) {
  2186. type NoMethod JobStatistics2ReservationUsage
  2187. raw := NoMethod(*s)
  2188. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2189. }
  2190. type JobStatistics3 struct {
  2191. // BadRecords: [Output-only] The number of bad records encountered. Note
  2192. // that if the job has failed because of more bad records encountered
  2193. // than the maximum allowed in the load job configuration, then this
  2194. // number can be less than the total number of bad records present in
  2195. // the input data.
  2196. BadRecords int64 `json:"badRecords,omitempty,string"`
  2197. // InputFileBytes: [Output-only] Number of bytes of source data in a
  2198. // load job.
  2199. InputFileBytes int64 `json:"inputFileBytes,omitempty,string"`
  2200. // InputFiles: [Output-only] Number of source files in a load job.
  2201. InputFiles int64 `json:"inputFiles,omitempty,string"`
  2202. // OutputBytes: [Output-only] Size of the loaded data in bytes. Note
  2203. // that while a load job is in the running state, this value may change.
  2204. OutputBytes int64 `json:"outputBytes,omitempty,string"`
  2205. // OutputRows: [Output-only] Number of rows imported in a load job. Note
  2206. // that while an import job is in the running state, this value may
  2207. // change.
  2208. OutputRows int64 `json:"outputRows,omitempty,string"`
  2209. // ForceSendFields is a list of field names (e.g. "BadRecords") to
  2210. // unconditionally include in API requests. By default, fields with
  2211. // empty values are omitted from API requests. However, any non-pointer,
  2212. // non-interface field appearing in ForceSendFields will be sent to the
  2213. // server regardless of whether the field is empty or not. This may be
  2214. // used to include empty fields in Patch requests.
  2215. ForceSendFields []string `json:"-"`
  2216. // NullFields is a list of field names (e.g. "BadRecords") to include in
  2217. // API requests with the JSON null value. By default, fields with empty
  2218. // values are omitted from API requests. However, any field with an
  2219. // empty value appearing in NullFields will be sent to the server as
  2220. // null. It is an error if a field in this list has a non-empty value.
  2221. // This may be used to include null fields in Patch requests.
  2222. NullFields []string `json:"-"`
  2223. }
  2224. func (s *JobStatistics3) MarshalJSON() ([]byte, error) {
  2225. type NoMethod JobStatistics3
  2226. raw := NoMethod(*s)
  2227. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2228. }
  2229. type JobStatistics4 struct {
  2230. // DestinationUriFileCounts: [Output-only] Number of files per
  2231. // destination URI or URI pattern specified in the extract
  2232. // configuration. These values will be in the same order as the URIs
  2233. // specified in the 'destinationUris' field.
  2234. DestinationUriFileCounts googleapi.Int64s `json:"destinationUriFileCounts,omitempty"`
  2235. // InputBytes: [Output-only] Number of user bytes extracted into the
  2236. // result. This is the byte count as computed by BigQuery for billing
  2237. // purposes.
  2238. InputBytes int64 `json:"inputBytes,omitempty,string"`
  2239. // ForceSendFields is a list of field names (e.g.
  2240. // "DestinationUriFileCounts") to unconditionally include in API
  2241. // requests. By default, fields with empty values are omitted from API
  2242. // requests. However, any non-pointer, non-interface field appearing in
  2243. // ForceSendFields will be sent to the server regardless of whether the
  2244. // field is empty or not. This may be used to include empty fields in
  2245. // Patch requests.
  2246. ForceSendFields []string `json:"-"`
  2247. // NullFields is a list of field names (e.g. "DestinationUriFileCounts")
  2248. // to include in API requests with the JSON null value. By default,
  2249. // fields with empty values are omitted from API requests. However, any
  2250. // field with an empty value appearing in NullFields will be sent to the
  2251. // server as null. It is an error if a field in this list has a
  2252. // non-empty value. This may be used to include null fields in Patch
  2253. // requests.
  2254. NullFields []string `json:"-"`
  2255. }
  2256. func (s *JobStatistics4) MarshalJSON() ([]byte, error) {
  2257. type NoMethod JobStatistics4
  2258. raw := NoMethod(*s)
  2259. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2260. }
  2261. type JobStatus struct {
  2262. // ErrorResult: [Output-only] Final error result of the job. If present,
  2263. // indicates that the job has completed and was unsuccessful.
  2264. ErrorResult *ErrorProto `json:"errorResult,omitempty"`
  2265. // Errors: [Output-only] The first errors encountered during the running
  2266. // of the job. The final message includes the number of errors that
  2267. // caused the process to stop. Errors here do not necessarily mean that
  2268. // the job has completed or was unsuccessful.
  2269. Errors []*ErrorProto `json:"errors,omitempty"`
  2270. // State: [Output-only] Running state of the job.
  2271. State string `json:"state,omitempty"`
  2272. // ForceSendFields is a list of field names (e.g. "ErrorResult") to
  2273. // unconditionally include in API requests. By default, fields with
  2274. // empty values are omitted from API requests. However, any non-pointer,
  2275. // non-interface field appearing in ForceSendFields will be sent to the
  2276. // server regardless of whether the field is empty or not. This may be
  2277. // used to include empty fields in Patch requests.
  2278. ForceSendFields []string `json:"-"`
  2279. // NullFields is a list of field names (e.g. "ErrorResult") to include
  2280. // in API requests with the JSON null value. By default, fields with
  2281. // empty values are omitted from API requests. However, any field with
  2282. // an empty value appearing in NullFields will be sent to the server as
  2283. // null. It is an error if a field in this list has a non-empty value.
  2284. // This may be used to include null fields in Patch requests.
  2285. NullFields []string `json:"-"`
  2286. }
  2287. func (s *JobStatus) MarshalJSON() ([]byte, error) {
  2288. type NoMethod JobStatus
  2289. raw := NoMethod(*s)
  2290. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2291. }
  2292. type JsonValue interface{}
  2293. type MaterializedViewDefinition struct {
  2294. // LastRefreshTime: [Output-only] [TrustedTester] The time when this
  2295. // materialized view was last modified, in milliseconds since the epoch.
  2296. LastRefreshTime int64 `json:"lastRefreshTime,omitempty,string"`
  2297. // Query: [Required] A query whose result is persisted.
  2298. Query string `json:"query,omitempty"`
  2299. // ForceSendFields is a list of field names (e.g. "LastRefreshTime") to
  2300. // unconditionally include in API requests. By default, fields with
  2301. // empty values are omitted from API requests. However, any non-pointer,
  2302. // non-interface field appearing in ForceSendFields will be sent to the
  2303. // server regardless of whether the field is empty or not. This may be
  2304. // used to include empty fields in Patch requests.
  2305. ForceSendFields []string `json:"-"`
  2306. // NullFields is a list of field names (e.g. "LastRefreshTime") to
  2307. // include in API requests with the JSON null value. By default, fields
  2308. // with empty values are omitted from API requests. However, any field
  2309. // with an empty value appearing in NullFields will be sent to the
  2310. // server as null. It is an error if a field in this list has a
  2311. // non-empty value. This may be used to include null fields in Patch
  2312. // requests.
  2313. NullFields []string `json:"-"`
  2314. }
  2315. func (s *MaterializedViewDefinition) MarshalJSON() ([]byte, error) {
  2316. type NoMethod MaterializedViewDefinition
  2317. raw := NoMethod(*s)
  2318. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2319. }
  2320. type ModelDefinition struct {
  2321. // ModelOptions: [Output-only, Beta] Model options used for the first
  2322. // training run. These options are immutable for subsequent training
  2323. // runs. Default values are used for any options not specified in the
  2324. // input query.
  2325. ModelOptions *ModelDefinitionModelOptions `json:"modelOptions,omitempty"`
  2326. // TrainingRuns: [Output-only, Beta] Information about ml training runs,
  2327. // each training run comprises of multiple iterations and there may be
  2328. // multiple training runs for the model if warm start is used or if a
  2329. // user decides to continue a previously cancelled query.
  2330. TrainingRuns []*BqmlTrainingRun `json:"trainingRuns,omitempty"`
  2331. // ForceSendFields is a list of field names (e.g. "ModelOptions") to
  2332. // unconditionally include in API requests. By default, fields with
  2333. // empty values are omitted from API requests. However, any non-pointer,
  2334. // non-interface field appearing in ForceSendFields will be sent to the
  2335. // server regardless of whether the field is empty or not. This may be
  2336. // used to include empty fields in Patch requests.
  2337. ForceSendFields []string `json:"-"`
  2338. // NullFields is a list of field names (e.g. "ModelOptions") to include
  2339. // in API requests with the JSON null value. By default, fields with
  2340. // empty values are omitted from API requests. However, any field with
  2341. // an empty value appearing in NullFields will be sent to the server as
  2342. // null. It is an error if a field in this list has a non-empty value.
  2343. // This may be used to include null fields in Patch requests.
  2344. NullFields []string `json:"-"`
  2345. }
  2346. func (s *ModelDefinition) MarshalJSON() ([]byte, error) {
  2347. type NoMethod ModelDefinition
  2348. raw := NoMethod(*s)
  2349. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2350. }
  2351. // ModelDefinitionModelOptions: [Output-only, Beta] Model options used
  2352. // for the first training run. These options are immutable for
  2353. // subsequent training runs. Default values are used for any options not
  2354. // specified in the input query.
  2355. type ModelDefinitionModelOptions struct {
  2356. Labels []string `json:"labels,omitempty"`
  2357. LossType string `json:"lossType,omitempty"`
  2358. ModelType string `json:"modelType,omitempty"`
  2359. // ForceSendFields is a list of field names (e.g. "Labels") to
  2360. // unconditionally include in API requests. By default, fields with
  2361. // empty values are omitted from API requests. However, any non-pointer,
  2362. // non-interface field appearing in ForceSendFields will be sent to the
  2363. // server regardless of whether the field is empty or not. This may be
  2364. // used to include empty fields in Patch requests.
  2365. ForceSendFields []string `json:"-"`
  2366. // NullFields is a list of field names (e.g. "Labels") to include in API
  2367. // requests with the JSON null value. By default, fields with empty
  2368. // values are omitted from API requests. However, any field with an
  2369. // empty value appearing in NullFields will be sent to the server as
  2370. // null. It is an error if a field in this list has a non-empty value.
  2371. // This may be used to include null fields in Patch requests.
  2372. NullFields []string `json:"-"`
  2373. }
  2374. func (s *ModelDefinitionModelOptions) MarshalJSON() ([]byte, error) {
  2375. type NoMethod ModelDefinitionModelOptions
  2376. raw := NoMethod(*s)
  2377. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2378. }
  2379. type ProjectList struct {
  2380. // Etag: A hash of the page of results
  2381. Etag string `json:"etag,omitempty"`
  2382. // Kind: The type of list.
  2383. Kind string `json:"kind,omitempty"`
  2384. // NextPageToken: A token to request the next page of results.
  2385. NextPageToken string `json:"nextPageToken,omitempty"`
  2386. // Projects: Projects to which you have at least READ access.
  2387. Projects []*ProjectListProjects `json:"projects,omitempty"`
  2388. // TotalItems: The total number of projects in the list.
  2389. TotalItems int64 `json:"totalItems,omitempty"`
  2390. // ServerResponse contains the HTTP response code and headers from the
  2391. // server.
  2392. googleapi.ServerResponse `json:"-"`
  2393. // ForceSendFields is a list of field names (e.g. "Etag") to
  2394. // unconditionally include in API requests. By default, fields with
  2395. // empty values are omitted from API requests. However, any non-pointer,
  2396. // non-interface field appearing in ForceSendFields will be sent to the
  2397. // server regardless of whether the field is empty or not. This may be
  2398. // used to include empty fields in Patch requests.
  2399. ForceSendFields []string `json:"-"`
  2400. // NullFields is a list of field names (e.g. "Etag") to include in API
  2401. // requests with the JSON null value. By default, fields with empty
  2402. // values are omitted from API requests. However, any field with an
  2403. // empty value appearing in NullFields will be sent to the server as
  2404. // null. It is an error if a field in this list has a non-empty value.
  2405. // This may be used to include null fields in Patch requests.
  2406. NullFields []string `json:"-"`
  2407. }
  2408. func (s *ProjectList) MarshalJSON() ([]byte, error) {
  2409. type NoMethod ProjectList
  2410. raw := NoMethod(*s)
  2411. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2412. }
  2413. type ProjectListProjects struct {
  2414. // FriendlyName: A descriptive name for this project.
  2415. FriendlyName string `json:"friendlyName,omitempty"`
  2416. // Id: An opaque ID of this project.
  2417. Id string `json:"id,omitempty"`
  2418. // Kind: The resource type.
  2419. Kind string `json:"kind,omitempty"`
  2420. // NumericId: The numeric ID of this project.
  2421. NumericId uint64 `json:"numericId,omitempty,string"`
  2422. // ProjectReference: A unique reference to this project.
  2423. ProjectReference *ProjectReference `json:"projectReference,omitempty"`
  2424. // ForceSendFields is a list of field names (e.g. "FriendlyName") to
  2425. // unconditionally include in API requests. By default, fields with
  2426. // empty values are omitted from API requests. However, any non-pointer,
  2427. // non-interface field appearing in ForceSendFields will be sent to the
  2428. // server regardless of whether the field is empty or not. This may be
  2429. // used to include empty fields in Patch requests.
  2430. ForceSendFields []string `json:"-"`
  2431. // NullFields is a list of field names (e.g. "FriendlyName") to include
  2432. // in API requests with the JSON null value. By default, fields with
  2433. // empty values are omitted from API requests. However, any field with
  2434. // an empty value appearing in NullFields will be sent to the server as
  2435. // null. It is an error if a field in this list has a non-empty value.
  2436. // This may be used to include null fields in Patch requests.
  2437. NullFields []string `json:"-"`
  2438. }
  2439. func (s *ProjectListProjects) MarshalJSON() ([]byte, error) {
  2440. type NoMethod ProjectListProjects
  2441. raw := NoMethod(*s)
  2442. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2443. }
  2444. type ProjectReference struct {
  2445. // ProjectId: [Required] ID of the project. Can be either the numeric ID
  2446. // or the assigned ID of the project.
  2447. ProjectId string `json:"projectId,omitempty"`
  2448. // ForceSendFields is a list of field names (e.g. "ProjectId") to
  2449. // unconditionally include in API requests. By default, fields with
  2450. // empty values are omitted from API requests. However, any non-pointer,
  2451. // non-interface field appearing in ForceSendFields will be sent to the
  2452. // server regardless of whether the field is empty or not. This may be
  2453. // used to include empty fields in Patch requests.
  2454. ForceSendFields []string `json:"-"`
  2455. // NullFields is a list of field names (e.g. "ProjectId") to include in
  2456. // API requests with the JSON null value. By default, fields with empty
  2457. // values are omitted from API requests. However, any field with an
  2458. // empty value appearing in NullFields will be sent to the server as
  2459. // null. It is an error if a field in this list has a non-empty value.
  2460. // This may be used to include null fields in Patch requests.
  2461. NullFields []string `json:"-"`
  2462. }
  2463. func (s *ProjectReference) MarshalJSON() ([]byte, error) {
  2464. type NoMethod ProjectReference
  2465. raw := NoMethod(*s)
  2466. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2467. }
  2468. type QueryParameter struct {
  2469. // Name: [Optional] If unset, this is a positional parameter. Otherwise,
  2470. // should be unique within a query.
  2471. Name string `json:"name,omitempty"`
  2472. // ParameterType: [Required] The type of this parameter.
  2473. ParameterType *QueryParameterType `json:"parameterType,omitempty"`
  2474. // ParameterValue: [Required] The value of this parameter.
  2475. ParameterValue *QueryParameterValue `json:"parameterValue,omitempty"`
  2476. // ForceSendFields is a list of field names (e.g. "Name") to
  2477. // unconditionally include in API requests. By default, fields with
  2478. // empty values are omitted from API requests. However, any non-pointer,
  2479. // non-interface field appearing in ForceSendFields will be sent to the
  2480. // server regardless of whether the field is empty or not. This may be
  2481. // used to include empty fields in Patch requests.
  2482. ForceSendFields []string `json:"-"`
  2483. // NullFields is a list of field names (e.g. "Name") to include in API
  2484. // requests with the JSON null value. By default, fields with empty
  2485. // values are omitted from API requests. However, any field with an
  2486. // empty value appearing in NullFields will be sent to the server as
  2487. // null. It is an error if a field in this list has a non-empty value.
  2488. // This may be used to include null fields in Patch requests.
  2489. NullFields []string `json:"-"`
  2490. }
  2491. func (s *QueryParameter) MarshalJSON() ([]byte, error) {
  2492. type NoMethod QueryParameter
  2493. raw := NoMethod(*s)
  2494. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2495. }
  2496. type QueryParameterType struct {
  2497. // ArrayType: [Optional] The type of the array's elements, if this is an
  2498. // array.
  2499. ArrayType *QueryParameterType `json:"arrayType,omitempty"`
  2500. // StructTypes: [Optional] The types of the fields of this struct, in
  2501. // order, if this is a struct.
  2502. StructTypes []*QueryParameterTypeStructTypes `json:"structTypes,omitempty"`
  2503. // Type: [Required] The top level type of this field.
  2504. Type string `json:"type,omitempty"`
  2505. // ForceSendFields is a list of field names (e.g. "ArrayType") to
  2506. // unconditionally include in API requests. By default, fields with
  2507. // empty values are omitted from API requests. However, any non-pointer,
  2508. // non-interface field appearing in ForceSendFields will be sent to the
  2509. // server regardless of whether the field is empty or not. This may be
  2510. // used to include empty fields in Patch requests.
  2511. ForceSendFields []string `json:"-"`
  2512. // NullFields is a list of field names (e.g. "ArrayType") to include in
  2513. // API requests with the JSON null value. By default, fields with empty
  2514. // values are omitted from API requests. However, any field with an
  2515. // empty value appearing in NullFields will be sent to the server as
  2516. // null. It is an error if a field in this list has a non-empty value.
  2517. // This may be used to include null fields in Patch requests.
  2518. NullFields []string `json:"-"`
  2519. }
  2520. func (s *QueryParameterType) MarshalJSON() ([]byte, error) {
  2521. type NoMethod QueryParameterType
  2522. raw := NoMethod(*s)
  2523. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2524. }
  2525. type QueryParameterTypeStructTypes struct {
  2526. // Description: [Optional] Human-oriented description of the field.
  2527. Description string `json:"description,omitempty"`
  2528. // Name: [Optional] The name of this field.
  2529. Name string `json:"name,omitempty"`
  2530. // Type: [Required] The type of this field.
  2531. Type *QueryParameterType `json:"type,omitempty"`
  2532. // ForceSendFields is a list of field names (e.g. "Description") to
  2533. // unconditionally include in API requests. By default, fields with
  2534. // empty values are omitted from API requests. However, any non-pointer,
  2535. // non-interface field appearing in ForceSendFields will be sent to the
  2536. // server regardless of whether the field is empty or not. This may be
  2537. // used to include empty fields in Patch requests.
  2538. ForceSendFields []string `json:"-"`
  2539. // NullFields is a list of field names (e.g. "Description") to include
  2540. // in API requests with the JSON null value. By default, fields with
  2541. // empty values are omitted from API requests. However, any field with
  2542. // an empty value appearing in NullFields will be sent to the server as
  2543. // null. It is an error if a field in this list has a non-empty value.
  2544. // This may be used to include null fields in Patch requests.
  2545. NullFields []string `json:"-"`
  2546. }
  2547. func (s *QueryParameterTypeStructTypes) MarshalJSON() ([]byte, error) {
  2548. type NoMethod QueryParameterTypeStructTypes
  2549. raw := NoMethod(*s)
  2550. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2551. }
  2552. type QueryParameterValue struct {
  2553. // ArrayValues: [Optional] The array values, if this is an array type.
  2554. ArrayValues []*QueryParameterValue `json:"arrayValues,omitempty"`
  2555. // StructValues: [Optional] The struct field values, in order of the
  2556. // struct type's declaration.
  2557. StructValues map[string]QueryParameterValue `json:"structValues,omitempty"`
  2558. // Value: [Optional] The value of this value, if a simple scalar type.
  2559. Value string `json:"value,omitempty"`
  2560. // ForceSendFields is a list of field names (e.g. "ArrayValues") to
  2561. // unconditionally include in API requests. By default, fields with
  2562. // empty values are omitted from API requests. However, any non-pointer,
  2563. // non-interface field appearing in ForceSendFields will be sent to the
  2564. // server regardless of whether the field is empty or not. This may be
  2565. // used to include empty fields in Patch requests.
  2566. ForceSendFields []string `json:"-"`
  2567. // NullFields is a list of field names (e.g. "ArrayValues") to include
  2568. // in API requests with the JSON null value. By default, fields with
  2569. // empty values are omitted from API requests. However, any field with
  2570. // an empty value appearing in NullFields will be sent to the server as
  2571. // null. It is an error if a field in this list has a non-empty value.
  2572. // This may be used to include null fields in Patch requests.
  2573. NullFields []string `json:"-"`
  2574. }
  2575. func (s *QueryParameterValue) MarshalJSON() ([]byte, error) {
  2576. type NoMethod QueryParameterValue
  2577. raw := NoMethod(*s)
  2578. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2579. }
  2580. type QueryRequest struct {
  2581. // DefaultDataset: [Optional] Specifies the default datasetId and
  2582. // projectId to assume for any unqualified table names in the query. If
  2583. // not set, all table names in the query string must be qualified in the
  2584. // format 'datasetId.tableId'.
  2585. DefaultDataset *DatasetReference `json:"defaultDataset,omitempty"`
  2586. // DryRun: [Optional] If set to true, BigQuery doesn't run the job.
  2587. // Instead, if the query is valid, BigQuery returns statistics about the
  2588. // job such as how many bytes would be processed. If the query is
  2589. // invalid, an error returns. The default value is false.
  2590. DryRun bool `json:"dryRun,omitempty"`
  2591. // Kind: The resource type of the request.
  2592. Kind string `json:"kind,omitempty"`
  2593. // Location: The geographic location where the job should run. See
  2594. // details at
  2595. // https://cloud.google.com/bigquery/docs/locations#specifying_your_location.
  2596. Location string `json:"location,omitempty"`
  2597. // MaxResults: [Optional] The maximum number of rows of data to return
  2598. // per page of results. Setting this flag to a small value such as 1000
  2599. // and then paging through results might improve reliability when the
  2600. // query result set is large. In addition to this limit, responses are
  2601. // also limited to 10 MB. By default, there is no maximum row count, and
  2602. // only the byte limit applies.
  2603. MaxResults int64 `json:"maxResults,omitempty"`
  2604. // ParameterMode: Standard SQL only. Set to POSITIONAL to use positional
  2605. // (?) query parameters or to NAMED to use named (@myparam) query
  2606. // parameters in this query.
  2607. ParameterMode string `json:"parameterMode,omitempty"`
  2608. // PreserveNulls: [Deprecated] This property is deprecated.
  2609. PreserveNulls bool `json:"preserveNulls,omitempty"`
  2610. // Query: [Required] A query string, following the BigQuery query
  2611. // syntax, of the query to execute. Example: "SELECT count(f1) FROM
  2612. // [myProjectId:myDatasetId.myTableId]".
  2613. Query string `json:"query,omitempty"`
  2614. // QueryParameters: Query parameters for Standard SQL queries.
  2615. QueryParameters []*QueryParameter `json:"queryParameters,omitempty"`
  2616. // TimeoutMs: [Optional] How long to wait for the query to complete, in
  2617. // milliseconds, before the request times out and returns. Note that
  2618. // this is only a timeout for the request, not the query. If the query
  2619. // takes longer to run than the timeout value, the call returns without
  2620. // any results and with the 'jobComplete' flag set to false. You can
  2621. // call GetQueryResults() to wait for the query to complete and read the
  2622. // results. The default value is 10000 milliseconds (10 seconds).
  2623. TimeoutMs int64 `json:"timeoutMs,omitempty"`
  2624. // UseLegacySql: Specifies whether to use BigQuery's legacy SQL dialect
  2625. // for this query. The default value is true. If set to false, the query
  2626. // will use BigQuery's standard SQL:
  2627. // https://cloud.google.com/bigquery/sql-reference/ When useLegacySql is
  2628. // set to false, the value of flattenResults is ignored; query will be
  2629. // run as if flattenResults is false.
  2630. //
  2631. // Default: true
  2632. UseLegacySql *bool `json:"useLegacySql,omitempty"`
  2633. // UseQueryCache: [Optional] Whether to look for the result in the query
  2634. // cache. The query cache is a best-effort cache that will be flushed
  2635. // whenever tables in the query are modified. The default value is true.
  2636. //
  2637. // Default: true
  2638. UseQueryCache *bool `json:"useQueryCache,omitempty"`
  2639. // ForceSendFields is a list of field names (e.g. "DefaultDataset") to
  2640. // unconditionally include in API requests. By default, fields with
  2641. // empty values are omitted from API requests. However, any non-pointer,
  2642. // non-interface field appearing in ForceSendFields will be sent to the
  2643. // server regardless of whether the field is empty or not. This may be
  2644. // used to include empty fields in Patch requests.
  2645. ForceSendFields []string `json:"-"`
  2646. // NullFields is a list of field names (e.g. "DefaultDataset") to
  2647. // include in API requests with the JSON null value. By default, fields
  2648. // with empty values are omitted from API requests. However, any field
  2649. // with an empty value appearing in NullFields will be sent to the
  2650. // server as null. It is an error if a field in this list has a
  2651. // non-empty value. This may be used to include null fields in Patch
  2652. // requests.
  2653. NullFields []string `json:"-"`
  2654. }
  2655. func (s *QueryRequest) MarshalJSON() ([]byte, error) {
  2656. type NoMethod QueryRequest
  2657. raw := NoMethod(*s)
  2658. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2659. }
  2660. type QueryResponse struct {
  2661. // CacheHit: Whether the query result was fetched from the query cache.
  2662. CacheHit bool `json:"cacheHit,omitempty"`
  2663. // Errors: [Output-only] The first errors or warnings encountered during
  2664. // the running of the job. The final message includes the number of
  2665. // errors that caused the process to stop. Errors here do not
  2666. // necessarily mean that the job has completed or was unsuccessful.
  2667. Errors []*ErrorProto `json:"errors,omitempty"`
  2668. // JobComplete: Whether the query has completed or not. If rows or
  2669. // totalRows are present, this will always be true. If this is false,
  2670. // totalRows will not be available.
  2671. JobComplete bool `json:"jobComplete,omitempty"`
  2672. // JobReference: Reference to the Job that was created to run the query.
  2673. // This field will be present even if the original request timed out, in
  2674. // which case GetQueryResults can be used to read the results once the
  2675. // query has completed. Since this API only returns the first page of
  2676. // results, subsequent pages can be fetched via the same mechanism
  2677. // (GetQueryResults).
  2678. JobReference *JobReference `json:"jobReference,omitempty"`
  2679. // Kind: The resource type.
  2680. Kind string `json:"kind,omitempty"`
  2681. // NumDmlAffectedRows: [Output-only] The number of rows affected by a
  2682. // DML statement. Present only for DML statements INSERT, UPDATE or
  2683. // DELETE.
  2684. NumDmlAffectedRows int64 `json:"numDmlAffectedRows,omitempty,string"`
  2685. // PageToken: A token used for paging results.
  2686. PageToken string `json:"pageToken,omitempty"`
  2687. // Rows: An object with as many results as can be contained within the
  2688. // maximum permitted reply size. To get any additional rows, you can
  2689. // call GetQueryResults and specify the jobReference returned above.
  2690. Rows []*TableRow `json:"rows,omitempty"`
  2691. // Schema: The schema of the results. Present only when the query
  2692. // completes successfully.
  2693. Schema *TableSchema `json:"schema,omitempty"`
  2694. // TotalBytesProcessed: The total number of bytes processed for this
  2695. // query. If this query was a dry run, this is the number of bytes that
  2696. // would be processed if the query were run.
  2697. TotalBytesProcessed int64 `json:"totalBytesProcessed,omitempty,string"`
  2698. // TotalRows: The total number of rows in the complete query result set,
  2699. // which can be more than the number of rows in this single page of
  2700. // results.
  2701. TotalRows uint64 `json:"totalRows,omitempty,string"`
  2702. // ServerResponse contains the HTTP response code and headers from the
  2703. // server.
  2704. googleapi.ServerResponse `json:"-"`
  2705. // ForceSendFields is a list of field names (e.g. "CacheHit") to
  2706. // unconditionally include in API requests. By default, fields with
  2707. // empty values are omitted from API requests. However, any non-pointer,
  2708. // non-interface field appearing in ForceSendFields will be sent to the
  2709. // server regardless of whether the field is empty or not. This may be
  2710. // used to include empty fields in Patch requests.
  2711. ForceSendFields []string `json:"-"`
  2712. // NullFields is a list of field names (e.g. "CacheHit") to include in
  2713. // API requests with the JSON null value. By default, fields with empty
  2714. // values are omitted from API requests. However, any field with an
  2715. // empty value appearing in NullFields will be sent to the server as
  2716. // null. It is an error if a field in this list has a non-empty value.
  2717. // This may be used to include null fields in Patch requests.
  2718. NullFields []string `json:"-"`
  2719. }
  2720. func (s *QueryResponse) MarshalJSON() ([]byte, error) {
  2721. type NoMethod QueryResponse
  2722. raw := NoMethod(*s)
  2723. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2724. }
  2725. type QueryTimelineSample struct {
  2726. // ActiveUnits: Total number of units currently being processed by
  2727. // workers. This does not correspond directly to slot usage. This is the
  2728. // largest value observed since the last sample.
  2729. ActiveUnits int64 `json:"activeUnits,omitempty,string"`
  2730. // CompletedUnits: Total parallel units of work completed by this query.
  2731. CompletedUnits int64 `json:"completedUnits,omitempty,string"`
  2732. // ElapsedMs: Milliseconds elapsed since the start of query execution.
  2733. ElapsedMs int64 `json:"elapsedMs,omitempty,string"`
  2734. // PendingUnits: Total parallel units of work remaining for the active
  2735. // stages.
  2736. PendingUnits int64 `json:"pendingUnits,omitempty,string"`
  2737. // TotalSlotMs: Cumulative slot-ms consumed by the query.
  2738. TotalSlotMs int64 `json:"totalSlotMs,omitempty,string"`
  2739. // ForceSendFields is a list of field names (e.g. "ActiveUnits") to
  2740. // unconditionally include in API requests. By default, fields with
  2741. // empty values are omitted from API requests. However, any non-pointer,
  2742. // non-interface field appearing in ForceSendFields will be sent to the
  2743. // server regardless of whether the field is empty or not. This may be
  2744. // used to include empty fields in Patch requests.
  2745. ForceSendFields []string `json:"-"`
  2746. // NullFields is a list of field names (e.g. "ActiveUnits") to include
  2747. // in API requests with the JSON null value. By default, fields with
  2748. // empty values are omitted from API requests. However, any field with
  2749. // an empty value appearing in NullFields will be sent to the server as
  2750. // null. It is an error if a field in this list has a non-empty value.
  2751. // This may be used to include null fields in Patch requests.
  2752. NullFields []string `json:"-"`
  2753. }
  2754. func (s *QueryTimelineSample) MarshalJSON() ([]byte, error) {
  2755. type NoMethod QueryTimelineSample
  2756. raw := NoMethod(*s)
  2757. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2758. }
  2759. type RangePartitioning struct {
  2760. // Field: [TrustedTester] [Required] The table is partitioned by this
  2761. // field. The field must be a top-level NULLABLE/REQUIRED field. The
  2762. // only supported type is INTEGER/INT64.
  2763. Field string `json:"field,omitempty"`
  2764. // Range: [TrustedTester] [Required] Defines the ranges for range
  2765. // partitioning.
  2766. Range *RangePartitioningRange `json:"range,omitempty"`
  2767. // ForceSendFields is a list of field names (e.g. "Field") to
  2768. // unconditionally include in API requests. By default, fields with
  2769. // empty values are omitted from API requests. However, any non-pointer,
  2770. // non-interface field appearing in ForceSendFields will be sent to the
  2771. // server regardless of whether the field is empty or not. This may be
  2772. // used to include empty fields in Patch requests.
  2773. ForceSendFields []string `json:"-"`
  2774. // NullFields is a list of field names (e.g. "Field") to include in API
  2775. // requests with the JSON null value. By default, fields with empty
  2776. // values are omitted from API requests. However, any field with an
  2777. // empty value appearing in NullFields will be sent to the server as
  2778. // null. It is an error if a field in this list has a non-empty value.
  2779. // This may be used to include null fields in Patch requests.
  2780. NullFields []string `json:"-"`
  2781. }
  2782. func (s *RangePartitioning) MarshalJSON() ([]byte, error) {
  2783. type NoMethod RangePartitioning
  2784. raw := NoMethod(*s)
  2785. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2786. }
  2787. // RangePartitioningRange: [TrustedTester] [Required] Defines the ranges
  2788. // for range partitioning.
  2789. type RangePartitioningRange struct {
  2790. // End: [TrustedTester] [Required] The end of range partitioning,
  2791. // exclusive.
  2792. End int64 `json:"end,omitempty,string"`
  2793. // Interval: [TrustedTester] [Required] The width of each interval.
  2794. Interval int64 `json:"interval,omitempty,string"`
  2795. // Start: [TrustedTester] [Required] The start of range partitioning,
  2796. // inclusive.
  2797. Start int64 `json:"start,omitempty,string"`
  2798. // ForceSendFields is a list of field names (e.g. "End") to
  2799. // unconditionally include in API requests. By default, fields with
  2800. // empty values are omitted from API requests. However, any non-pointer,
  2801. // non-interface field appearing in ForceSendFields will be sent to the
  2802. // server regardless of whether the field is empty or not. This may be
  2803. // used to include empty fields in Patch requests.
  2804. ForceSendFields []string `json:"-"`
  2805. // NullFields is a list of field names (e.g. "End") to include in API
  2806. // requests with the JSON null value. By default, fields with empty
  2807. // values are omitted from API requests. However, any field with an
  2808. // empty value appearing in NullFields will be sent to the server as
  2809. // null. It is an error if a field in this list has a non-empty value.
  2810. // This may be used to include null fields in Patch requests.
  2811. NullFields []string `json:"-"`
  2812. }
  2813. func (s *RangePartitioningRange) MarshalJSON() ([]byte, error) {
  2814. type NoMethod RangePartitioningRange
  2815. raw := NoMethod(*s)
  2816. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2817. }
  2818. type RoutineReference struct {
  2819. // DatasetId: [Required] The ID of the dataset containing this routine.
  2820. DatasetId string `json:"datasetId,omitempty"`
  2821. // ProjectId: [Required] The ID of the project containing this routine.
  2822. ProjectId string `json:"projectId,omitempty"`
  2823. // RoutineId: [Required] The ID of the routine. The ID must contain only
  2824. // letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum
  2825. // length is 256 characters.
  2826. RoutineId string `json:"routineId,omitempty"`
  2827. // ForceSendFields is a list of field names (e.g. "DatasetId") to
  2828. // unconditionally include in API requests. By default, fields with
  2829. // empty values are omitted from API requests. However, any non-pointer,
  2830. // non-interface field appearing in ForceSendFields will be sent to the
  2831. // server regardless of whether the field is empty or not. This may be
  2832. // used to include empty fields in Patch requests.
  2833. ForceSendFields []string `json:"-"`
  2834. // NullFields is a list of field names (e.g. "DatasetId") to include in
  2835. // API requests with the JSON null value. By default, fields with empty
  2836. // values are omitted from API requests. However, any field with an
  2837. // empty value appearing in NullFields will be sent to the server as
  2838. // null. It is an error if a field in this list has a non-empty value.
  2839. // This may be used to include null fields in Patch requests.
  2840. NullFields []string `json:"-"`
  2841. }
  2842. func (s *RoutineReference) MarshalJSON() ([]byte, error) {
  2843. type NoMethod RoutineReference
  2844. raw := NoMethod(*s)
  2845. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2846. }
  2847. type Streamingbuffer struct {
  2848. // EstimatedBytes: [Output-only] A lower-bound estimate of the number of
  2849. // bytes currently in the streaming buffer.
  2850. EstimatedBytes uint64 `json:"estimatedBytes,omitempty,string"`
  2851. // EstimatedRows: [Output-only] A lower-bound estimate of the number of
  2852. // rows currently in the streaming buffer.
  2853. EstimatedRows uint64 `json:"estimatedRows,omitempty,string"`
  2854. // OldestEntryTime: [Output-only] Contains the timestamp of the oldest
  2855. // entry in the streaming buffer, in milliseconds since the epoch, if
  2856. // the streaming buffer is available.
  2857. OldestEntryTime uint64 `json:"oldestEntryTime,omitempty,string"`
  2858. // ForceSendFields is a list of field names (e.g. "EstimatedBytes") to
  2859. // unconditionally include in API requests. By default, fields with
  2860. // empty values are omitted from API requests. However, any non-pointer,
  2861. // non-interface field appearing in ForceSendFields will be sent to the
  2862. // server regardless of whether the field is empty or not. This may be
  2863. // used to include empty fields in Patch requests.
  2864. ForceSendFields []string `json:"-"`
  2865. // NullFields is a list of field names (e.g. "EstimatedBytes") to
  2866. // include in API requests with the JSON null value. By default, fields
  2867. // with empty values are omitted from API requests. However, any field
  2868. // with an empty value appearing in NullFields will be sent to the
  2869. // server as null. It is an error if a field in this list has a
  2870. // non-empty value. This may be used to include null fields in Patch
  2871. // requests.
  2872. NullFields []string `json:"-"`
  2873. }
  2874. func (s *Streamingbuffer) MarshalJSON() ([]byte, error) {
  2875. type NoMethod Streamingbuffer
  2876. raw := NoMethod(*s)
  2877. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2878. }
  2879. type Table struct {
  2880. // Clustering: [Beta] Clustering specification for the table. Must be
  2881. // specified with partitioning, data in the table will be first
  2882. // partitioned and subsequently clustered.
  2883. Clustering *Clustering `json:"clustering,omitempty"`
  2884. // CreationTime: [Output-only] The time when this table was created, in
  2885. // milliseconds since the epoch.
  2886. CreationTime int64 `json:"creationTime,omitempty,string"`
  2887. // Description: [Optional] A user-friendly description of this table.
  2888. Description string `json:"description,omitempty"`
  2889. // EncryptionConfiguration: Custom encryption configuration (e.g., Cloud
  2890. // KMS keys).
  2891. EncryptionConfiguration *EncryptionConfiguration `json:"encryptionConfiguration,omitempty"`
  2892. // Etag: [Output-only] A hash of the table metadata. Used to ensure
  2893. // there were no concurrent modifications to the resource when
  2894. // attempting an update. Not guaranteed to change when the table
  2895. // contents or the fields numRows, numBytes, numLongTermBytes or
  2896. // lastModifiedTime change.
  2897. Etag string `json:"etag,omitempty"`
  2898. // ExpirationTime: [Optional] The time when this table expires, in
  2899. // milliseconds since the epoch. If not present, the table will persist
  2900. // indefinitely. Expired tables will be deleted and their storage
  2901. // reclaimed. The defaultTableExpirationMs property of the encapsulating
  2902. // dataset can be used to set a default expirationTime on newly created
  2903. // tables.
  2904. ExpirationTime int64 `json:"expirationTime,omitempty,string"`
  2905. // ExternalDataConfiguration: [Optional] Describes the data format,
  2906. // location, and other properties of a table stored outside of BigQuery.
  2907. // By defining these properties, the data source can then be queried as
  2908. // if it were a standard BigQuery table.
  2909. ExternalDataConfiguration *ExternalDataConfiguration `json:"externalDataConfiguration,omitempty"`
  2910. // FriendlyName: [Optional] A descriptive name for this table.
  2911. FriendlyName string `json:"friendlyName,omitempty"`
  2912. // Id: [Output-only] An opaque ID uniquely identifying the table.
  2913. Id string `json:"id,omitempty"`
  2914. // Kind: [Output-only] The type of the resource.
  2915. Kind string `json:"kind,omitempty"`
  2916. // Labels: The labels associated with this table. You can use these to
  2917. // organize and group your tables. Label keys and values can be no
  2918. // longer than 63 characters, can only contain lowercase letters,
  2919. // numeric characters, underscores and dashes. International characters
  2920. // are allowed. Label values are optional. Label keys must start with a
  2921. // letter and each label in the list must have a different key.
  2922. Labels map[string]string `json:"labels,omitempty"`
  2923. // LastModifiedTime: [Output-only] The time when this table was last
  2924. // modified, in milliseconds since the epoch.
  2925. LastModifiedTime uint64 `json:"lastModifiedTime,omitempty,string"`
  2926. // Location: [Output-only] The geographic location where the table
  2927. // resides. This value is inherited from the dataset.
  2928. Location string `json:"location,omitempty"`
  2929. // MaterializedView: [Optional] Materialized view definition.
  2930. MaterializedView *MaterializedViewDefinition `json:"materializedView,omitempty"`
  2931. // Model: [Output-only, Beta] Present iff this table represents a ML
  2932. // model. Describes the training information for the model, and it is
  2933. // required to run 'PREDICT' queries.
  2934. Model *ModelDefinition `json:"model,omitempty"`
  2935. // NumBytes: [Output-only] The size of this table in bytes, excluding
  2936. // any data in the streaming buffer.
  2937. NumBytes int64 `json:"numBytes,omitempty,string"`
  2938. // NumLongTermBytes: [Output-only] The number of bytes in the table that
  2939. // are considered "long-term storage".
  2940. NumLongTermBytes int64 `json:"numLongTermBytes,omitempty,string"`
  2941. // NumPhysicalBytes: [Output-only] [TrustedTester] The physical size of
  2942. // this table in bytes, excluding any data in the streaming buffer. This
  2943. // includes compression and storage used for time travel.
  2944. NumPhysicalBytes int64 `json:"numPhysicalBytes,omitempty,string"`
  2945. // NumRows: [Output-only] The number of rows of data in this table,
  2946. // excluding any data in the streaming buffer.
  2947. NumRows uint64 `json:"numRows,omitempty,string"`
  2948. // RangePartitioning: [TrustedTester] Range partitioning specification
  2949. // for this table. Only one of timePartitioning and rangePartitioning
  2950. // should be specified.
  2951. RangePartitioning *RangePartitioning `json:"rangePartitioning,omitempty"`
  2952. // RequirePartitionFilter: [Beta] [Optional] If set to true, queries
  2953. // over this table require a partition filter that can be used for
  2954. // partition elimination to be specified.
  2955. RequirePartitionFilter bool `json:"requirePartitionFilter,omitempty"`
  2956. // Schema: [Optional] Describes the schema of this table.
  2957. Schema *TableSchema `json:"schema,omitempty"`
  2958. // SelfLink: [Output-only] A URL that can be used to access this
  2959. // resource again.
  2960. SelfLink string `json:"selfLink,omitempty"`
  2961. // StreamingBuffer: [Output-only] Contains information regarding this
  2962. // table's streaming buffer, if one is present. This field will be
  2963. // absent if the table is not being streamed to or if there is no data
  2964. // in the streaming buffer.
  2965. StreamingBuffer *Streamingbuffer `json:"streamingBuffer,omitempty"`
  2966. // TableReference: [Required] Reference describing the ID of this table.
  2967. TableReference *TableReference `json:"tableReference,omitempty"`
  2968. // TimePartitioning: Time-based partitioning specification for this
  2969. // table. Only one of timePartitioning and rangePartitioning should be
  2970. // specified.
  2971. TimePartitioning *TimePartitioning `json:"timePartitioning,omitempty"`
  2972. // Type: [Output-only] Describes the table type. The following values
  2973. // are supported: TABLE: A normal BigQuery table. VIEW: A virtual table
  2974. // defined by a SQL query. [TrustedTester] MATERIALIZED_VIEW: SQL query
  2975. // whose result is persisted. EXTERNAL: A table that references data
  2976. // stored in an external storage system, such as Google Cloud Storage.
  2977. // The default value is TABLE.
  2978. Type string `json:"type,omitempty"`
  2979. // View: [Optional] The view definition.
  2980. View *ViewDefinition `json:"view,omitempty"`
  2981. // ServerResponse contains the HTTP response code and headers from the
  2982. // server.
  2983. googleapi.ServerResponse `json:"-"`
  2984. // ForceSendFields is a list of field names (e.g. "Clustering") to
  2985. // unconditionally include in API requests. By default, fields with
  2986. // empty values are omitted from API requests. However, any non-pointer,
  2987. // non-interface field appearing in ForceSendFields will be sent to the
  2988. // server regardless of whether the field is empty or not. This may be
  2989. // used to include empty fields in Patch requests.
  2990. ForceSendFields []string `json:"-"`
  2991. // NullFields is a list of field names (e.g. "Clustering") to include in
  2992. // API requests with the JSON null value. By default, fields with empty
  2993. // values are omitted from API requests. However, any field with an
  2994. // empty value appearing in NullFields will be sent to the server as
  2995. // null. It is an error if a field in this list has a non-empty value.
  2996. // This may be used to include null fields in Patch requests.
  2997. NullFields []string `json:"-"`
  2998. }
  2999. func (s *Table) MarshalJSON() ([]byte, error) {
  3000. type NoMethod Table
  3001. raw := NoMethod(*s)
  3002. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3003. }
  3004. type TableCell struct {
  3005. V interface{} `json:"v,omitempty"`
  3006. // ForceSendFields is a list of field names (e.g. "V") to
  3007. // unconditionally include in API requests. By default, fields with
  3008. // empty values are omitted from API requests. However, any non-pointer,
  3009. // non-interface field appearing in ForceSendFields will be sent to the
  3010. // server regardless of whether the field is empty or not. This may be
  3011. // used to include empty fields in Patch requests.
  3012. ForceSendFields []string `json:"-"`
  3013. // NullFields is a list of field names (e.g. "V") to include in API
  3014. // requests with the JSON null value. By default, fields with empty
  3015. // values are omitted from API requests. However, any field with an
  3016. // empty value appearing in NullFields will be sent to the server as
  3017. // null. It is an error if a field in this list has a non-empty value.
  3018. // This may be used to include null fields in Patch requests.
  3019. NullFields []string `json:"-"`
  3020. }
  3021. func (s *TableCell) MarshalJSON() ([]byte, error) {
  3022. type NoMethod TableCell
  3023. raw := NoMethod(*s)
  3024. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3025. }
  3026. type TableDataInsertAllRequest struct {
  3027. // IgnoreUnknownValues: [Optional] Accept rows that contain values that
  3028. // do not match the schema. The unknown values are ignored. Default is
  3029. // false, which treats unknown values as errors.
  3030. IgnoreUnknownValues bool `json:"ignoreUnknownValues,omitempty"`
  3031. // Kind: The resource type of the response.
  3032. Kind string `json:"kind,omitempty"`
  3033. // Rows: The rows to insert.
  3034. Rows []*TableDataInsertAllRequestRows `json:"rows,omitempty"`
  3035. // SkipInvalidRows: [Optional] Insert all valid rows of a request, even
  3036. // if invalid rows exist. The default value is false, which causes the
  3037. // entire request to fail if any invalid rows exist.
  3038. SkipInvalidRows bool `json:"skipInvalidRows,omitempty"`
  3039. // TemplateSuffix: If specified, treats the destination table as a base
  3040. // template, and inserts the rows into an instance table named
  3041. // "{destination}{templateSuffix}". BigQuery will manage creation of the
  3042. // instance table, using the schema of the base template table. See
  3043. // https://cloud.google.com/bigquery/streaming-data-into-bigquery#template-tables for considerations when working with templates
  3044. // tables.
  3045. TemplateSuffix string `json:"templateSuffix,omitempty"`
  3046. // ForceSendFields is a list of field names (e.g. "IgnoreUnknownValues")
  3047. // to unconditionally include in API requests. By default, fields with
  3048. // empty values are omitted from API requests. However, any non-pointer,
  3049. // non-interface field appearing in ForceSendFields will be sent to the
  3050. // server regardless of whether the field is empty or not. This may be
  3051. // used to include empty fields in Patch requests.
  3052. ForceSendFields []string `json:"-"`
  3053. // NullFields is a list of field names (e.g. "IgnoreUnknownValues") to
  3054. // include in API requests with the JSON null value. By default, fields
  3055. // with empty values are omitted from API requests. However, any field
  3056. // with an empty value appearing in NullFields will be sent to the
  3057. // server as null. It is an error if a field in this list has a
  3058. // non-empty value. This may be used to include null fields in Patch
  3059. // requests.
  3060. NullFields []string `json:"-"`
  3061. }
  3062. func (s *TableDataInsertAllRequest) MarshalJSON() ([]byte, error) {
  3063. type NoMethod TableDataInsertAllRequest
  3064. raw := NoMethod(*s)
  3065. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3066. }
  3067. type TableDataInsertAllRequestRows struct {
  3068. // InsertId: [Optional] A unique ID for each row. BigQuery uses this
  3069. // property to detect duplicate insertion requests on a best-effort
  3070. // basis.
  3071. InsertId string `json:"insertId,omitempty"`
  3072. // Json: [Required] A JSON object that contains a row of data. The
  3073. // object's properties and values must match the destination table's
  3074. // schema.
  3075. Json map[string]JsonValue `json:"json,omitempty"`
  3076. // ForceSendFields is a list of field names (e.g. "InsertId") to
  3077. // unconditionally include in API requests. By default, fields with
  3078. // empty values are omitted from API requests. However, any non-pointer,
  3079. // non-interface field appearing in ForceSendFields will be sent to the
  3080. // server regardless of whether the field is empty or not. This may be
  3081. // used to include empty fields in Patch requests.
  3082. ForceSendFields []string `json:"-"`
  3083. // NullFields is a list of field names (e.g. "InsertId") to include in
  3084. // API requests with the JSON null value. By default, fields with empty
  3085. // values are omitted from API requests. However, any field with an
  3086. // empty value appearing in NullFields will be sent to the server as
  3087. // null. It is an error if a field in this list has a non-empty value.
  3088. // This may be used to include null fields in Patch requests.
  3089. NullFields []string `json:"-"`
  3090. }
  3091. func (s *TableDataInsertAllRequestRows) MarshalJSON() ([]byte, error) {
  3092. type NoMethod TableDataInsertAllRequestRows
  3093. raw := NoMethod(*s)
  3094. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3095. }
  3096. type TableDataInsertAllResponse struct {
  3097. // InsertErrors: An array of errors for rows that were not inserted.
  3098. InsertErrors []*TableDataInsertAllResponseInsertErrors `json:"insertErrors,omitempty"`
  3099. // Kind: The resource type of the response.
  3100. Kind string `json:"kind,omitempty"`
  3101. // ServerResponse contains the HTTP response code and headers from the
  3102. // server.
  3103. googleapi.ServerResponse `json:"-"`
  3104. // ForceSendFields is a list of field names (e.g. "InsertErrors") to
  3105. // unconditionally include in API requests. By default, fields with
  3106. // empty values are omitted from API requests. However, any non-pointer,
  3107. // non-interface field appearing in ForceSendFields will be sent to the
  3108. // server regardless of whether the field is empty or not. This may be
  3109. // used to include empty fields in Patch requests.
  3110. ForceSendFields []string `json:"-"`
  3111. // NullFields is a list of field names (e.g. "InsertErrors") to include
  3112. // in API requests with the JSON null value. By default, fields with
  3113. // empty values are omitted from API requests. However, any field with
  3114. // an empty value appearing in NullFields will be sent to the server as
  3115. // null. It is an error if a field in this list has a non-empty value.
  3116. // This may be used to include null fields in Patch requests.
  3117. NullFields []string `json:"-"`
  3118. }
  3119. func (s *TableDataInsertAllResponse) MarshalJSON() ([]byte, error) {
  3120. type NoMethod TableDataInsertAllResponse
  3121. raw := NoMethod(*s)
  3122. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3123. }
  3124. type TableDataInsertAllResponseInsertErrors struct {
  3125. // Errors: Error information for the row indicated by the index
  3126. // property.
  3127. Errors []*ErrorProto `json:"errors,omitempty"`
  3128. // Index: The index of the row that error applies to.
  3129. Index int64 `json:"index,omitempty"`
  3130. // ForceSendFields is a list of field names (e.g. "Errors") to
  3131. // unconditionally include in API requests. By default, fields with
  3132. // empty values are omitted from API requests. However, any non-pointer,
  3133. // non-interface field appearing in ForceSendFields will be sent to the
  3134. // server regardless of whether the field is empty or not. This may be
  3135. // used to include empty fields in Patch requests.
  3136. ForceSendFields []string `json:"-"`
  3137. // NullFields is a list of field names (e.g. "Errors") to include in API
  3138. // requests with the JSON null value. By default, fields with empty
  3139. // values are omitted from API requests. However, any field with an
  3140. // empty value appearing in NullFields will be sent to the server as
  3141. // null. It is an error if a field in this list has a non-empty value.
  3142. // This may be used to include null fields in Patch requests.
  3143. NullFields []string `json:"-"`
  3144. }
  3145. func (s *TableDataInsertAllResponseInsertErrors) MarshalJSON() ([]byte, error) {
  3146. type NoMethod TableDataInsertAllResponseInsertErrors
  3147. raw := NoMethod(*s)
  3148. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3149. }
  3150. type TableDataList struct {
  3151. // Etag: A hash of this page of results.
  3152. Etag string `json:"etag,omitempty"`
  3153. // Kind: The resource type of the response.
  3154. Kind string `json:"kind,omitempty"`
  3155. // PageToken: A token used for paging results. Providing this token
  3156. // instead of the startIndex parameter can help you retrieve stable
  3157. // results when an underlying table is changing.
  3158. PageToken string `json:"pageToken,omitempty"`
  3159. // Rows: Rows of results.
  3160. Rows []*TableRow `json:"rows,omitempty"`
  3161. // TotalRows: The total number of rows in the complete table.
  3162. TotalRows int64 `json:"totalRows,omitempty,string"`
  3163. // ServerResponse contains the HTTP response code and headers from the
  3164. // server.
  3165. googleapi.ServerResponse `json:"-"`
  3166. // ForceSendFields is a list of field names (e.g. "Etag") to
  3167. // unconditionally include in API requests. By default, fields with
  3168. // empty values are omitted from API requests. However, any non-pointer,
  3169. // non-interface field appearing in ForceSendFields will be sent to the
  3170. // server regardless of whether the field is empty or not. This may be
  3171. // used to include empty fields in Patch requests.
  3172. ForceSendFields []string `json:"-"`
  3173. // NullFields is a list of field names (e.g. "Etag") to include in API
  3174. // requests with the JSON null value. By default, fields with empty
  3175. // values are omitted from API requests. However, any field with an
  3176. // empty value appearing in NullFields will be sent to the server as
  3177. // null. It is an error if a field in this list has a non-empty value.
  3178. // This may be used to include null fields in Patch requests.
  3179. NullFields []string `json:"-"`
  3180. }
  3181. func (s *TableDataList) MarshalJSON() ([]byte, error) {
  3182. type NoMethod TableDataList
  3183. raw := NoMethod(*s)
  3184. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3185. }
  3186. type TableFieldSchema struct {
  3187. // Categories: [Optional] The categories attached to this field, used
  3188. // for field-level access control.
  3189. Categories *TableFieldSchemaCategories `json:"categories,omitempty"`
  3190. // Description: [Optional] The field description. The maximum length is
  3191. // 1,024 characters.
  3192. Description string `json:"description,omitempty"`
  3193. // Fields: [Optional] Describes the nested schema fields if the type
  3194. // property is set to RECORD.
  3195. Fields []*TableFieldSchema `json:"fields,omitempty"`
  3196. // Mode: [Optional] The field mode. Possible values include NULLABLE,
  3197. // REQUIRED and REPEATED. The default value is NULLABLE.
  3198. Mode string `json:"mode,omitempty"`
  3199. // Name: [Required] The field name. The name must contain only letters
  3200. // (a-z, A-Z), numbers (0-9), or underscores (_), and must start with a
  3201. // letter or underscore. The maximum length is 128 characters.
  3202. Name string `json:"name,omitempty"`
  3203. // Type: [Required] The field data type. Possible values include STRING,
  3204. // BYTES, INTEGER, INT64 (same as INTEGER), FLOAT, FLOAT64 (same as
  3205. // FLOAT), BOOLEAN, BOOL (same as BOOLEAN), TIMESTAMP, DATE, TIME,
  3206. // DATETIME, RECORD (where RECORD indicates that the field contains a
  3207. // nested schema) or STRUCT (same as RECORD).
  3208. Type string `json:"type,omitempty"`
  3209. // ForceSendFields is a list of field names (e.g. "Categories") to
  3210. // unconditionally include in API requests. By default, fields with
  3211. // empty values are omitted from API requests. However, any non-pointer,
  3212. // non-interface field appearing in ForceSendFields will be sent to the
  3213. // server regardless of whether the field is empty or not. This may be
  3214. // used to include empty fields in Patch requests.
  3215. ForceSendFields []string `json:"-"`
  3216. // NullFields is a list of field names (e.g. "Categories") to include in
  3217. // API requests with the JSON null value. By default, fields with empty
  3218. // values are omitted from API requests. However, any field with an
  3219. // empty value appearing in NullFields will be sent to the server as
  3220. // null. It is an error if a field in this list has a non-empty value.
  3221. // This may be used to include null fields in Patch requests.
  3222. NullFields []string `json:"-"`
  3223. }
  3224. func (s *TableFieldSchema) MarshalJSON() ([]byte, error) {
  3225. type NoMethod TableFieldSchema
  3226. raw := NoMethod(*s)
  3227. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3228. }
  3229. // TableFieldSchemaCategories: [Optional] The categories attached to
  3230. // this field, used for field-level access control.
  3231. type TableFieldSchemaCategories struct {
  3232. // Names: A list of category resource names. For example,
  3233. // "projects/1/taxonomies/2/categories/3". At most 5 categories are
  3234. // allowed.
  3235. Names []string `json:"names,omitempty"`
  3236. // ForceSendFields is a list of field names (e.g. "Names") to
  3237. // unconditionally include in API requests. By default, fields with
  3238. // empty values are omitted from API requests. However, any non-pointer,
  3239. // non-interface field appearing in ForceSendFields will be sent to the
  3240. // server regardless of whether the field is empty or not. This may be
  3241. // used to include empty fields in Patch requests.
  3242. ForceSendFields []string `json:"-"`
  3243. // NullFields is a list of field names (e.g. "Names") to include in API
  3244. // requests with the JSON null value. By default, fields with empty
  3245. // values are omitted from API requests. However, any field with an
  3246. // empty value appearing in NullFields will be sent to the server as
  3247. // null. It is an error if a field in this list has a non-empty value.
  3248. // This may be used to include null fields in Patch requests.
  3249. NullFields []string `json:"-"`
  3250. }
  3251. func (s *TableFieldSchemaCategories) MarshalJSON() ([]byte, error) {
  3252. type NoMethod TableFieldSchemaCategories
  3253. raw := NoMethod(*s)
  3254. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3255. }
  3256. type TableList struct {
  3257. // Etag: A hash of this page of results.
  3258. Etag string `json:"etag,omitempty"`
  3259. // Kind: The type of list.
  3260. Kind string `json:"kind,omitempty"`
  3261. // NextPageToken: A token to request the next page of results.
  3262. NextPageToken string `json:"nextPageToken,omitempty"`
  3263. // Tables: Tables in the requested dataset.
  3264. Tables []*TableListTables `json:"tables,omitempty"`
  3265. // TotalItems: The total number of tables in the dataset.
  3266. TotalItems int64 `json:"totalItems,omitempty"`
  3267. // ServerResponse contains the HTTP response code and headers from the
  3268. // server.
  3269. googleapi.ServerResponse `json:"-"`
  3270. // ForceSendFields is a list of field names (e.g. "Etag") to
  3271. // unconditionally include in API requests. By default, fields with
  3272. // empty values are omitted from API requests. However, any non-pointer,
  3273. // non-interface field appearing in ForceSendFields will be sent to the
  3274. // server regardless of whether the field is empty or not. This may be
  3275. // used to include empty fields in Patch requests.
  3276. ForceSendFields []string `json:"-"`
  3277. // NullFields is a list of field names (e.g. "Etag") to include in API
  3278. // requests with the JSON null value. By default, fields with empty
  3279. // values are omitted from API requests. However, any field with an
  3280. // empty value appearing in NullFields will be sent to the server as
  3281. // null. It is an error if a field in this list has a non-empty value.
  3282. // This may be used to include null fields in Patch requests.
  3283. NullFields []string `json:"-"`
  3284. }
  3285. func (s *TableList) MarshalJSON() ([]byte, error) {
  3286. type NoMethod TableList
  3287. raw := NoMethod(*s)
  3288. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3289. }
  3290. type TableListTables struct {
  3291. // Clustering: [Beta] Clustering specification for this table, if
  3292. // configured.
  3293. Clustering *Clustering `json:"clustering,omitempty"`
  3294. // CreationTime: The time when this table was created, in milliseconds
  3295. // since the epoch.
  3296. CreationTime int64 `json:"creationTime,omitempty,string"`
  3297. // ExpirationTime: [Optional] The time when this table expires, in
  3298. // milliseconds since the epoch. If not present, the table will persist
  3299. // indefinitely. Expired tables will be deleted and their storage
  3300. // reclaimed.
  3301. ExpirationTime int64 `json:"expirationTime,omitempty,string"`
  3302. // FriendlyName: The user-friendly name for this table.
  3303. FriendlyName string `json:"friendlyName,omitempty"`
  3304. // Id: An opaque ID of the table
  3305. Id string `json:"id,omitempty"`
  3306. // Kind: The resource type.
  3307. Kind string `json:"kind,omitempty"`
  3308. // Labels: The labels associated with this table. You can use these to
  3309. // organize and group your tables.
  3310. Labels map[string]string `json:"labels,omitempty"`
  3311. // TableReference: A reference uniquely identifying the table.
  3312. TableReference *TableReference `json:"tableReference,omitempty"`
  3313. // TimePartitioning: The time-based partitioning specification for this
  3314. // table, if configured.
  3315. TimePartitioning *TimePartitioning `json:"timePartitioning,omitempty"`
  3316. // Type: The type of table. Possible values are: TABLE, VIEW.
  3317. Type string `json:"type,omitempty"`
  3318. // View: Additional details for a view.
  3319. View *TableListTablesView `json:"view,omitempty"`
  3320. // ForceSendFields is a list of field names (e.g. "Clustering") to
  3321. // unconditionally include in API requests. By default, fields with
  3322. // empty values are omitted from API requests. However, any non-pointer,
  3323. // non-interface field appearing in ForceSendFields will be sent to the
  3324. // server regardless of whether the field is empty or not. This may be
  3325. // used to include empty fields in Patch requests.
  3326. ForceSendFields []string `json:"-"`
  3327. // NullFields is a list of field names (e.g. "Clustering") to include in
  3328. // API requests with the JSON null value. By default, fields with empty
  3329. // values are omitted from API requests. However, any field with an
  3330. // empty value appearing in NullFields will be sent to the server as
  3331. // null. It is an error if a field in this list has a non-empty value.
  3332. // This may be used to include null fields in Patch requests.
  3333. NullFields []string `json:"-"`
  3334. }
  3335. func (s *TableListTables) MarshalJSON() ([]byte, error) {
  3336. type NoMethod TableListTables
  3337. raw := NoMethod(*s)
  3338. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3339. }
  3340. // TableListTablesView: Additional details for a view.
  3341. type TableListTablesView struct {
  3342. // UseLegacySql: True if view is defined in legacy SQL dialect, false if
  3343. // in standard SQL.
  3344. UseLegacySql bool `json:"useLegacySql,omitempty"`
  3345. // ForceSendFields is a list of field names (e.g. "UseLegacySql") to
  3346. // unconditionally include in API requests. By default, fields with
  3347. // empty values are omitted from API requests. However, any non-pointer,
  3348. // non-interface field appearing in ForceSendFields will be sent to the
  3349. // server regardless of whether the field is empty or not. This may be
  3350. // used to include empty fields in Patch requests.
  3351. ForceSendFields []string `json:"-"`
  3352. // NullFields is a list of field names (e.g. "UseLegacySql") to include
  3353. // in API requests with the JSON null value. By default, fields with
  3354. // empty values are omitted from API requests. However, any field with
  3355. // an empty value appearing in NullFields will be sent to the server as
  3356. // null. It is an error if a field in this list has a non-empty value.
  3357. // This may be used to include null fields in Patch requests.
  3358. NullFields []string `json:"-"`
  3359. }
  3360. func (s *TableListTablesView) MarshalJSON() ([]byte, error) {
  3361. type NoMethod TableListTablesView
  3362. raw := NoMethod(*s)
  3363. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3364. }
  3365. type TableReference struct {
  3366. // DatasetId: [Required] The ID of the dataset containing this table.
  3367. DatasetId string `json:"datasetId,omitempty"`
  3368. // ProjectId: [Required] The ID of the project containing this table.
  3369. ProjectId string `json:"projectId,omitempty"`
  3370. // TableId: [Required] The ID of the table. The ID must contain only
  3371. // letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum
  3372. // length is 1,024 characters.
  3373. TableId string `json:"tableId,omitempty"`
  3374. // ForceSendFields is a list of field names (e.g. "DatasetId") to
  3375. // unconditionally include in API requests. By default, fields with
  3376. // empty values are omitted from API requests. However, any non-pointer,
  3377. // non-interface field appearing in ForceSendFields will be sent to the
  3378. // server regardless of whether the field is empty or not. This may be
  3379. // used to include empty fields in Patch requests.
  3380. ForceSendFields []string `json:"-"`
  3381. // NullFields is a list of field names (e.g. "DatasetId") to include in
  3382. // API requests with the JSON null value. By default, fields with empty
  3383. // values are omitted from API requests. However, any field with an
  3384. // empty value appearing in NullFields will be sent to the server as
  3385. // null. It is an error if a field in this list has a non-empty value.
  3386. // This may be used to include null fields in Patch requests.
  3387. NullFields []string `json:"-"`
  3388. }
  3389. func (s *TableReference) MarshalJSON() ([]byte, error) {
  3390. type NoMethod TableReference
  3391. raw := NoMethod(*s)
  3392. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3393. }
  3394. type TableRow struct {
  3395. // F: Represents a single row in the result set, consisting of one or
  3396. // more fields.
  3397. F []*TableCell `json:"f,omitempty"`
  3398. // ForceSendFields is a list of field names (e.g. "F") to
  3399. // unconditionally include in API requests. By default, fields with
  3400. // empty values are omitted from API requests. However, any non-pointer,
  3401. // non-interface field appearing in ForceSendFields will be sent to the
  3402. // server regardless of whether the field is empty or not. This may be
  3403. // used to include empty fields in Patch requests.
  3404. ForceSendFields []string `json:"-"`
  3405. // NullFields is a list of field names (e.g. "F") to include in API
  3406. // requests with the JSON null value. By default, fields with empty
  3407. // values are omitted from API requests. However, any field with an
  3408. // empty value appearing in NullFields will be sent to the server as
  3409. // null. It is an error if a field in this list has a non-empty value.
  3410. // This may be used to include null fields in Patch requests.
  3411. NullFields []string `json:"-"`
  3412. }
  3413. func (s *TableRow) MarshalJSON() ([]byte, error) {
  3414. type NoMethod TableRow
  3415. raw := NoMethod(*s)
  3416. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3417. }
  3418. type TableSchema struct {
  3419. // Fields: Describes the fields in a table.
  3420. Fields []*TableFieldSchema `json:"fields,omitempty"`
  3421. // ForceSendFields is a list of field names (e.g. "Fields") to
  3422. // unconditionally include in API requests. By default, fields with
  3423. // empty values are omitted from API requests. However, any non-pointer,
  3424. // non-interface field appearing in ForceSendFields will be sent to the
  3425. // server regardless of whether the field is empty or not. This may be
  3426. // used to include empty fields in Patch requests.
  3427. ForceSendFields []string `json:"-"`
  3428. // NullFields is a list of field names (e.g. "Fields") to include in API
  3429. // requests with the JSON null value. By default, fields with empty
  3430. // values are omitted from API requests. However, any field with an
  3431. // empty value appearing in NullFields will be sent to the server as
  3432. // null. It is an error if a field in this list has a non-empty value.
  3433. // This may be used to include null fields in Patch requests.
  3434. NullFields []string `json:"-"`
  3435. }
  3436. func (s *TableSchema) MarshalJSON() ([]byte, error) {
  3437. type NoMethod TableSchema
  3438. raw := NoMethod(*s)
  3439. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3440. }
  3441. type TimePartitioning struct {
  3442. // ExpirationMs: [Optional] Number of milliseconds for which to keep the
  3443. // storage for partitions in the table. The storage in a partition will
  3444. // have an expiration time of its partition time plus this value.
  3445. ExpirationMs int64 `json:"expirationMs,omitempty,string"`
  3446. // Field: [Beta] [Optional] If not set, the table is partitioned by
  3447. // pseudo column, referenced via either '_PARTITIONTIME' as TIMESTAMP
  3448. // type, or '_PARTITIONDATE' as DATE type. If field is specified, the
  3449. // table is instead partitioned by this field. The field must be a
  3450. // top-level TIMESTAMP or DATE field. Its mode must be NULLABLE or
  3451. // REQUIRED.
  3452. Field string `json:"field,omitempty"`
  3453. RequirePartitionFilter bool `json:"requirePartitionFilter,omitempty"`
  3454. // Type: [Required] The only type supported is DAY, which will generate
  3455. // one partition per day.
  3456. Type string `json:"type,omitempty"`
  3457. // ForceSendFields is a list of field names (e.g. "ExpirationMs") to
  3458. // unconditionally include in API requests. By default, fields with
  3459. // empty values are omitted from API requests. However, any non-pointer,
  3460. // non-interface field appearing in ForceSendFields will be sent to the
  3461. // server regardless of whether the field is empty or not. This may be
  3462. // used to include empty fields in Patch requests.
  3463. ForceSendFields []string `json:"-"`
  3464. // NullFields is a list of field names (e.g. "ExpirationMs") to include
  3465. // in API requests with the JSON null value. By default, fields with
  3466. // empty values are omitted from API requests. However, any field with
  3467. // an empty value appearing in NullFields will be sent to the server as
  3468. // null. It is an error if a field in this list has a non-empty value.
  3469. // This may be used to include null fields in Patch requests.
  3470. NullFields []string `json:"-"`
  3471. }
  3472. func (s *TimePartitioning) MarshalJSON() ([]byte, error) {
  3473. type NoMethod TimePartitioning
  3474. raw := NoMethod(*s)
  3475. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3476. }
  3477. type UserDefinedFunctionResource struct {
  3478. // InlineCode: [Pick one] An inline resource that contains code for a
  3479. // user-defined function (UDF). Providing a inline code resource is
  3480. // equivalent to providing a URI for a file containing the same code.
  3481. InlineCode string `json:"inlineCode,omitempty"`
  3482. // ResourceUri: [Pick one] A code resource to load from a Google Cloud
  3483. // Storage URI (gs://bucket/path).
  3484. ResourceUri string `json:"resourceUri,omitempty"`
  3485. // ForceSendFields is a list of field names (e.g. "InlineCode") to
  3486. // unconditionally include in API requests. By default, fields with
  3487. // empty values are omitted from API requests. However, any non-pointer,
  3488. // non-interface field appearing in ForceSendFields will be sent to the
  3489. // server regardless of whether the field is empty or not. This may be
  3490. // used to include empty fields in Patch requests.
  3491. ForceSendFields []string `json:"-"`
  3492. // NullFields is a list of field names (e.g. "InlineCode") to include in
  3493. // API requests with the JSON null value. By default, fields with empty
  3494. // values are omitted from API requests. However, any field with an
  3495. // empty value appearing in NullFields will be sent to the server as
  3496. // null. It is an error if a field in this list has a non-empty value.
  3497. // This may be used to include null fields in Patch requests.
  3498. NullFields []string `json:"-"`
  3499. }
  3500. func (s *UserDefinedFunctionResource) MarshalJSON() ([]byte, error) {
  3501. type NoMethod UserDefinedFunctionResource
  3502. raw := NoMethod(*s)
  3503. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3504. }
  3505. type ViewDefinition struct {
  3506. // Query: [Required] A query that BigQuery executes when the view is
  3507. // referenced.
  3508. Query string `json:"query,omitempty"`
  3509. // UseLegacySql: Specifies whether to use BigQuery's legacy SQL for this
  3510. // view. The default value is true. If set to false, the view will use
  3511. // BigQuery's standard SQL:
  3512. // https://cloud.google.com/bigquery/sql-reference/ Queries and views
  3513. // that reference this view must use the same flag value.
  3514. UseLegacySql bool `json:"useLegacySql,omitempty"`
  3515. // UserDefinedFunctionResources: Describes user-defined function
  3516. // resources used in the query.
  3517. UserDefinedFunctionResources []*UserDefinedFunctionResource `json:"userDefinedFunctionResources,omitempty"`
  3518. // ForceSendFields is a list of field names (e.g. "Query") to
  3519. // unconditionally include in API requests. By default, fields with
  3520. // empty values are omitted from API requests. However, any non-pointer,
  3521. // non-interface field appearing in ForceSendFields will be sent to the
  3522. // server regardless of whether the field is empty or not. This may be
  3523. // used to include empty fields in Patch requests.
  3524. ForceSendFields []string `json:"-"`
  3525. // NullFields is a list of field names (e.g. "Query") to include in API
  3526. // requests with the JSON null value. By default, fields with empty
  3527. // values are omitted from API requests. However, any field with an
  3528. // empty value appearing in NullFields will be sent to the server as
  3529. // null. It is an error if a field in this list has a non-empty value.
  3530. // This may be used to include null fields in Patch requests.
  3531. NullFields []string `json:"-"`
  3532. }
  3533. func (s *ViewDefinition) MarshalJSON() ([]byte, error) {
  3534. type NoMethod ViewDefinition
  3535. raw := NoMethod(*s)
  3536. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  3537. }
  3538. // method id "bigquery.datasets.delete":
  3539. type DatasetsDeleteCall struct {
  3540. s *Service
  3541. projectId string
  3542. datasetId string
  3543. urlParams_ gensupport.URLParams
  3544. ctx_ context.Context
  3545. header_ http.Header
  3546. }
  3547. // Delete: Deletes the dataset specified by the datasetId value. Before
  3548. // you can delete a dataset, you must delete all its tables, either
  3549. // manually or by specifying deleteContents. Immediately after deletion,
  3550. // you can create another dataset with the same name.
  3551. func (r *DatasetsService) Delete(projectId string, datasetId string) *DatasetsDeleteCall {
  3552. c := &DatasetsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3553. c.projectId = projectId
  3554. c.datasetId = datasetId
  3555. return c
  3556. }
  3557. // DeleteContents sets the optional parameter "deleteContents": If True,
  3558. // delete all the tables in the dataset. If False and the dataset
  3559. // contains tables, the request will fail. Default is False
  3560. func (c *DatasetsDeleteCall) DeleteContents(deleteContents bool) *DatasetsDeleteCall {
  3561. c.urlParams_.Set("deleteContents", fmt.Sprint(deleteContents))
  3562. return c
  3563. }
  3564. // Fields allows partial responses to be retrieved. See
  3565. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3566. // for more information.
  3567. func (c *DatasetsDeleteCall) Fields(s ...googleapi.Field) *DatasetsDeleteCall {
  3568. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3569. return c
  3570. }
  3571. // Context sets the context to be used in this call's Do method. Any
  3572. // pending HTTP request will be aborted if the provided context is
  3573. // canceled.
  3574. func (c *DatasetsDeleteCall) Context(ctx context.Context) *DatasetsDeleteCall {
  3575. c.ctx_ = ctx
  3576. return c
  3577. }
  3578. // Header returns an http.Header that can be modified by the caller to
  3579. // add HTTP headers to the request.
  3580. func (c *DatasetsDeleteCall) Header() http.Header {
  3581. if c.header_ == nil {
  3582. c.header_ = make(http.Header)
  3583. }
  3584. return c.header_
  3585. }
  3586. func (c *DatasetsDeleteCall) doRequest(alt string) (*http.Response, error) {
  3587. reqHeaders := make(http.Header)
  3588. for k, v := range c.header_ {
  3589. reqHeaders[k] = v
  3590. }
  3591. reqHeaders.Set("User-Agent", c.s.userAgent())
  3592. var body io.Reader = nil
  3593. c.urlParams_.Set("alt", alt)
  3594. c.urlParams_.Set("prettyPrint", "false")
  3595. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}")
  3596. urls += "?" + c.urlParams_.Encode()
  3597. req, err := http.NewRequest("DELETE", urls, body)
  3598. if err != nil {
  3599. return nil, err
  3600. }
  3601. req.Header = reqHeaders
  3602. googleapi.Expand(req.URL, map[string]string{
  3603. "projectId": c.projectId,
  3604. "datasetId": c.datasetId,
  3605. })
  3606. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3607. }
  3608. // Do executes the "bigquery.datasets.delete" call.
  3609. func (c *DatasetsDeleteCall) Do(opts ...googleapi.CallOption) error {
  3610. gensupport.SetOptions(c.urlParams_, opts...)
  3611. res, err := c.doRequest("json")
  3612. if err != nil {
  3613. return err
  3614. }
  3615. defer googleapi.CloseBody(res)
  3616. if err := googleapi.CheckResponse(res); err != nil {
  3617. return err
  3618. }
  3619. return nil
  3620. // {
  3621. // "description": "Deletes the dataset specified by the datasetId value. Before you can delete a dataset, you must delete all its tables, either manually or by specifying deleteContents. Immediately after deletion, you can create another dataset with the same name.",
  3622. // "httpMethod": "DELETE",
  3623. // "id": "bigquery.datasets.delete",
  3624. // "parameterOrder": [
  3625. // "projectId",
  3626. // "datasetId"
  3627. // ],
  3628. // "parameters": {
  3629. // "datasetId": {
  3630. // "description": "Dataset ID of dataset being deleted",
  3631. // "location": "path",
  3632. // "required": true,
  3633. // "type": "string"
  3634. // },
  3635. // "deleteContents": {
  3636. // "description": "If True, delete all the tables in the dataset. If False and the dataset contains tables, the request will fail. Default is False",
  3637. // "location": "query",
  3638. // "type": "boolean"
  3639. // },
  3640. // "projectId": {
  3641. // "description": "Project ID of the dataset being deleted",
  3642. // "location": "path",
  3643. // "required": true,
  3644. // "type": "string"
  3645. // }
  3646. // },
  3647. // "path": "projects/{projectId}/datasets/{datasetId}",
  3648. // "scopes": [
  3649. // "https://www.googleapis.com/auth/bigquery",
  3650. // "https://www.googleapis.com/auth/cloud-platform"
  3651. // ]
  3652. // }
  3653. }
  3654. // method id "bigquery.datasets.get":
  3655. type DatasetsGetCall struct {
  3656. s *Service
  3657. projectId string
  3658. datasetId string
  3659. urlParams_ gensupport.URLParams
  3660. ifNoneMatch_ string
  3661. ctx_ context.Context
  3662. header_ http.Header
  3663. }
  3664. // Get: Returns the dataset specified by datasetID.
  3665. func (r *DatasetsService) Get(projectId string, datasetId string) *DatasetsGetCall {
  3666. c := &DatasetsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3667. c.projectId = projectId
  3668. c.datasetId = datasetId
  3669. return c
  3670. }
  3671. // Fields allows partial responses to be retrieved. See
  3672. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3673. // for more information.
  3674. func (c *DatasetsGetCall) Fields(s ...googleapi.Field) *DatasetsGetCall {
  3675. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3676. return c
  3677. }
  3678. // IfNoneMatch sets the optional parameter which makes the operation
  3679. // fail if the object's ETag matches the given value. This is useful for
  3680. // getting updates only after the object has changed since the last
  3681. // request. Use googleapi.IsNotModified to check whether the response
  3682. // error from Do is the result of In-None-Match.
  3683. func (c *DatasetsGetCall) IfNoneMatch(entityTag string) *DatasetsGetCall {
  3684. c.ifNoneMatch_ = entityTag
  3685. return c
  3686. }
  3687. // Context sets the context to be used in this call's Do method. Any
  3688. // pending HTTP request will be aborted if the provided context is
  3689. // canceled.
  3690. func (c *DatasetsGetCall) Context(ctx context.Context) *DatasetsGetCall {
  3691. c.ctx_ = ctx
  3692. return c
  3693. }
  3694. // Header returns an http.Header that can be modified by the caller to
  3695. // add HTTP headers to the request.
  3696. func (c *DatasetsGetCall) Header() http.Header {
  3697. if c.header_ == nil {
  3698. c.header_ = make(http.Header)
  3699. }
  3700. return c.header_
  3701. }
  3702. func (c *DatasetsGetCall) doRequest(alt string) (*http.Response, error) {
  3703. reqHeaders := make(http.Header)
  3704. for k, v := range c.header_ {
  3705. reqHeaders[k] = v
  3706. }
  3707. reqHeaders.Set("User-Agent", c.s.userAgent())
  3708. if c.ifNoneMatch_ != "" {
  3709. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3710. }
  3711. var body io.Reader = nil
  3712. c.urlParams_.Set("alt", alt)
  3713. c.urlParams_.Set("prettyPrint", "false")
  3714. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}")
  3715. urls += "?" + c.urlParams_.Encode()
  3716. req, err := http.NewRequest("GET", urls, body)
  3717. if err != nil {
  3718. return nil, err
  3719. }
  3720. req.Header = reqHeaders
  3721. googleapi.Expand(req.URL, map[string]string{
  3722. "projectId": c.projectId,
  3723. "datasetId": c.datasetId,
  3724. })
  3725. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3726. }
  3727. // Do executes the "bigquery.datasets.get" call.
  3728. // Exactly one of *Dataset or error will be non-nil. Any non-2xx status
  3729. // code is an error. Response headers are in either
  3730. // *Dataset.ServerResponse.Header or (if a response was returned at all)
  3731. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3732. // check whether the returned error was because http.StatusNotModified
  3733. // was returned.
  3734. func (c *DatasetsGetCall) Do(opts ...googleapi.CallOption) (*Dataset, error) {
  3735. gensupport.SetOptions(c.urlParams_, opts...)
  3736. res, err := c.doRequest("json")
  3737. if res != nil && res.StatusCode == http.StatusNotModified {
  3738. if res.Body != nil {
  3739. res.Body.Close()
  3740. }
  3741. return nil, &googleapi.Error{
  3742. Code: res.StatusCode,
  3743. Header: res.Header,
  3744. }
  3745. }
  3746. if err != nil {
  3747. return nil, err
  3748. }
  3749. defer googleapi.CloseBody(res)
  3750. if err := googleapi.CheckResponse(res); err != nil {
  3751. return nil, err
  3752. }
  3753. ret := &Dataset{
  3754. ServerResponse: googleapi.ServerResponse{
  3755. Header: res.Header,
  3756. HTTPStatusCode: res.StatusCode,
  3757. },
  3758. }
  3759. target := &ret
  3760. if err := gensupport.DecodeResponse(target, res); err != nil {
  3761. return nil, err
  3762. }
  3763. return ret, nil
  3764. // {
  3765. // "description": "Returns the dataset specified by datasetID.",
  3766. // "httpMethod": "GET",
  3767. // "id": "bigquery.datasets.get",
  3768. // "parameterOrder": [
  3769. // "projectId",
  3770. // "datasetId"
  3771. // ],
  3772. // "parameters": {
  3773. // "datasetId": {
  3774. // "description": "Dataset ID of the requested dataset",
  3775. // "location": "path",
  3776. // "required": true,
  3777. // "type": "string"
  3778. // },
  3779. // "projectId": {
  3780. // "description": "Project ID of the requested dataset",
  3781. // "location": "path",
  3782. // "required": true,
  3783. // "type": "string"
  3784. // }
  3785. // },
  3786. // "path": "projects/{projectId}/datasets/{datasetId}",
  3787. // "response": {
  3788. // "$ref": "Dataset"
  3789. // },
  3790. // "scopes": [
  3791. // "https://www.googleapis.com/auth/bigquery",
  3792. // "https://www.googleapis.com/auth/cloud-platform",
  3793. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  3794. // ]
  3795. // }
  3796. }
  3797. // method id "bigquery.datasets.insert":
  3798. type DatasetsInsertCall struct {
  3799. s *Service
  3800. projectId string
  3801. dataset *Dataset
  3802. urlParams_ gensupport.URLParams
  3803. ctx_ context.Context
  3804. header_ http.Header
  3805. }
  3806. // Insert: Creates a new empty dataset.
  3807. func (r *DatasetsService) Insert(projectId string, dataset *Dataset) *DatasetsInsertCall {
  3808. c := &DatasetsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3809. c.projectId = projectId
  3810. c.dataset = dataset
  3811. return c
  3812. }
  3813. // Fields allows partial responses to be retrieved. See
  3814. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3815. // for more information.
  3816. func (c *DatasetsInsertCall) Fields(s ...googleapi.Field) *DatasetsInsertCall {
  3817. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3818. return c
  3819. }
  3820. // Context sets the context to be used in this call's Do method. Any
  3821. // pending HTTP request will be aborted if the provided context is
  3822. // canceled.
  3823. func (c *DatasetsInsertCall) Context(ctx context.Context) *DatasetsInsertCall {
  3824. c.ctx_ = ctx
  3825. return c
  3826. }
  3827. // Header returns an http.Header that can be modified by the caller to
  3828. // add HTTP headers to the request.
  3829. func (c *DatasetsInsertCall) Header() http.Header {
  3830. if c.header_ == nil {
  3831. c.header_ = make(http.Header)
  3832. }
  3833. return c.header_
  3834. }
  3835. func (c *DatasetsInsertCall) doRequest(alt string) (*http.Response, error) {
  3836. reqHeaders := make(http.Header)
  3837. for k, v := range c.header_ {
  3838. reqHeaders[k] = v
  3839. }
  3840. reqHeaders.Set("User-Agent", c.s.userAgent())
  3841. var body io.Reader = nil
  3842. body, err := googleapi.WithoutDataWrapper.JSONReader(c.dataset)
  3843. if err != nil {
  3844. return nil, err
  3845. }
  3846. reqHeaders.Set("Content-Type", "application/json")
  3847. c.urlParams_.Set("alt", alt)
  3848. c.urlParams_.Set("prettyPrint", "false")
  3849. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets")
  3850. urls += "?" + c.urlParams_.Encode()
  3851. req, err := http.NewRequest("POST", urls, body)
  3852. if err != nil {
  3853. return nil, err
  3854. }
  3855. req.Header = reqHeaders
  3856. googleapi.Expand(req.URL, map[string]string{
  3857. "projectId": c.projectId,
  3858. })
  3859. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3860. }
  3861. // Do executes the "bigquery.datasets.insert" call.
  3862. // Exactly one of *Dataset or error will be non-nil. Any non-2xx status
  3863. // code is an error. Response headers are in either
  3864. // *Dataset.ServerResponse.Header or (if a response was returned at all)
  3865. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3866. // check whether the returned error was because http.StatusNotModified
  3867. // was returned.
  3868. func (c *DatasetsInsertCall) Do(opts ...googleapi.CallOption) (*Dataset, error) {
  3869. gensupport.SetOptions(c.urlParams_, opts...)
  3870. res, err := c.doRequest("json")
  3871. if res != nil && res.StatusCode == http.StatusNotModified {
  3872. if res.Body != nil {
  3873. res.Body.Close()
  3874. }
  3875. return nil, &googleapi.Error{
  3876. Code: res.StatusCode,
  3877. Header: res.Header,
  3878. }
  3879. }
  3880. if err != nil {
  3881. return nil, err
  3882. }
  3883. defer googleapi.CloseBody(res)
  3884. if err := googleapi.CheckResponse(res); err != nil {
  3885. return nil, err
  3886. }
  3887. ret := &Dataset{
  3888. ServerResponse: googleapi.ServerResponse{
  3889. Header: res.Header,
  3890. HTTPStatusCode: res.StatusCode,
  3891. },
  3892. }
  3893. target := &ret
  3894. if err := gensupport.DecodeResponse(target, res); err != nil {
  3895. return nil, err
  3896. }
  3897. return ret, nil
  3898. // {
  3899. // "description": "Creates a new empty dataset.",
  3900. // "httpMethod": "POST",
  3901. // "id": "bigquery.datasets.insert",
  3902. // "parameterOrder": [
  3903. // "projectId"
  3904. // ],
  3905. // "parameters": {
  3906. // "projectId": {
  3907. // "description": "Project ID of the new dataset",
  3908. // "location": "path",
  3909. // "required": true,
  3910. // "type": "string"
  3911. // }
  3912. // },
  3913. // "path": "projects/{projectId}/datasets",
  3914. // "request": {
  3915. // "$ref": "Dataset"
  3916. // },
  3917. // "response": {
  3918. // "$ref": "Dataset"
  3919. // },
  3920. // "scopes": [
  3921. // "https://www.googleapis.com/auth/bigquery",
  3922. // "https://www.googleapis.com/auth/cloud-platform"
  3923. // ]
  3924. // }
  3925. }
  3926. // method id "bigquery.datasets.list":
  3927. type DatasetsListCall struct {
  3928. s *Service
  3929. projectId string
  3930. urlParams_ gensupport.URLParams
  3931. ifNoneMatch_ string
  3932. ctx_ context.Context
  3933. header_ http.Header
  3934. }
  3935. // List: Lists all datasets in the specified project to which you have
  3936. // been granted the READER dataset role.
  3937. func (r *DatasetsService) List(projectId string) *DatasetsListCall {
  3938. c := &DatasetsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3939. c.projectId = projectId
  3940. return c
  3941. }
  3942. // All sets the optional parameter "all": Whether to list all datasets,
  3943. // including hidden ones
  3944. func (c *DatasetsListCall) All(all bool) *DatasetsListCall {
  3945. c.urlParams_.Set("all", fmt.Sprint(all))
  3946. return c
  3947. }
  3948. // Filter sets the optional parameter "filter": An expression for
  3949. // filtering the results of the request by label. The syntax is
  3950. // "labels.<name>[:<value>]". Multiple filters can be ANDed together by
  3951. // connecting with a space. Example: "labels.department:receiving
  3952. // labels.active". See Filtering datasets using labels for details.
  3953. func (c *DatasetsListCall) Filter(filter string) *DatasetsListCall {
  3954. c.urlParams_.Set("filter", filter)
  3955. return c
  3956. }
  3957. // MaxResults sets the optional parameter "maxResults": The maximum
  3958. // number of results to return
  3959. func (c *DatasetsListCall) MaxResults(maxResults int64) *DatasetsListCall {
  3960. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3961. return c
  3962. }
  3963. // PageToken sets the optional parameter "pageToken": Page token,
  3964. // returned by a previous call, to request the next page of results
  3965. func (c *DatasetsListCall) PageToken(pageToken string) *DatasetsListCall {
  3966. c.urlParams_.Set("pageToken", pageToken)
  3967. return c
  3968. }
  3969. // Fields allows partial responses to be retrieved. See
  3970. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3971. // for more information.
  3972. func (c *DatasetsListCall) Fields(s ...googleapi.Field) *DatasetsListCall {
  3973. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3974. return c
  3975. }
  3976. // IfNoneMatch sets the optional parameter which makes the operation
  3977. // fail if the object's ETag matches the given value. This is useful for
  3978. // getting updates only after the object has changed since the last
  3979. // request. Use googleapi.IsNotModified to check whether the response
  3980. // error from Do is the result of In-None-Match.
  3981. func (c *DatasetsListCall) IfNoneMatch(entityTag string) *DatasetsListCall {
  3982. c.ifNoneMatch_ = entityTag
  3983. return c
  3984. }
  3985. // Context sets the context to be used in this call's Do method. Any
  3986. // pending HTTP request will be aborted if the provided context is
  3987. // canceled.
  3988. func (c *DatasetsListCall) Context(ctx context.Context) *DatasetsListCall {
  3989. c.ctx_ = ctx
  3990. return c
  3991. }
  3992. // Header returns an http.Header that can be modified by the caller to
  3993. // add HTTP headers to the request.
  3994. func (c *DatasetsListCall) Header() http.Header {
  3995. if c.header_ == nil {
  3996. c.header_ = make(http.Header)
  3997. }
  3998. return c.header_
  3999. }
  4000. func (c *DatasetsListCall) doRequest(alt string) (*http.Response, error) {
  4001. reqHeaders := make(http.Header)
  4002. for k, v := range c.header_ {
  4003. reqHeaders[k] = v
  4004. }
  4005. reqHeaders.Set("User-Agent", c.s.userAgent())
  4006. if c.ifNoneMatch_ != "" {
  4007. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4008. }
  4009. var body io.Reader = nil
  4010. c.urlParams_.Set("alt", alt)
  4011. c.urlParams_.Set("prettyPrint", "false")
  4012. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets")
  4013. urls += "?" + c.urlParams_.Encode()
  4014. req, err := http.NewRequest("GET", urls, body)
  4015. if err != nil {
  4016. return nil, err
  4017. }
  4018. req.Header = reqHeaders
  4019. googleapi.Expand(req.URL, map[string]string{
  4020. "projectId": c.projectId,
  4021. })
  4022. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4023. }
  4024. // Do executes the "bigquery.datasets.list" call.
  4025. // Exactly one of *DatasetList or error will be non-nil. Any non-2xx
  4026. // status code is an error. Response headers are in either
  4027. // *DatasetList.ServerResponse.Header or (if a response was returned at
  4028. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4029. // to check whether the returned error was because
  4030. // http.StatusNotModified was returned.
  4031. func (c *DatasetsListCall) Do(opts ...googleapi.CallOption) (*DatasetList, error) {
  4032. gensupport.SetOptions(c.urlParams_, opts...)
  4033. res, err := c.doRequest("json")
  4034. if res != nil && res.StatusCode == http.StatusNotModified {
  4035. if res.Body != nil {
  4036. res.Body.Close()
  4037. }
  4038. return nil, &googleapi.Error{
  4039. Code: res.StatusCode,
  4040. Header: res.Header,
  4041. }
  4042. }
  4043. if err != nil {
  4044. return nil, err
  4045. }
  4046. defer googleapi.CloseBody(res)
  4047. if err := googleapi.CheckResponse(res); err != nil {
  4048. return nil, err
  4049. }
  4050. ret := &DatasetList{
  4051. ServerResponse: googleapi.ServerResponse{
  4052. Header: res.Header,
  4053. HTTPStatusCode: res.StatusCode,
  4054. },
  4055. }
  4056. target := &ret
  4057. if err := gensupport.DecodeResponse(target, res); err != nil {
  4058. return nil, err
  4059. }
  4060. return ret, nil
  4061. // {
  4062. // "description": "Lists all datasets in the specified project to which you have been granted the READER dataset role.",
  4063. // "httpMethod": "GET",
  4064. // "id": "bigquery.datasets.list",
  4065. // "parameterOrder": [
  4066. // "projectId"
  4067. // ],
  4068. // "parameters": {
  4069. // "all": {
  4070. // "description": "Whether to list all datasets, including hidden ones",
  4071. // "location": "query",
  4072. // "type": "boolean"
  4073. // },
  4074. // "filter": {
  4075. // "description": "An expression for filtering the results of the request by label. The syntax is \"labels.\u003cname\u003e[:\u003cvalue\u003e]\". Multiple filters can be ANDed together by connecting with a space. Example: \"labels.department:receiving labels.active\". See Filtering datasets using labels for details.",
  4076. // "location": "query",
  4077. // "type": "string"
  4078. // },
  4079. // "maxResults": {
  4080. // "description": "The maximum number of results to return",
  4081. // "format": "uint32",
  4082. // "location": "query",
  4083. // "type": "integer"
  4084. // },
  4085. // "pageToken": {
  4086. // "description": "Page token, returned by a previous call, to request the next page of results",
  4087. // "location": "query",
  4088. // "type": "string"
  4089. // },
  4090. // "projectId": {
  4091. // "description": "Project ID of the datasets to be listed",
  4092. // "location": "path",
  4093. // "required": true,
  4094. // "type": "string"
  4095. // }
  4096. // },
  4097. // "path": "projects/{projectId}/datasets",
  4098. // "response": {
  4099. // "$ref": "DatasetList"
  4100. // },
  4101. // "scopes": [
  4102. // "https://www.googleapis.com/auth/bigquery",
  4103. // "https://www.googleapis.com/auth/cloud-platform",
  4104. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  4105. // ]
  4106. // }
  4107. }
  4108. // Pages invokes f for each page of results.
  4109. // A non-nil error returned from f will halt the iteration.
  4110. // The provided context supersedes any context provided to the Context method.
  4111. func (c *DatasetsListCall) Pages(ctx context.Context, f func(*DatasetList) error) error {
  4112. c.ctx_ = ctx
  4113. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4114. for {
  4115. x, err := c.Do()
  4116. if err != nil {
  4117. return err
  4118. }
  4119. if err := f(x); err != nil {
  4120. return err
  4121. }
  4122. if x.NextPageToken == "" {
  4123. return nil
  4124. }
  4125. c.PageToken(x.NextPageToken)
  4126. }
  4127. }
  4128. // method id "bigquery.datasets.patch":
  4129. type DatasetsPatchCall struct {
  4130. s *Service
  4131. projectId string
  4132. datasetId string
  4133. dataset *Dataset
  4134. urlParams_ gensupport.URLParams
  4135. ctx_ context.Context
  4136. header_ http.Header
  4137. }
  4138. // Patch: Updates information in an existing dataset. The update method
  4139. // replaces the entire dataset resource, whereas the patch method only
  4140. // replaces fields that are provided in the submitted dataset resource.
  4141. // This method supports patch semantics.
  4142. func (r *DatasetsService) Patch(projectId string, datasetId string, dataset *Dataset) *DatasetsPatchCall {
  4143. c := &DatasetsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4144. c.projectId = projectId
  4145. c.datasetId = datasetId
  4146. c.dataset = dataset
  4147. return c
  4148. }
  4149. // Fields allows partial responses to be retrieved. See
  4150. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4151. // for more information.
  4152. func (c *DatasetsPatchCall) Fields(s ...googleapi.Field) *DatasetsPatchCall {
  4153. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4154. return c
  4155. }
  4156. // Context sets the context to be used in this call's Do method. Any
  4157. // pending HTTP request will be aborted if the provided context is
  4158. // canceled.
  4159. func (c *DatasetsPatchCall) Context(ctx context.Context) *DatasetsPatchCall {
  4160. c.ctx_ = ctx
  4161. return c
  4162. }
  4163. // Header returns an http.Header that can be modified by the caller to
  4164. // add HTTP headers to the request.
  4165. func (c *DatasetsPatchCall) Header() http.Header {
  4166. if c.header_ == nil {
  4167. c.header_ = make(http.Header)
  4168. }
  4169. return c.header_
  4170. }
  4171. func (c *DatasetsPatchCall) doRequest(alt string) (*http.Response, error) {
  4172. reqHeaders := make(http.Header)
  4173. for k, v := range c.header_ {
  4174. reqHeaders[k] = v
  4175. }
  4176. reqHeaders.Set("User-Agent", c.s.userAgent())
  4177. var body io.Reader = nil
  4178. body, err := googleapi.WithoutDataWrapper.JSONReader(c.dataset)
  4179. if err != nil {
  4180. return nil, err
  4181. }
  4182. reqHeaders.Set("Content-Type", "application/json")
  4183. c.urlParams_.Set("alt", alt)
  4184. c.urlParams_.Set("prettyPrint", "false")
  4185. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}")
  4186. urls += "?" + c.urlParams_.Encode()
  4187. req, err := http.NewRequest("PATCH", urls, body)
  4188. if err != nil {
  4189. return nil, err
  4190. }
  4191. req.Header = reqHeaders
  4192. googleapi.Expand(req.URL, map[string]string{
  4193. "projectId": c.projectId,
  4194. "datasetId": c.datasetId,
  4195. })
  4196. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4197. }
  4198. // Do executes the "bigquery.datasets.patch" call.
  4199. // Exactly one of *Dataset or error will be non-nil. Any non-2xx status
  4200. // code is an error. Response headers are in either
  4201. // *Dataset.ServerResponse.Header or (if a response was returned at all)
  4202. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4203. // check whether the returned error was because http.StatusNotModified
  4204. // was returned.
  4205. func (c *DatasetsPatchCall) Do(opts ...googleapi.CallOption) (*Dataset, error) {
  4206. gensupport.SetOptions(c.urlParams_, opts...)
  4207. res, err := c.doRequest("json")
  4208. if res != nil && res.StatusCode == http.StatusNotModified {
  4209. if res.Body != nil {
  4210. res.Body.Close()
  4211. }
  4212. return nil, &googleapi.Error{
  4213. Code: res.StatusCode,
  4214. Header: res.Header,
  4215. }
  4216. }
  4217. if err != nil {
  4218. return nil, err
  4219. }
  4220. defer googleapi.CloseBody(res)
  4221. if err := googleapi.CheckResponse(res); err != nil {
  4222. return nil, err
  4223. }
  4224. ret := &Dataset{
  4225. ServerResponse: googleapi.ServerResponse{
  4226. Header: res.Header,
  4227. HTTPStatusCode: res.StatusCode,
  4228. },
  4229. }
  4230. target := &ret
  4231. if err := gensupport.DecodeResponse(target, res); err != nil {
  4232. return nil, err
  4233. }
  4234. return ret, nil
  4235. // {
  4236. // "description": "Updates information in an existing dataset. The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource. This method supports patch semantics.",
  4237. // "httpMethod": "PATCH",
  4238. // "id": "bigquery.datasets.patch",
  4239. // "parameterOrder": [
  4240. // "projectId",
  4241. // "datasetId"
  4242. // ],
  4243. // "parameters": {
  4244. // "datasetId": {
  4245. // "description": "Dataset ID of the dataset being updated",
  4246. // "location": "path",
  4247. // "required": true,
  4248. // "type": "string"
  4249. // },
  4250. // "projectId": {
  4251. // "description": "Project ID of the dataset being updated",
  4252. // "location": "path",
  4253. // "required": true,
  4254. // "type": "string"
  4255. // }
  4256. // },
  4257. // "path": "projects/{projectId}/datasets/{datasetId}",
  4258. // "request": {
  4259. // "$ref": "Dataset"
  4260. // },
  4261. // "response": {
  4262. // "$ref": "Dataset"
  4263. // },
  4264. // "scopes": [
  4265. // "https://www.googleapis.com/auth/bigquery",
  4266. // "https://www.googleapis.com/auth/cloud-platform"
  4267. // ]
  4268. // }
  4269. }
  4270. // method id "bigquery.datasets.update":
  4271. type DatasetsUpdateCall struct {
  4272. s *Service
  4273. projectId string
  4274. datasetId string
  4275. dataset *Dataset
  4276. urlParams_ gensupport.URLParams
  4277. ctx_ context.Context
  4278. header_ http.Header
  4279. }
  4280. // Update: Updates information in an existing dataset. The update method
  4281. // replaces the entire dataset resource, whereas the patch method only
  4282. // replaces fields that are provided in the submitted dataset resource.
  4283. func (r *DatasetsService) Update(projectId string, datasetId string, dataset *Dataset) *DatasetsUpdateCall {
  4284. c := &DatasetsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4285. c.projectId = projectId
  4286. c.datasetId = datasetId
  4287. c.dataset = dataset
  4288. return c
  4289. }
  4290. // Fields allows partial responses to be retrieved. See
  4291. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4292. // for more information.
  4293. func (c *DatasetsUpdateCall) Fields(s ...googleapi.Field) *DatasetsUpdateCall {
  4294. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4295. return c
  4296. }
  4297. // Context sets the context to be used in this call's Do method. Any
  4298. // pending HTTP request will be aborted if the provided context is
  4299. // canceled.
  4300. func (c *DatasetsUpdateCall) Context(ctx context.Context) *DatasetsUpdateCall {
  4301. c.ctx_ = ctx
  4302. return c
  4303. }
  4304. // Header returns an http.Header that can be modified by the caller to
  4305. // add HTTP headers to the request.
  4306. func (c *DatasetsUpdateCall) Header() http.Header {
  4307. if c.header_ == nil {
  4308. c.header_ = make(http.Header)
  4309. }
  4310. return c.header_
  4311. }
  4312. func (c *DatasetsUpdateCall) doRequest(alt string) (*http.Response, error) {
  4313. reqHeaders := make(http.Header)
  4314. for k, v := range c.header_ {
  4315. reqHeaders[k] = v
  4316. }
  4317. reqHeaders.Set("User-Agent", c.s.userAgent())
  4318. var body io.Reader = nil
  4319. body, err := googleapi.WithoutDataWrapper.JSONReader(c.dataset)
  4320. if err != nil {
  4321. return nil, err
  4322. }
  4323. reqHeaders.Set("Content-Type", "application/json")
  4324. c.urlParams_.Set("alt", alt)
  4325. c.urlParams_.Set("prettyPrint", "false")
  4326. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}")
  4327. urls += "?" + c.urlParams_.Encode()
  4328. req, err := http.NewRequest("PUT", urls, body)
  4329. if err != nil {
  4330. return nil, err
  4331. }
  4332. req.Header = reqHeaders
  4333. googleapi.Expand(req.URL, map[string]string{
  4334. "projectId": c.projectId,
  4335. "datasetId": c.datasetId,
  4336. })
  4337. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4338. }
  4339. // Do executes the "bigquery.datasets.update" call.
  4340. // Exactly one of *Dataset or error will be non-nil. Any non-2xx status
  4341. // code is an error. Response headers are in either
  4342. // *Dataset.ServerResponse.Header or (if a response was returned at all)
  4343. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4344. // check whether the returned error was because http.StatusNotModified
  4345. // was returned.
  4346. func (c *DatasetsUpdateCall) Do(opts ...googleapi.CallOption) (*Dataset, error) {
  4347. gensupport.SetOptions(c.urlParams_, opts...)
  4348. res, err := c.doRequest("json")
  4349. if res != nil && res.StatusCode == http.StatusNotModified {
  4350. if res.Body != nil {
  4351. res.Body.Close()
  4352. }
  4353. return nil, &googleapi.Error{
  4354. Code: res.StatusCode,
  4355. Header: res.Header,
  4356. }
  4357. }
  4358. if err != nil {
  4359. return nil, err
  4360. }
  4361. defer googleapi.CloseBody(res)
  4362. if err := googleapi.CheckResponse(res); err != nil {
  4363. return nil, err
  4364. }
  4365. ret := &Dataset{
  4366. ServerResponse: googleapi.ServerResponse{
  4367. Header: res.Header,
  4368. HTTPStatusCode: res.StatusCode,
  4369. },
  4370. }
  4371. target := &ret
  4372. if err := gensupport.DecodeResponse(target, res); err != nil {
  4373. return nil, err
  4374. }
  4375. return ret, nil
  4376. // {
  4377. // "description": "Updates information in an existing dataset. The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource.",
  4378. // "httpMethod": "PUT",
  4379. // "id": "bigquery.datasets.update",
  4380. // "parameterOrder": [
  4381. // "projectId",
  4382. // "datasetId"
  4383. // ],
  4384. // "parameters": {
  4385. // "datasetId": {
  4386. // "description": "Dataset ID of the dataset being updated",
  4387. // "location": "path",
  4388. // "required": true,
  4389. // "type": "string"
  4390. // },
  4391. // "projectId": {
  4392. // "description": "Project ID of the dataset being updated",
  4393. // "location": "path",
  4394. // "required": true,
  4395. // "type": "string"
  4396. // }
  4397. // },
  4398. // "path": "projects/{projectId}/datasets/{datasetId}",
  4399. // "request": {
  4400. // "$ref": "Dataset"
  4401. // },
  4402. // "response": {
  4403. // "$ref": "Dataset"
  4404. // },
  4405. // "scopes": [
  4406. // "https://www.googleapis.com/auth/bigquery",
  4407. // "https://www.googleapis.com/auth/cloud-platform"
  4408. // ]
  4409. // }
  4410. }
  4411. // method id "bigquery.jobs.cancel":
  4412. type JobsCancelCall struct {
  4413. s *Service
  4414. projectId string
  4415. jobId string
  4416. urlParams_ gensupport.URLParams
  4417. ctx_ context.Context
  4418. header_ http.Header
  4419. }
  4420. // Cancel: Requests that a job be cancelled. This call will return
  4421. // immediately, and the client will need to poll for the job status to
  4422. // see if the cancel completed successfully. Cancelled jobs may still
  4423. // incur costs.
  4424. func (r *JobsService) Cancel(projectId string, jobId string) *JobsCancelCall {
  4425. c := &JobsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4426. c.projectId = projectId
  4427. c.jobId = jobId
  4428. return c
  4429. }
  4430. // Location sets the optional parameter "location": The geographic
  4431. // location of the job. Required except for US and EU. See details at
  4432. // https://cloud.google.com/bigquery/docs/locations#specifying_your_location.
  4433. func (c *JobsCancelCall) Location(location string) *JobsCancelCall {
  4434. c.urlParams_.Set("location", location)
  4435. return c
  4436. }
  4437. // Fields allows partial responses to be retrieved. See
  4438. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4439. // for more information.
  4440. func (c *JobsCancelCall) Fields(s ...googleapi.Field) *JobsCancelCall {
  4441. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4442. return c
  4443. }
  4444. // Context sets the context to be used in this call's Do method. Any
  4445. // pending HTTP request will be aborted if the provided context is
  4446. // canceled.
  4447. func (c *JobsCancelCall) Context(ctx context.Context) *JobsCancelCall {
  4448. c.ctx_ = ctx
  4449. return c
  4450. }
  4451. // Header returns an http.Header that can be modified by the caller to
  4452. // add HTTP headers to the request.
  4453. func (c *JobsCancelCall) Header() http.Header {
  4454. if c.header_ == nil {
  4455. c.header_ = make(http.Header)
  4456. }
  4457. return c.header_
  4458. }
  4459. func (c *JobsCancelCall) doRequest(alt string) (*http.Response, error) {
  4460. reqHeaders := make(http.Header)
  4461. for k, v := range c.header_ {
  4462. reqHeaders[k] = v
  4463. }
  4464. reqHeaders.Set("User-Agent", c.s.userAgent())
  4465. var body io.Reader = nil
  4466. c.urlParams_.Set("alt", alt)
  4467. c.urlParams_.Set("prettyPrint", "false")
  4468. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/jobs/{jobId}/cancel")
  4469. urls += "?" + c.urlParams_.Encode()
  4470. req, err := http.NewRequest("POST", urls, body)
  4471. if err != nil {
  4472. return nil, err
  4473. }
  4474. req.Header = reqHeaders
  4475. googleapi.Expand(req.URL, map[string]string{
  4476. "projectId": c.projectId,
  4477. "jobId": c.jobId,
  4478. })
  4479. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4480. }
  4481. // Do executes the "bigquery.jobs.cancel" call.
  4482. // Exactly one of *JobCancelResponse or error will be non-nil. Any
  4483. // non-2xx status code is an error. Response headers are in either
  4484. // *JobCancelResponse.ServerResponse.Header or (if a response was
  4485. // returned at all) in error.(*googleapi.Error).Header. Use
  4486. // googleapi.IsNotModified to check whether the returned error was
  4487. // because http.StatusNotModified was returned.
  4488. func (c *JobsCancelCall) Do(opts ...googleapi.CallOption) (*JobCancelResponse, error) {
  4489. gensupport.SetOptions(c.urlParams_, opts...)
  4490. res, err := c.doRequest("json")
  4491. if res != nil && res.StatusCode == http.StatusNotModified {
  4492. if res.Body != nil {
  4493. res.Body.Close()
  4494. }
  4495. return nil, &googleapi.Error{
  4496. Code: res.StatusCode,
  4497. Header: res.Header,
  4498. }
  4499. }
  4500. if err != nil {
  4501. return nil, err
  4502. }
  4503. defer googleapi.CloseBody(res)
  4504. if err := googleapi.CheckResponse(res); err != nil {
  4505. return nil, err
  4506. }
  4507. ret := &JobCancelResponse{
  4508. ServerResponse: googleapi.ServerResponse{
  4509. Header: res.Header,
  4510. HTTPStatusCode: res.StatusCode,
  4511. },
  4512. }
  4513. target := &ret
  4514. if err := gensupport.DecodeResponse(target, res); err != nil {
  4515. return nil, err
  4516. }
  4517. return ret, nil
  4518. // {
  4519. // "description": "Requests that a job be cancelled. This call will return immediately, and the client will need to poll for the job status to see if the cancel completed successfully. Cancelled jobs may still incur costs.",
  4520. // "httpMethod": "POST",
  4521. // "id": "bigquery.jobs.cancel",
  4522. // "parameterOrder": [
  4523. // "projectId",
  4524. // "jobId"
  4525. // ],
  4526. // "parameters": {
  4527. // "jobId": {
  4528. // "description": "[Required] Job ID of the job to cancel",
  4529. // "location": "path",
  4530. // "required": true,
  4531. // "type": "string"
  4532. // },
  4533. // "location": {
  4534. // "description": "The geographic location of the job. Required except for US and EU. See details at https://cloud.google.com/bigquery/docs/locations#specifying_your_location.",
  4535. // "location": "query",
  4536. // "type": "string"
  4537. // },
  4538. // "projectId": {
  4539. // "description": "[Required] Project ID of the job to cancel",
  4540. // "location": "path",
  4541. // "required": true,
  4542. // "type": "string"
  4543. // }
  4544. // },
  4545. // "path": "projects/{projectId}/jobs/{jobId}/cancel",
  4546. // "response": {
  4547. // "$ref": "JobCancelResponse"
  4548. // },
  4549. // "scopes": [
  4550. // "https://www.googleapis.com/auth/bigquery",
  4551. // "https://www.googleapis.com/auth/cloud-platform"
  4552. // ]
  4553. // }
  4554. }
  4555. // method id "bigquery.jobs.get":
  4556. type JobsGetCall struct {
  4557. s *Service
  4558. projectId string
  4559. jobId string
  4560. urlParams_ gensupport.URLParams
  4561. ifNoneMatch_ string
  4562. ctx_ context.Context
  4563. header_ http.Header
  4564. }
  4565. // Get: Returns information about a specific job. Job information is
  4566. // available for a six month period after creation. Requires that you're
  4567. // the person who ran the job, or have the Is Owner project role.
  4568. func (r *JobsService) Get(projectId string, jobId string) *JobsGetCall {
  4569. c := &JobsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4570. c.projectId = projectId
  4571. c.jobId = jobId
  4572. return c
  4573. }
  4574. // Location sets the optional parameter "location": The geographic
  4575. // location of the job. Required except for US and EU. See details at
  4576. // https://cloud.google.com/bigquery/docs/locations#specifying_your_location.
  4577. func (c *JobsGetCall) Location(location string) *JobsGetCall {
  4578. c.urlParams_.Set("location", location)
  4579. return c
  4580. }
  4581. // Fields allows partial responses to be retrieved. See
  4582. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4583. // for more information.
  4584. func (c *JobsGetCall) Fields(s ...googleapi.Field) *JobsGetCall {
  4585. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4586. return c
  4587. }
  4588. // IfNoneMatch sets the optional parameter which makes the operation
  4589. // fail if the object's ETag matches the given value. This is useful for
  4590. // getting updates only after the object has changed since the last
  4591. // request. Use googleapi.IsNotModified to check whether the response
  4592. // error from Do is the result of In-None-Match.
  4593. func (c *JobsGetCall) IfNoneMatch(entityTag string) *JobsGetCall {
  4594. c.ifNoneMatch_ = entityTag
  4595. return c
  4596. }
  4597. // Context sets the context to be used in this call's Do method. Any
  4598. // pending HTTP request will be aborted if the provided context is
  4599. // canceled.
  4600. func (c *JobsGetCall) Context(ctx context.Context) *JobsGetCall {
  4601. c.ctx_ = ctx
  4602. return c
  4603. }
  4604. // Header returns an http.Header that can be modified by the caller to
  4605. // add HTTP headers to the request.
  4606. func (c *JobsGetCall) Header() http.Header {
  4607. if c.header_ == nil {
  4608. c.header_ = make(http.Header)
  4609. }
  4610. return c.header_
  4611. }
  4612. func (c *JobsGetCall) doRequest(alt string) (*http.Response, error) {
  4613. reqHeaders := make(http.Header)
  4614. for k, v := range c.header_ {
  4615. reqHeaders[k] = v
  4616. }
  4617. reqHeaders.Set("User-Agent", c.s.userAgent())
  4618. if c.ifNoneMatch_ != "" {
  4619. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4620. }
  4621. var body io.Reader = nil
  4622. c.urlParams_.Set("alt", alt)
  4623. c.urlParams_.Set("prettyPrint", "false")
  4624. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/jobs/{jobId}")
  4625. urls += "?" + c.urlParams_.Encode()
  4626. req, err := http.NewRequest("GET", urls, body)
  4627. if err != nil {
  4628. return nil, err
  4629. }
  4630. req.Header = reqHeaders
  4631. googleapi.Expand(req.URL, map[string]string{
  4632. "projectId": c.projectId,
  4633. "jobId": c.jobId,
  4634. })
  4635. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4636. }
  4637. // Do executes the "bigquery.jobs.get" call.
  4638. // Exactly one of *Job or error will be non-nil. Any non-2xx status code
  4639. // is an error. Response headers are in either
  4640. // *Job.ServerResponse.Header or (if a response was returned at all) in
  4641. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  4642. // whether the returned error was because http.StatusNotModified was
  4643. // returned.
  4644. func (c *JobsGetCall) Do(opts ...googleapi.CallOption) (*Job, error) {
  4645. gensupport.SetOptions(c.urlParams_, opts...)
  4646. res, err := c.doRequest("json")
  4647. if res != nil && res.StatusCode == http.StatusNotModified {
  4648. if res.Body != nil {
  4649. res.Body.Close()
  4650. }
  4651. return nil, &googleapi.Error{
  4652. Code: res.StatusCode,
  4653. Header: res.Header,
  4654. }
  4655. }
  4656. if err != nil {
  4657. return nil, err
  4658. }
  4659. defer googleapi.CloseBody(res)
  4660. if err := googleapi.CheckResponse(res); err != nil {
  4661. return nil, err
  4662. }
  4663. ret := &Job{
  4664. ServerResponse: googleapi.ServerResponse{
  4665. Header: res.Header,
  4666. HTTPStatusCode: res.StatusCode,
  4667. },
  4668. }
  4669. target := &ret
  4670. if err := gensupport.DecodeResponse(target, res); err != nil {
  4671. return nil, err
  4672. }
  4673. return ret, nil
  4674. // {
  4675. // "description": "Returns information about a specific job. Job information is available for a six month period after creation. Requires that you're the person who ran the job, or have the Is Owner project role.",
  4676. // "httpMethod": "GET",
  4677. // "id": "bigquery.jobs.get",
  4678. // "parameterOrder": [
  4679. // "projectId",
  4680. // "jobId"
  4681. // ],
  4682. // "parameters": {
  4683. // "jobId": {
  4684. // "description": "[Required] Job ID of the requested job",
  4685. // "location": "path",
  4686. // "required": true,
  4687. // "type": "string"
  4688. // },
  4689. // "location": {
  4690. // "description": "The geographic location of the job. Required except for US and EU. See details at https://cloud.google.com/bigquery/docs/locations#specifying_your_location.",
  4691. // "location": "query",
  4692. // "type": "string"
  4693. // },
  4694. // "projectId": {
  4695. // "description": "[Required] Project ID of the requested job",
  4696. // "location": "path",
  4697. // "required": true,
  4698. // "type": "string"
  4699. // }
  4700. // },
  4701. // "path": "projects/{projectId}/jobs/{jobId}",
  4702. // "response": {
  4703. // "$ref": "Job"
  4704. // },
  4705. // "scopes": [
  4706. // "https://www.googleapis.com/auth/bigquery",
  4707. // "https://www.googleapis.com/auth/cloud-platform",
  4708. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  4709. // ]
  4710. // }
  4711. }
  4712. // method id "bigquery.jobs.getQueryResults":
  4713. type JobsGetQueryResultsCall struct {
  4714. s *Service
  4715. projectId string
  4716. jobId string
  4717. urlParams_ gensupport.URLParams
  4718. ifNoneMatch_ string
  4719. ctx_ context.Context
  4720. header_ http.Header
  4721. }
  4722. // GetQueryResults: Retrieves the results of a query job.
  4723. func (r *JobsService) GetQueryResults(projectId string, jobId string) *JobsGetQueryResultsCall {
  4724. c := &JobsGetQueryResultsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4725. c.projectId = projectId
  4726. c.jobId = jobId
  4727. return c
  4728. }
  4729. // Location sets the optional parameter "location": The geographic
  4730. // location where the job should run. Required except for US and EU. See
  4731. // details at
  4732. // https://cloud.google.com/bigquery/docs/locations#specifying_your_location.
  4733. func (c *JobsGetQueryResultsCall) Location(location string) *JobsGetQueryResultsCall {
  4734. c.urlParams_.Set("location", location)
  4735. return c
  4736. }
  4737. // MaxResults sets the optional parameter "maxResults": Maximum number
  4738. // of results to read
  4739. func (c *JobsGetQueryResultsCall) MaxResults(maxResults int64) *JobsGetQueryResultsCall {
  4740. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  4741. return c
  4742. }
  4743. // PageToken sets the optional parameter "pageToken": Page token,
  4744. // returned by a previous call, to request the next page of results
  4745. func (c *JobsGetQueryResultsCall) PageToken(pageToken string) *JobsGetQueryResultsCall {
  4746. c.urlParams_.Set("pageToken", pageToken)
  4747. return c
  4748. }
  4749. // StartIndex sets the optional parameter "startIndex": Zero-based index
  4750. // of the starting row
  4751. func (c *JobsGetQueryResultsCall) StartIndex(startIndex uint64) *JobsGetQueryResultsCall {
  4752. c.urlParams_.Set("startIndex", fmt.Sprint(startIndex))
  4753. return c
  4754. }
  4755. // TimeoutMs sets the optional parameter "timeoutMs": How long to wait
  4756. // for the query to complete, in milliseconds, before returning. Default
  4757. // is 10 seconds. If the timeout passes before the job completes, the
  4758. // 'jobComplete' field in the response will be false
  4759. func (c *JobsGetQueryResultsCall) TimeoutMs(timeoutMs int64) *JobsGetQueryResultsCall {
  4760. c.urlParams_.Set("timeoutMs", fmt.Sprint(timeoutMs))
  4761. return c
  4762. }
  4763. // Fields allows partial responses to be retrieved. See
  4764. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4765. // for more information.
  4766. func (c *JobsGetQueryResultsCall) Fields(s ...googleapi.Field) *JobsGetQueryResultsCall {
  4767. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4768. return c
  4769. }
  4770. // IfNoneMatch sets the optional parameter which makes the operation
  4771. // fail if the object's ETag matches the given value. This is useful for
  4772. // getting updates only after the object has changed since the last
  4773. // request. Use googleapi.IsNotModified to check whether the response
  4774. // error from Do is the result of In-None-Match.
  4775. func (c *JobsGetQueryResultsCall) IfNoneMatch(entityTag string) *JobsGetQueryResultsCall {
  4776. c.ifNoneMatch_ = entityTag
  4777. return c
  4778. }
  4779. // Context sets the context to be used in this call's Do method. Any
  4780. // pending HTTP request will be aborted if the provided context is
  4781. // canceled.
  4782. func (c *JobsGetQueryResultsCall) Context(ctx context.Context) *JobsGetQueryResultsCall {
  4783. c.ctx_ = ctx
  4784. return c
  4785. }
  4786. // Header returns an http.Header that can be modified by the caller to
  4787. // add HTTP headers to the request.
  4788. func (c *JobsGetQueryResultsCall) Header() http.Header {
  4789. if c.header_ == nil {
  4790. c.header_ = make(http.Header)
  4791. }
  4792. return c.header_
  4793. }
  4794. func (c *JobsGetQueryResultsCall) doRequest(alt string) (*http.Response, error) {
  4795. reqHeaders := make(http.Header)
  4796. for k, v := range c.header_ {
  4797. reqHeaders[k] = v
  4798. }
  4799. reqHeaders.Set("User-Agent", c.s.userAgent())
  4800. if c.ifNoneMatch_ != "" {
  4801. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4802. }
  4803. var body io.Reader = nil
  4804. c.urlParams_.Set("alt", alt)
  4805. c.urlParams_.Set("prettyPrint", "false")
  4806. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/queries/{jobId}")
  4807. urls += "?" + c.urlParams_.Encode()
  4808. req, err := http.NewRequest("GET", urls, body)
  4809. if err != nil {
  4810. return nil, err
  4811. }
  4812. req.Header = reqHeaders
  4813. googleapi.Expand(req.URL, map[string]string{
  4814. "projectId": c.projectId,
  4815. "jobId": c.jobId,
  4816. })
  4817. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4818. }
  4819. // Do executes the "bigquery.jobs.getQueryResults" call.
  4820. // Exactly one of *GetQueryResultsResponse or error will be non-nil. Any
  4821. // non-2xx status code is an error. Response headers are in either
  4822. // *GetQueryResultsResponse.ServerResponse.Header or (if a response was
  4823. // returned at all) in error.(*googleapi.Error).Header. Use
  4824. // googleapi.IsNotModified to check whether the returned error was
  4825. // because http.StatusNotModified was returned.
  4826. func (c *JobsGetQueryResultsCall) Do(opts ...googleapi.CallOption) (*GetQueryResultsResponse, error) {
  4827. gensupport.SetOptions(c.urlParams_, opts...)
  4828. res, err := c.doRequest("json")
  4829. if res != nil && res.StatusCode == http.StatusNotModified {
  4830. if res.Body != nil {
  4831. res.Body.Close()
  4832. }
  4833. return nil, &googleapi.Error{
  4834. Code: res.StatusCode,
  4835. Header: res.Header,
  4836. }
  4837. }
  4838. if err != nil {
  4839. return nil, err
  4840. }
  4841. defer googleapi.CloseBody(res)
  4842. if err := googleapi.CheckResponse(res); err != nil {
  4843. return nil, err
  4844. }
  4845. ret := &GetQueryResultsResponse{
  4846. ServerResponse: googleapi.ServerResponse{
  4847. Header: res.Header,
  4848. HTTPStatusCode: res.StatusCode,
  4849. },
  4850. }
  4851. target := &ret
  4852. if err := gensupport.DecodeResponse(target, res); err != nil {
  4853. return nil, err
  4854. }
  4855. return ret, nil
  4856. // {
  4857. // "description": "Retrieves the results of a query job.",
  4858. // "httpMethod": "GET",
  4859. // "id": "bigquery.jobs.getQueryResults",
  4860. // "parameterOrder": [
  4861. // "projectId",
  4862. // "jobId"
  4863. // ],
  4864. // "parameters": {
  4865. // "jobId": {
  4866. // "description": "[Required] Job ID of the query job",
  4867. // "location": "path",
  4868. // "required": true,
  4869. // "type": "string"
  4870. // },
  4871. // "location": {
  4872. // "description": "The geographic location where the job should run. Required except for US and EU. See details at https://cloud.google.com/bigquery/docs/locations#specifying_your_location.",
  4873. // "location": "query",
  4874. // "type": "string"
  4875. // },
  4876. // "maxResults": {
  4877. // "description": "Maximum number of results to read",
  4878. // "format": "uint32",
  4879. // "location": "query",
  4880. // "type": "integer"
  4881. // },
  4882. // "pageToken": {
  4883. // "description": "Page token, returned by a previous call, to request the next page of results",
  4884. // "location": "query",
  4885. // "type": "string"
  4886. // },
  4887. // "projectId": {
  4888. // "description": "[Required] Project ID of the query job",
  4889. // "location": "path",
  4890. // "required": true,
  4891. // "type": "string"
  4892. // },
  4893. // "startIndex": {
  4894. // "description": "Zero-based index of the starting row",
  4895. // "format": "uint64",
  4896. // "location": "query",
  4897. // "type": "string"
  4898. // },
  4899. // "timeoutMs": {
  4900. // "description": "How long to wait for the query to complete, in milliseconds, before returning. Default is 10 seconds. If the timeout passes before the job completes, the 'jobComplete' field in the response will be false",
  4901. // "format": "uint32",
  4902. // "location": "query",
  4903. // "type": "integer"
  4904. // }
  4905. // },
  4906. // "path": "projects/{projectId}/queries/{jobId}",
  4907. // "response": {
  4908. // "$ref": "GetQueryResultsResponse"
  4909. // },
  4910. // "scopes": [
  4911. // "https://www.googleapis.com/auth/bigquery",
  4912. // "https://www.googleapis.com/auth/cloud-platform",
  4913. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  4914. // ]
  4915. // }
  4916. }
  4917. // Pages invokes f for each page of results.
  4918. // A non-nil error returned from f will halt the iteration.
  4919. // The provided context supersedes any context provided to the Context method.
  4920. func (c *JobsGetQueryResultsCall) Pages(ctx context.Context, f func(*GetQueryResultsResponse) error) error {
  4921. c.ctx_ = ctx
  4922. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4923. for {
  4924. x, err := c.Do()
  4925. if err != nil {
  4926. return err
  4927. }
  4928. if err := f(x); err != nil {
  4929. return err
  4930. }
  4931. if x.PageToken == "" {
  4932. return nil
  4933. }
  4934. c.PageToken(x.PageToken)
  4935. }
  4936. }
  4937. // method id "bigquery.jobs.insert":
  4938. type JobsInsertCall struct {
  4939. s *Service
  4940. projectId string
  4941. job *Job
  4942. urlParams_ gensupport.URLParams
  4943. mediaInfo_ *gensupport.MediaInfo
  4944. ctx_ context.Context
  4945. header_ http.Header
  4946. }
  4947. // Insert: Starts a new asynchronous job. Requires the Can View project
  4948. // role.
  4949. func (r *JobsService) Insert(projectId string, job *Job) *JobsInsertCall {
  4950. c := &JobsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4951. c.projectId = projectId
  4952. c.job = job
  4953. return c
  4954. }
  4955. // Media specifies the media to upload in one or more chunks. The chunk
  4956. // size may be controlled by supplying a MediaOption generated by
  4957. // googleapi.ChunkSize. The chunk size defaults to
  4958. // googleapi.DefaultUploadChunkSize.The Content-Type header used in the
  4959. // upload request will be determined by sniffing the contents of r,
  4960. // unless a MediaOption generated by googleapi.ContentType is
  4961. // supplied.
  4962. // At most one of Media and ResumableMedia may be set.
  4963. func (c *JobsInsertCall) Media(r io.Reader, options ...googleapi.MediaOption) *JobsInsertCall {
  4964. c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
  4965. return c
  4966. }
  4967. // ResumableMedia specifies the media to upload in chunks and can be
  4968. // canceled with ctx.
  4969. //
  4970. // Deprecated: use Media instead.
  4971. //
  4972. // At most one of Media and ResumableMedia may be set. mediaType
  4973. // identifies the MIME media type of the upload, such as "image/png". If
  4974. // mediaType is "", it will be auto-detected. The provided ctx will
  4975. // supersede any context previously provided to the Context method.
  4976. func (c *JobsInsertCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *JobsInsertCall {
  4977. c.ctx_ = ctx
  4978. c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
  4979. return c
  4980. }
  4981. // ProgressUpdater provides a callback function that will be called
  4982. // after every chunk. It should be a low-latency function in order to
  4983. // not slow down the upload operation. This should only be called when
  4984. // using ResumableMedia (as opposed to Media).
  4985. func (c *JobsInsertCall) ProgressUpdater(pu googleapi.ProgressUpdater) *JobsInsertCall {
  4986. c.mediaInfo_.SetProgressUpdater(pu)
  4987. return c
  4988. }
  4989. // Fields allows partial responses to be retrieved. See
  4990. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4991. // for more information.
  4992. func (c *JobsInsertCall) Fields(s ...googleapi.Field) *JobsInsertCall {
  4993. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4994. return c
  4995. }
  4996. // Context sets the context to be used in this call's Do method. Any
  4997. // pending HTTP request will be aborted if the provided context is
  4998. // canceled.
  4999. // This context will supersede any context previously provided to the
  5000. // ResumableMedia method.
  5001. func (c *JobsInsertCall) Context(ctx context.Context) *JobsInsertCall {
  5002. c.ctx_ = ctx
  5003. return c
  5004. }
  5005. // Header returns an http.Header that can be modified by the caller to
  5006. // add HTTP headers to the request.
  5007. func (c *JobsInsertCall) Header() http.Header {
  5008. if c.header_ == nil {
  5009. c.header_ = make(http.Header)
  5010. }
  5011. return c.header_
  5012. }
  5013. func (c *JobsInsertCall) doRequest(alt string) (*http.Response, error) {
  5014. reqHeaders := make(http.Header)
  5015. for k, v := range c.header_ {
  5016. reqHeaders[k] = v
  5017. }
  5018. reqHeaders.Set("User-Agent", c.s.userAgent())
  5019. var body io.Reader = nil
  5020. body, err := googleapi.WithoutDataWrapper.JSONReader(c.job)
  5021. if err != nil {
  5022. return nil, err
  5023. }
  5024. reqHeaders.Set("Content-Type", "application/json")
  5025. c.urlParams_.Set("alt", alt)
  5026. c.urlParams_.Set("prettyPrint", "false")
  5027. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/jobs")
  5028. if c.mediaInfo_ != nil {
  5029. urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
  5030. c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
  5031. }
  5032. if body == nil {
  5033. body = new(bytes.Buffer)
  5034. reqHeaders.Set("Content-Type", "application/json")
  5035. }
  5036. body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
  5037. defer cleanup()
  5038. urls += "?" + c.urlParams_.Encode()
  5039. req, err := http.NewRequest("POST", urls, body)
  5040. if err != nil {
  5041. return nil, err
  5042. }
  5043. req.Header = reqHeaders
  5044. req.GetBody = getBody
  5045. googleapi.Expand(req.URL, map[string]string{
  5046. "projectId": c.projectId,
  5047. })
  5048. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5049. }
  5050. // Do executes the "bigquery.jobs.insert" call.
  5051. // Exactly one of *Job or error will be non-nil. Any non-2xx status code
  5052. // is an error. Response headers are in either
  5053. // *Job.ServerResponse.Header or (if a response was returned at all) in
  5054. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  5055. // whether the returned error was because http.StatusNotModified was
  5056. // returned.
  5057. func (c *JobsInsertCall) Do(opts ...googleapi.CallOption) (*Job, error) {
  5058. gensupport.SetOptions(c.urlParams_, opts...)
  5059. res, err := c.doRequest("json")
  5060. if res != nil && res.StatusCode == http.StatusNotModified {
  5061. if res.Body != nil {
  5062. res.Body.Close()
  5063. }
  5064. return nil, &googleapi.Error{
  5065. Code: res.StatusCode,
  5066. Header: res.Header,
  5067. }
  5068. }
  5069. if err != nil {
  5070. return nil, err
  5071. }
  5072. defer googleapi.CloseBody(res)
  5073. if err := googleapi.CheckResponse(res); err != nil {
  5074. return nil, err
  5075. }
  5076. rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
  5077. if rx != nil {
  5078. rx.Client = c.s.client
  5079. rx.UserAgent = c.s.userAgent()
  5080. ctx := c.ctx_
  5081. if ctx == nil {
  5082. ctx = context.TODO()
  5083. }
  5084. res, err = rx.Upload(ctx)
  5085. if err != nil {
  5086. return nil, err
  5087. }
  5088. defer res.Body.Close()
  5089. if err := googleapi.CheckResponse(res); err != nil {
  5090. return nil, err
  5091. }
  5092. }
  5093. ret := &Job{
  5094. ServerResponse: googleapi.ServerResponse{
  5095. Header: res.Header,
  5096. HTTPStatusCode: res.StatusCode,
  5097. },
  5098. }
  5099. target := &ret
  5100. if err := gensupport.DecodeResponse(target, res); err != nil {
  5101. return nil, err
  5102. }
  5103. return ret, nil
  5104. // {
  5105. // "description": "Starts a new asynchronous job. Requires the Can View project role.",
  5106. // "httpMethod": "POST",
  5107. // "id": "bigquery.jobs.insert",
  5108. // "mediaUpload": {
  5109. // "accept": [
  5110. // "*/*"
  5111. // ],
  5112. // "protocols": {
  5113. // "resumable": {
  5114. // "multipart": true,
  5115. // "path": "/resumable/upload/bigquery/v2/projects/{projectId}/jobs"
  5116. // },
  5117. // "simple": {
  5118. // "multipart": true,
  5119. // "path": "/upload/bigquery/v2/projects/{projectId}/jobs"
  5120. // }
  5121. // }
  5122. // },
  5123. // "parameterOrder": [
  5124. // "projectId"
  5125. // ],
  5126. // "parameters": {
  5127. // "projectId": {
  5128. // "description": "Project ID of the project that will be billed for the job",
  5129. // "location": "path",
  5130. // "required": true,
  5131. // "type": "string"
  5132. // }
  5133. // },
  5134. // "path": "projects/{projectId}/jobs",
  5135. // "request": {
  5136. // "$ref": "Job"
  5137. // },
  5138. // "response": {
  5139. // "$ref": "Job"
  5140. // },
  5141. // "scopes": [
  5142. // "https://www.googleapis.com/auth/bigquery",
  5143. // "https://www.googleapis.com/auth/cloud-platform",
  5144. // "https://www.googleapis.com/auth/devstorage.full_control",
  5145. // "https://www.googleapis.com/auth/devstorage.read_only",
  5146. // "https://www.googleapis.com/auth/devstorage.read_write"
  5147. // ],
  5148. // "supportsMediaUpload": true
  5149. // }
  5150. }
  5151. // method id "bigquery.jobs.list":
  5152. type JobsListCall struct {
  5153. s *Service
  5154. projectId string
  5155. urlParams_ gensupport.URLParams
  5156. ifNoneMatch_ string
  5157. ctx_ context.Context
  5158. header_ http.Header
  5159. }
  5160. // List: Lists all jobs that you started in the specified project. Job
  5161. // information is available for a six month period after creation. The
  5162. // job list is sorted in reverse chronological order, by job creation
  5163. // time. Requires the Can View project role, or the Is Owner project
  5164. // role if you set the allUsers property.
  5165. func (r *JobsService) List(projectId string) *JobsListCall {
  5166. c := &JobsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5167. c.projectId = projectId
  5168. return c
  5169. }
  5170. // AllUsers sets the optional parameter "allUsers": Whether to display
  5171. // jobs owned by all users in the project. Default false
  5172. func (c *JobsListCall) AllUsers(allUsers bool) *JobsListCall {
  5173. c.urlParams_.Set("allUsers", fmt.Sprint(allUsers))
  5174. return c
  5175. }
  5176. // MaxCreationTime sets the optional parameter "maxCreationTime": Max
  5177. // value for job creation time, in milliseconds since the POSIX epoch.
  5178. // If set, only jobs created before or at this timestamp are returned
  5179. func (c *JobsListCall) MaxCreationTime(maxCreationTime uint64) *JobsListCall {
  5180. c.urlParams_.Set("maxCreationTime", fmt.Sprint(maxCreationTime))
  5181. return c
  5182. }
  5183. // MaxResults sets the optional parameter "maxResults": Maximum number
  5184. // of results to return
  5185. func (c *JobsListCall) MaxResults(maxResults int64) *JobsListCall {
  5186. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  5187. return c
  5188. }
  5189. // MinCreationTime sets the optional parameter "minCreationTime": Min
  5190. // value for job creation time, in milliseconds since the POSIX epoch.
  5191. // If set, only jobs created after or at this timestamp are returned
  5192. func (c *JobsListCall) MinCreationTime(minCreationTime uint64) *JobsListCall {
  5193. c.urlParams_.Set("minCreationTime", fmt.Sprint(minCreationTime))
  5194. return c
  5195. }
  5196. // PageToken sets the optional parameter "pageToken": Page token,
  5197. // returned by a previous call, to request the next page of results
  5198. func (c *JobsListCall) PageToken(pageToken string) *JobsListCall {
  5199. c.urlParams_.Set("pageToken", pageToken)
  5200. return c
  5201. }
  5202. // Projection sets the optional parameter "projection": Restrict
  5203. // information returned to a set of selected fields
  5204. //
  5205. // Possible values:
  5206. // "full" - Includes all job data
  5207. // "minimal" - Does not include the job configuration
  5208. func (c *JobsListCall) Projection(projection string) *JobsListCall {
  5209. c.urlParams_.Set("projection", projection)
  5210. return c
  5211. }
  5212. // StateFilter sets the optional parameter "stateFilter": Filter for job
  5213. // state
  5214. //
  5215. // Possible values:
  5216. // "done" - Finished jobs
  5217. // "pending" - Pending jobs
  5218. // "running" - Running jobs
  5219. func (c *JobsListCall) StateFilter(stateFilter ...string) *JobsListCall {
  5220. c.urlParams_.SetMulti("stateFilter", append([]string{}, stateFilter...))
  5221. return c
  5222. }
  5223. // Fields allows partial responses to be retrieved. See
  5224. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5225. // for more information.
  5226. func (c *JobsListCall) Fields(s ...googleapi.Field) *JobsListCall {
  5227. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5228. return c
  5229. }
  5230. // IfNoneMatch sets the optional parameter which makes the operation
  5231. // fail if the object's ETag matches the given value. This is useful for
  5232. // getting updates only after the object has changed since the last
  5233. // request. Use googleapi.IsNotModified to check whether the response
  5234. // error from Do is the result of In-None-Match.
  5235. func (c *JobsListCall) IfNoneMatch(entityTag string) *JobsListCall {
  5236. c.ifNoneMatch_ = entityTag
  5237. return c
  5238. }
  5239. // Context sets the context to be used in this call's Do method. Any
  5240. // pending HTTP request will be aborted if the provided context is
  5241. // canceled.
  5242. func (c *JobsListCall) Context(ctx context.Context) *JobsListCall {
  5243. c.ctx_ = ctx
  5244. return c
  5245. }
  5246. // Header returns an http.Header that can be modified by the caller to
  5247. // add HTTP headers to the request.
  5248. func (c *JobsListCall) Header() http.Header {
  5249. if c.header_ == nil {
  5250. c.header_ = make(http.Header)
  5251. }
  5252. return c.header_
  5253. }
  5254. func (c *JobsListCall) doRequest(alt string) (*http.Response, error) {
  5255. reqHeaders := make(http.Header)
  5256. for k, v := range c.header_ {
  5257. reqHeaders[k] = v
  5258. }
  5259. reqHeaders.Set("User-Agent", c.s.userAgent())
  5260. if c.ifNoneMatch_ != "" {
  5261. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5262. }
  5263. var body io.Reader = nil
  5264. c.urlParams_.Set("alt", alt)
  5265. c.urlParams_.Set("prettyPrint", "false")
  5266. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/jobs")
  5267. urls += "?" + c.urlParams_.Encode()
  5268. req, err := http.NewRequest("GET", urls, body)
  5269. if err != nil {
  5270. return nil, err
  5271. }
  5272. req.Header = reqHeaders
  5273. googleapi.Expand(req.URL, map[string]string{
  5274. "projectId": c.projectId,
  5275. })
  5276. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5277. }
  5278. // Do executes the "bigquery.jobs.list" call.
  5279. // Exactly one of *JobList or error will be non-nil. Any non-2xx status
  5280. // code is an error. Response headers are in either
  5281. // *JobList.ServerResponse.Header or (if a response was returned at all)
  5282. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5283. // check whether the returned error was because http.StatusNotModified
  5284. // was returned.
  5285. func (c *JobsListCall) Do(opts ...googleapi.CallOption) (*JobList, error) {
  5286. gensupport.SetOptions(c.urlParams_, opts...)
  5287. res, err := c.doRequest("json")
  5288. if res != nil && res.StatusCode == http.StatusNotModified {
  5289. if res.Body != nil {
  5290. res.Body.Close()
  5291. }
  5292. return nil, &googleapi.Error{
  5293. Code: res.StatusCode,
  5294. Header: res.Header,
  5295. }
  5296. }
  5297. if err != nil {
  5298. return nil, err
  5299. }
  5300. defer googleapi.CloseBody(res)
  5301. if err := googleapi.CheckResponse(res); err != nil {
  5302. return nil, err
  5303. }
  5304. ret := &JobList{
  5305. ServerResponse: googleapi.ServerResponse{
  5306. Header: res.Header,
  5307. HTTPStatusCode: res.StatusCode,
  5308. },
  5309. }
  5310. target := &ret
  5311. if err := gensupport.DecodeResponse(target, res); err != nil {
  5312. return nil, err
  5313. }
  5314. return ret, nil
  5315. // {
  5316. // "description": "Lists all jobs that you started in the specified project. Job information is available for a six month period after creation. The job list is sorted in reverse chronological order, by job creation time. Requires the Can View project role, or the Is Owner project role if you set the allUsers property.",
  5317. // "httpMethod": "GET",
  5318. // "id": "bigquery.jobs.list",
  5319. // "parameterOrder": [
  5320. // "projectId"
  5321. // ],
  5322. // "parameters": {
  5323. // "allUsers": {
  5324. // "description": "Whether to display jobs owned by all users in the project. Default false",
  5325. // "location": "query",
  5326. // "type": "boolean"
  5327. // },
  5328. // "maxCreationTime": {
  5329. // "description": "Max value for job creation time, in milliseconds since the POSIX epoch. If set, only jobs created before or at this timestamp are returned",
  5330. // "format": "uint64",
  5331. // "location": "query",
  5332. // "type": "string"
  5333. // },
  5334. // "maxResults": {
  5335. // "description": "Maximum number of results to return",
  5336. // "format": "uint32",
  5337. // "location": "query",
  5338. // "type": "integer"
  5339. // },
  5340. // "minCreationTime": {
  5341. // "description": "Min value for job creation time, in milliseconds since the POSIX epoch. If set, only jobs created after or at this timestamp are returned",
  5342. // "format": "uint64",
  5343. // "location": "query",
  5344. // "type": "string"
  5345. // },
  5346. // "pageToken": {
  5347. // "description": "Page token, returned by a previous call, to request the next page of results",
  5348. // "location": "query",
  5349. // "type": "string"
  5350. // },
  5351. // "projectId": {
  5352. // "description": "Project ID of the jobs to list",
  5353. // "location": "path",
  5354. // "required": true,
  5355. // "type": "string"
  5356. // },
  5357. // "projection": {
  5358. // "description": "Restrict information returned to a set of selected fields",
  5359. // "enum": [
  5360. // "full",
  5361. // "minimal"
  5362. // ],
  5363. // "enumDescriptions": [
  5364. // "Includes all job data",
  5365. // "Does not include the job configuration"
  5366. // ],
  5367. // "location": "query",
  5368. // "type": "string"
  5369. // },
  5370. // "stateFilter": {
  5371. // "description": "Filter for job state",
  5372. // "enum": [
  5373. // "done",
  5374. // "pending",
  5375. // "running"
  5376. // ],
  5377. // "enumDescriptions": [
  5378. // "Finished jobs",
  5379. // "Pending jobs",
  5380. // "Running jobs"
  5381. // ],
  5382. // "location": "query",
  5383. // "repeated": true,
  5384. // "type": "string"
  5385. // }
  5386. // },
  5387. // "path": "projects/{projectId}/jobs",
  5388. // "response": {
  5389. // "$ref": "JobList"
  5390. // },
  5391. // "scopes": [
  5392. // "https://www.googleapis.com/auth/bigquery",
  5393. // "https://www.googleapis.com/auth/cloud-platform",
  5394. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  5395. // ]
  5396. // }
  5397. }
  5398. // Pages invokes f for each page of results.
  5399. // A non-nil error returned from f will halt the iteration.
  5400. // The provided context supersedes any context provided to the Context method.
  5401. func (c *JobsListCall) Pages(ctx context.Context, f func(*JobList) error) error {
  5402. c.ctx_ = ctx
  5403. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5404. for {
  5405. x, err := c.Do()
  5406. if err != nil {
  5407. return err
  5408. }
  5409. if err := f(x); err != nil {
  5410. return err
  5411. }
  5412. if x.NextPageToken == "" {
  5413. return nil
  5414. }
  5415. c.PageToken(x.NextPageToken)
  5416. }
  5417. }
  5418. // method id "bigquery.jobs.query":
  5419. type JobsQueryCall struct {
  5420. s *Service
  5421. projectId string
  5422. queryrequest *QueryRequest
  5423. urlParams_ gensupport.URLParams
  5424. ctx_ context.Context
  5425. header_ http.Header
  5426. }
  5427. // Query: Runs a BigQuery SQL query synchronously and returns query
  5428. // results if the query completes within a specified timeout.
  5429. func (r *JobsService) Query(projectId string, queryrequest *QueryRequest) *JobsQueryCall {
  5430. c := &JobsQueryCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5431. c.projectId = projectId
  5432. c.queryrequest = queryrequest
  5433. return c
  5434. }
  5435. // Fields allows partial responses to be retrieved. See
  5436. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5437. // for more information.
  5438. func (c *JobsQueryCall) Fields(s ...googleapi.Field) *JobsQueryCall {
  5439. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5440. return c
  5441. }
  5442. // Context sets the context to be used in this call's Do method. Any
  5443. // pending HTTP request will be aborted if the provided context is
  5444. // canceled.
  5445. func (c *JobsQueryCall) Context(ctx context.Context) *JobsQueryCall {
  5446. c.ctx_ = ctx
  5447. return c
  5448. }
  5449. // Header returns an http.Header that can be modified by the caller to
  5450. // add HTTP headers to the request.
  5451. func (c *JobsQueryCall) Header() http.Header {
  5452. if c.header_ == nil {
  5453. c.header_ = make(http.Header)
  5454. }
  5455. return c.header_
  5456. }
  5457. func (c *JobsQueryCall) doRequest(alt string) (*http.Response, error) {
  5458. reqHeaders := make(http.Header)
  5459. for k, v := range c.header_ {
  5460. reqHeaders[k] = v
  5461. }
  5462. reqHeaders.Set("User-Agent", c.s.userAgent())
  5463. var body io.Reader = nil
  5464. body, err := googleapi.WithoutDataWrapper.JSONReader(c.queryrequest)
  5465. if err != nil {
  5466. return nil, err
  5467. }
  5468. reqHeaders.Set("Content-Type", "application/json")
  5469. c.urlParams_.Set("alt", alt)
  5470. c.urlParams_.Set("prettyPrint", "false")
  5471. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/queries")
  5472. urls += "?" + c.urlParams_.Encode()
  5473. req, err := http.NewRequest("POST", urls, body)
  5474. if err != nil {
  5475. return nil, err
  5476. }
  5477. req.Header = reqHeaders
  5478. googleapi.Expand(req.URL, map[string]string{
  5479. "projectId": c.projectId,
  5480. })
  5481. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5482. }
  5483. // Do executes the "bigquery.jobs.query" call.
  5484. // Exactly one of *QueryResponse or error will be non-nil. Any non-2xx
  5485. // status code is an error. Response headers are in either
  5486. // *QueryResponse.ServerResponse.Header or (if a response was returned
  5487. // at all) in error.(*googleapi.Error).Header. Use
  5488. // googleapi.IsNotModified to check whether the returned error was
  5489. // because http.StatusNotModified was returned.
  5490. func (c *JobsQueryCall) Do(opts ...googleapi.CallOption) (*QueryResponse, error) {
  5491. gensupport.SetOptions(c.urlParams_, opts...)
  5492. res, err := c.doRequest("json")
  5493. if res != nil && res.StatusCode == http.StatusNotModified {
  5494. if res.Body != nil {
  5495. res.Body.Close()
  5496. }
  5497. return nil, &googleapi.Error{
  5498. Code: res.StatusCode,
  5499. Header: res.Header,
  5500. }
  5501. }
  5502. if err != nil {
  5503. return nil, err
  5504. }
  5505. defer googleapi.CloseBody(res)
  5506. if err := googleapi.CheckResponse(res); err != nil {
  5507. return nil, err
  5508. }
  5509. ret := &QueryResponse{
  5510. ServerResponse: googleapi.ServerResponse{
  5511. Header: res.Header,
  5512. HTTPStatusCode: res.StatusCode,
  5513. },
  5514. }
  5515. target := &ret
  5516. if err := gensupport.DecodeResponse(target, res); err != nil {
  5517. return nil, err
  5518. }
  5519. return ret, nil
  5520. // {
  5521. // "description": "Runs a BigQuery SQL query synchronously and returns query results if the query completes within a specified timeout.",
  5522. // "httpMethod": "POST",
  5523. // "id": "bigquery.jobs.query",
  5524. // "parameterOrder": [
  5525. // "projectId"
  5526. // ],
  5527. // "parameters": {
  5528. // "projectId": {
  5529. // "description": "Project ID of the project billed for the query",
  5530. // "location": "path",
  5531. // "required": true,
  5532. // "type": "string"
  5533. // }
  5534. // },
  5535. // "path": "projects/{projectId}/queries",
  5536. // "request": {
  5537. // "$ref": "QueryRequest"
  5538. // },
  5539. // "response": {
  5540. // "$ref": "QueryResponse"
  5541. // },
  5542. // "scopes": [
  5543. // "https://www.googleapis.com/auth/bigquery",
  5544. // "https://www.googleapis.com/auth/cloud-platform",
  5545. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  5546. // ]
  5547. // }
  5548. }
  5549. // method id "bigquery.projects.getServiceAccount":
  5550. type ProjectsGetServiceAccountCall struct {
  5551. s *Service
  5552. projectId string
  5553. urlParams_ gensupport.URLParams
  5554. ifNoneMatch_ string
  5555. ctx_ context.Context
  5556. header_ http.Header
  5557. }
  5558. // GetServiceAccount: Returns the email address of the service account
  5559. // for your project used for interactions with Google Cloud KMS.
  5560. func (r *ProjectsService) GetServiceAccount(projectId string) *ProjectsGetServiceAccountCall {
  5561. c := &ProjectsGetServiceAccountCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5562. c.projectId = projectId
  5563. return c
  5564. }
  5565. // Fields allows partial responses to be retrieved. See
  5566. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5567. // for more information.
  5568. func (c *ProjectsGetServiceAccountCall) Fields(s ...googleapi.Field) *ProjectsGetServiceAccountCall {
  5569. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5570. return c
  5571. }
  5572. // IfNoneMatch sets the optional parameter which makes the operation
  5573. // fail if the object's ETag matches the given value. This is useful for
  5574. // getting updates only after the object has changed since the last
  5575. // request. Use googleapi.IsNotModified to check whether the response
  5576. // error from Do is the result of In-None-Match.
  5577. func (c *ProjectsGetServiceAccountCall) IfNoneMatch(entityTag string) *ProjectsGetServiceAccountCall {
  5578. c.ifNoneMatch_ = entityTag
  5579. return c
  5580. }
  5581. // Context sets the context to be used in this call's Do method. Any
  5582. // pending HTTP request will be aborted if the provided context is
  5583. // canceled.
  5584. func (c *ProjectsGetServiceAccountCall) Context(ctx context.Context) *ProjectsGetServiceAccountCall {
  5585. c.ctx_ = ctx
  5586. return c
  5587. }
  5588. // Header returns an http.Header that can be modified by the caller to
  5589. // add HTTP headers to the request.
  5590. func (c *ProjectsGetServiceAccountCall) Header() http.Header {
  5591. if c.header_ == nil {
  5592. c.header_ = make(http.Header)
  5593. }
  5594. return c.header_
  5595. }
  5596. func (c *ProjectsGetServiceAccountCall) doRequest(alt string) (*http.Response, error) {
  5597. reqHeaders := make(http.Header)
  5598. for k, v := range c.header_ {
  5599. reqHeaders[k] = v
  5600. }
  5601. reqHeaders.Set("User-Agent", c.s.userAgent())
  5602. if c.ifNoneMatch_ != "" {
  5603. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5604. }
  5605. var body io.Reader = nil
  5606. c.urlParams_.Set("alt", alt)
  5607. c.urlParams_.Set("prettyPrint", "false")
  5608. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/serviceAccount")
  5609. urls += "?" + c.urlParams_.Encode()
  5610. req, err := http.NewRequest("GET", urls, body)
  5611. if err != nil {
  5612. return nil, err
  5613. }
  5614. req.Header = reqHeaders
  5615. googleapi.Expand(req.URL, map[string]string{
  5616. "projectId": c.projectId,
  5617. })
  5618. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5619. }
  5620. // Do executes the "bigquery.projects.getServiceAccount" call.
  5621. // Exactly one of *GetServiceAccountResponse or error will be non-nil.
  5622. // Any non-2xx status code is an error. Response headers are in either
  5623. // *GetServiceAccountResponse.ServerResponse.Header or (if a response
  5624. // was returned at all) in error.(*googleapi.Error).Header. Use
  5625. // googleapi.IsNotModified to check whether the returned error was
  5626. // because http.StatusNotModified was returned.
  5627. func (c *ProjectsGetServiceAccountCall) Do(opts ...googleapi.CallOption) (*GetServiceAccountResponse, error) {
  5628. gensupport.SetOptions(c.urlParams_, opts...)
  5629. res, err := c.doRequest("json")
  5630. if res != nil && res.StatusCode == http.StatusNotModified {
  5631. if res.Body != nil {
  5632. res.Body.Close()
  5633. }
  5634. return nil, &googleapi.Error{
  5635. Code: res.StatusCode,
  5636. Header: res.Header,
  5637. }
  5638. }
  5639. if err != nil {
  5640. return nil, err
  5641. }
  5642. defer googleapi.CloseBody(res)
  5643. if err := googleapi.CheckResponse(res); err != nil {
  5644. return nil, err
  5645. }
  5646. ret := &GetServiceAccountResponse{
  5647. ServerResponse: googleapi.ServerResponse{
  5648. Header: res.Header,
  5649. HTTPStatusCode: res.StatusCode,
  5650. },
  5651. }
  5652. target := &ret
  5653. if err := gensupport.DecodeResponse(target, res); err != nil {
  5654. return nil, err
  5655. }
  5656. return ret, nil
  5657. // {
  5658. // "description": "Returns the email address of the service account for your project used for interactions with Google Cloud KMS.",
  5659. // "httpMethod": "GET",
  5660. // "id": "bigquery.projects.getServiceAccount",
  5661. // "parameterOrder": [
  5662. // "projectId"
  5663. // ],
  5664. // "parameters": {
  5665. // "projectId": {
  5666. // "description": "Project ID for which the service account is requested.",
  5667. // "location": "path",
  5668. // "required": true,
  5669. // "type": "string"
  5670. // }
  5671. // },
  5672. // "path": "projects/{projectId}/serviceAccount",
  5673. // "response": {
  5674. // "$ref": "GetServiceAccountResponse"
  5675. // },
  5676. // "scopes": [
  5677. // "https://www.googleapis.com/auth/bigquery",
  5678. // "https://www.googleapis.com/auth/cloud-platform",
  5679. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  5680. // ]
  5681. // }
  5682. }
  5683. // method id "bigquery.projects.list":
  5684. type ProjectsListCall struct {
  5685. s *Service
  5686. urlParams_ gensupport.URLParams
  5687. ifNoneMatch_ string
  5688. ctx_ context.Context
  5689. header_ http.Header
  5690. }
  5691. // List: Lists all projects to which you have been granted any project
  5692. // role.
  5693. func (r *ProjectsService) List() *ProjectsListCall {
  5694. c := &ProjectsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5695. return c
  5696. }
  5697. // MaxResults sets the optional parameter "maxResults": Maximum number
  5698. // of results to return
  5699. func (c *ProjectsListCall) MaxResults(maxResults int64) *ProjectsListCall {
  5700. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  5701. return c
  5702. }
  5703. // PageToken sets the optional parameter "pageToken": Page token,
  5704. // returned by a previous call, to request the next page of results
  5705. func (c *ProjectsListCall) PageToken(pageToken string) *ProjectsListCall {
  5706. c.urlParams_.Set("pageToken", pageToken)
  5707. return c
  5708. }
  5709. // Fields allows partial responses to be retrieved. See
  5710. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5711. // for more information.
  5712. func (c *ProjectsListCall) Fields(s ...googleapi.Field) *ProjectsListCall {
  5713. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5714. return c
  5715. }
  5716. // IfNoneMatch sets the optional parameter which makes the operation
  5717. // fail if the object's ETag matches the given value. This is useful for
  5718. // getting updates only after the object has changed since the last
  5719. // request. Use googleapi.IsNotModified to check whether the response
  5720. // error from Do is the result of In-None-Match.
  5721. func (c *ProjectsListCall) IfNoneMatch(entityTag string) *ProjectsListCall {
  5722. c.ifNoneMatch_ = entityTag
  5723. return c
  5724. }
  5725. // Context sets the context to be used in this call's Do method. Any
  5726. // pending HTTP request will be aborted if the provided context is
  5727. // canceled.
  5728. func (c *ProjectsListCall) Context(ctx context.Context) *ProjectsListCall {
  5729. c.ctx_ = ctx
  5730. return c
  5731. }
  5732. // Header returns an http.Header that can be modified by the caller to
  5733. // add HTTP headers to the request.
  5734. func (c *ProjectsListCall) Header() http.Header {
  5735. if c.header_ == nil {
  5736. c.header_ = make(http.Header)
  5737. }
  5738. return c.header_
  5739. }
  5740. func (c *ProjectsListCall) doRequest(alt string) (*http.Response, error) {
  5741. reqHeaders := make(http.Header)
  5742. for k, v := range c.header_ {
  5743. reqHeaders[k] = v
  5744. }
  5745. reqHeaders.Set("User-Agent", c.s.userAgent())
  5746. if c.ifNoneMatch_ != "" {
  5747. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5748. }
  5749. var body io.Reader = nil
  5750. c.urlParams_.Set("alt", alt)
  5751. c.urlParams_.Set("prettyPrint", "false")
  5752. urls := googleapi.ResolveRelative(c.s.BasePath, "projects")
  5753. urls += "?" + c.urlParams_.Encode()
  5754. req, err := http.NewRequest("GET", urls, body)
  5755. if err != nil {
  5756. return nil, err
  5757. }
  5758. req.Header = reqHeaders
  5759. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5760. }
  5761. // Do executes the "bigquery.projects.list" call.
  5762. // Exactly one of *ProjectList or error will be non-nil. Any non-2xx
  5763. // status code is an error. Response headers are in either
  5764. // *ProjectList.ServerResponse.Header or (if a response was returned at
  5765. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5766. // to check whether the returned error was because
  5767. // http.StatusNotModified was returned.
  5768. func (c *ProjectsListCall) Do(opts ...googleapi.CallOption) (*ProjectList, error) {
  5769. gensupport.SetOptions(c.urlParams_, opts...)
  5770. res, err := c.doRequest("json")
  5771. if res != nil && res.StatusCode == http.StatusNotModified {
  5772. if res.Body != nil {
  5773. res.Body.Close()
  5774. }
  5775. return nil, &googleapi.Error{
  5776. Code: res.StatusCode,
  5777. Header: res.Header,
  5778. }
  5779. }
  5780. if err != nil {
  5781. return nil, err
  5782. }
  5783. defer googleapi.CloseBody(res)
  5784. if err := googleapi.CheckResponse(res); err != nil {
  5785. return nil, err
  5786. }
  5787. ret := &ProjectList{
  5788. ServerResponse: googleapi.ServerResponse{
  5789. Header: res.Header,
  5790. HTTPStatusCode: res.StatusCode,
  5791. },
  5792. }
  5793. target := &ret
  5794. if err := gensupport.DecodeResponse(target, res); err != nil {
  5795. return nil, err
  5796. }
  5797. return ret, nil
  5798. // {
  5799. // "description": "Lists all projects to which you have been granted any project role.",
  5800. // "httpMethod": "GET",
  5801. // "id": "bigquery.projects.list",
  5802. // "parameters": {
  5803. // "maxResults": {
  5804. // "description": "Maximum number of results to return",
  5805. // "format": "uint32",
  5806. // "location": "query",
  5807. // "type": "integer"
  5808. // },
  5809. // "pageToken": {
  5810. // "description": "Page token, returned by a previous call, to request the next page of results",
  5811. // "location": "query",
  5812. // "type": "string"
  5813. // }
  5814. // },
  5815. // "path": "projects",
  5816. // "response": {
  5817. // "$ref": "ProjectList"
  5818. // },
  5819. // "scopes": [
  5820. // "https://www.googleapis.com/auth/bigquery",
  5821. // "https://www.googleapis.com/auth/cloud-platform",
  5822. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  5823. // ]
  5824. // }
  5825. }
  5826. // Pages invokes f for each page of results.
  5827. // A non-nil error returned from f will halt the iteration.
  5828. // The provided context supersedes any context provided to the Context method.
  5829. func (c *ProjectsListCall) Pages(ctx context.Context, f func(*ProjectList) error) error {
  5830. c.ctx_ = ctx
  5831. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5832. for {
  5833. x, err := c.Do()
  5834. if err != nil {
  5835. return err
  5836. }
  5837. if err := f(x); err != nil {
  5838. return err
  5839. }
  5840. if x.NextPageToken == "" {
  5841. return nil
  5842. }
  5843. c.PageToken(x.NextPageToken)
  5844. }
  5845. }
  5846. // method id "bigquery.tabledata.insertAll":
  5847. type TabledataInsertAllCall struct {
  5848. s *Service
  5849. projectId string
  5850. datasetId string
  5851. tableId string
  5852. tabledatainsertallrequest *TableDataInsertAllRequest
  5853. urlParams_ gensupport.URLParams
  5854. ctx_ context.Context
  5855. header_ http.Header
  5856. }
  5857. // InsertAll: Streams data into BigQuery one record at a time without
  5858. // needing to run a load job. Requires the WRITER dataset role.
  5859. func (r *TabledataService) InsertAll(projectId string, datasetId string, tableId string, tabledatainsertallrequest *TableDataInsertAllRequest) *TabledataInsertAllCall {
  5860. c := &TabledataInsertAllCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5861. c.projectId = projectId
  5862. c.datasetId = datasetId
  5863. c.tableId = tableId
  5864. c.tabledatainsertallrequest = tabledatainsertallrequest
  5865. return c
  5866. }
  5867. // Fields allows partial responses to be retrieved. See
  5868. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5869. // for more information.
  5870. func (c *TabledataInsertAllCall) Fields(s ...googleapi.Field) *TabledataInsertAllCall {
  5871. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5872. return c
  5873. }
  5874. // Context sets the context to be used in this call's Do method. Any
  5875. // pending HTTP request will be aborted if the provided context is
  5876. // canceled.
  5877. func (c *TabledataInsertAllCall) Context(ctx context.Context) *TabledataInsertAllCall {
  5878. c.ctx_ = ctx
  5879. return c
  5880. }
  5881. // Header returns an http.Header that can be modified by the caller to
  5882. // add HTTP headers to the request.
  5883. func (c *TabledataInsertAllCall) Header() http.Header {
  5884. if c.header_ == nil {
  5885. c.header_ = make(http.Header)
  5886. }
  5887. return c.header_
  5888. }
  5889. func (c *TabledataInsertAllCall) doRequest(alt string) (*http.Response, error) {
  5890. reqHeaders := make(http.Header)
  5891. for k, v := range c.header_ {
  5892. reqHeaders[k] = v
  5893. }
  5894. reqHeaders.Set("User-Agent", c.s.userAgent())
  5895. var body io.Reader = nil
  5896. body, err := googleapi.WithoutDataWrapper.JSONReader(c.tabledatainsertallrequest)
  5897. if err != nil {
  5898. return nil, err
  5899. }
  5900. reqHeaders.Set("Content-Type", "application/json")
  5901. c.urlParams_.Set("alt", alt)
  5902. c.urlParams_.Set("prettyPrint", "false")
  5903. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}/tables/{tableId}/insertAll")
  5904. urls += "?" + c.urlParams_.Encode()
  5905. req, err := http.NewRequest("POST", urls, body)
  5906. if err != nil {
  5907. return nil, err
  5908. }
  5909. req.Header = reqHeaders
  5910. googleapi.Expand(req.URL, map[string]string{
  5911. "projectId": c.projectId,
  5912. "datasetId": c.datasetId,
  5913. "tableId": c.tableId,
  5914. })
  5915. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5916. }
  5917. // Do executes the "bigquery.tabledata.insertAll" call.
  5918. // Exactly one of *TableDataInsertAllResponse or error will be non-nil.
  5919. // Any non-2xx status code is an error. Response headers are in either
  5920. // *TableDataInsertAllResponse.ServerResponse.Header or (if a response
  5921. // was returned at all) in error.(*googleapi.Error).Header. Use
  5922. // googleapi.IsNotModified to check whether the returned error was
  5923. // because http.StatusNotModified was returned.
  5924. func (c *TabledataInsertAllCall) Do(opts ...googleapi.CallOption) (*TableDataInsertAllResponse, error) {
  5925. gensupport.SetOptions(c.urlParams_, opts...)
  5926. res, err := c.doRequest("json")
  5927. if res != nil && res.StatusCode == http.StatusNotModified {
  5928. if res.Body != nil {
  5929. res.Body.Close()
  5930. }
  5931. return nil, &googleapi.Error{
  5932. Code: res.StatusCode,
  5933. Header: res.Header,
  5934. }
  5935. }
  5936. if err != nil {
  5937. return nil, err
  5938. }
  5939. defer googleapi.CloseBody(res)
  5940. if err := googleapi.CheckResponse(res); err != nil {
  5941. return nil, err
  5942. }
  5943. ret := &TableDataInsertAllResponse{
  5944. ServerResponse: googleapi.ServerResponse{
  5945. Header: res.Header,
  5946. HTTPStatusCode: res.StatusCode,
  5947. },
  5948. }
  5949. target := &ret
  5950. if err := gensupport.DecodeResponse(target, res); err != nil {
  5951. return nil, err
  5952. }
  5953. return ret, nil
  5954. // {
  5955. // "description": "Streams data into BigQuery one record at a time without needing to run a load job. Requires the WRITER dataset role.",
  5956. // "httpMethod": "POST",
  5957. // "id": "bigquery.tabledata.insertAll",
  5958. // "parameterOrder": [
  5959. // "projectId",
  5960. // "datasetId",
  5961. // "tableId"
  5962. // ],
  5963. // "parameters": {
  5964. // "datasetId": {
  5965. // "description": "Dataset ID of the destination table.",
  5966. // "location": "path",
  5967. // "required": true,
  5968. // "type": "string"
  5969. // },
  5970. // "projectId": {
  5971. // "description": "Project ID of the destination table.",
  5972. // "location": "path",
  5973. // "required": true,
  5974. // "type": "string"
  5975. // },
  5976. // "tableId": {
  5977. // "description": "Table ID of the destination table.",
  5978. // "location": "path",
  5979. // "required": true,
  5980. // "type": "string"
  5981. // }
  5982. // },
  5983. // "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}/insertAll",
  5984. // "request": {
  5985. // "$ref": "TableDataInsertAllRequest"
  5986. // },
  5987. // "response": {
  5988. // "$ref": "TableDataInsertAllResponse"
  5989. // },
  5990. // "scopes": [
  5991. // "https://www.googleapis.com/auth/bigquery",
  5992. // "https://www.googleapis.com/auth/bigquery.insertdata",
  5993. // "https://www.googleapis.com/auth/cloud-platform"
  5994. // ]
  5995. // }
  5996. }
  5997. // method id "bigquery.tabledata.list":
  5998. type TabledataListCall struct {
  5999. s *Service
  6000. projectId string
  6001. datasetId string
  6002. tableId string
  6003. urlParams_ gensupport.URLParams
  6004. ifNoneMatch_ string
  6005. ctx_ context.Context
  6006. header_ http.Header
  6007. }
  6008. // List: Retrieves table data from a specified set of rows. Requires the
  6009. // READER dataset role.
  6010. func (r *TabledataService) List(projectId string, datasetId string, tableId string) *TabledataListCall {
  6011. c := &TabledataListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6012. c.projectId = projectId
  6013. c.datasetId = datasetId
  6014. c.tableId = tableId
  6015. return c
  6016. }
  6017. // MaxResults sets the optional parameter "maxResults": Maximum number
  6018. // of results to return
  6019. func (c *TabledataListCall) MaxResults(maxResults int64) *TabledataListCall {
  6020. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  6021. return c
  6022. }
  6023. // PageToken sets the optional parameter "pageToken": Page token,
  6024. // returned by a previous call, identifying the result set
  6025. func (c *TabledataListCall) PageToken(pageToken string) *TabledataListCall {
  6026. c.urlParams_.Set("pageToken", pageToken)
  6027. return c
  6028. }
  6029. // SelectedFields sets the optional parameter "selectedFields": List of
  6030. // fields to return (comma-separated). If unspecified, all fields are
  6031. // returned
  6032. func (c *TabledataListCall) SelectedFields(selectedFields string) *TabledataListCall {
  6033. c.urlParams_.Set("selectedFields", selectedFields)
  6034. return c
  6035. }
  6036. // StartIndex sets the optional parameter "startIndex": Zero-based index
  6037. // of the starting row to read
  6038. func (c *TabledataListCall) StartIndex(startIndex uint64) *TabledataListCall {
  6039. c.urlParams_.Set("startIndex", fmt.Sprint(startIndex))
  6040. return c
  6041. }
  6042. // Fields allows partial responses to be retrieved. See
  6043. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6044. // for more information.
  6045. func (c *TabledataListCall) Fields(s ...googleapi.Field) *TabledataListCall {
  6046. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6047. return c
  6048. }
  6049. // IfNoneMatch sets the optional parameter which makes the operation
  6050. // fail if the object's ETag matches the given value. This is useful for
  6051. // getting updates only after the object has changed since the last
  6052. // request. Use googleapi.IsNotModified to check whether the response
  6053. // error from Do is the result of In-None-Match.
  6054. func (c *TabledataListCall) IfNoneMatch(entityTag string) *TabledataListCall {
  6055. c.ifNoneMatch_ = entityTag
  6056. return c
  6057. }
  6058. // Context sets the context to be used in this call's Do method. Any
  6059. // pending HTTP request will be aborted if the provided context is
  6060. // canceled.
  6061. func (c *TabledataListCall) Context(ctx context.Context) *TabledataListCall {
  6062. c.ctx_ = ctx
  6063. return c
  6064. }
  6065. // Header returns an http.Header that can be modified by the caller to
  6066. // add HTTP headers to the request.
  6067. func (c *TabledataListCall) Header() http.Header {
  6068. if c.header_ == nil {
  6069. c.header_ = make(http.Header)
  6070. }
  6071. return c.header_
  6072. }
  6073. func (c *TabledataListCall) doRequest(alt string) (*http.Response, error) {
  6074. reqHeaders := make(http.Header)
  6075. for k, v := range c.header_ {
  6076. reqHeaders[k] = v
  6077. }
  6078. reqHeaders.Set("User-Agent", c.s.userAgent())
  6079. if c.ifNoneMatch_ != "" {
  6080. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6081. }
  6082. var body io.Reader = nil
  6083. c.urlParams_.Set("alt", alt)
  6084. c.urlParams_.Set("prettyPrint", "false")
  6085. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}/tables/{tableId}/data")
  6086. urls += "?" + c.urlParams_.Encode()
  6087. req, err := http.NewRequest("GET", urls, body)
  6088. if err != nil {
  6089. return nil, err
  6090. }
  6091. req.Header = reqHeaders
  6092. googleapi.Expand(req.URL, map[string]string{
  6093. "projectId": c.projectId,
  6094. "datasetId": c.datasetId,
  6095. "tableId": c.tableId,
  6096. })
  6097. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6098. }
  6099. // Do executes the "bigquery.tabledata.list" call.
  6100. // Exactly one of *TableDataList or error will be non-nil. Any non-2xx
  6101. // status code is an error. Response headers are in either
  6102. // *TableDataList.ServerResponse.Header or (if a response was returned
  6103. // at all) in error.(*googleapi.Error).Header. Use
  6104. // googleapi.IsNotModified to check whether the returned error was
  6105. // because http.StatusNotModified was returned.
  6106. func (c *TabledataListCall) Do(opts ...googleapi.CallOption) (*TableDataList, error) {
  6107. gensupport.SetOptions(c.urlParams_, opts...)
  6108. res, err := c.doRequest("json")
  6109. if res != nil && res.StatusCode == http.StatusNotModified {
  6110. if res.Body != nil {
  6111. res.Body.Close()
  6112. }
  6113. return nil, &googleapi.Error{
  6114. Code: res.StatusCode,
  6115. Header: res.Header,
  6116. }
  6117. }
  6118. if err != nil {
  6119. return nil, err
  6120. }
  6121. defer googleapi.CloseBody(res)
  6122. if err := googleapi.CheckResponse(res); err != nil {
  6123. return nil, err
  6124. }
  6125. ret := &TableDataList{
  6126. ServerResponse: googleapi.ServerResponse{
  6127. Header: res.Header,
  6128. HTTPStatusCode: res.StatusCode,
  6129. },
  6130. }
  6131. target := &ret
  6132. if err := gensupport.DecodeResponse(target, res); err != nil {
  6133. return nil, err
  6134. }
  6135. return ret, nil
  6136. // {
  6137. // "description": "Retrieves table data from a specified set of rows. Requires the READER dataset role.",
  6138. // "httpMethod": "GET",
  6139. // "id": "bigquery.tabledata.list",
  6140. // "parameterOrder": [
  6141. // "projectId",
  6142. // "datasetId",
  6143. // "tableId"
  6144. // ],
  6145. // "parameters": {
  6146. // "datasetId": {
  6147. // "description": "Dataset ID of the table to read",
  6148. // "location": "path",
  6149. // "required": true,
  6150. // "type": "string"
  6151. // },
  6152. // "maxResults": {
  6153. // "description": "Maximum number of results to return",
  6154. // "format": "uint32",
  6155. // "location": "query",
  6156. // "type": "integer"
  6157. // },
  6158. // "pageToken": {
  6159. // "description": "Page token, returned by a previous call, identifying the result set",
  6160. // "location": "query",
  6161. // "type": "string"
  6162. // },
  6163. // "projectId": {
  6164. // "description": "Project ID of the table to read",
  6165. // "location": "path",
  6166. // "required": true,
  6167. // "type": "string"
  6168. // },
  6169. // "selectedFields": {
  6170. // "description": "List of fields to return (comma-separated). If unspecified, all fields are returned",
  6171. // "location": "query",
  6172. // "type": "string"
  6173. // },
  6174. // "startIndex": {
  6175. // "description": "Zero-based index of the starting row to read",
  6176. // "format": "uint64",
  6177. // "location": "query",
  6178. // "type": "string"
  6179. // },
  6180. // "tableId": {
  6181. // "description": "Table ID of the table to read",
  6182. // "location": "path",
  6183. // "required": true,
  6184. // "type": "string"
  6185. // }
  6186. // },
  6187. // "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}/data",
  6188. // "response": {
  6189. // "$ref": "TableDataList"
  6190. // },
  6191. // "scopes": [
  6192. // "https://www.googleapis.com/auth/bigquery",
  6193. // "https://www.googleapis.com/auth/cloud-platform",
  6194. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  6195. // ]
  6196. // }
  6197. }
  6198. // Pages invokes f for each page of results.
  6199. // A non-nil error returned from f will halt the iteration.
  6200. // The provided context supersedes any context provided to the Context method.
  6201. func (c *TabledataListCall) Pages(ctx context.Context, f func(*TableDataList) error) error {
  6202. c.ctx_ = ctx
  6203. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  6204. for {
  6205. x, err := c.Do()
  6206. if err != nil {
  6207. return err
  6208. }
  6209. if err := f(x); err != nil {
  6210. return err
  6211. }
  6212. if x.PageToken == "" {
  6213. return nil
  6214. }
  6215. c.PageToken(x.PageToken)
  6216. }
  6217. }
  6218. // method id "bigquery.tables.delete":
  6219. type TablesDeleteCall struct {
  6220. s *Service
  6221. projectId string
  6222. datasetId string
  6223. tableId string
  6224. urlParams_ gensupport.URLParams
  6225. ctx_ context.Context
  6226. header_ http.Header
  6227. }
  6228. // Delete: Deletes the table specified by tableId from the dataset. If
  6229. // the table contains data, all the data will be deleted.
  6230. func (r *TablesService) Delete(projectId string, datasetId string, tableId string) *TablesDeleteCall {
  6231. c := &TablesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6232. c.projectId = projectId
  6233. c.datasetId = datasetId
  6234. c.tableId = tableId
  6235. return c
  6236. }
  6237. // Fields allows partial responses to be retrieved. See
  6238. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6239. // for more information.
  6240. func (c *TablesDeleteCall) Fields(s ...googleapi.Field) *TablesDeleteCall {
  6241. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6242. return c
  6243. }
  6244. // Context sets the context to be used in this call's Do method. Any
  6245. // pending HTTP request will be aborted if the provided context is
  6246. // canceled.
  6247. func (c *TablesDeleteCall) Context(ctx context.Context) *TablesDeleteCall {
  6248. c.ctx_ = ctx
  6249. return c
  6250. }
  6251. // Header returns an http.Header that can be modified by the caller to
  6252. // add HTTP headers to the request.
  6253. func (c *TablesDeleteCall) Header() http.Header {
  6254. if c.header_ == nil {
  6255. c.header_ = make(http.Header)
  6256. }
  6257. return c.header_
  6258. }
  6259. func (c *TablesDeleteCall) doRequest(alt string) (*http.Response, error) {
  6260. reqHeaders := make(http.Header)
  6261. for k, v := range c.header_ {
  6262. reqHeaders[k] = v
  6263. }
  6264. reqHeaders.Set("User-Agent", c.s.userAgent())
  6265. var body io.Reader = nil
  6266. c.urlParams_.Set("alt", alt)
  6267. c.urlParams_.Set("prettyPrint", "false")
  6268. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}/tables/{tableId}")
  6269. urls += "?" + c.urlParams_.Encode()
  6270. req, err := http.NewRequest("DELETE", urls, body)
  6271. if err != nil {
  6272. return nil, err
  6273. }
  6274. req.Header = reqHeaders
  6275. googleapi.Expand(req.URL, map[string]string{
  6276. "projectId": c.projectId,
  6277. "datasetId": c.datasetId,
  6278. "tableId": c.tableId,
  6279. })
  6280. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6281. }
  6282. // Do executes the "bigquery.tables.delete" call.
  6283. func (c *TablesDeleteCall) Do(opts ...googleapi.CallOption) error {
  6284. gensupport.SetOptions(c.urlParams_, opts...)
  6285. res, err := c.doRequest("json")
  6286. if err != nil {
  6287. return err
  6288. }
  6289. defer googleapi.CloseBody(res)
  6290. if err := googleapi.CheckResponse(res); err != nil {
  6291. return err
  6292. }
  6293. return nil
  6294. // {
  6295. // "description": "Deletes the table specified by tableId from the dataset. If the table contains data, all the data will be deleted.",
  6296. // "httpMethod": "DELETE",
  6297. // "id": "bigquery.tables.delete",
  6298. // "parameterOrder": [
  6299. // "projectId",
  6300. // "datasetId",
  6301. // "tableId"
  6302. // ],
  6303. // "parameters": {
  6304. // "datasetId": {
  6305. // "description": "Dataset ID of the table to delete",
  6306. // "location": "path",
  6307. // "required": true,
  6308. // "type": "string"
  6309. // },
  6310. // "projectId": {
  6311. // "description": "Project ID of the table to delete",
  6312. // "location": "path",
  6313. // "required": true,
  6314. // "type": "string"
  6315. // },
  6316. // "tableId": {
  6317. // "description": "Table ID of the table to delete",
  6318. // "location": "path",
  6319. // "required": true,
  6320. // "type": "string"
  6321. // }
  6322. // },
  6323. // "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}",
  6324. // "scopes": [
  6325. // "https://www.googleapis.com/auth/bigquery",
  6326. // "https://www.googleapis.com/auth/cloud-platform"
  6327. // ]
  6328. // }
  6329. }
  6330. // method id "bigquery.tables.get":
  6331. type TablesGetCall struct {
  6332. s *Service
  6333. projectId string
  6334. datasetId string
  6335. tableId string
  6336. urlParams_ gensupport.URLParams
  6337. ifNoneMatch_ string
  6338. ctx_ context.Context
  6339. header_ http.Header
  6340. }
  6341. // Get: Gets the specified table resource by table ID. This method does
  6342. // not return the data in the table, it only returns the table resource,
  6343. // which describes the structure of this table.
  6344. func (r *TablesService) Get(projectId string, datasetId string, tableId string) *TablesGetCall {
  6345. c := &TablesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6346. c.projectId = projectId
  6347. c.datasetId = datasetId
  6348. c.tableId = tableId
  6349. return c
  6350. }
  6351. // SelectedFields sets the optional parameter "selectedFields": List of
  6352. // fields to return (comma-separated). If unspecified, all fields are
  6353. // returned
  6354. func (c *TablesGetCall) SelectedFields(selectedFields string) *TablesGetCall {
  6355. c.urlParams_.Set("selectedFields", selectedFields)
  6356. return c
  6357. }
  6358. // Fields allows partial responses to be retrieved. See
  6359. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6360. // for more information.
  6361. func (c *TablesGetCall) Fields(s ...googleapi.Field) *TablesGetCall {
  6362. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6363. return c
  6364. }
  6365. // IfNoneMatch sets the optional parameter which makes the operation
  6366. // fail if the object's ETag matches the given value. This is useful for
  6367. // getting updates only after the object has changed since the last
  6368. // request. Use googleapi.IsNotModified to check whether the response
  6369. // error from Do is the result of In-None-Match.
  6370. func (c *TablesGetCall) IfNoneMatch(entityTag string) *TablesGetCall {
  6371. c.ifNoneMatch_ = entityTag
  6372. return c
  6373. }
  6374. // Context sets the context to be used in this call's Do method. Any
  6375. // pending HTTP request will be aborted if the provided context is
  6376. // canceled.
  6377. func (c *TablesGetCall) Context(ctx context.Context) *TablesGetCall {
  6378. c.ctx_ = ctx
  6379. return c
  6380. }
  6381. // Header returns an http.Header that can be modified by the caller to
  6382. // add HTTP headers to the request.
  6383. func (c *TablesGetCall) Header() http.Header {
  6384. if c.header_ == nil {
  6385. c.header_ = make(http.Header)
  6386. }
  6387. return c.header_
  6388. }
  6389. func (c *TablesGetCall) doRequest(alt string) (*http.Response, error) {
  6390. reqHeaders := make(http.Header)
  6391. for k, v := range c.header_ {
  6392. reqHeaders[k] = v
  6393. }
  6394. reqHeaders.Set("User-Agent", c.s.userAgent())
  6395. if c.ifNoneMatch_ != "" {
  6396. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6397. }
  6398. var body io.Reader = nil
  6399. c.urlParams_.Set("alt", alt)
  6400. c.urlParams_.Set("prettyPrint", "false")
  6401. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}/tables/{tableId}")
  6402. urls += "?" + c.urlParams_.Encode()
  6403. req, err := http.NewRequest("GET", urls, body)
  6404. if err != nil {
  6405. return nil, err
  6406. }
  6407. req.Header = reqHeaders
  6408. googleapi.Expand(req.URL, map[string]string{
  6409. "projectId": c.projectId,
  6410. "datasetId": c.datasetId,
  6411. "tableId": c.tableId,
  6412. })
  6413. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6414. }
  6415. // Do executes the "bigquery.tables.get" call.
  6416. // Exactly one of *Table or error will be non-nil. Any non-2xx status
  6417. // code is an error. Response headers are in either
  6418. // *Table.ServerResponse.Header or (if a response was returned at all)
  6419. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6420. // check whether the returned error was because http.StatusNotModified
  6421. // was returned.
  6422. func (c *TablesGetCall) Do(opts ...googleapi.CallOption) (*Table, error) {
  6423. gensupport.SetOptions(c.urlParams_, opts...)
  6424. res, err := c.doRequest("json")
  6425. if res != nil && res.StatusCode == http.StatusNotModified {
  6426. if res.Body != nil {
  6427. res.Body.Close()
  6428. }
  6429. return nil, &googleapi.Error{
  6430. Code: res.StatusCode,
  6431. Header: res.Header,
  6432. }
  6433. }
  6434. if err != nil {
  6435. return nil, err
  6436. }
  6437. defer googleapi.CloseBody(res)
  6438. if err := googleapi.CheckResponse(res); err != nil {
  6439. return nil, err
  6440. }
  6441. ret := &Table{
  6442. ServerResponse: googleapi.ServerResponse{
  6443. Header: res.Header,
  6444. HTTPStatusCode: res.StatusCode,
  6445. },
  6446. }
  6447. target := &ret
  6448. if err := gensupport.DecodeResponse(target, res); err != nil {
  6449. return nil, err
  6450. }
  6451. return ret, nil
  6452. // {
  6453. // "description": "Gets the specified table resource by table ID. This method does not return the data in the table, it only returns the table resource, which describes the structure of this table.",
  6454. // "httpMethod": "GET",
  6455. // "id": "bigquery.tables.get",
  6456. // "parameterOrder": [
  6457. // "projectId",
  6458. // "datasetId",
  6459. // "tableId"
  6460. // ],
  6461. // "parameters": {
  6462. // "datasetId": {
  6463. // "description": "Dataset ID of the requested table",
  6464. // "location": "path",
  6465. // "required": true,
  6466. // "type": "string"
  6467. // },
  6468. // "projectId": {
  6469. // "description": "Project ID of the requested table",
  6470. // "location": "path",
  6471. // "required": true,
  6472. // "type": "string"
  6473. // },
  6474. // "selectedFields": {
  6475. // "description": "List of fields to return (comma-separated). If unspecified, all fields are returned",
  6476. // "location": "query",
  6477. // "type": "string"
  6478. // },
  6479. // "tableId": {
  6480. // "description": "Table ID of the requested table",
  6481. // "location": "path",
  6482. // "required": true,
  6483. // "type": "string"
  6484. // }
  6485. // },
  6486. // "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}",
  6487. // "response": {
  6488. // "$ref": "Table"
  6489. // },
  6490. // "scopes": [
  6491. // "https://www.googleapis.com/auth/bigquery",
  6492. // "https://www.googleapis.com/auth/cloud-platform",
  6493. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  6494. // ]
  6495. // }
  6496. }
  6497. // method id "bigquery.tables.insert":
  6498. type TablesInsertCall struct {
  6499. s *Service
  6500. projectId string
  6501. datasetId string
  6502. table *Table
  6503. urlParams_ gensupport.URLParams
  6504. ctx_ context.Context
  6505. header_ http.Header
  6506. }
  6507. // Insert: Creates a new, empty table in the dataset.
  6508. func (r *TablesService) Insert(projectId string, datasetId string, table *Table) *TablesInsertCall {
  6509. c := &TablesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6510. c.projectId = projectId
  6511. c.datasetId = datasetId
  6512. c.table = table
  6513. return c
  6514. }
  6515. // Fields allows partial responses to be retrieved. See
  6516. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6517. // for more information.
  6518. func (c *TablesInsertCall) Fields(s ...googleapi.Field) *TablesInsertCall {
  6519. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6520. return c
  6521. }
  6522. // Context sets the context to be used in this call's Do method. Any
  6523. // pending HTTP request will be aborted if the provided context is
  6524. // canceled.
  6525. func (c *TablesInsertCall) Context(ctx context.Context) *TablesInsertCall {
  6526. c.ctx_ = ctx
  6527. return c
  6528. }
  6529. // Header returns an http.Header that can be modified by the caller to
  6530. // add HTTP headers to the request.
  6531. func (c *TablesInsertCall) Header() http.Header {
  6532. if c.header_ == nil {
  6533. c.header_ = make(http.Header)
  6534. }
  6535. return c.header_
  6536. }
  6537. func (c *TablesInsertCall) doRequest(alt string) (*http.Response, error) {
  6538. reqHeaders := make(http.Header)
  6539. for k, v := range c.header_ {
  6540. reqHeaders[k] = v
  6541. }
  6542. reqHeaders.Set("User-Agent", c.s.userAgent())
  6543. var body io.Reader = nil
  6544. body, err := googleapi.WithoutDataWrapper.JSONReader(c.table)
  6545. if err != nil {
  6546. return nil, err
  6547. }
  6548. reqHeaders.Set("Content-Type", "application/json")
  6549. c.urlParams_.Set("alt", alt)
  6550. c.urlParams_.Set("prettyPrint", "false")
  6551. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}/tables")
  6552. urls += "?" + c.urlParams_.Encode()
  6553. req, err := http.NewRequest("POST", urls, body)
  6554. if err != nil {
  6555. return nil, err
  6556. }
  6557. req.Header = reqHeaders
  6558. googleapi.Expand(req.URL, map[string]string{
  6559. "projectId": c.projectId,
  6560. "datasetId": c.datasetId,
  6561. })
  6562. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6563. }
  6564. // Do executes the "bigquery.tables.insert" call.
  6565. // Exactly one of *Table or error will be non-nil. Any non-2xx status
  6566. // code is an error. Response headers are in either
  6567. // *Table.ServerResponse.Header or (if a response was returned at all)
  6568. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6569. // check whether the returned error was because http.StatusNotModified
  6570. // was returned.
  6571. func (c *TablesInsertCall) Do(opts ...googleapi.CallOption) (*Table, error) {
  6572. gensupport.SetOptions(c.urlParams_, opts...)
  6573. res, err := c.doRequest("json")
  6574. if res != nil && res.StatusCode == http.StatusNotModified {
  6575. if res.Body != nil {
  6576. res.Body.Close()
  6577. }
  6578. return nil, &googleapi.Error{
  6579. Code: res.StatusCode,
  6580. Header: res.Header,
  6581. }
  6582. }
  6583. if err != nil {
  6584. return nil, err
  6585. }
  6586. defer googleapi.CloseBody(res)
  6587. if err := googleapi.CheckResponse(res); err != nil {
  6588. return nil, err
  6589. }
  6590. ret := &Table{
  6591. ServerResponse: googleapi.ServerResponse{
  6592. Header: res.Header,
  6593. HTTPStatusCode: res.StatusCode,
  6594. },
  6595. }
  6596. target := &ret
  6597. if err := gensupport.DecodeResponse(target, res); err != nil {
  6598. return nil, err
  6599. }
  6600. return ret, nil
  6601. // {
  6602. // "description": "Creates a new, empty table in the dataset.",
  6603. // "httpMethod": "POST",
  6604. // "id": "bigquery.tables.insert",
  6605. // "parameterOrder": [
  6606. // "projectId",
  6607. // "datasetId"
  6608. // ],
  6609. // "parameters": {
  6610. // "datasetId": {
  6611. // "description": "Dataset ID of the new table",
  6612. // "location": "path",
  6613. // "required": true,
  6614. // "type": "string"
  6615. // },
  6616. // "projectId": {
  6617. // "description": "Project ID of the new table",
  6618. // "location": "path",
  6619. // "required": true,
  6620. // "type": "string"
  6621. // }
  6622. // },
  6623. // "path": "projects/{projectId}/datasets/{datasetId}/tables",
  6624. // "request": {
  6625. // "$ref": "Table"
  6626. // },
  6627. // "response": {
  6628. // "$ref": "Table"
  6629. // },
  6630. // "scopes": [
  6631. // "https://www.googleapis.com/auth/bigquery",
  6632. // "https://www.googleapis.com/auth/cloud-platform"
  6633. // ]
  6634. // }
  6635. }
  6636. // method id "bigquery.tables.list":
  6637. type TablesListCall struct {
  6638. s *Service
  6639. projectId string
  6640. datasetId string
  6641. urlParams_ gensupport.URLParams
  6642. ifNoneMatch_ string
  6643. ctx_ context.Context
  6644. header_ http.Header
  6645. }
  6646. // List: Lists all tables in the specified dataset. Requires the READER
  6647. // dataset role.
  6648. func (r *TablesService) List(projectId string, datasetId string) *TablesListCall {
  6649. c := &TablesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6650. c.projectId = projectId
  6651. c.datasetId = datasetId
  6652. return c
  6653. }
  6654. // MaxResults sets the optional parameter "maxResults": Maximum number
  6655. // of results to return
  6656. func (c *TablesListCall) MaxResults(maxResults int64) *TablesListCall {
  6657. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  6658. return c
  6659. }
  6660. // PageToken sets the optional parameter "pageToken": Page token,
  6661. // returned by a previous call, to request the next page of results
  6662. func (c *TablesListCall) PageToken(pageToken string) *TablesListCall {
  6663. c.urlParams_.Set("pageToken", pageToken)
  6664. return c
  6665. }
  6666. // Fields allows partial responses to be retrieved. See
  6667. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6668. // for more information.
  6669. func (c *TablesListCall) Fields(s ...googleapi.Field) *TablesListCall {
  6670. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6671. return c
  6672. }
  6673. // IfNoneMatch sets the optional parameter which makes the operation
  6674. // fail if the object's ETag matches the given value. This is useful for
  6675. // getting updates only after the object has changed since the last
  6676. // request. Use googleapi.IsNotModified to check whether the response
  6677. // error from Do is the result of In-None-Match.
  6678. func (c *TablesListCall) IfNoneMatch(entityTag string) *TablesListCall {
  6679. c.ifNoneMatch_ = entityTag
  6680. return c
  6681. }
  6682. // Context sets the context to be used in this call's Do method. Any
  6683. // pending HTTP request will be aborted if the provided context is
  6684. // canceled.
  6685. func (c *TablesListCall) Context(ctx context.Context) *TablesListCall {
  6686. c.ctx_ = ctx
  6687. return c
  6688. }
  6689. // Header returns an http.Header that can be modified by the caller to
  6690. // add HTTP headers to the request.
  6691. func (c *TablesListCall) Header() http.Header {
  6692. if c.header_ == nil {
  6693. c.header_ = make(http.Header)
  6694. }
  6695. return c.header_
  6696. }
  6697. func (c *TablesListCall) doRequest(alt string) (*http.Response, error) {
  6698. reqHeaders := make(http.Header)
  6699. for k, v := range c.header_ {
  6700. reqHeaders[k] = v
  6701. }
  6702. reqHeaders.Set("User-Agent", c.s.userAgent())
  6703. if c.ifNoneMatch_ != "" {
  6704. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6705. }
  6706. var body io.Reader = nil
  6707. c.urlParams_.Set("alt", alt)
  6708. c.urlParams_.Set("prettyPrint", "false")
  6709. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}/tables")
  6710. urls += "?" + c.urlParams_.Encode()
  6711. req, err := http.NewRequest("GET", urls, body)
  6712. if err != nil {
  6713. return nil, err
  6714. }
  6715. req.Header = reqHeaders
  6716. googleapi.Expand(req.URL, map[string]string{
  6717. "projectId": c.projectId,
  6718. "datasetId": c.datasetId,
  6719. })
  6720. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6721. }
  6722. // Do executes the "bigquery.tables.list" call.
  6723. // Exactly one of *TableList or error will be non-nil. Any non-2xx
  6724. // status code is an error. Response headers are in either
  6725. // *TableList.ServerResponse.Header or (if a response was returned at
  6726. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  6727. // to check whether the returned error was because
  6728. // http.StatusNotModified was returned.
  6729. func (c *TablesListCall) Do(opts ...googleapi.CallOption) (*TableList, error) {
  6730. gensupport.SetOptions(c.urlParams_, opts...)
  6731. res, err := c.doRequest("json")
  6732. if res != nil && res.StatusCode == http.StatusNotModified {
  6733. if res.Body != nil {
  6734. res.Body.Close()
  6735. }
  6736. return nil, &googleapi.Error{
  6737. Code: res.StatusCode,
  6738. Header: res.Header,
  6739. }
  6740. }
  6741. if err != nil {
  6742. return nil, err
  6743. }
  6744. defer googleapi.CloseBody(res)
  6745. if err := googleapi.CheckResponse(res); err != nil {
  6746. return nil, err
  6747. }
  6748. ret := &TableList{
  6749. ServerResponse: googleapi.ServerResponse{
  6750. Header: res.Header,
  6751. HTTPStatusCode: res.StatusCode,
  6752. },
  6753. }
  6754. target := &ret
  6755. if err := gensupport.DecodeResponse(target, res); err != nil {
  6756. return nil, err
  6757. }
  6758. return ret, nil
  6759. // {
  6760. // "description": "Lists all tables in the specified dataset. Requires the READER dataset role.",
  6761. // "httpMethod": "GET",
  6762. // "id": "bigquery.tables.list",
  6763. // "parameterOrder": [
  6764. // "projectId",
  6765. // "datasetId"
  6766. // ],
  6767. // "parameters": {
  6768. // "datasetId": {
  6769. // "description": "Dataset ID of the tables to list",
  6770. // "location": "path",
  6771. // "required": true,
  6772. // "type": "string"
  6773. // },
  6774. // "maxResults": {
  6775. // "description": "Maximum number of results to return",
  6776. // "format": "uint32",
  6777. // "location": "query",
  6778. // "type": "integer"
  6779. // },
  6780. // "pageToken": {
  6781. // "description": "Page token, returned by a previous call, to request the next page of results",
  6782. // "location": "query",
  6783. // "type": "string"
  6784. // },
  6785. // "projectId": {
  6786. // "description": "Project ID of the tables to list",
  6787. // "location": "path",
  6788. // "required": true,
  6789. // "type": "string"
  6790. // }
  6791. // },
  6792. // "path": "projects/{projectId}/datasets/{datasetId}/tables",
  6793. // "response": {
  6794. // "$ref": "TableList"
  6795. // },
  6796. // "scopes": [
  6797. // "https://www.googleapis.com/auth/bigquery",
  6798. // "https://www.googleapis.com/auth/cloud-platform",
  6799. // "https://www.googleapis.com/auth/cloud-platform.read-only"
  6800. // ]
  6801. // }
  6802. }
  6803. // Pages invokes f for each page of results.
  6804. // A non-nil error returned from f will halt the iteration.
  6805. // The provided context supersedes any context provided to the Context method.
  6806. func (c *TablesListCall) Pages(ctx context.Context, f func(*TableList) error) error {
  6807. c.ctx_ = ctx
  6808. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  6809. for {
  6810. x, err := c.Do()
  6811. if err != nil {
  6812. return err
  6813. }
  6814. if err := f(x); err != nil {
  6815. return err
  6816. }
  6817. if x.NextPageToken == "" {
  6818. return nil
  6819. }
  6820. c.PageToken(x.NextPageToken)
  6821. }
  6822. }
  6823. // method id "bigquery.tables.patch":
  6824. type TablesPatchCall struct {
  6825. s *Service
  6826. projectId string
  6827. datasetId string
  6828. tableId string
  6829. table *Table
  6830. urlParams_ gensupport.URLParams
  6831. ctx_ context.Context
  6832. header_ http.Header
  6833. }
  6834. // Patch: Updates information in an existing table. The update method
  6835. // replaces the entire table resource, whereas the patch method only
  6836. // replaces fields that are provided in the submitted table resource.
  6837. // This method supports patch semantics.
  6838. func (r *TablesService) Patch(projectId string, datasetId string, tableId string, table *Table) *TablesPatchCall {
  6839. c := &TablesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6840. c.projectId = projectId
  6841. c.datasetId = datasetId
  6842. c.tableId = tableId
  6843. c.table = table
  6844. return c
  6845. }
  6846. // Fields allows partial responses to be retrieved. See
  6847. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6848. // for more information.
  6849. func (c *TablesPatchCall) Fields(s ...googleapi.Field) *TablesPatchCall {
  6850. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6851. return c
  6852. }
  6853. // Context sets the context to be used in this call's Do method. Any
  6854. // pending HTTP request will be aborted if the provided context is
  6855. // canceled.
  6856. func (c *TablesPatchCall) Context(ctx context.Context) *TablesPatchCall {
  6857. c.ctx_ = ctx
  6858. return c
  6859. }
  6860. // Header returns an http.Header that can be modified by the caller to
  6861. // add HTTP headers to the request.
  6862. func (c *TablesPatchCall) Header() http.Header {
  6863. if c.header_ == nil {
  6864. c.header_ = make(http.Header)
  6865. }
  6866. return c.header_
  6867. }
  6868. func (c *TablesPatchCall) doRequest(alt string) (*http.Response, error) {
  6869. reqHeaders := make(http.Header)
  6870. for k, v := range c.header_ {
  6871. reqHeaders[k] = v
  6872. }
  6873. reqHeaders.Set("User-Agent", c.s.userAgent())
  6874. var body io.Reader = nil
  6875. body, err := googleapi.WithoutDataWrapper.JSONReader(c.table)
  6876. if err != nil {
  6877. return nil, err
  6878. }
  6879. reqHeaders.Set("Content-Type", "application/json")
  6880. c.urlParams_.Set("alt", alt)
  6881. c.urlParams_.Set("prettyPrint", "false")
  6882. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}/tables/{tableId}")
  6883. urls += "?" + c.urlParams_.Encode()
  6884. req, err := http.NewRequest("PATCH", urls, body)
  6885. if err != nil {
  6886. return nil, err
  6887. }
  6888. req.Header = reqHeaders
  6889. googleapi.Expand(req.URL, map[string]string{
  6890. "projectId": c.projectId,
  6891. "datasetId": c.datasetId,
  6892. "tableId": c.tableId,
  6893. })
  6894. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6895. }
  6896. // Do executes the "bigquery.tables.patch" call.
  6897. // Exactly one of *Table or error will be non-nil. Any non-2xx status
  6898. // code is an error. Response headers are in either
  6899. // *Table.ServerResponse.Header or (if a response was returned at all)
  6900. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6901. // check whether the returned error was because http.StatusNotModified
  6902. // was returned.
  6903. func (c *TablesPatchCall) Do(opts ...googleapi.CallOption) (*Table, error) {
  6904. gensupport.SetOptions(c.urlParams_, opts...)
  6905. res, err := c.doRequest("json")
  6906. if res != nil && res.StatusCode == http.StatusNotModified {
  6907. if res.Body != nil {
  6908. res.Body.Close()
  6909. }
  6910. return nil, &googleapi.Error{
  6911. Code: res.StatusCode,
  6912. Header: res.Header,
  6913. }
  6914. }
  6915. if err != nil {
  6916. return nil, err
  6917. }
  6918. defer googleapi.CloseBody(res)
  6919. if err := googleapi.CheckResponse(res); err != nil {
  6920. return nil, err
  6921. }
  6922. ret := &Table{
  6923. ServerResponse: googleapi.ServerResponse{
  6924. Header: res.Header,
  6925. HTTPStatusCode: res.StatusCode,
  6926. },
  6927. }
  6928. target := &ret
  6929. if err := gensupport.DecodeResponse(target, res); err != nil {
  6930. return nil, err
  6931. }
  6932. return ret, nil
  6933. // {
  6934. // "description": "Updates information in an existing table. The update method replaces the entire table resource, whereas the patch method only replaces fields that are provided in the submitted table resource. This method supports patch semantics.",
  6935. // "httpMethod": "PATCH",
  6936. // "id": "bigquery.tables.patch",
  6937. // "parameterOrder": [
  6938. // "projectId",
  6939. // "datasetId",
  6940. // "tableId"
  6941. // ],
  6942. // "parameters": {
  6943. // "datasetId": {
  6944. // "description": "Dataset ID of the table to update",
  6945. // "location": "path",
  6946. // "required": true,
  6947. // "type": "string"
  6948. // },
  6949. // "projectId": {
  6950. // "description": "Project ID of the table to update",
  6951. // "location": "path",
  6952. // "required": true,
  6953. // "type": "string"
  6954. // },
  6955. // "tableId": {
  6956. // "description": "Table ID of the table to update",
  6957. // "location": "path",
  6958. // "required": true,
  6959. // "type": "string"
  6960. // }
  6961. // },
  6962. // "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}",
  6963. // "request": {
  6964. // "$ref": "Table"
  6965. // },
  6966. // "response": {
  6967. // "$ref": "Table"
  6968. // },
  6969. // "scopes": [
  6970. // "https://www.googleapis.com/auth/bigquery",
  6971. // "https://www.googleapis.com/auth/cloud-platform"
  6972. // ]
  6973. // }
  6974. }
  6975. // method id "bigquery.tables.update":
  6976. type TablesUpdateCall struct {
  6977. s *Service
  6978. projectId string
  6979. datasetId string
  6980. tableId string
  6981. table *Table
  6982. urlParams_ gensupport.URLParams
  6983. ctx_ context.Context
  6984. header_ http.Header
  6985. }
  6986. // Update: Updates information in an existing table. The update method
  6987. // replaces the entire table resource, whereas the patch method only
  6988. // replaces fields that are provided in the submitted table resource.
  6989. func (r *TablesService) Update(projectId string, datasetId string, tableId string, table *Table) *TablesUpdateCall {
  6990. c := &TablesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6991. c.projectId = projectId
  6992. c.datasetId = datasetId
  6993. c.tableId = tableId
  6994. c.table = table
  6995. return c
  6996. }
  6997. // Fields allows partial responses to be retrieved. See
  6998. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6999. // for more information.
  7000. func (c *TablesUpdateCall) Fields(s ...googleapi.Field) *TablesUpdateCall {
  7001. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7002. return c
  7003. }
  7004. // Context sets the context to be used in this call's Do method. Any
  7005. // pending HTTP request will be aborted if the provided context is
  7006. // canceled.
  7007. func (c *TablesUpdateCall) Context(ctx context.Context) *TablesUpdateCall {
  7008. c.ctx_ = ctx
  7009. return c
  7010. }
  7011. // Header returns an http.Header that can be modified by the caller to
  7012. // add HTTP headers to the request.
  7013. func (c *TablesUpdateCall) Header() http.Header {
  7014. if c.header_ == nil {
  7015. c.header_ = make(http.Header)
  7016. }
  7017. return c.header_
  7018. }
  7019. func (c *TablesUpdateCall) doRequest(alt string) (*http.Response, error) {
  7020. reqHeaders := make(http.Header)
  7021. for k, v := range c.header_ {
  7022. reqHeaders[k] = v
  7023. }
  7024. reqHeaders.Set("User-Agent", c.s.userAgent())
  7025. var body io.Reader = nil
  7026. body, err := googleapi.WithoutDataWrapper.JSONReader(c.table)
  7027. if err != nil {
  7028. return nil, err
  7029. }
  7030. reqHeaders.Set("Content-Type", "application/json")
  7031. c.urlParams_.Set("alt", alt)
  7032. c.urlParams_.Set("prettyPrint", "false")
  7033. urls := googleapi.ResolveRelative(c.s.BasePath, "projects/{projectId}/datasets/{datasetId}/tables/{tableId}")
  7034. urls += "?" + c.urlParams_.Encode()
  7035. req, err := http.NewRequest("PUT", urls, body)
  7036. if err != nil {
  7037. return nil, err
  7038. }
  7039. req.Header = reqHeaders
  7040. googleapi.Expand(req.URL, map[string]string{
  7041. "projectId": c.projectId,
  7042. "datasetId": c.datasetId,
  7043. "tableId": c.tableId,
  7044. })
  7045. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7046. }
  7047. // Do executes the "bigquery.tables.update" call.
  7048. // Exactly one of *Table or error will be non-nil. Any non-2xx status
  7049. // code is an error. Response headers are in either
  7050. // *Table.ServerResponse.Header or (if a response was returned at all)
  7051. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  7052. // check whether the returned error was because http.StatusNotModified
  7053. // was returned.
  7054. func (c *TablesUpdateCall) Do(opts ...googleapi.CallOption) (*Table, error) {
  7055. gensupport.SetOptions(c.urlParams_, opts...)
  7056. res, err := c.doRequest("json")
  7057. if res != nil && res.StatusCode == http.StatusNotModified {
  7058. if res.Body != nil {
  7059. res.Body.Close()
  7060. }
  7061. return nil, &googleapi.Error{
  7062. Code: res.StatusCode,
  7063. Header: res.Header,
  7064. }
  7065. }
  7066. if err != nil {
  7067. return nil, err
  7068. }
  7069. defer googleapi.CloseBody(res)
  7070. if err := googleapi.CheckResponse(res); err != nil {
  7071. return nil, err
  7072. }
  7073. ret := &Table{
  7074. ServerResponse: googleapi.ServerResponse{
  7075. Header: res.Header,
  7076. HTTPStatusCode: res.StatusCode,
  7077. },
  7078. }
  7079. target := &ret
  7080. if err := gensupport.DecodeResponse(target, res); err != nil {
  7081. return nil, err
  7082. }
  7083. return ret, nil
  7084. // {
  7085. // "description": "Updates information in an existing table. The update method replaces the entire table resource, whereas the patch method only replaces fields that are provided in the submitted table resource.",
  7086. // "httpMethod": "PUT",
  7087. // "id": "bigquery.tables.update",
  7088. // "parameterOrder": [
  7089. // "projectId",
  7090. // "datasetId",
  7091. // "tableId"
  7092. // ],
  7093. // "parameters": {
  7094. // "datasetId": {
  7095. // "description": "Dataset ID of the table to update",
  7096. // "location": "path",
  7097. // "required": true,
  7098. // "type": "string"
  7099. // },
  7100. // "projectId": {
  7101. // "description": "Project ID of the table to update",
  7102. // "location": "path",
  7103. // "required": true,
  7104. // "type": "string"
  7105. // },
  7106. // "tableId": {
  7107. // "description": "Table ID of the table to update",
  7108. // "location": "path",
  7109. // "required": true,
  7110. // "type": "string"
  7111. // }
  7112. // },
  7113. // "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}",
  7114. // "request": {
  7115. // "$ref": "Table"
  7116. // },
  7117. // "response": {
  7118. // "$ref": "Table"
  7119. // },
  7120. // "scopes": [
  7121. // "https://www.googleapis.com/auth/bigquery",
  7122. // "https://www.googleapis.com/auth/cloud-platform"
  7123. // ]
  7124. // }
  7125. }