gcloud 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/AUTHENTICATION.md +3 -3
- data/CHANGELOG.md +92 -0
- data/OVERVIEW.md +3 -3
- data/lib/gcloud.rb +75 -25
- data/lib/gcloud/backoff.rb +5 -1
- data/lib/gcloud/bigquery.rb +25 -43
- data/lib/gcloud/bigquery/copy_job.rb +13 -13
- data/lib/gcloud/bigquery/data.rb +20 -16
- data/lib/gcloud/bigquery/dataset.rb +202 -177
- data/lib/gcloud/bigquery/dataset/access.rb +118 -104
- data/lib/gcloud/bigquery/dataset/list.rb +14 -18
- data/lib/gcloud/bigquery/extract_job.rb +12 -12
- data/lib/gcloud/bigquery/insert_response.rb +12 -14
- data/lib/gcloud/bigquery/job.rb +45 -57
- data/lib/gcloud/bigquery/job/list.rb +18 -24
- data/lib/gcloud/bigquery/load_job.rb +35 -27
- data/lib/gcloud/bigquery/project.rb +53 -73
- data/lib/gcloud/bigquery/query_data.rb +28 -35
- data/lib/gcloud/bigquery/query_job.rb +18 -18
- data/lib/gcloud/bigquery/schema.rb +359 -0
- data/lib/gcloud/bigquery/service.rb +506 -0
- data/lib/gcloud/bigquery/table.rb +185 -266
- data/lib/gcloud/bigquery/table/list.rb +15 -19
- data/lib/gcloud/bigquery/view.rb +126 -81
- data/lib/gcloud/datastore.rb +39 -27
- data/lib/gcloud/datastore/commit.rb +2 -2
- data/lib/gcloud/datastore/dataset.rb +8 -19
- data/lib/gcloud/datastore/dataset/lookup_results.rb +2 -4
- data/lib/gcloud/datastore/dataset/query_results.rb +0 -2
- data/lib/gcloud/datastore/entity.rb +7 -1
- data/lib/gcloud/datastore/errors.rb +5 -27
- data/lib/gcloud/datastore/grpc_utils.rb +4 -3
- data/lib/gcloud/datastore/key.rb +6 -0
- data/lib/gcloud/datastore/service.rb +18 -12
- data/lib/gcloud/datastore/transaction.rb +0 -10
- data/lib/gcloud/dns.rb +29 -19
- data/lib/gcloud/dns/change.rb +10 -15
- data/lib/gcloud/dns/change/list.rb +4 -4
- data/lib/gcloud/dns/importer.rb +1 -1
- data/lib/gcloud/dns/project.rb +32 -49
- data/lib/gcloud/dns/record.rb +8 -2
- data/lib/gcloud/dns/record/list.rb +4 -4
- data/lib/gcloud/dns/service.rb +167 -0
- data/lib/gcloud/dns/zone.rb +33 -52
- data/lib/gcloud/dns/zone/list.rb +12 -16
- data/lib/gcloud/errors.rb +31 -19
- data/lib/gcloud/logging.rb +50 -39
- data/lib/gcloud/logging/entry.rb +197 -24
- data/lib/gcloud/logging/entry/list.rb +0 -2
- data/lib/gcloud/logging/logger.rb +1 -1
- data/lib/gcloud/logging/metric.rb +3 -9
- data/lib/gcloud/logging/metric/list.rb +0 -2
- data/lib/gcloud/logging/project.rb +58 -54
- data/lib/gcloud/logging/resource_descriptor.rb +2 -2
- data/lib/gcloud/logging/resource_descriptor/list.rb +0 -2
- data/lib/gcloud/logging/service.rb +32 -23
- data/lib/gcloud/logging/sink.rb +8 -14
- data/lib/gcloud/logging/sink/list.rb +0 -2
- data/lib/gcloud/pubsub.rb +21 -16
- data/lib/gcloud/pubsub/policy.rb +204 -0
- data/lib/gcloud/pubsub/project.rb +26 -38
- data/lib/gcloud/pubsub/service.rb +39 -31
- data/lib/gcloud/pubsub/subscription.rb +56 -59
- data/lib/gcloud/pubsub/subscription/list.rb +4 -4
- data/lib/gcloud/pubsub/topic.rb +69 -66
- data/lib/gcloud/pubsub/topic/list.rb +0 -2
- data/lib/gcloud/pubsub/topic/{batch.rb → publisher.rb} +15 -2
- data/lib/gcloud/resource_manager.rb +27 -26
- data/lib/gcloud/resource_manager/manager.rb +19 -39
- data/lib/gcloud/resource_manager/policy.rb +211 -0
- data/lib/gcloud/resource_manager/project.rb +97 -121
- data/lib/gcloud/resource_manager/project/list.rb +7 -7
- data/lib/gcloud/resource_manager/project/updater.rb +4 -9
- data/lib/gcloud/resource_manager/service.rb +127 -0
- data/lib/gcloud/storage.rb +24 -42
- data/lib/gcloud/storage/bucket.rb +104 -192
- data/lib/gcloud/storage/bucket/acl.rb +47 -143
- data/lib/gcloud/storage/bucket/cors.rb +55 -11
- data/lib/gcloud/storage/bucket/list.rb +14 -14
- data/lib/gcloud/storage/errors.rb +3 -43
- data/lib/gcloud/storage/file.rb +114 -111
- data/lib/gcloud/storage/file/acl.rb +27 -113
- data/lib/gcloud/storage/file/list.rb +21 -21
- data/lib/gcloud/storage/project.rb +49 -59
- data/lib/gcloud/storage/service.rb +347 -0
- data/lib/gcloud/translate.rb +24 -14
- data/lib/gcloud/translate/api.rb +12 -21
- data/lib/gcloud/translate/detection.rb +5 -5
- data/lib/gcloud/translate/language.rb +1 -1
- data/lib/gcloud/translate/service.rb +80 -0
- data/lib/gcloud/translate/translation.rb +6 -6
- data/lib/gcloud/version.rb +1 -1
- data/lib/gcloud/vision.rb +24 -15
- data/lib/gcloud/vision/annotate.rb +24 -21
- data/lib/gcloud/vision/annotation.rb +9 -9
- data/lib/gcloud/vision/annotation/entity.rb +11 -11
- data/lib/gcloud/vision/annotation/face.rb +25 -25
- data/lib/gcloud/vision/annotation/properties.rb +8 -8
- data/lib/gcloud/vision/annotation/safe_search.rb +4 -4
- data/lib/gcloud/vision/annotation/text.rb +7 -7
- data/lib/gcloud/vision/annotation/vertex.rb +1 -1
- data/lib/gcloud/vision/image.rb +11 -11
- data/lib/gcloud/vision/location.rb +5 -2
- data/lib/gcloud/vision/project.rb +14 -16
- data/lib/gcloud/vision/service.rb +66 -0
- data/lib/google/api_client.rb +0 -0
- metadata +27 -24
- data/lib/gcloud/bigquery/connection.rb +0 -624
- data/lib/gcloud/bigquery/errors.rb +0 -68
- data/lib/gcloud/bigquery/table/schema.rb +0 -234
- data/lib/gcloud/dns/connection.rb +0 -173
- data/lib/gcloud/dns/errors.rb +0 -68
- data/lib/gcloud/resource_manager/connection.rb +0 -134
- data/lib/gcloud/resource_manager/errors.rb +0 -68
- data/lib/gcloud/storage/connection.rb +0 -444
- data/lib/gcloud/translate/connection.rb +0 -85
- data/lib/gcloud/translate/errors.rb +0 -68
- data/lib/gcloud/upload.rb +0 -95
- data/lib/gcloud/vision/connection.rb +0 -63
- data/lib/gcloud/vision/errors.rb +0 -69
@@ -46,17 +46,17 @@ module Gcloud
|
|
46
46
|
"owner" => "OWNER" }
|
47
47
|
|
48
48
|
# @private
|
49
|
-
SCOPES = { "user" =>
|
50
|
-
"user_by_email" =>
|
51
|
-
"userByEmail" =>
|
52
|
-
"group" =>
|
53
|
-
"group_by_email" =>
|
54
|
-
"groupByEmail" =>
|
55
|
-
"domain" =>
|
56
|
-
"special" =>
|
57
|
-
"special_group" =>
|
58
|
-
"specialGroup" =>
|
59
|
-
"view" =>
|
49
|
+
SCOPES = { "user" => :user_by_email,
|
50
|
+
"user_by_email" => :user_by_email,
|
51
|
+
"userByEmail" => :user_by_email,
|
52
|
+
"group" => :group_by_email,
|
53
|
+
"group_by_email" => :group_by_email,
|
54
|
+
"groupByEmail" => :group_by_email,
|
55
|
+
"domain" => :domain,
|
56
|
+
"special" => :special_group,
|
57
|
+
"special_group" => :special_group,
|
58
|
+
"specialGroup" => :special_group,
|
59
|
+
"view" => :view }
|
60
60
|
|
61
61
|
# @private
|
62
62
|
GROUPS = { "owners" => "projectOwners",
|
@@ -72,22 +72,37 @@ module Gcloud
|
|
72
72
|
"all_authenticated_users" => "allAuthenticatedUsers",
|
73
73
|
"allAuthenticatedUsers" => "allAuthenticatedUsers" }
|
74
74
|
|
75
|
-
# @private
|
76
|
-
attr_reader :access
|
77
|
-
|
78
75
|
##
|
79
76
|
# @private
|
80
77
|
# Initialized a new Access object.
|
81
|
-
# Must provide a valid Dataset object.
|
82
|
-
|
83
|
-
|
84
|
-
@
|
85
|
-
@
|
78
|
+
# Must provide a valid Google::Apis::BigqueryV2::Dataset object.
|
79
|
+
# Access will mutate the gapi object.
|
80
|
+
def initialize
|
81
|
+
@rules = [] # easiest to do this in the constructor
|
82
|
+
@original_rules_hashes = @rules.map(&:to_h)
|
86
83
|
end
|
87
84
|
|
88
85
|
# @private
|
89
86
|
def changed?
|
90
|
-
@
|
87
|
+
@original_rules_hashes != @rules.map(&:to_h)
|
88
|
+
end
|
89
|
+
|
90
|
+
# @private
|
91
|
+
def empty?
|
92
|
+
@rules.empty?
|
93
|
+
end
|
94
|
+
|
95
|
+
# @private
|
96
|
+
def freeze
|
97
|
+
@rules = @rules.map(&:dup).map(&:freeze)
|
98
|
+
@rules.freeze
|
99
|
+
super
|
100
|
+
end
|
101
|
+
|
102
|
+
##
|
103
|
+
# @private View the access rules as an array of hashes.
|
104
|
+
def to_a
|
105
|
+
@rules.map(&:to_h)
|
91
106
|
end
|
92
107
|
|
93
108
|
##
|
@@ -123,7 +138,7 @@ module Gcloud
|
|
123
138
|
# Reference](https://cloud.google.com/bigquery/query-reference#from):
|
124
139
|
# +project_name:datasetId.tableId+.
|
125
140
|
def add_reader_view view
|
126
|
-
|
141
|
+
add_access_view view
|
127
142
|
end
|
128
143
|
|
129
144
|
##
|
@@ -151,17 +166,6 @@ module Gcloud
|
|
151
166
|
add_access_role_scope_value :writer, :special, group
|
152
167
|
end
|
153
168
|
|
154
|
-
##
|
155
|
-
# Add writer access to a view.
|
156
|
-
# The view can be a Gcloud::Bigquery::View object,
|
157
|
-
# or a string identifier as specified by the
|
158
|
-
# [Query
|
159
|
-
# Reference](https://cloud.google.com/bigquery/query-reference#from):
|
160
|
-
# +project_name:datasetId.tableId+.
|
161
|
-
def add_writer_view view
|
162
|
-
add_access_role_scope_value :writer, :view, view
|
163
|
-
end
|
164
|
-
|
165
169
|
##
|
166
170
|
# Add owner access to a user.
|
167
171
|
def add_owner_user email
|
@@ -187,17 +191,6 @@ module Gcloud
|
|
187
191
|
add_access_role_scope_value :owner, :special, group
|
188
192
|
end
|
189
193
|
|
190
|
-
##
|
191
|
-
# Add owner access to a view.
|
192
|
-
# The view can be a Gcloud::Bigquery::View object,
|
193
|
-
# or a string identifier as specified by the
|
194
|
-
# [Query
|
195
|
-
# Reference](https://cloud.google.com/bigquery/query-reference#from):
|
196
|
-
# +project_name:datasetId.tableId+.
|
197
|
-
def add_owner_view view
|
198
|
-
add_access_role_scope_value :owner, :view, view
|
199
|
-
end
|
200
|
-
|
201
194
|
##
|
202
195
|
# Remove reader access from a user.
|
203
196
|
def remove_reader_user email
|
@@ -231,7 +224,7 @@ module Gcloud
|
|
231
224
|
# Reference](https://cloud.google.com/bigquery/query-reference#from):
|
232
225
|
# +project_name:datasetId.tableId+.
|
233
226
|
def remove_reader_view view
|
234
|
-
|
227
|
+
remove_access_view view
|
235
228
|
end
|
236
229
|
|
237
230
|
##
|
@@ -259,17 +252,6 @@ module Gcloud
|
|
259
252
|
remove_access_role_scope_value :writer, :special, group
|
260
253
|
end
|
261
254
|
|
262
|
-
##
|
263
|
-
# Remove writer access from a view.
|
264
|
-
# The view can be a Gcloud::Bigquery::View object,
|
265
|
-
# or a string identifier as specified by the
|
266
|
-
# [Query
|
267
|
-
# Reference](https://cloud.google.com/bigquery/query-reference#from):
|
268
|
-
# +project_name:datasetId.tableId+.
|
269
|
-
def remove_writer_view view
|
270
|
-
remove_access_role_scope_value :writer, :view, view
|
271
|
-
end
|
272
|
-
|
273
255
|
##
|
274
256
|
# Remove owner access from a user.
|
275
257
|
def remove_owner_user email
|
@@ -295,17 +277,6 @@ module Gcloud
|
|
295
277
|
remove_access_role_scope_value :owner, :special, group
|
296
278
|
end
|
297
279
|
|
298
|
-
##
|
299
|
-
# Remove owner access from a view.
|
300
|
-
# The view can be a Gcloud::Bigquery::View object,
|
301
|
-
# or a string identifier as specified by the
|
302
|
-
# [Query
|
303
|
-
# Reference](https://cloud.google.com/bigquery/query-reference#from):
|
304
|
-
# +project_name:datasetId.tableId+.
|
305
|
-
def remove_owner_view view
|
306
|
-
remove_access_role_scope_value :owner, :view, view
|
307
|
-
end
|
308
|
-
|
309
280
|
##
|
310
281
|
# Checks reader access for a user.
|
311
282
|
def reader_user? email
|
@@ -339,7 +310,7 @@ module Gcloud
|
|
339
310
|
# Reference](https://cloud.google.com/bigquery/query-reference#from):
|
340
311
|
# +project_name:datasetId.tableId+.
|
341
312
|
def reader_view? view
|
342
|
-
|
313
|
+
lookup_access_view view
|
343
314
|
end
|
344
315
|
|
345
316
|
##
|
@@ -367,17 +338,6 @@ module Gcloud
|
|
367
338
|
lookup_access_role_scope_value :writer, :special, group
|
368
339
|
end
|
369
340
|
|
370
|
-
##
|
371
|
-
# Checks writer access for a view.
|
372
|
-
# The view can be a Gcloud::Bigquery::View object,
|
373
|
-
# or a string identifier as specified by the
|
374
|
-
# [Query
|
375
|
-
# Reference](https://cloud.google.com/bigquery/query-reference#from):
|
376
|
-
# +project_name:datasetId.tableId+.
|
377
|
-
def writer_view? view
|
378
|
-
lookup_access_role_scope_value :writer, :view, view
|
379
|
-
end
|
380
|
-
|
381
341
|
##
|
382
342
|
# Checks owner access for a user.
|
383
343
|
def owner_user? email
|
@@ -403,15 +363,21 @@ module Gcloud
|
|
403
363
|
lookup_access_role_scope_value :owner, :special, group
|
404
364
|
end
|
405
365
|
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
366
|
+
# @private
|
367
|
+
def self.from_gapi gapi
|
368
|
+
rules = Array gapi.access
|
369
|
+
new.tap do |s|
|
370
|
+
s.instance_variable_set :@rules, rules
|
371
|
+
s.instance_variable_set :@original_rules_hashes,
|
372
|
+
rules.map(&:to_h)
|
373
|
+
s.instance_variable_set :@dataset_reference,
|
374
|
+
gapi.dataset_reference
|
375
|
+
end
|
376
|
+
end
|
377
|
+
|
378
|
+
# @private
|
379
|
+
def to_gapi
|
380
|
+
@rules
|
415
381
|
end
|
416
382
|
|
417
383
|
protected
|
@@ -446,46 +412,94 @@ module Gcloud
|
|
446
412
|
if view.respond_to? :table_ref
|
447
413
|
view.table_ref
|
448
414
|
else
|
449
|
-
|
415
|
+
Service.table_ref_from_s view, @dataset_reference
|
450
416
|
end
|
451
417
|
end
|
452
418
|
|
453
419
|
# @private
|
454
420
|
def add_access_role_scope_value role, scope, value
|
455
|
-
role = validate_role
|
421
|
+
role = validate_role(role)
|
456
422
|
scope = validate_scope scope
|
457
423
|
# If scope is special group, make sure value is in the list
|
458
|
-
value = validate_special_group(value) if scope ==
|
459
|
-
# If scope is view, make sure value is in the right format
|
460
|
-
value = validate_view(value) if scope == "view"
|
424
|
+
value = validate_special_group(value) if scope == :special_group
|
461
425
|
# Remove any rules of this scope and value
|
462
|
-
|
426
|
+
@rules.reject!(&find_by_scope_and_value(scope, value))
|
427
|
+
# Add new rule for this role, scope, and value
|
428
|
+
opts = { role: role, scope => value }
|
429
|
+
@rules << Google::Apis::BigqueryV2::Dataset::Access.new(opts)
|
430
|
+
end
|
431
|
+
|
432
|
+
# @private
|
433
|
+
def add_access_view value
|
434
|
+
# scope is view, make sure value is in the right format
|
435
|
+
value = validate_view(value)
|
436
|
+
# Remove existing view rule, if any
|
437
|
+
@rules.reject!(&find_view(value))
|
463
438
|
# Add new rule for this role, scope, and value
|
464
|
-
|
439
|
+
opts = { view: value }
|
440
|
+
@rules << Google::Apis::BigqueryV2::Dataset::Access.new(opts)
|
465
441
|
end
|
466
442
|
|
467
443
|
# @private
|
468
444
|
def remove_access_role_scope_value role, scope, value
|
469
|
-
role = validate_role
|
445
|
+
role = validate_role(role)
|
470
446
|
scope = validate_scope scope
|
471
447
|
# If scope is special group, make sure value is in the list
|
472
|
-
value = validate_special_group(value) if scope ==
|
473
|
-
# If scope is view, make sure value is in the right format
|
474
|
-
value = validate_view(value) if scope == "view"
|
448
|
+
value = validate_special_group(value) if scope == :special_group
|
475
449
|
# Remove any rules of this role, scope, and value
|
476
|
-
|
450
|
+
@rules.reject!(
|
451
|
+
&find_by_role_and_scope_and_value(role, scope, value))
|
452
|
+
end
|
453
|
+
|
454
|
+
# @private
|
455
|
+
def remove_access_view value
|
456
|
+
# scope is view, make sure value is in the right format
|
457
|
+
value = validate_view(value)
|
458
|
+
# Remove existing view rule, if any
|
459
|
+
@rules.reject!(&find_view(value))
|
477
460
|
end
|
478
461
|
|
479
462
|
# @private
|
480
463
|
def lookup_access_role_scope_value role, scope, value
|
481
|
-
role = validate_role
|
464
|
+
role = validate_role(role)
|
482
465
|
scope = validate_scope scope
|
483
466
|
# If scope is special group, make sure value is in the list
|
484
|
-
value = validate_special_group(value) if scope ==
|
485
|
-
# If scope is view, make sure value is in the right format
|
486
|
-
value = validate_view(value) if scope == "view"
|
467
|
+
value = validate_special_group(value) if scope == :special_group
|
487
468
|
# Detect any rules of this role, scope, and value
|
488
|
-
!(
|
469
|
+
!(!@rules.detect(
|
470
|
+
&find_by_role_and_scope_and_value(role, scope, value)))
|
471
|
+
end
|
472
|
+
|
473
|
+
# @private
|
474
|
+
def lookup_access_view value
|
475
|
+
# scope is view, make sure value is in the right format
|
476
|
+
value = validate_view(value)
|
477
|
+
# Detect view rule, if any
|
478
|
+
!(!@rules.detect(&find_view(value)))
|
479
|
+
end
|
480
|
+
|
481
|
+
# @private
|
482
|
+
def find_by_role_and_scope_and_value role, scope, value
|
483
|
+
lambda do |a|
|
484
|
+
h = a.to_h
|
485
|
+
h[:role] == role && h[scope] == value
|
486
|
+
end
|
487
|
+
end
|
488
|
+
|
489
|
+
# @private
|
490
|
+
def find_by_scope_and_value scope, value
|
491
|
+
lambda do |a|
|
492
|
+
h = a.to_h
|
493
|
+
h[scope] == value
|
494
|
+
end
|
495
|
+
end
|
496
|
+
|
497
|
+
# @private
|
498
|
+
def find_view value
|
499
|
+
lambda do |a|
|
500
|
+
h = a.to_h
|
501
|
+
h[:view].to_h == value.to_h
|
502
|
+
end
|
489
503
|
end
|
490
504
|
end
|
491
505
|
end
|
@@ -71,14 +71,10 @@ module Gcloud
|
|
71
71
|
# end
|
72
72
|
def next
|
73
73
|
return nil unless next?
|
74
|
-
|
74
|
+
ensure_service!
|
75
75
|
options = { all: @hidden, token: token, max: @max }
|
76
|
-
|
77
|
-
|
78
|
-
self.class.from_response resp, @connection
|
79
|
-
else
|
80
|
-
fail ApiError.from_response(resp)
|
81
|
-
end
|
76
|
+
gapi = @service.list_datasets options
|
77
|
+
self.class.from_gapi gapi, @service, @hidden, @max
|
82
78
|
end
|
83
79
|
|
84
80
|
##
|
@@ -148,24 +144,24 @@ module Gcloud
|
|
148
144
|
|
149
145
|
##
|
150
146
|
# @private New Dataset::List from a response object.
|
151
|
-
def self.
|
152
|
-
datasets = List.new(Array(
|
153
|
-
Dataset.from_gapi gapi_object,
|
147
|
+
def self.from_gapi gapi_list, service, hidden = nil, max = nil
|
148
|
+
datasets = List.new(Array(gapi_list.datasets).map do |gapi_object|
|
149
|
+
Dataset.from_gapi gapi_object, service
|
154
150
|
end)
|
155
|
-
datasets.instance_variable_set
|
156
|
-
datasets.instance_variable_set
|
157
|
-
datasets.instance_variable_set
|
158
|
-
datasets.instance_variable_set
|
159
|
-
datasets.instance_variable_set
|
151
|
+
datasets.instance_variable_set :@token, gapi_list.next_page_token
|
152
|
+
datasets.instance_variable_set :@etag, gapi_list.etag
|
153
|
+
datasets.instance_variable_set :@service, service
|
154
|
+
datasets.instance_variable_set :@hidden, hidden
|
155
|
+
datasets.instance_variable_set :@max, max
|
160
156
|
datasets
|
161
157
|
end
|
162
158
|
|
163
159
|
protected
|
164
160
|
|
165
161
|
##
|
166
|
-
# Raise an error unless an active
|
167
|
-
def
|
168
|
-
fail "Must have active connection" unless @
|
162
|
+
# Raise an error unless an active service is available.
|
163
|
+
def ensure_service!
|
164
|
+
fail "Must have active connection" unless @service
|
169
165
|
end
|
170
166
|
end
|
171
167
|
end
|
@@ -32,25 +32,25 @@ module Gcloud
|
|
32
32
|
# The URI or URIs representing the Google Cloud Storage files to which
|
33
33
|
# the data is exported.
|
34
34
|
def destinations
|
35
|
-
Array
|
35
|
+
Array @gapi.configuration.extract.destination_uris
|
36
36
|
end
|
37
37
|
|
38
38
|
##
|
39
39
|
# The table from which the data is exported. This is the table upon
|
40
40
|
# which {Table#extract} was called. Returns a {Table} instance.
|
41
41
|
def source
|
42
|
-
table =
|
42
|
+
table = @gapi.configuration.extract.source_table
|
43
43
|
return nil unless table
|
44
|
-
retrieve_table table
|
45
|
-
table
|
46
|
-
table
|
44
|
+
retrieve_table table.project_id,
|
45
|
+
table.dataset_id,
|
46
|
+
table.table_id
|
47
47
|
end
|
48
48
|
|
49
49
|
##
|
50
50
|
# Checks if the export operation compresses the data using gzip. The
|
51
51
|
# default is `false`.
|
52
52
|
def compression?
|
53
|
-
val =
|
53
|
+
val = @gapi.configuration.extract.compression
|
54
54
|
val == "GZIP"
|
55
55
|
end
|
56
56
|
|
@@ -58,7 +58,7 @@ module Gcloud
|
|
58
58
|
# Checks if the destination format for the data is [newline-delimited
|
59
59
|
# JSON](http://jsonlines.org/). The default is `false`.
|
60
60
|
def json?
|
61
|
-
val =
|
61
|
+
val = @gapi.configuration.extract.destination_format
|
62
62
|
val == "NEWLINE_DELIMITED_JSON"
|
63
63
|
end
|
64
64
|
|
@@ -66,7 +66,7 @@ module Gcloud
|
|
66
66
|
# Checks if the destination format for the data is CSV. Tables with nested
|
67
67
|
# or repeated fields cannot be exported as CSV. The default is `true`.
|
68
68
|
def csv?
|
69
|
-
val =
|
69
|
+
val = @gapi.configuration.extract.destination_format
|
70
70
|
return true if val.nil?
|
71
71
|
val == "CSV"
|
72
72
|
end
|
@@ -75,7 +75,7 @@ module Gcloud
|
|
75
75
|
# Checks if the destination format for the data is
|
76
76
|
# [Avro](http://avro.apache.org/). The default is `false`.
|
77
77
|
def avro?
|
78
|
-
val =
|
78
|
+
val = @gapi.configuration.extract.destination_format
|
79
79
|
val == "AVRO"
|
80
80
|
end
|
81
81
|
|
@@ -83,7 +83,7 @@ module Gcloud
|
|
83
83
|
# The symbol the operation uses to delimit fields in the exported data.
|
84
84
|
# The default is a comma (,).
|
85
85
|
def delimiter
|
86
|
-
val =
|
86
|
+
val = @gapi.configuration.extract.field_delimiter
|
87
87
|
val = "," if val.nil?
|
88
88
|
val
|
89
89
|
end
|
@@ -92,7 +92,7 @@ module Gcloud
|
|
92
92
|
# Checks if the exported data contains a header row. The default is
|
93
93
|
# `true`.
|
94
94
|
def print_header?
|
95
|
-
val =
|
95
|
+
val = @gapi.configuration.extract.print_header
|
96
96
|
val = true if val.nil?
|
97
97
|
val
|
98
98
|
end
|
@@ -102,7 +102,7 @@ module Gcloud
|
|
102
102
|
# {#destinations}. Returns an Array of values in the same order as the URI
|
103
103
|
# patterns.
|
104
104
|
def destinations_file_counts
|
105
|
-
Array
|
105
|
+
Array @gapi.statistics.extract.destination_uri_file_counts
|
106
106
|
end
|
107
107
|
|
108
108
|
##
|