google-apis-bigquery_v2 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1555 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'google/apis/core/base_service'
16
+ require 'google/apis/core/json_representation'
17
+ require 'google/apis/core/hashable'
18
+ require 'google/apis/errors'
19
+
20
+ module Google
21
+ module Apis
22
+ module BigqueryV2
23
+ # BigQuery API
24
+ #
25
+ # A data platform for customers to create, manage, share and query data.
26
+ #
27
+ # @example
28
+ # require 'google/apis/bigquery_v2'
29
+ #
30
+ # Bigquery = Google::Apis::BigqueryV2 # Alias the module
31
+ # service = Bigquery::BigqueryService.new
32
+ #
33
+ # @see https://cloud.google.com/bigquery/
34
+ class BigqueryService < Google::Apis::Core::BaseService
35
+ # @return [String]
36
+ # API key. Your API key identifies your project and provides you with API access,
37
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
38
+ attr_accessor :key
39
+
40
+ # @return [String]
41
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
42
+ # characters.
43
+ attr_accessor :quota_user
44
+
45
+ # @return [String]
46
+ # Deprecated. Please use quotaUser instead.
47
+ attr_accessor :user_ip
48
+
49
+ def initialize
50
+ super('https://bigquery.googleapis.com/', 'bigquery/v2/',
51
+ client_name: 'google-apis-bigquery_v2',
52
+ client_version: Google::Apis::BigqueryV2::GEM_VERSION)
53
+ @batch_path = 'batch/bigquery/v2'
54
+ end
55
+
56
+ # Deletes the dataset specified by the datasetId value. Before you can delete a
57
+ # dataset, you must delete all its tables, either manually or by specifying
58
+ # deleteContents. Immediately after deletion, you can create another dataset
59
+ # with the same name.
60
+ # @param [String] project_id
61
+ # Project ID of the dataset being deleted
62
+ # @param [String] dataset_id
63
+ # Dataset ID of dataset being deleted
64
+ # @param [Boolean] delete_contents
65
+ # If True, delete all the tables in the dataset. If False and the dataset
66
+ # contains tables, the request will fail. Default is False
67
+ # @param [String] fields
68
+ # Selector specifying which fields to include in a partial response.
69
+ # @param [String] quota_user
70
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
71
+ # characters.
72
+ # @param [String] user_ip
73
+ # Deprecated. Please use quotaUser instead.
74
+ # @param [Google::Apis::RequestOptions] options
75
+ # Request-specific options
76
+ #
77
+ # @yield [result, err] Result & error if block supplied
78
+ # @yieldparam result [NilClass] No result returned for this method
79
+ # @yieldparam err [StandardError] error object if request failed
80
+ #
81
+ # @return [void]
82
+ #
83
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
84
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
85
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
86
+ def delete_dataset(project_id, dataset_id, delete_contents: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
87
+ command = make_simple_command(:delete, 'projects/{projectId}/datasets/{datasetId}', options)
88
+ command.params['projectId'] = project_id unless project_id.nil?
89
+ command.params['datasetId'] = dataset_id unless dataset_id.nil?
90
+ command.query['deleteContents'] = delete_contents unless delete_contents.nil?
91
+ command.query['fields'] = fields unless fields.nil?
92
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
93
+ command.query['userIp'] = user_ip unless user_ip.nil?
94
+ execute_or_queue_command(command, &block)
95
+ end
96
+
97
+ # Returns the dataset specified by datasetID.
98
+ # @param [String] project_id
99
+ # Project ID of the requested dataset
100
+ # @param [String] dataset_id
101
+ # Dataset ID of the requested dataset
102
+ # @param [String] fields
103
+ # Selector specifying which fields to include in a partial response.
104
+ # @param [String] quota_user
105
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
106
+ # characters.
107
+ # @param [String] user_ip
108
+ # Deprecated. Please use quotaUser instead.
109
+ # @param [Google::Apis::RequestOptions] options
110
+ # Request-specific options
111
+ #
112
+ # @yield [result, err] Result & error if block supplied
113
+ # @yieldparam result [Google::Apis::BigqueryV2::Dataset] parsed result object
114
+ # @yieldparam err [StandardError] error object if request failed
115
+ #
116
+ # @return [Google::Apis::BigqueryV2::Dataset]
117
+ #
118
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
119
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
120
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
121
+ def get_dataset(project_id, dataset_id, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
122
+ command = make_simple_command(:get, 'projects/{projectId}/datasets/{datasetId}', options)
123
+ command.response_representation = Google::Apis::BigqueryV2::Dataset::Representation
124
+ command.response_class = Google::Apis::BigqueryV2::Dataset
125
+ command.params['projectId'] = project_id unless project_id.nil?
126
+ command.params['datasetId'] = dataset_id unless dataset_id.nil?
127
+ command.query['fields'] = fields unless fields.nil?
128
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
129
+ command.query['userIp'] = user_ip unless user_ip.nil?
130
+ execute_or_queue_command(command, &block)
131
+ end
132
+
133
+ # Creates a new empty dataset.
134
+ # @param [String] project_id
135
+ # Project ID of the new dataset
136
+ # @param [Google::Apis::BigqueryV2::Dataset] dataset_object
137
+ # @param [String] fields
138
+ # Selector specifying which fields to include in a partial response.
139
+ # @param [String] quota_user
140
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
141
+ # characters.
142
+ # @param [String] user_ip
143
+ # Deprecated. Please use quotaUser instead.
144
+ # @param [Google::Apis::RequestOptions] options
145
+ # Request-specific options
146
+ #
147
+ # @yield [result, err] Result & error if block supplied
148
+ # @yieldparam result [Google::Apis::BigqueryV2::Dataset] parsed result object
149
+ # @yieldparam err [StandardError] error object if request failed
150
+ #
151
+ # @return [Google::Apis::BigqueryV2::Dataset]
152
+ #
153
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
154
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
155
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
156
+ def insert_dataset(project_id, dataset_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
157
+ command = make_simple_command(:post, 'projects/{projectId}/datasets', options)
158
+ command.request_representation = Google::Apis::BigqueryV2::Dataset::Representation
159
+ command.request_object = dataset_object
160
+ command.response_representation = Google::Apis::BigqueryV2::Dataset::Representation
161
+ command.response_class = Google::Apis::BigqueryV2::Dataset
162
+ command.params['projectId'] = project_id unless project_id.nil?
163
+ command.query['fields'] = fields unless fields.nil?
164
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
165
+ command.query['userIp'] = user_ip unless user_ip.nil?
166
+ execute_or_queue_command(command, &block)
167
+ end
168
+
169
+ # Lists all datasets in the specified project to which you have been granted the
170
+ # READER dataset role.
171
+ # @param [String] project_id
172
+ # Project ID of the datasets to be listed
173
+ # @param [Boolean] all
174
+ # Whether to list all datasets, including hidden ones
175
+ # @param [String] filter
176
+ # An expression for filtering the results of the request by label. The syntax is
177
+ # "labels.<name>[:<value>]". Multiple filters can be ANDed together by
178
+ # connecting with a space. Example: "labels.department:receiving labels.active".
179
+ # See Filtering datasets using labels for details.
180
+ # @param [Fixnum] max_results
181
+ # The maximum number of results to return
182
+ # @param [String] page_token
183
+ # Page token, returned by a previous call, to request the next page of results
184
+ # @param [String] fields
185
+ # Selector specifying which fields to include in a partial response.
186
+ # @param [String] quota_user
187
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
188
+ # characters.
189
+ # @param [String] user_ip
190
+ # Deprecated. Please use quotaUser instead.
191
+ # @param [Google::Apis::RequestOptions] options
192
+ # Request-specific options
193
+ #
194
+ # @yield [result, err] Result & error if block supplied
195
+ # @yieldparam result [Google::Apis::BigqueryV2::DatasetList] parsed result object
196
+ # @yieldparam err [StandardError] error object if request failed
197
+ #
198
+ # @return [Google::Apis::BigqueryV2::DatasetList]
199
+ #
200
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
201
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
202
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
203
+ def list_datasets(project_id, all: nil, filter: nil, max_results: nil, page_token: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
204
+ command = make_simple_command(:get, 'projects/{projectId}/datasets', options)
205
+ command.response_representation = Google::Apis::BigqueryV2::DatasetList::Representation
206
+ command.response_class = Google::Apis::BigqueryV2::DatasetList
207
+ command.params['projectId'] = project_id unless project_id.nil?
208
+ command.query['all'] = all unless all.nil?
209
+ command.query['filter'] = filter unless filter.nil?
210
+ command.query['maxResults'] = max_results unless max_results.nil?
211
+ command.query['pageToken'] = page_token unless page_token.nil?
212
+ command.query['fields'] = fields unless fields.nil?
213
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
214
+ command.query['userIp'] = user_ip unless user_ip.nil?
215
+ execute_or_queue_command(command, &block)
216
+ end
217
+
218
+ # Updates information in an existing dataset. The update method replaces the
219
+ # entire dataset resource, whereas the patch method only replaces fields that
220
+ # are provided in the submitted dataset resource. This method supports patch
221
+ # semantics.
222
+ # @param [String] project_id
223
+ # Project ID of the dataset being updated
224
+ # @param [String] dataset_id
225
+ # Dataset ID of the dataset being updated
226
+ # @param [Google::Apis::BigqueryV2::Dataset] dataset_object
227
+ # @param [String] fields
228
+ # Selector specifying which fields to include in a partial response.
229
+ # @param [String] quota_user
230
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
231
+ # characters.
232
+ # @param [String] user_ip
233
+ # Deprecated. Please use quotaUser instead.
234
+ # @param [Google::Apis::RequestOptions] options
235
+ # Request-specific options
236
+ #
237
+ # @yield [result, err] Result & error if block supplied
238
+ # @yieldparam result [Google::Apis::BigqueryV2::Dataset] parsed result object
239
+ # @yieldparam err [StandardError] error object if request failed
240
+ #
241
+ # @return [Google::Apis::BigqueryV2::Dataset]
242
+ #
243
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
244
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
245
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
246
+ def patch_dataset(project_id, dataset_id, dataset_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
247
+ command = make_simple_command(:patch, 'projects/{projectId}/datasets/{datasetId}', options)
248
+ command.request_representation = Google::Apis::BigqueryV2::Dataset::Representation
249
+ command.request_object = dataset_object
250
+ command.response_representation = Google::Apis::BigqueryV2::Dataset::Representation
251
+ command.response_class = Google::Apis::BigqueryV2::Dataset
252
+ command.params['projectId'] = project_id unless project_id.nil?
253
+ command.params['datasetId'] = dataset_id unless dataset_id.nil?
254
+ command.query['fields'] = fields unless fields.nil?
255
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
256
+ command.query['userIp'] = user_ip unless user_ip.nil?
257
+ execute_or_queue_command(command, &block)
258
+ end
259
+
260
+ # Updates information in an existing dataset. The update method replaces the
261
+ # entire dataset resource, whereas the patch method only replaces fields that
262
+ # are provided in the submitted dataset resource.
263
+ # @param [String] project_id
264
+ # Project ID of the dataset being updated
265
+ # @param [String] dataset_id
266
+ # Dataset ID of the dataset being updated
267
+ # @param [Google::Apis::BigqueryV2::Dataset] dataset_object
268
+ # @param [String] fields
269
+ # Selector specifying which fields to include in a partial response.
270
+ # @param [String] quota_user
271
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
272
+ # characters.
273
+ # @param [String] user_ip
274
+ # Deprecated. Please use quotaUser instead.
275
+ # @param [Google::Apis::RequestOptions] options
276
+ # Request-specific options
277
+ #
278
+ # @yield [result, err] Result & error if block supplied
279
+ # @yieldparam result [Google::Apis::BigqueryV2::Dataset] parsed result object
280
+ # @yieldparam err [StandardError] error object if request failed
281
+ #
282
+ # @return [Google::Apis::BigqueryV2::Dataset]
283
+ #
284
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
285
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
286
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
287
+ def update_dataset(project_id, dataset_id, dataset_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
288
+ command = make_simple_command(:put, 'projects/{projectId}/datasets/{datasetId}', options)
289
+ command.request_representation = Google::Apis::BigqueryV2::Dataset::Representation
290
+ command.request_object = dataset_object
291
+ command.response_representation = Google::Apis::BigqueryV2::Dataset::Representation
292
+ command.response_class = Google::Apis::BigqueryV2::Dataset
293
+ command.params['projectId'] = project_id unless project_id.nil?
294
+ command.params['datasetId'] = dataset_id unless dataset_id.nil?
295
+ command.query['fields'] = fields unless fields.nil?
296
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
297
+ command.query['userIp'] = user_ip unless user_ip.nil?
298
+ execute_or_queue_command(command, &block)
299
+ end
300
+
301
+ # Requests that a job be cancelled. This call will return immediately, and the
302
+ # client will need to poll for the job status to see if the cancel completed
303
+ # successfully. Cancelled jobs may still incur costs.
304
+ # @param [String] project_id
305
+ # [Required] Project ID of the job to cancel
306
+ # @param [String] job_id
307
+ # [Required] Job ID of the job to cancel
308
+ # @param [String] location
309
+ # The geographic location of the job. Required except for US and EU. See details
310
+ # at https://cloud.google.com/bigquery/docs/locations#specifying_your_location.
311
+ # @param [String] fields
312
+ # Selector specifying which fields to include in a partial response.
313
+ # @param [String] quota_user
314
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
315
+ # characters.
316
+ # @param [String] user_ip
317
+ # Deprecated. Please use quotaUser instead.
318
+ # @param [Google::Apis::RequestOptions] options
319
+ # Request-specific options
320
+ #
321
+ # @yield [result, err] Result & error if block supplied
322
+ # @yieldparam result [Google::Apis::BigqueryV2::CancelJobResponse] parsed result object
323
+ # @yieldparam err [StandardError] error object if request failed
324
+ #
325
+ # @return [Google::Apis::BigqueryV2::CancelJobResponse]
326
+ #
327
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
328
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
329
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
330
+ def cancel_job(project_id, job_id, location: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
331
+ command = make_simple_command(:post, 'projects/{projectId}/jobs/{jobId}/cancel', options)
332
+ command.response_representation = Google::Apis::BigqueryV2::CancelJobResponse::Representation
333
+ command.response_class = Google::Apis::BigqueryV2::CancelJobResponse
334
+ command.params['projectId'] = project_id unless project_id.nil?
335
+ command.params['jobId'] = job_id unless job_id.nil?
336
+ command.query['location'] = location unless location.nil?
337
+ command.query['fields'] = fields unless fields.nil?
338
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
339
+ command.query['userIp'] = user_ip unless user_ip.nil?
340
+ execute_or_queue_command(command, &block)
341
+ end
342
+
343
+ # Returns information about a specific job. Job information is available for a
344
+ # six month period after creation. Requires that you're the person who ran the
345
+ # job, or have the Is Owner project role.
346
+ # @param [String] project_id
347
+ # [Required] Project ID of the requested job
348
+ # @param [String] job_id
349
+ # [Required] Job ID of the requested job
350
+ # @param [String] location
351
+ # The geographic location of the job. Required except for US and EU. See details
352
+ # at https://cloud.google.com/bigquery/docs/locations#specifying_your_location.
353
+ # @param [String] fields
354
+ # Selector specifying which fields to include in a partial response.
355
+ # @param [String] quota_user
356
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
357
+ # characters.
358
+ # @param [String] user_ip
359
+ # Deprecated. Please use quotaUser instead.
360
+ # @param [Google::Apis::RequestOptions] options
361
+ # Request-specific options
362
+ #
363
+ # @yield [result, err] Result & error if block supplied
364
+ # @yieldparam result [Google::Apis::BigqueryV2::Job] parsed result object
365
+ # @yieldparam err [StandardError] error object if request failed
366
+ #
367
+ # @return [Google::Apis::BigqueryV2::Job]
368
+ #
369
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
370
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
371
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
372
+ def get_job(project_id, job_id, location: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
373
+ command = make_simple_command(:get, 'projects/{projectId}/jobs/{jobId}', options)
374
+ command.response_representation = Google::Apis::BigqueryV2::Job::Representation
375
+ command.response_class = Google::Apis::BigqueryV2::Job
376
+ command.params['projectId'] = project_id unless project_id.nil?
377
+ command.params['jobId'] = job_id unless job_id.nil?
378
+ command.query['location'] = location unless location.nil?
379
+ command.query['fields'] = fields unless fields.nil?
380
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
381
+ command.query['userIp'] = user_ip unless user_ip.nil?
382
+ execute_or_queue_command(command, &block)
383
+ end
384
+
385
+ # Retrieves the results of a query job.
386
+ # @param [String] project_id
387
+ # [Required] Project ID of the query job
388
+ # @param [String] job_id
389
+ # [Required] Job ID of the query job
390
+ # @param [String] location
391
+ # The geographic location where the job should run. Required except for US and
392
+ # EU. See details at https://cloud.google.com/bigquery/docs/locations#
393
+ # specifying_your_location.
394
+ # @param [Fixnum] max_results
395
+ # Maximum number of results to read
396
+ # @param [String] page_token
397
+ # Page token, returned by a previous call, to request the next page of results
398
+ # @param [Fixnum] start_index
399
+ # Zero-based index of the starting row
400
+ # @param [Fixnum] timeout_ms
401
+ # How long to wait for the query to complete, in milliseconds, before returning.
402
+ # Default is 10 seconds. If the timeout passes before the job completes, the '
403
+ # jobComplete' field in the response will be false
404
+ # @param [String] fields
405
+ # Selector specifying which fields to include in a partial response.
406
+ # @param [String] quota_user
407
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
408
+ # characters.
409
+ # @param [String] user_ip
410
+ # Deprecated. Please use quotaUser instead.
411
+ # @param [Google::Apis::RequestOptions] options
412
+ # Request-specific options
413
+ #
414
+ # @yield [result, err] Result & error if block supplied
415
+ # @yieldparam result [Google::Apis::BigqueryV2::GetQueryResultsResponse] parsed result object
416
+ # @yieldparam err [StandardError] error object if request failed
417
+ #
418
+ # @return [Google::Apis::BigqueryV2::GetQueryResultsResponse]
419
+ #
420
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
421
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
422
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
423
+ def get_job_query_results(project_id, job_id, location: nil, max_results: nil, page_token: nil, start_index: nil, timeout_ms: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
424
+ command = make_simple_command(:get, 'projects/{projectId}/queries/{jobId}', options)
425
+ command.response_representation = Google::Apis::BigqueryV2::GetQueryResultsResponse::Representation
426
+ command.response_class = Google::Apis::BigqueryV2::GetQueryResultsResponse
427
+ command.params['projectId'] = project_id unless project_id.nil?
428
+ command.params['jobId'] = job_id unless job_id.nil?
429
+ command.query['location'] = location unless location.nil?
430
+ command.query['maxResults'] = max_results unless max_results.nil?
431
+ command.query['pageToken'] = page_token unless page_token.nil?
432
+ command.query['startIndex'] = start_index unless start_index.nil?
433
+ command.query['timeoutMs'] = timeout_ms unless timeout_ms.nil?
434
+ command.query['fields'] = fields unless fields.nil?
435
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
436
+ command.query['userIp'] = user_ip unless user_ip.nil?
437
+ execute_or_queue_command(command, &block)
438
+ end
439
+
440
+ # Starts a new asynchronous job. Requires the Can View project role.
441
+ # @param [String] project_id
442
+ # Project ID of the project that will be billed for the job
443
+ # @param [Google::Apis::BigqueryV2::Job] job_object
444
+ # @param [String] fields
445
+ # Selector specifying which fields to include in a partial response.
446
+ # @param [String] quota_user
447
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
448
+ # characters.
449
+ # @param [String] user_ip
450
+ # Deprecated. Please use quotaUser instead.
451
+ # @param [IO, String] upload_source
452
+ # IO stream or filename containing content to upload
453
+ # @param [String] content_type
454
+ # Content type of the uploaded content.
455
+ # @param [Google::Apis::RequestOptions] options
456
+ # Request-specific options
457
+ #
458
+ # @yield [result, err] Result & error if block supplied
459
+ # @yieldparam result [Google::Apis::BigqueryV2::Job] parsed result object
460
+ # @yieldparam err [StandardError] error object if request failed
461
+ #
462
+ # @return [Google::Apis::BigqueryV2::Job]
463
+ #
464
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
465
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
466
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
467
+ def insert_job(project_id, job_object = nil, fields: nil, quota_user: nil, user_ip: nil, upload_source: nil, content_type: nil, options: nil, &block)
468
+ if upload_source.nil?
469
+ command = make_simple_command(:post, 'projects/{projectId}/jobs', options)
470
+ else
471
+ command = make_upload_command(:post, 'projects/{projectId}/jobs', options)
472
+ command.upload_source = upload_source
473
+ command.upload_content_type = content_type
474
+ end
475
+ command.request_representation = Google::Apis::BigqueryV2::Job::Representation
476
+ command.request_object = job_object
477
+ command.response_representation = Google::Apis::BigqueryV2::Job::Representation
478
+ command.response_class = Google::Apis::BigqueryV2::Job
479
+ command.params['projectId'] = project_id unless project_id.nil?
480
+ command.query['fields'] = fields unless fields.nil?
481
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
482
+ command.query['userIp'] = user_ip unless user_ip.nil?
483
+ execute_or_queue_command(command, &block)
484
+ end
485
+
486
+ # Lists all jobs that you started in the specified project. Job information is
487
+ # available for a six month period after creation. The job list is sorted in
488
+ # reverse chronological order, by job creation time. Requires the Can View
489
+ # project role, or the Is Owner project role if you set the allUsers property.
490
+ # @param [String] project_id
491
+ # Project ID of the jobs to list
492
+ # @param [Boolean] all_users
493
+ # Whether to display jobs owned by all users in the project. Default false
494
+ # @param [Fixnum] max_creation_time
495
+ # Max value for job creation time, in milliseconds since the POSIX epoch. If set,
496
+ # only jobs created before or at this timestamp are returned
497
+ # @param [Fixnum] max_results
498
+ # Maximum number of results to return
499
+ # @param [Fixnum] min_creation_time
500
+ # Min value for job creation time, in milliseconds since the POSIX epoch. If set,
501
+ # only jobs created after or at this timestamp are returned
502
+ # @param [String] page_token
503
+ # Page token, returned by a previous call, to request the next page of results
504
+ # @param [String] parent_job_id
505
+ # If set, retrieves only jobs whose parent is this job. Otherwise, retrieves
506
+ # only jobs which have no parent
507
+ # @param [String] projection
508
+ # Restrict information returned to a set of selected fields
509
+ # @param [Array<String>, String] state_filter
510
+ # Filter for job state
511
+ # @param [String] fields
512
+ # Selector specifying which fields to include in a partial response.
513
+ # @param [String] quota_user
514
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
515
+ # characters.
516
+ # @param [String] user_ip
517
+ # Deprecated. Please use quotaUser instead.
518
+ # @param [Google::Apis::RequestOptions] options
519
+ # Request-specific options
520
+ #
521
+ # @yield [result, err] Result & error if block supplied
522
+ # @yieldparam result [Google::Apis::BigqueryV2::JobList] parsed result object
523
+ # @yieldparam err [StandardError] error object if request failed
524
+ #
525
+ # @return [Google::Apis::BigqueryV2::JobList]
526
+ #
527
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
528
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
529
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
530
+ def list_jobs(project_id, all_users: nil, max_creation_time: nil, max_results: nil, min_creation_time: nil, page_token: nil, parent_job_id: nil, projection: nil, state_filter: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
531
+ command = make_simple_command(:get, 'projects/{projectId}/jobs', options)
532
+ command.response_representation = Google::Apis::BigqueryV2::JobList::Representation
533
+ command.response_class = Google::Apis::BigqueryV2::JobList
534
+ command.params['projectId'] = project_id unless project_id.nil?
535
+ command.query['allUsers'] = all_users unless all_users.nil?
536
+ command.query['maxCreationTime'] = max_creation_time unless max_creation_time.nil?
537
+ command.query['maxResults'] = max_results unless max_results.nil?
538
+ command.query['minCreationTime'] = min_creation_time unless min_creation_time.nil?
539
+ command.query['pageToken'] = page_token unless page_token.nil?
540
+ command.query['parentJobId'] = parent_job_id unless parent_job_id.nil?
541
+ command.query['projection'] = projection unless projection.nil?
542
+ command.query['stateFilter'] = state_filter unless state_filter.nil?
543
+ command.query['fields'] = fields unless fields.nil?
544
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
545
+ command.query['userIp'] = user_ip unless user_ip.nil?
546
+ execute_or_queue_command(command, &block)
547
+ end
548
+
549
+ # Runs a BigQuery SQL query synchronously and returns query results if the query
550
+ # completes within a specified timeout.
551
+ # @param [String] project_id
552
+ # Project ID of the project billed for the query
553
+ # @param [Google::Apis::BigqueryV2::QueryRequest] query_request_object
554
+ # @param [String] fields
555
+ # Selector specifying which fields to include in a partial response.
556
+ # @param [String] quota_user
557
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
558
+ # characters.
559
+ # @param [String] user_ip
560
+ # Deprecated. Please use quotaUser instead.
561
+ # @param [Google::Apis::RequestOptions] options
562
+ # Request-specific options
563
+ #
564
+ # @yield [result, err] Result & error if block supplied
565
+ # @yieldparam result [Google::Apis::BigqueryV2::QueryResponse] parsed result object
566
+ # @yieldparam err [StandardError] error object if request failed
567
+ #
568
+ # @return [Google::Apis::BigqueryV2::QueryResponse]
569
+ #
570
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
571
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
572
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
573
+ def query_job(project_id, query_request_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
574
+ command = make_simple_command(:post, 'projects/{projectId}/queries', options)
575
+ command.request_representation = Google::Apis::BigqueryV2::QueryRequest::Representation
576
+ command.request_object = query_request_object
577
+ command.response_representation = Google::Apis::BigqueryV2::QueryResponse::Representation
578
+ command.response_class = Google::Apis::BigqueryV2::QueryResponse
579
+ command.params['projectId'] = project_id unless project_id.nil?
580
+ command.query['fields'] = fields unless fields.nil?
581
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
582
+ command.query['userIp'] = user_ip unless user_ip.nil?
583
+ execute_or_queue_command(command, &block)
584
+ end
585
+
586
+ # Deletes the model specified by modelId from the dataset.
587
+ # @param [String] project_id
588
+ # Required. Project ID of the model to delete.
589
+ # @param [String] dataset_id
590
+ # Required. Dataset ID of the model to delete.
591
+ # @param [String] model_id
592
+ # Required. Model ID of the model to delete.
593
+ # @param [String] fields
594
+ # Selector specifying which fields to include in a partial response.
595
+ # @param [String] quota_user
596
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
597
+ # characters.
598
+ # @param [String] user_ip
599
+ # Deprecated. Please use quotaUser instead.
600
+ # @param [Google::Apis::RequestOptions] options
601
+ # Request-specific options
602
+ #
603
+ # @yield [result, err] Result & error if block supplied
604
+ # @yieldparam result [NilClass] No result returned for this method
605
+ # @yieldparam err [StandardError] error object if request failed
606
+ #
607
+ # @return [void]
608
+ #
609
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
610
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
611
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
612
+ def delete_model(project_id, dataset_id, model_id, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
613
+ command = make_simple_command(:delete, 'projects/{+projectId}/datasets/{+datasetId}/models/{+modelId}', options)
614
+ command.params['projectId'] = project_id unless project_id.nil?
615
+ command.params['datasetId'] = dataset_id unless dataset_id.nil?
616
+ command.params['modelId'] = model_id unless model_id.nil?
617
+ command.query['fields'] = fields unless fields.nil?
618
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
619
+ command.query['userIp'] = user_ip unless user_ip.nil?
620
+ execute_or_queue_command(command, &block)
621
+ end
622
+
623
+ # Gets the specified model resource by model ID.
624
+ # @param [String] project_id
625
+ # Required. Project ID of the requested model.
626
+ # @param [String] dataset_id
627
+ # Required. Dataset ID of the requested model.
628
+ # @param [String] model_id
629
+ # Required. Model ID of the requested model.
630
+ # @param [String] fields
631
+ # Selector specifying which fields to include in a partial response.
632
+ # @param [String] quota_user
633
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
634
+ # characters.
635
+ # @param [String] user_ip
636
+ # Deprecated. Please use quotaUser instead.
637
+ # @param [Google::Apis::RequestOptions] options
638
+ # Request-specific options
639
+ #
640
+ # @yield [result, err] Result & error if block supplied
641
+ # @yieldparam result [Google::Apis::BigqueryV2::Model] parsed result object
642
+ # @yieldparam err [StandardError] error object if request failed
643
+ #
644
+ # @return [Google::Apis::BigqueryV2::Model]
645
+ #
646
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
647
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
648
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
649
+ def get_model(project_id, dataset_id, model_id, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
650
+ command = make_simple_command(:get, 'projects/{+projectId}/datasets/{+datasetId}/models/{+modelId}', options)
651
+ command.response_representation = Google::Apis::BigqueryV2::Model::Representation
652
+ command.response_class = Google::Apis::BigqueryV2::Model
653
+ command.params['projectId'] = project_id unless project_id.nil?
654
+ command.params['datasetId'] = dataset_id unless dataset_id.nil?
655
+ command.params['modelId'] = model_id unless model_id.nil?
656
+ command.query['fields'] = fields unless fields.nil?
657
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
658
+ command.query['userIp'] = user_ip unless user_ip.nil?
659
+ execute_or_queue_command(command, &block)
660
+ end
661
+
662
+ # Lists all models in the specified dataset. Requires the READER dataset role.
663
+ # @param [String] project_id
664
+ # Required. Project ID of the models to list.
665
+ # @param [String] dataset_id
666
+ # Required. Dataset ID of the models to list.
667
+ # @param [Fixnum] max_results
668
+ # The maximum number of results to return in a single response page. Leverage
669
+ # the page tokens to iterate through the entire collection.
670
+ # @param [String] page_token
671
+ # Page token, returned by a previous call to request the next page of results
672
+ # @param [String] fields
673
+ # Selector specifying which fields to include in a partial response.
674
+ # @param [String] quota_user
675
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
676
+ # characters.
677
+ # @param [String] user_ip
678
+ # Deprecated. Please use quotaUser instead.
679
+ # @param [Google::Apis::RequestOptions] options
680
+ # Request-specific options
681
+ #
682
+ # @yield [result, err] Result & error if block supplied
683
+ # @yieldparam result [Google::Apis::BigqueryV2::ListModelsResponse] parsed result object
684
+ # @yieldparam err [StandardError] error object if request failed
685
+ #
686
+ # @return [Google::Apis::BigqueryV2::ListModelsResponse]
687
+ #
688
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
689
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
690
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
691
+ def list_models(project_id, dataset_id, max_results: nil, page_token: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
692
+ command = make_simple_command(:get, 'projects/{+projectId}/datasets/{+datasetId}/models', options)
693
+ command.response_representation = Google::Apis::BigqueryV2::ListModelsResponse::Representation
694
+ command.response_class = Google::Apis::BigqueryV2::ListModelsResponse
695
+ command.params['projectId'] = project_id unless project_id.nil?
696
+ command.params['datasetId'] = dataset_id unless dataset_id.nil?
697
+ command.query['maxResults'] = max_results unless max_results.nil?
698
+ command.query['pageToken'] = page_token unless page_token.nil?
699
+ command.query['fields'] = fields unless fields.nil?
700
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
701
+ command.query['userIp'] = user_ip unless user_ip.nil?
702
+ execute_or_queue_command(command, &block)
703
+ end
704
+
705
+ # Patch specific fields in the specified model.
706
+ # @param [String] project_id
707
+ # Required. Project ID of the model to patch.
708
+ # @param [String] dataset_id
709
+ # Required. Dataset ID of the model to patch.
710
+ # @param [String] model_id
711
+ # Required. Model ID of the model to patch.
712
+ # @param [Google::Apis::BigqueryV2::Model] model_object
713
+ # @param [String] fields
714
+ # Selector specifying which fields to include in a partial response.
715
+ # @param [String] quota_user
716
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
717
+ # characters.
718
+ # @param [String] user_ip
719
+ # Deprecated. Please use quotaUser instead.
720
+ # @param [Google::Apis::RequestOptions] options
721
+ # Request-specific options
722
+ #
723
+ # @yield [result, err] Result & error if block supplied
724
+ # @yieldparam result [Google::Apis::BigqueryV2::Model] parsed result object
725
+ # @yieldparam err [StandardError] error object if request failed
726
+ #
727
+ # @return [Google::Apis::BigqueryV2::Model]
728
+ #
729
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
730
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
731
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
732
+ def patch_model(project_id, dataset_id, model_id, model_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
733
+ command = make_simple_command(:patch, 'projects/{+projectId}/datasets/{+datasetId}/models/{+modelId}', options)
734
+ command.request_representation = Google::Apis::BigqueryV2::Model::Representation
735
+ command.request_object = model_object
736
+ command.response_representation = Google::Apis::BigqueryV2::Model::Representation
737
+ command.response_class = Google::Apis::BigqueryV2::Model
738
+ command.params['projectId'] = project_id unless project_id.nil?
739
+ command.params['datasetId'] = dataset_id unless dataset_id.nil?
740
+ command.params['modelId'] = model_id unless model_id.nil?
741
+ command.query['fields'] = fields unless fields.nil?
742
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
743
+ command.query['userIp'] = user_ip unless user_ip.nil?
744
+ execute_or_queue_command(command, &block)
745
+ end
746
+
747
+ # Returns the email address of the service account for your project used for
748
+ # interactions with Google Cloud KMS.
749
+ # @param [String] project_id
750
+ # Project ID for which the service account is requested.
751
+ # @param [String] fields
752
+ # Selector specifying which fields to include in a partial response.
753
+ # @param [String] quota_user
754
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
755
+ # characters.
756
+ # @param [String] user_ip
757
+ # Deprecated. Please use quotaUser instead.
758
+ # @param [Google::Apis::RequestOptions] options
759
+ # Request-specific options
760
+ #
761
+ # @yield [result, err] Result & error if block supplied
762
+ # @yieldparam result [Google::Apis::BigqueryV2::GetServiceAccountResponse] parsed result object
763
+ # @yieldparam err [StandardError] error object if request failed
764
+ #
765
+ # @return [Google::Apis::BigqueryV2::GetServiceAccountResponse]
766
+ #
767
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
768
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
769
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
770
+ def get_project_service_account(project_id, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
771
+ command = make_simple_command(:get, 'projects/{projectId}/serviceAccount', options)
772
+ command.response_representation = Google::Apis::BigqueryV2::GetServiceAccountResponse::Representation
773
+ command.response_class = Google::Apis::BigqueryV2::GetServiceAccountResponse
774
+ command.params['projectId'] = project_id unless project_id.nil?
775
+ command.query['fields'] = fields unless fields.nil?
776
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
777
+ command.query['userIp'] = user_ip unless user_ip.nil?
778
+ execute_or_queue_command(command, &block)
779
+ end
780
+
781
+ # Lists all projects to which you have been granted any project role.
782
+ # @param [Fixnum] max_results
783
+ # Maximum number of results to return
784
+ # @param [String] page_token
785
+ # Page token, returned by a previous call, to request the next page of results
786
+ # @param [String] fields
787
+ # Selector specifying which fields to include in a partial response.
788
+ # @param [String] quota_user
789
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
790
+ # characters.
791
+ # @param [String] user_ip
792
+ # Deprecated. Please use quotaUser instead.
793
+ # @param [Google::Apis::RequestOptions] options
794
+ # Request-specific options
795
+ #
796
+ # @yield [result, err] Result & error if block supplied
797
+ # @yieldparam result [Google::Apis::BigqueryV2::ProjectList] parsed result object
798
+ # @yieldparam err [StandardError] error object if request failed
799
+ #
800
+ # @return [Google::Apis::BigqueryV2::ProjectList]
801
+ #
802
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
803
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
804
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
805
+ def list_projects(max_results: nil, page_token: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
806
+ command = make_simple_command(:get, 'projects', options)
807
+ command.response_representation = Google::Apis::BigqueryV2::ProjectList::Representation
808
+ command.response_class = Google::Apis::BigqueryV2::ProjectList
809
+ command.query['maxResults'] = max_results unless max_results.nil?
810
+ command.query['pageToken'] = page_token unless page_token.nil?
811
+ command.query['fields'] = fields unless fields.nil?
812
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
813
+ command.query['userIp'] = user_ip unless user_ip.nil?
814
+ execute_or_queue_command(command, &block)
815
+ end
816
+
817
+ # Deletes the routine specified by routineId from the dataset.
818
+ # @param [String] project_id
819
+ # Required. Project ID of the routine to delete
820
+ # @param [String] dataset_id
821
+ # Required. Dataset ID of the routine to delete
822
+ # @param [String] routine_id
823
+ # Required. Routine ID of the routine to delete
824
+ # @param [String] fields
825
+ # Selector specifying which fields to include in a partial response.
826
+ # @param [String] quota_user
827
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
828
+ # characters.
829
+ # @param [String] user_ip
830
+ # Deprecated. Please use quotaUser instead.
831
+ # @param [Google::Apis::RequestOptions] options
832
+ # Request-specific options
833
+ #
834
+ # @yield [result, err] Result & error if block supplied
835
+ # @yieldparam result [NilClass] No result returned for this method
836
+ # @yieldparam err [StandardError] error object if request failed
837
+ #
838
+ # @return [void]
839
+ #
840
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
841
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
842
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
843
+ def delete_routine(project_id, dataset_id, routine_id, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
844
+ command = make_simple_command(:delete, 'projects/{+projectId}/datasets/{+datasetId}/routines/{+routineId}', options)
845
+ command.params['projectId'] = project_id unless project_id.nil?
846
+ command.params['datasetId'] = dataset_id unless dataset_id.nil?
847
+ command.params['routineId'] = routine_id unless routine_id.nil?
848
+ command.query['fields'] = fields unless fields.nil?
849
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
850
+ command.query['userIp'] = user_ip unless user_ip.nil?
851
+ execute_or_queue_command(command, &block)
852
+ end
853
+
854
+ # Gets the specified routine resource by routine ID.
855
+ # @param [String] project_id
856
+ # Required. Project ID of the requested routine
857
+ # @param [String] dataset_id
858
+ # Required. Dataset ID of the requested routine
859
+ # @param [String] routine_id
860
+ # Required. Routine ID of the requested routine
861
+ # @param [String] read_mask
862
+ # If set, only the Routine fields in the field mask are returned in the response.
863
+ # If unset, all Routine fields are returned.
864
+ # @param [String] fields
865
+ # Selector specifying which fields to include in a partial response.
866
+ # @param [String] quota_user
867
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
868
+ # characters.
869
+ # @param [String] user_ip
870
+ # Deprecated. Please use quotaUser instead.
871
+ # @param [Google::Apis::RequestOptions] options
872
+ # Request-specific options
873
+ #
874
+ # @yield [result, err] Result & error if block supplied
875
+ # @yieldparam result [Google::Apis::BigqueryV2::Routine] parsed result object
876
+ # @yieldparam err [StandardError] error object if request failed
877
+ #
878
+ # @return [Google::Apis::BigqueryV2::Routine]
879
+ #
880
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
881
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
882
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
883
+ def get_routine(project_id, dataset_id, routine_id, read_mask: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
884
+ command = make_simple_command(:get, 'projects/{+projectId}/datasets/{+datasetId}/routines/{+routineId}', options)
885
+ command.response_representation = Google::Apis::BigqueryV2::Routine::Representation
886
+ command.response_class = Google::Apis::BigqueryV2::Routine
887
+ command.params['projectId'] = project_id unless project_id.nil?
888
+ command.params['datasetId'] = dataset_id unless dataset_id.nil?
889
+ command.params['routineId'] = routine_id unless routine_id.nil?
890
+ command.query['readMask'] = read_mask unless read_mask.nil?
891
+ command.query['fields'] = fields unless fields.nil?
892
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
893
+ command.query['userIp'] = user_ip unless user_ip.nil?
894
+ execute_or_queue_command(command, &block)
895
+ end
896
+
897
+ # Creates a new routine in the dataset.
898
+ # @param [String] project_id
899
+ # Required. Project ID of the new routine
900
+ # @param [String] dataset_id
901
+ # Required. Dataset ID of the new routine
902
+ # @param [Google::Apis::BigqueryV2::Routine] routine_object
903
+ # @param [String] fields
904
+ # Selector specifying which fields to include in a partial response.
905
+ # @param [String] quota_user
906
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
907
+ # characters.
908
+ # @param [String] user_ip
909
+ # Deprecated. Please use quotaUser instead.
910
+ # @param [Google::Apis::RequestOptions] options
911
+ # Request-specific options
912
+ #
913
+ # @yield [result, err] Result & error if block supplied
914
+ # @yieldparam result [Google::Apis::BigqueryV2::Routine] parsed result object
915
+ # @yieldparam err [StandardError] error object if request failed
916
+ #
917
+ # @return [Google::Apis::BigqueryV2::Routine]
918
+ #
919
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
920
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
921
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
922
+ def insert_routine(project_id, dataset_id, routine_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
923
+ command = make_simple_command(:post, 'projects/{+projectId}/datasets/{+datasetId}/routines', options)
924
+ command.request_representation = Google::Apis::BigqueryV2::Routine::Representation
925
+ command.request_object = routine_object
926
+ command.response_representation = Google::Apis::BigqueryV2::Routine::Representation
927
+ command.response_class = Google::Apis::BigqueryV2::Routine
928
+ command.params['projectId'] = project_id unless project_id.nil?
929
+ command.params['datasetId'] = dataset_id unless dataset_id.nil?
930
+ command.query['fields'] = fields unless fields.nil?
931
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
932
+ command.query['userIp'] = user_ip unless user_ip.nil?
933
+ execute_or_queue_command(command, &block)
934
+ end
935
+
936
+ # Lists all routines in the specified dataset. Requires the READER dataset role.
937
+ # @param [String] project_id
938
+ # Required. Project ID of the routines to list
939
+ # @param [String] dataset_id
940
+ # Required. Dataset ID of the routines to list
941
+ # @param [String] filter
942
+ # If set, then only the Routines matching this filter are returned. The current
943
+ # supported form is either "routine_type:" or "routineType:", where is a
944
+ # RoutineType enum. Example: "routineType:SCALAR_FUNCTION".
945
+ # @param [Fixnum] max_results
946
+ # The maximum number of results to return in a single response page. Leverage
947
+ # the page tokens to iterate through the entire collection.
948
+ # @param [String] page_token
949
+ # Page token, returned by a previous call, to request the next page of results
950
+ # @param [String] read_mask
951
+ # If set, then only the Routine fields in the field mask, as well as project_id,
952
+ # dataset_id and routine_id, are returned in the response. If unset, then the
953
+ # following Routine fields are returned: etag, project_id, dataset_id,
954
+ # routine_id, routine_type, creation_time, last_modified_time, and language.
955
+ # @param [String] fields
956
+ # Selector specifying which fields to include in a partial response.
957
+ # @param [String] quota_user
958
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
959
+ # characters.
960
+ # @param [String] user_ip
961
+ # Deprecated. Please use quotaUser instead.
962
+ # @param [Google::Apis::RequestOptions] options
963
+ # Request-specific options
964
+ #
965
+ # @yield [result, err] Result & error if block supplied
966
+ # @yieldparam result [Google::Apis::BigqueryV2::ListRoutinesResponse] parsed result object
967
+ # @yieldparam err [StandardError] error object if request failed
968
+ #
969
+ # @return [Google::Apis::BigqueryV2::ListRoutinesResponse]
970
+ #
971
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
972
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
973
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
974
+ def list_routines(project_id, dataset_id, filter: nil, max_results: nil, page_token: nil, read_mask: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
975
+ command = make_simple_command(:get, 'projects/{+projectId}/datasets/{+datasetId}/routines', options)
976
+ command.response_representation = Google::Apis::BigqueryV2::ListRoutinesResponse::Representation
977
+ command.response_class = Google::Apis::BigqueryV2::ListRoutinesResponse
978
+ command.params['projectId'] = project_id unless project_id.nil?
979
+ command.params['datasetId'] = dataset_id unless dataset_id.nil?
980
+ command.query['filter'] = filter unless filter.nil?
981
+ command.query['maxResults'] = max_results unless max_results.nil?
982
+ command.query['pageToken'] = page_token unless page_token.nil?
983
+ command.query['readMask'] = read_mask unless read_mask.nil?
984
+ command.query['fields'] = fields unless fields.nil?
985
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
986
+ command.query['userIp'] = user_ip unless user_ip.nil?
987
+ execute_or_queue_command(command, &block)
988
+ end
989
+
990
+ # Updates information in an existing routine. The update method replaces the
991
+ # entire Routine resource.
992
+ # @param [String] project_id
993
+ # Required. Project ID of the routine to update
994
+ # @param [String] dataset_id
995
+ # Required. Dataset ID of the routine to update
996
+ # @param [String] routine_id
997
+ # Required. Routine ID of the routine to update
998
+ # @param [Google::Apis::BigqueryV2::Routine] routine_object
999
+ # @param [String] fields
1000
+ # Selector specifying which fields to include in a partial response.
1001
+ # @param [String] quota_user
1002
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
1003
+ # characters.
1004
+ # @param [String] user_ip
1005
+ # Deprecated. Please use quotaUser instead.
1006
+ # @param [Google::Apis::RequestOptions] options
1007
+ # Request-specific options
1008
+ #
1009
+ # @yield [result, err] Result & error if block supplied
1010
+ # @yieldparam result [Google::Apis::BigqueryV2::Routine] parsed result object
1011
+ # @yieldparam err [StandardError] error object if request failed
1012
+ #
1013
+ # @return [Google::Apis::BigqueryV2::Routine]
1014
+ #
1015
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1016
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1017
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1018
+ def update_routine(project_id, dataset_id, routine_id, routine_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
1019
+ command = make_simple_command(:put, 'projects/{+projectId}/datasets/{+datasetId}/routines/{+routineId}', options)
1020
+ command.request_representation = Google::Apis::BigqueryV2::Routine::Representation
1021
+ command.request_object = routine_object
1022
+ command.response_representation = Google::Apis::BigqueryV2::Routine::Representation
1023
+ command.response_class = Google::Apis::BigqueryV2::Routine
1024
+ command.params['projectId'] = project_id unless project_id.nil?
1025
+ command.params['datasetId'] = dataset_id unless dataset_id.nil?
1026
+ command.params['routineId'] = routine_id unless routine_id.nil?
1027
+ command.query['fields'] = fields unless fields.nil?
1028
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1029
+ command.query['userIp'] = user_ip unless user_ip.nil?
1030
+ execute_or_queue_command(command, &block)
1031
+ end
1032
+
1033
+ # Lists all row access policies on the specified table.
1034
+ # @param [String] project_id
1035
+ # Required. Project ID of the row access policies to list.
1036
+ # @param [String] dataset_id
1037
+ # Required. Dataset ID of row access policies to list.
1038
+ # @param [String] table_id
1039
+ # Required. Table ID of the table to list row access policies.
1040
+ # @param [Fixnum] page_size
1041
+ # The maximum number of results to return in a single response page. Leverage
1042
+ # the page tokens to iterate through the entire collection.
1043
+ # @param [String] page_token
1044
+ # Page token, returned by a previous call, to request the next page of results.
1045
+ # @param [String] fields
1046
+ # Selector specifying which fields to include in a partial response.
1047
+ # @param [String] quota_user
1048
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
1049
+ # characters.
1050
+ # @param [String] user_ip
1051
+ # Deprecated. Please use quotaUser instead.
1052
+ # @param [Google::Apis::RequestOptions] options
1053
+ # Request-specific options
1054
+ #
1055
+ # @yield [result, err] Result & error if block supplied
1056
+ # @yieldparam result [Google::Apis::BigqueryV2::ListRowAccessPoliciesResponse] parsed result object
1057
+ # @yieldparam err [StandardError] error object if request failed
1058
+ #
1059
+ # @return [Google::Apis::BigqueryV2::ListRowAccessPoliciesResponse]
1060
+ #
1061
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1062
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1063
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1064
+ def list_row_access_policies(project_id, dataset_id, table_id, page_size: nil, page_token: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
1065
+ command = make_simple_command(:get, 'projects/{+projectId}/datasets/{+datasetId}/tables/{+tableId}/rowAccessPolicies', options)
1066
+ command.response_representation = Google::Apis::BigqueryV2::ListRowAccessPoliciesResponse::Representation
1067
+ command.response_class = Google::Apis::BigqueryV2::ListRowAccessPoliciesResponse
1068
+ command.params['projectId'] = project_id unless project_id.nil?
1069
+ command.params['datasetId'] = dataset_id unless dataset_id.nil?
1070
+ command.params['tableId'] = table_id unless table_id.nil?
1071
+ command.query['pageSize'] = page_size unless page_size.nil?
1072
+ command.query['pageToken'] = page_token unless page_token.nil?
1073
+ command.query['fields'] = fields unless fields.nil?
1074
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1075
+ command.query['userIp'] = user_ip unless user_ip.nil?
1076
+ execute_or_queue_command(command, &block)
1077
+ end
1078
+
1079
+ # Streams data into BigQuery one record at a time without needing to run a load
1080
+ # job. Requires the WRITER dataset role.
1081
+ # @param [String] project_id
1082
+ # Project ID of the destination table.
1083
+ # @param [String] dataset_id
1084
+ # Dataset ID of the destination table.
1085
+ # @param [String] table_id
1086
+ # Table ID of the destination table.
1087
+ # @param [Google::Apis::BigqueryV2::InsertAllTableDataRequest] insert_all_table_data_request_object
1088
+ # @param [String] fields
1089
+ # Selector specifying which fields to include in a partial response.
1090
+ # @param [String] quota_user
1091
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
1092
+ # characters.
1093
+ # @param [String] user_ip
1094
+ # Deprecated. Please use quotaUser instead.
1095
+ # @param [Google::Apis::RequestOptions] options
1096
+ # Request-specific options
1097
+ #
1098
+ # @yield [result, err] Result & error if block supplied
1099
+ # @yieldparam result [Google::Apis::BigqueryV2::InsertAllTableDataResponse] parsed result object
1100
+ # @yieldparam err [StandardError] error object if request failed
1101
+ #
1102
+ # @return [Google::Apis::BigqueryV2::InsertAllTableDataResponse]
1103
+ #
1104
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1105
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1106
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1107
+ def insert_all_table_data(project_id, dataset_id, table_id, insert_all_table_data_request_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
1108
+ command = make_simple_command(:post, 'projects/{projectId}/datasets/{datasetId}/tables/{tableId}/insertAll', options)
1109
+ command.request_representation = Google::Apis::BigqueryV2::InsertAllTableDataRequest::Representation
1110
+ command.request_object = insert_all_table_data_request_object
1111
+ command.response_representation = Google::Apis::BigqueryV2::InsertAllTableDataResponse::Representation
1112
+ command.response_class = Google::Apis::BigqueryV2::InsertAllTableDataResponse
1113
+ command.params['projectId'] = project_id unless project_id.nil?
1114
+ command.params['datasetId'] = dataset_id unless dataset_id.nil?
1115
+ command.params['tableId'] = table_id unless table_id.nil?
1116
+ command.query['fields'] = fields unless fields.nil?
1117
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1118
+ command.query['userIp'] = user_ip unless user_ip.nil?
1119
+ execute_or_queue_command(command, &block)
1120
+ end
1121
+
1122
+ # Retrieves table data from a specified set of rows. Requires the READER dataset
1123
+ # role.
1124
+ # @param [String] project_id
1125
+ # Project ID of the table to read
1126
+ # @param [String] dataset_id
1127
+ # Dataset ID of the table to read
1128
+ # @param [String] table_id
1129
+ # Table ID of the table to read
1130
+ # @param [Fixnum] max_results
1131
+ # Maximum number of results to return
1132
+ # @param [String] page_token
1133
+ # Page token, returned by a previous call, identifying the result set
1134
+ # @param [String] selected_fields
1135
+ # List of fields to return (comma-separated). If unspecified, all fields are
1136
+ # returned
1137
+ # @param [Fixnum] start_index
1138
+ # Zero-based index of the starting row to read
1139
+ # @param [String] fields
1140
+ # Selector specifying which fields to include in a partial response.
1141
+ # @param [String] quota_user
1142
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
1143
+ # characters.
1144
+ # @param [String] user_ip
1145
+ # Deprecated. Please use quotaUser instead.
1146
+ # @param [Google::Apis::RequestOptions] options
1147
+ # Request-specific options
1148
+ #
1149
+ # @yield [result, err] Result & error if block supplied
1150
+ # @yieldparam result [Google::Apis::BigqueryV2::TableDataList] parsed result object
1151
+ # @yieldparam err [StandardError] error object if request failed
1152
+ #
1153
+ # @return [Google::Apis::BigqueryV2::TableDataList]
1154
+ #
1155
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1156
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1157
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1158
+ def list_table_data(project_id, dataset_id, table_id, max_results: nil, page_token: nil, selected_fields: nil, start_index: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
1159
+ command = make_simple_command(:get, 'projects/{projectId}/datasets/{datasetId}/tables/{tableId}/data', options)
1160
+ command.response_representation = Google::Apis::BigqueryV2::TableDataList::Representation
1161
+ command.response_class = Google::Apis::BigqueryV2::TableDataList
1162
+ command.params['projectId'] = project_id unless project_id.nil?
1163
+ command.params['datasetId'] = dataset_id unless dataset_id.nil?
1164
+ command.params['tableId'] = table_id unless table_id.nil?
1165
+ command.query['maxResults'] = max_results unless max_results.nil?
1166
+ command.query['pageToken'] = page_token unless page_token.nil?
1167
+ command.query['selectedFields'] = selected_fields unless selected_fields.nil?
1168
+ command.query['startIndex'] = start_index unless start_index.nil?
1169
+ command.query['fields'] = fields unless fields.nil?
1170
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1171
+ command.query['userIp'] = user_ip unless user_ip.nil?
1172
+ execute_or_queue_command(command, &block)
1173
+ end
1174
+
1175
+ # Deletes the table specified by tableId from the dataset. If the table contains
1176
+ # data, all the data will be deleted.
1177
+ # @param [String] project_id
1178
+ # Project ID of the table to delete
1179
+ # @param [String] dataset_id
1180
+ # Dataset ID of the table to delete
1181
+ # @param [String] table_id
1182
+ # Table ID of the table to delete
1183
+ # @param [String] fields
1184
+ # Selector specifying which fields to include in a partial response.
1185
+ # @param [String] quota_user
1186
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
1187
+ # characters.
1188
+ # @param [String] user_ip
1189
+ # Deprecated. Please use quotaUser instead.
1190
+ # @param [Google::Apis::RequestOptions] options
1191
+ # Request-specific options
1192
+ #
1193
+ # @yield [result, err] Result & error if block supplied
1194
+ # @yieldparam result [NilClass] No result returned for this method
1195
+ # @yieldparam err [StandardError] error object if request failed
1196
+ #
1197
+ # @return [void]
1198
+ #
1199
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1200
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1201
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1202
+ def delete_table(project_id, dataset_id, table_id, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
1203
+ command = make_simple_command(:delete, 'projects/{projectId}/datasets/{datasetId}/tables/{tableId}', options)
1204
+ command.params['projectId'] = project_id unless project_id.nil?
1205
+ command.params['datasetId'] = dataset_id unless dataset_id.nil?
1206
+ command.params['tableId'] = table_id unless table_id.nil?
1207
+ command.query['fields'] = fields unless fields.nil?
1208
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1209
+ command.query['userIp'] = user_ip unless user_ip.nil?
1210
+ execute_or_queue_command(command, &block)
1211
+ end
1212
+
1213
+ # Gets the specified table resource by table ID. This method does not return the
1214
+ # data in the table, it only returns the table resource, which describes the
1215
+ # structure of this table.
1216
+ # @param [String] project_id
1217
+ # Project ID of the requested table
1218
+ # @param [String] dataset_id
1219
+ # Dataset ID of the requested table
1220
+ # @param [String] table_id
1221
+ # Table ID of the requested table
1222
+ # @param [String] selected_fields
1223
+ # List of fields to return (comma-separated). If unspecified, all fields are
1224
+ # returned
1225
+ # @param [String] fields
1226
+ # Selector specifying which fields to include in a partial response.
1227
+ # @param [String] quota_user
1228
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
1229
+ # characters.
1230
+ # @param [String] user_ip
1231
+ # Deprecated. Please use quotaUser instead.
1232
+ # @param [Google::Apis::RequestOptions] options
1233
+ # Request-specific options
1234
+ #
1235
+ # @yield [result, err] Result & error if block supplied
1236
+ # @yieldparam result [Google::Apis::BigqueryV2::Table] parsed result object
1237
+ # @yieldparam err [StandardError] error object if request failed
1238
+ #
1239
+ # @return [Google::Apis::BigqueryV2::Table]
1240
+ #
1241
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1242
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1243
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1244
+ def get_table(project_id, dataset_id, table_id, selected_fields: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
1245
+ command = make_simple_command(:get, 'projects/{projectId}/datasets/{datasetId}/tables/{tableId}', options)
1246
+ command.response_representation = Google::Apis::BigqueryV2::Table::Representation
1247
+ command.response_class = Google::Apis::BigqueryV2::Table
1248
+ command.params['projectId'] = project_id unless project_id.nil?
1249
+ command.params['datasetId'] = dataset_id unless dataset_id.nil?
1250
+ command.params['tableId'] = table_id unless table_id.nil?
1251
+ command.query['selectedFields'] = selected_fields unless selected_fields.nil?
1252
+ command.query['fields'] = fields unless fields.nil?
1253
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1254
+ command.query['userIp'] = user_ip unless user_ip.nil?
1255
+ execute_or_queue_command(command, &block)
1256
+ end
1257
+
1258
+ # Gets the access control policy for a resource. Returns an empty policy if the
1259
+ # resource exists and does not have a policy set.
1260
+ # @param [String] resource
1261
+ # REQUIRED: The resource for which the policy is being requested. See the
1262
+ # operation documentation for the appropriate value for this field.
1263
+ # @param [Google::Apis::BigqueryV2::GetIamPolicyRequest] get_iam_policy_request_object
1264
+ # @param [String] fields
1265
+ # Selector specifying which fields to include in a partial response.
1266
+ # @param [String] quota_user
1267
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
1268
+ # characters.
1269
+ # @param [String] user_ip
1270
+ # Deprecated. Please use quotaUser instead.
1271
+ # @param [Google::Apis::RequestOptions] options
1272
+ # Request-specific options
1273
+ #
1274
+ # @yield [result, err] Result & error if block supplied
1275
+ # @yieldparam result [Google::Apis::BigqueryV2::Policy] parsed result object
1276
+ # @yieldparam err [StandardError] error object if request failed
1277
+ #
1278
+ # @return [Google::Apis::BigqueryV2::Policy]
1279
+ #
1280
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1281
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1282
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1283
+ def get_table_iam_policy(resource, get_iam_policy_request_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
1284
+ command = make_simple_command(:post, '{+resource}:getIamPolicy', options)
1285
+ command.request_representation = Google::Apis::BigqueryV2::GetIamPolicyRequest::Representation
1286
+ command.request_object = get_iam_policy_request_object
1287
+ command.response_representation = Google::Apis::BigqueryV2::Policy::Representation
1288
+ command.response_class = Google::Apis::BigqueryV2::Policy
1289
+ command.params['resource'] = resource unless resource.nil?
1290
+ command.query['fields'] = fields unless fields.nil?
1291
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1292
+ command.query['userIp'] = user_ip unless user_ip.nil?
1293
+ execute_or_queue_command(command, &block)
1294
+ end
1295
+
1296
+ # Creates a new, empty table in the dataset.
1297
+ # @param [String] project_id
1298
+ # Project ID of the new table
1299
+ # @param [String] dataset_id
1300
+ # Dataset ID of the new table
1301
+ # @param [Google::Apis::BigqueryV2::Table] table_object
1302
+ # @param [String] fields
1303
+ # Selector specifying which fields to include in a partial response.
1304
+ # @param [String] quota_user
1305
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
1306
+ # characters.
1307
+ # @param [String] user_ip
1308
+ # Deprecated. Please use quotaUser instead.
1309
+ # @param [Google::Apis::RequestOptions] options
1310
+ # Request-specific options
1311
+ #
1312
+ # @yield [result, err] Result & error if block supplied
1313
+ # @yieldparam result [Google::Apis::BigqueryV2::Table] parsed result object
1314
+ # @yieldparam err [StandardError] error object if request failed
1315
+ #
1316
+ # @return [Google::Apis::BigqueryV2::Table]
1317
+ #
1318
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1319
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1320
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1321
+ def insert_table(project_id, dataset_id, table_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
1322
+ command = make_simple_command(:post, 'projects/{projectId}/datasets/{datasetId}/tables', options)
1323
+ command.request_representation = Google::Apis::BigqueryV2::Table::Representation
1324
+ command.request_object = table_object
1325
+ command.response_representation = Google::Apis::BigqueryV2::Table::Representation
1326
+ command.response_class = Google::Apis::BigqueryV2::Table
1327
+ command.params['projectId'] = project_id unless project_id.nil?
1328
+ command.params['datasetId'] = dataset_id unless dataset_id.nil?
1329
+ command.query['fields'] = fields unless fields.nil?
1330
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1331
+ command.query['userIp'] = user_ip unless user_ip.nil?
1332
+ execute_or_queue_command(command, &block)
1333
+ end
1334
+
1335
+ # Lists all tables in the specified dataset. Requires the READER dataset role.
1336
+ # @param [String] project_id
1337
+ # Project ID of the tables to list
1338
+ # @param [String] dataset_id
1339
+ # Dataset ID of the tables to list
1340
+ # @param [Fixnum] max_results
1341
+ # Maximum number of results to return
1342
+ # @param [String] page_token
1343
+ # Page token, returned by a previous call, to request the next page of results
1344
+ # @param [String] fields
1345
+ # Selector specifying which fields to include in a partial response.
1346
+ # @param [String] quota_user
1347
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
1348
+ # characters.
1349
+ # @param [String] user_ip
1350
+ # Deprecated. Please use quotaUser instead.
1351
+ # @param [Google::Apis::RequestOptions] options
1352
+ # Request-specific options
1353
+ #
1354
+ # @yield [result, err] Result & error if block supplied
1355
+ # @yieldparam result [Google::Apis::BigqueryV2::TableList] parsed result object
1356
+ # @yieldparam err [StandardError] error object if request failed
1357
+ #
1358
+ # @return [Google::Apis::BigqueryV2::TableList]
1359
+ #
1360
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1361
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1362
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1363
+ def list_tables(project_id, dataset_id, max_results: nil, page_token: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
1364
+ command = make_simple_command(:get, 'projects/{projectId}/datasets/{datasetId}/tables', options)
1365
+ command.response_representation = Google::Apis::BigqueryV2::TableList::Representation
1366
+ command.response_class = Google::Apis::BigqueryV2::TableList
1367
+ command.params['projectId'] = project_id unless project_id.nil?
1368
+ command.params['datasetId'] = dataset_id unless dataset_id.nil?
1369
+ command.query['maxResults'] = max_results unless max_results.nil?
1370
+ command.query['pageToken'] = page_token unless page_token.nil?
1371
+ command.query['fields'] = fields unless fields.nil?
1372
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1373
+ command.query['userIp'] = user_ip unless user_ip.nil?
1374
+ execute_or_queue_command(command, &block)
1375
+ end
1376
+
1377
+ # Updates information in an existing table. The update method replaces the
1378
+ # entire table resource, whereas the patch method only replaces fields that are
1379
+ # provided in the submitted table resource. This method supports patch semantics.
1380
+ # @param [String] project_id
1381
+ # Project ID of the table to update
1382
+ # @param [String] dataset_id
1383
+ # Dataset ID of the table to update
1384
+ # @param [String] table_id
1385
+ # Table ID of the table to update
1386
+ # @param [Google::Apis::BigqueryV2::Table] table_object
1387
+ # @param [String] fields
1388
+ # Selector specifying which fields to include in a partial response.
1389
+ # @param [String] quota_user
1390
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
1391
+ # characters.
1392
+ # @param [String] user_ip
1393
+ # Deprecated. Please use quotaUser instead.
1394
+ # @param [Google::Apis::RequestOptions] options
1395
+ # Request-specific options
1396
+ #
1397
+ # @yield [result, err] Result & error if block supplied
1398
+ # @yieldparam result [Google::Apis::BigqueryV2::Table] parsed result object
1399
+ # @yieldparam err [StandardError] error object if request failed
1400
+ #
1401
+ # @return [Google::Apis::BigqueryV2::Table]
1402
+ #
1403
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1404
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1405
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1406
+ def patch_table(project_id, dataset_id, table_id, table_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
1407
+ command = make_simple_command(:patch, 'projects/{projectId}/datasets/{datasetId}/tables/{tableId}', options)
1408
+ command.request_representation = Google::Apis::BigqueryV2::Table::Representation
1409
+ command.request_object = table_object
1410
+ command.response_representation = Google::Apis::BigqueryV2::Table::Representation
1411
+ command.response_class = Google::Apis::BigqueryV2::Table
1412
+ command.params['projectId'] = project_id unless project_id.nil?
1413
+ command.params['datasetId'] = dataset_id unless dataset_id.nil?
1414
+ command.params['tableId'] = table_id unless table_id.nil?
1415
+ command.query['fields'] = fields unless fields.nil?
1416
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1417
+ command.query['userIp'] = user_ip unless user_ip.nil?
1418
+ execute_or_queue_command(command, &block)
1419
+ end
1420
+
1421
+ # Sets the access control policy on the specified resource. Replaces any
1422
+ # existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `
1423
+ # PERMISSION_DENIED` errors.
1424
+ # @param [String] resource
1425
+ # REQUIRED: The resource for which the policy is being specified. See the
1426
+ # operation documentation for the appropriate value for this field.
1427
+ # @param [Google::Apis::BigqueryV2::SetIamPolicyRequest] set_iam_policy_request_object
1428
+ # @param [String] fields
1429
+ # Selector specifying which fields to include in a partial response.
1430
+ # @param [String] quota_user
1431
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
1432
+ # characters.
1433
+ # @param [String] user_ip
1434
+ # Deprecated. Please use quotaUser instead.
1435
+ # @param [Google::Apis::RequestOptions] options
1436
+ # Request-specific options
1437
+ #
1438
+ # @yield [result, err] Result & error if block supplied
1439
+ # @yieldparam result [Google::Apis::BigqueryV2::Policy] parsed result object
1440
+ # @yieldparam err [StandardError] error object if request failed
1441
+ #
1442
+ # @return [Google::Apis::BigqueryV2::Policy]
1443
+ #
1444
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1445
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1446
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1447
+ def set_table_iam_policy(resource, set_iam_policy_request_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
1448
+ command = make_simple_command(:post, '{+resource}:setIamPolicy', options)
1449
+ command.request_representation = Google::Apis::BigqueryV2::SetIamPolicyRequest::Representation
1450
+ command.request_object = set_iam_policy_request_object
1451
+ command.response_representation = Google::Apis::BigqueryV2::Policy::Representation
1452
+ command.response_class = Google::Apis::BigqueryV2::Policy
1453
+ command.params['resource'] = resource unless resource.nil?
1454
+ command.query['fields'] = fields unless fields.nil?
1455
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1456
+ command.query['userIp'] = user_ip unless user_ip.nil?
1457
+ execute_or_queue_command(command, &block)
1458
+ end
1459
+
1460
+ # Returns permissions that a caller has on the specified resource. If the
1461
+ # resource does not exist, this will return an empty set of permissions, not a `
1462
+ # NOT_FOUND` error. Note: This operation is designed to be used for building
1463
+ # permission-aware UIs and command-line tools, not for authorization checking.
1464
+ # This operation may "fail open" without warning.
1465
+ # @param [String] resource
1466
+ # REQUIRED: The resource for which the policy detail is being requested. See the
1467
+ # operation documentation for the appropriate value for this field.
1468
+ # @param [Google::Apis::BigqueryV2::TestIamPermissionsRequest] test_iam_permissions_request_object
1469
+ # @param [String] fields
1470
+ # Selector specifying which fields to include in a partial response.
1471
+ # @param [String] quota_user
1472
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
1473
+ # characters.
1474
+ # @param [String] user_ip
1475
+ # Deprecated. Please use quotaUser instead.
1476
+ # @param [Google::Apis::RequestOptions] options
1477
+ # Request-specific options
1478
+ #
1479
+ # @yield [result, err] Result & error if block supplied
1480
+ # @yieldparam result [Google::Apis::BigqueryV2::TestIamPermissionsResponse] parsed result object
1481
+ # @yieldparam err [StandardError] error object if request failed
1482
+ #
1483
+ # @return [Google::Apis::BigqueryV2::TestIamPermissionsResponse]
1484
+ #
1485
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1486
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1487
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1488
+ def test_table_iam_permissions(resource, test_iam_permissions_request_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
1489
+ command = make_simple_command(:post, '{+resource}:testIamPermissions', options)
1490
+ command.request_representation = Google::Apis::BigqueryV2::TestIamPermissionsRequest::Representation
1491
+ command.request_object = test_iam_permissions_request_object
1492
+ command.response_representation = Google::Apis::BigqueryV2::TestIamPermissionsResponse::Representation
1493
+ command.response_class = Google::Apis::BigqueryV2::TestIamPermissionsResponse
1494
+ command.params['resource'] = resource unless resource.nil?
1495
+ command.query['fields'] = fields unless fields.nil?
1496
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1497
+ command.query['userIp'] = user_ip unless user_ip.nil?
1498
+ execute_or_queue_command(command, &block)
1499
+ end
1500
+
1501
+ # Updates information in an existing table. The update method replaces the
1502
+ # entire table resource, whereas the patch method only replaces fields that are
1503
+ # provided in the submitted table resource.
1504
+ # @param [String] project_id
1505
+ # Project ID of the table to update
1506
+ # @param [String] dataset_id
1507
+ # Dataset ID of the table to update
1508
+ # @param [String] table_id
1509
+ # Table ID of the table to update
1510
+ # @param [Google::Apis::BigqueryV2::Table] table_object
1511
+ # @param [String] fields
1512
+ # Selector specifying which fields to include in a partial response.
1513
+ # @param [String] quota_user
1514
+ # An opaque string that represents a user for quota purposes. Must not exceed 40
1515
+ # characters.
1516
+ # @param [String] user_ip
1517
+ # Deprecated. Please use quotaUser instead.
1518
+ # @param [Google::Apis::RequestOptions] options
1519
+ # Request-specific options
1520
+ #
1521
+ # @yield [result, err] Result & error if block supplied
1522
+ # @yieldparam result [Google::Apis::BigqueryV2::Table] parsed result object
1523
+ # @yieldparam err [StandardError] error object if request failed
1524
+ #
1525
+ # @return [Google::Apis::BigqueryV2::Table]
1526
+ #
1527
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
1528
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
1529
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
1530
+ def update_table(project_id, dataset_id, table_id, table_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
1531
+ command = make_simple_command(:put, 'projects/{projectId}/datasets/{datasetId}/tables/{tableId}', options)
1532
+ command.request_representation = Google::Apis::BigqueryV2::Table::Representation
1533
+ command.request_object = table_object
1534
+ command.response_representation = Google::Apis::BigqueryV2::Table::Representation
1535
+ command.response_class = Google::Apis::BigqueryV2::Table
1536
+ command.params['projectId'] = project_id unless project_id.nil?
1537
+ command.params['datasetId'] = dataset_id unless dataset_id.nil?
1538
+ command.params['tableId'] = table_id unless table_id.nil?
1539
+ command.query['fields'] = fields unless fields.nil?
1540
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1541
+ command.query['userIp'] = user_ip unless user_ip.nil?
1542
+ execute_or_queue_command(command, &block)
1543
+ end
1544
+
1545
+ protected
1546
+
1547
+ def apply_command_defaults(command)
1548
+ command.query['key'] = key unless key.nil?
1549
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
1550
+ command.query['userIp'] = user_ip unless user_ip.nil?
1551
+ end
1552
+ end
1553
+ end
1554
+ end
1555
+ end