google-cloud-bigquery 1.21.2 → 1.26.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f38543236358fc319ecfcc2058ffa499e24034027aa56644924d2cf496815550
4
- data.tar.gz: 37196fa1c3db03e48df4cb0ae5ae5b9b1ee07b9d112063467ebc57d25b34551a
3
+ metadata.gz: 8c2f8d8d7a564df2c916cced8adf4c0b621a1e11250a3a04decfce08995a4a24
4
+ data.tar.gz: 57bbda27d4c54e0522b564b8cdc62fb5e9dce8b26c91d3f0604c624ff113f057
5
5
  SHA512:
6
- metadata.gz: a234359fb8a04b42f22725f5540cf0378b7e51b3d847ddd4f24ba41f2a54b4de85068bb9aee10089995c29794c0a64694223ac6bf88202eda6a646ce02c85275
7
- data.tar.gz: 99c6c915df70afde18de06907802c60d18df253238e6f3ab752827ea3cfc0aee0ab9bef8dc0816f5980db26334dd2b15ce0a2ecf7db3b026e2f0caa101dcafc8
6
+ metadata.gz: f445a86a5435cafc236d82faf91df46a06c6cee8612d8e6c4011450c93b73b61a883510909c6bb25e72516ae1a57c8a605736d82e0b63f0b10ad25cab90a1280
7
+ data.tar.gz: 43423f2bea5cea82c6c19bcf639bfb690f4718b0450140d299616ece59b147258ef877cafbc17b99c68274c310a0cd0123ae6b6db0b37bba2fb08be0395837f0
@@ -1,5 +1,59 @@
1
1
  # Release History
2
2
 
3
+ ### 1.26.0 / 2021-01-13
4
+
5
+ #### Features
6
+
7
+ * Add support for Hive Partitioning
8
+ * Add hive partitioning options to External::DataSource
9
+ * Add hive partitioning options to LoadJob and LoadJob::Updater
10
+ * Replace google-api-client with google-apis-bigquery_v2
11
+
12
+ ### 1.25.0 / 2020-11-16
13
+
14
+ #### Features
15
+
16
+ * Add routine (UDF) to Dataset::Access
17
+ * Add support for Table ACLS (IAM Policy)
18
+ * feat(bigquery): Add support for Table ACLS
19
+ * Add Bigquery::Policy
20
+ * Add Table#policy
21
+ * Add Table#test_iam_permissions
22
+ * Add Table#update_policy
23
+
24
+ ### 1.24.0 / 2020-10-29
25
+
26
+ #### Features
27
+
28
+ * Add iamMember to Dataset::Access
29
+
30
+ #### Bug Fixes
31
+
32
+ * Ensure dense encoding of JSON responses
33
+ * Set query param prettyPrint=false for all requests.
34
+ * Upgrade google-api-client to ~> 0.47
35
+
36
+ #### Documentation
37
+
38
+ * Update supported types for time partition type
39
+
40
+ ### 1.23.0 / 2020-09-17
41
+
42
+ #### Features
43
+
44
+ * quota_project can be set via library configuration ([#7627](https://www.github.com/googleapis/google-cloud-ruby/issues/7627))
45
+
46
+ ### 1.22.0 / 2020-09-10
47
+
48
+ #### Features
49
+
50
+ * Add support for ML model export
51
+ * Add model support to Project#extract and #extract_job
52
+ * Add ExtractJob#model?
53
+ * Add ExtractJob#ml_tf_saved_model?
54
+ * Add ExtractJob#ml_xgboost_booster?
55
+ * Add Model#extract and #extract_job
56
+
3
57
  ### 1.21.2 / 2020-07-21
4
58
 
5
59
  #### Documentation
@@ -45,7 +45,7 @@ there is a small amount of setup:
45
45
 
46
46
  ```sh
47
47
  $ cd google-cloud-bigquery/
48
- $ bundle exec rake bundleupdate
48
+ $ bundle install
49
49
  ```
50
50
 
51
51
  ## Console
@@ -133,6 +133,7 @@ Google::Cloud.configure.add_config! :bigquery do |config|
133
133
  config.add_field! :credentials, default_creds, match: [String, Hash, Google::Auth::Credentials], allow_nil: true
134
134
  config.add_alias! :keyfile, :credentials
135
135
  config.add_field! :scope, nil, match: [String, Array]
136
+ config.add_field! :quota_project, nil, match: String
136
137
  config.add_field! :retries, nil, match: Integer
137
138
  config.add_field! :timeout, nil, match: Integer
138
139
  config.add_field! :endpoint, nil, match: String
@@ -84,7 +84,7 @@ module Google
84
84
  Bigquery::Project.new(
85
85
  Bigquery::Service.new(
86
86
  project_id, credentials,
87
- retries: retries, timeout: timeout, host: endpoint
87
+ retries: retries, timeout: timeout, host: endpoint, quota_project: configure.quota_project
88
88
  )
89
89
  )
90
90
  end
@@ -318,7 +318,9 @@ module Google
318
318
  "parquet" => "PARQUET",
319
319
  "datastore" => "DATASTORE_BACKUP",
320
320
  "backup" => "DATASTORE_BACKUP",
321
- "datastore_backup" => "DATASTORE_BACKUP"
321
+ "datastore_backup" => "DATASTORE_BACKUP",
322
+ "ml_tf_saved_model" => "ML_TF_SAVED_MODEL",
323
+ "ml_xgboost_booster" => "ML_XGBOOST_BOOSTER"
322
324
  }[format.to_s.downcase]
323
325
  return val unless val.nil?
324
326
  format
@@ -272,12 +272,21 @@ module Google
272
272
  # Sets the labels to use for the job.
273
273
  #
274
274
  # @param [Hash] value A hash of user-provided labels associated with
275
- # the job. You can use these to organize and group your jobs. Label
276
- # keys and values can be no longer than 63 characters, can only
277
- # contain lowercase letters, numeric characters, underscores and
278
- # dashes. International characters are allowed. Label values are
279
- # optional. Label keys must start with a letter and each label in
280
- # the list must have a different key.
275
+ # the job. You can use these to organize and group your jobs.
276
+ #
277
+ # The labels applied to a resource must meet the following requirements:
278
+ #
279
+ # * Each resource can have multiple labels, up to a maximum of 64.
280
+ # * Each label must be a key-value pair.
281
+ # * Keys have a minimum length of 1 character and a maximum length of
282
+ # 63 characters, and cannot be empty. Values can be empty, and have
283
+ # a maximum length of 63 characters.
284
+ # * Keys and values can contain only lowercase letters, numeric characters,
285
+ # underscores, and dashes. All characters must use UTF-8 encoding, and
286
+ # international characters are allowed.
287
+ # * The key portion of a label must be unique. However, you can use the
288
+ # same key with multiple resources.
289
+ # * Keys must start with a lowercase letter or international character.
281
290
  #
282
291
  # @!group Attributes
283
292
  def labels= value
@@ -313,12 +313,19 @@ module Google
313
313
  # @param [Hash<String, String>] labels A hash containing key/value
314
314
  # pairs.
315
315
  #
316
- # * Label keys and values can be no longer than 63 characters.
317
- # * Label keys and values can contain only lowercase letters, numbers,
318
- # underscores, hyphens, and international characters.
319
- # * Label keys and values cannot exceed 128 bytes in size.
320
- # * Label keys must begin with a letter.
321
- # * Label keys must be unique within a dataset.
316
+ # The labels applied to a resource must meet the following requirements:
317
+ #
318
+ # * Each resource can have multiple labels, up to a maximum of 64.
319
+ # * Each label must be a key-value pair.
320
+ # * Keys have a minimum length of 1 character and a maximum length of
321
+ # 63 characters, and cannot be empty. Values can be empty, and have
322
+ # a maximum length of 63 characters.
323
+ # * Keys and values can contain only lowercase letters, numeric characters,
324
+ # underscores, and dashes. All characters must use UTF-8 encoding, and
325
+ # international characters are allowed.
326
+ # * The key portion of a label must be unique. However, you can use the
327
+ # same key with multiple resources.
328
+ # * Keys must start with a lowercase letter or international character.
322
329
  #
323
330
  # @example
324
331
  # require "google/cloud/bigquery"
@@ -1171,13 +1178,21 @@ module Google
1171
1178
  # is 1,024 characters. If `job_id` is provided, then `prefix` will not
1172
1179
  # be used.
1173
1180
  # @param [Hash] labels A hash of user-provided labels associated with
1174
- # the job. You can use these to organize and group your jobs. Label
1175
- # keys and values can be no longer than 63 characters, can only
1176
- # contain lowercase letters, numeric characters, underscores and
1177
- # dashes. International characters are allowed. Label values are
1178
- # optional. Label keys must start with a letter and each label in the
1179
- # list must have a different key. See [Requirements for
1180
- # labels](https://cloud.google.com/bigquery/docs/creating-managing-labels#requirements).
1181
+ # the job. You can use these to organize and group your jobs.
1182
+ #
1183
+ # The labels applied to a resource must meet the following requirements:
1184
+ #
1185
+ # * Each resource can have multiple labels, up to a maximum of 64.
1186
+ # * Each label must be a key-value pair.
1187
+ # * Keys have a minimum length of 1 character and a maximum length of
1188
+ # 63 characters, and cannot be empty. Values can be empty, and have
1189
+ # a maximum length of 63 characters.
1190
+ # * Keys and values can contain only lowercase letters, numeric characters,
1191
+ # underscores, and dashes. All characters must use UTF-8 encoding, and
1192
+ # international characters are allowed.
1193
+ # * The key portion of a label must be unique. However, you can use the
1194
+ # same key with multiple resources.
1195
+ # * Keys must start with a lowercase letter or international character.
1181
1196
  # @param [Array<String>, String] udfs User-defined function resources
1182
1197
  # used in a legacy SQL query. May be either a code resource to load from
1183
1198
  # a Google Cloud Storage URI (`gs://bucket/path`), or an inline resource
@@ -1792,13 +1807,21 @@ module Google
1792
1807
  # is 1,024 characters. If `job_id` is provided, then `prefix` will not
1793
1808
  # be used.
1794
1809
  # @param [Hash] labels A hash of user-provided labels associated with
1795
- # the job. You can use these to organize and group your jobs. Label
1796
- # keys and values can be no longer than 63 characters, can only
1797
- # contain lowercase letters, numeric characters, underscores and
1798
- # dashes. International characters are allowed. Label values are
1799
- # optional. Label keys must start with a letter and each label in the
1800
- # list must have a different key. See [Requirements for
1801
- # labels](https://cloud.google.com/bigquery/docs/creating-managing-labels#requirements).
1810
+ # the job. You can use these to organize and group your jobs.
1811
+ #
1812
+ # The labels applied to a resource must meet the following requirements:
1813
+ #
1814
+ # * Each resource can have multiple labels, up to a maximum of 64.
1815
+ # * Each label must be a key-value pair.
1816
+ # * Keys have a minimum length of 1 character and a maximum length of
1817
+ # 63 characters, and cannot be empty. Values can be empty, and have
1818
+ # a maximum length of 63 characters.
1819
+ # * Keys and values can contain only lowercase letters, numeric characters,
1820
+ # underscores, and dashes. All characters must use UTF-8 encoding, and
1821
+ # international characters are allowed.
1822
+ # * The key portion of a label must be unique. However, you can use the
1823
+ # same key with multiple resources.
1824
+ # * Keys must start with a lowercase letter or international character.
1802
1825
  # @yield [updater] A block for setting the schema and other
1803
1826
  # options for the destination table. The schema can be omitted if the
1804
1827
  # destination table already exists, or if you're loading data from a
@@ -48,16 +48,19 @@ module Google
48
48
 
49
49
  # @private
50
50
  SCOPES = {
51
- "user" => :user_by_email,
52
- "user_by_email" => :user_by_email,
53
- "userByEmail" => :user_by_email,
51
+ "domain" => :domain,
54
52
  "group" => :group_by_email,
55
53
  "group_by_email" => :group_by_email,
56
54
  "groupByEmail" => :group_by_email,
57
- "domain" => :domain,
55
+ "iam_member" => :iam_member,
56
+ "iamMember" => :iam_member,
57
+ "routine" => :routine,
58
58
  "special" => :special_group,
59
59
  "special_group" => :special_group,
60
60
  "specialGroup" => :special_group,
61
+ "user" => :user_by_email,
62
+ "user_by_email" => :user_by_email,
63
+ "userByEmail" => :user_by_email,
61
64
  "view" => :view
62
65
  }.freeze
63
66
 
@@ -150,6 +153,26 @@ module Google
150
153
  add_access_role_scope_value :reader, :group, email
151
154
  end
152
155
 
156
+ ##
157
+ # Add reader access to some other type of member that appears in the IAM
158
+ # Policy but isn't a user, group, domain, or special group.
159
+ #
160
+ # @param [String] identity The identity reference.
161
+ #
162
+ # @example
163
+ # require "google/cloud/bigquery"
164
+ #
165
+ # bigquery = Google::Cloud::Bigquery.new
166
+ # dataset = bigquery.dataset "my_dataset"
167
+ #
168
+ # dataset.access do |access|
169
+ # access.add_reader_iam_member "entity@example.com"
170
+ # end
171
+ #
172
+ def add_reader_iam_member identity
173
+ add_access_role_scope_value :reader, :iam_member, identity
174
+ end
175
+
153
176
  ##
154
177
  # Add reader access to a domain.
155
178
  #
@@ -190,6 +213,33 @@ module Google
190
213
  add_access_role_scope_value :reader, :special, group
191
214
  end
192
215
 
216
+ ##
217
+ # Add access to a routine from a different dataset. Queries executed
218
+ # against that routine will have read access to views/tables/routines
219
+ # in this dataset. Only UDF is supported for now. The role field is
220
+ # not required when this field is set. If that routine is updated by
221
+ # any user, access to the routine needs to be granted again via an
222
+ # update operation.
223
+ #
224
+ # @param [Google::Cloud::Bigquery::Routine] routine A routine object.
225
+ #
226
+ # @example
227
+ # require "google/cloud/bigquery"
228
+ #
229
+ # bigquery = Google::Cloud::Bigquery.new
230
+ # dataset = bigquery.dataset "my_dataset"
231
+ # other_dataset = bigquery.dataset "my_other_dataset", skip_lookup: true
232
+ #
233
+ # routine = other_dataset.routine "my_routine"
234
+ #
235
+ # dataset.access do |access|
236
+ # access.add_reader_routine routine
237
+ # end
238
+ #
239
+ def add_reader_routine routine
240
+ add_access_routine routine
241
+ end
242
+
193
243
  ##
194
244
  # Add reader access to a view.
195
245
  #
@@ -205,9 +255,9 @@ module Google
205
255
  #
206
256
  # bigquery = Google::Cloud::Bigquery.new
207
257
  # dataset = bigquery.dataset "my_dataset"
208
- # other_dataset = bigquery.dataset "my_other_dataset"
258
+ # other_dataset = bigquery.dataset "my_other_dataset", skip_lookup: true
209
259
  #
210
- # view = other_dataset.table "my_view"
260
+ # view = other_dataset.table "my_view", skip_lookup: true
211
261
  #
212
262
  # dataset.access do |access|
213
263
  # access.add_reader_view view
@@ -255,6 +305,26 @@ module Google
255
305
  add_access_role_scope_value :writer, :group, email
256
306
  end
257
307
 
308
+ ##
309
+ # Add writer access to some other type of member that appears in the IAM
310
+ # Policy but isn't a user, group, domain, or special group.
311
+ #
312
+ # @param [String] identity The identity reference.
313
+ #
314
+ # @example
315
+ # require "google/cloud/bigquery"
316
+ #
317
+ # bigquery = Google::Cloud::Bigquery.new
318
+ # dataset = bigquery.dataset "my_dataset"
319
+ #
320
+ # dataset.access do |access|
321
+ # access.add_writer_iam_member "entity@example.com"
322
+ # end
323
+ #
324
+ def add_writer_iam_member identity
325
+ add_access_role_scope_value :writer, :iam_member, identity
326
+ end
327
+
258
328
  ##
259
329
  # Add writer access to a domain.
260
330
  #
@@ -333,6 +403,26 @@ module Google
333
403
  add_access_role_scope_value :owner, :group, email
334
404
  end
335
405
 
406
+ ##
407
+ # Add owner access to some other type of member that appears in the IAM
408
+ # Policy but isn't a user, group, domain, or special group.
409
+ #
410
+ # @param [String] identity The identity reference.
411
+ #
412
+ # @example
413
+ # require "google/cloud/bigquery"
414
+ #
415
+ # bigquery = Google::Cloud::Bigquery.new
416
+ # dataset = bigquery.dataset "my_dataset"
417
+ #
418
+ # dataset.access do |access|
419
+ # access.add_owner_iam_member "entity@example.com"
420
+ # end
421
+ #
422
+ def add_owner_iam_member identity
423
+ add_access_role_scope_value :owner, :iam_member, identity
424
+ end
425
+
336
426
  ##
337
427
  # Add owner access to a domain.
338
428
  #
@@ -411,6 +501,26 @@ module Google
411
501
  remove_access_role_scope_value :reader, :group, email
412
502
  end
413
503
 
504
+ ##
505
+ # Remove reader access from some other type of member that appears in the IAM
506
+ # Policy but isn't a user, group, domain, or special group.
507
+ #
508
+ # @param [String] identity The identity reference.
509
+ #
510
+ # @example
511
+ # require "google/cloud/bigquery"
512
+ #
513
+ # bigquery = Google::Cloud::Bigquery.new
514
+ # dataset = bigquery.dataset "my_dataset"
515
+ #
516
+ # dataset.access do |access|
517
+ # access.remove_reader_iam_member "entity@example.com"
518
+ # end
519
+ #
520
+ def remove_reader_iam_member identity
521
+ remove_access_role_scope_value :reader, :iam_member, identity
522
+ end
523
+
414
524
  ##
415
525
  # Remove reader access from a domain.
416
526
  #
@@ -451,6 +561,28 @@ module Google
451
561
  remove_access_role_scope_value :reader, :special, group
452
562
  end
453
563
 
564
+ ##
565
+ # Remove reader access from a routine from a different dataset.
566
+ #
567
+ # @param [Google::Cloud::Bigquery::Routine] routine A routine object.
568
+ #
569
+ # @example
570
+ # require "google/cloud/bigquery"
571
+ #
572
+ # bigquery = Google::Cloud::Bigquery.new
573
+ # dataset = bigquery.dataset "my_dataset"
574
+ # other_dataset = bigquery.dataset "my_other_dataset", skip_lookup: true
575
+ #
576
+ # routine = other_dataset.routine "my_routine", skip_lookup: true
577
+ #
578
+ # dataset.access do |access|
579
+ # access.remove_reader_routine routine
580
+ # end
581
+ #
582
+ def remove_reader_routine routine
583
+ remove_access_routine routine
584
+ end
585
+
454
586
  ##
455
587
  # Remove reader access from a view.
456
588
  #
@@ -466,9 +598,9 @@ module Google
466
598
  #
467
599
  # bigquery = Google::Cloud::Bigquery.new
468
600
  # dataset = bigquery.dataset "my_dataset"
469
- # other_dataset = bigquery.dataset "my_other_dataset"
601
+ # other_dataset = bigquery.dataset "my_other_dataset", skip_lookup: true
470
602
  #
471
- # view = other_dataset.table "my_view"
603
+ # view = other_dataset.table "my_view", skip_lookup: true
472
604
  #
473
605
  # dataset.access do |access|
474
606
  # access.remove_reader_view view
@@ -516,6 +648,26 @@ module Google
516
648
  remove_access_role_scope_value :writer, :group, email
517
649
  end
518
650
 
651
+ ##
652
+ # Remove writer access from some other type of member that appears in the IAM
653
+ # Policy but isn't a user, group, domain, or special group.
654
+ #
655
+ # @param [String] identity The identity reference.
656
+ #
657
+ # @example
658
+ # require "google/cloud/bigquery"
659
+ #
660
+ # bigquery = Google::Cloud::Bigquery.new
661
+ # dataset = bigquery.dataset "my_dataset"
662
+ #
663
+ # dataset.access do |access|
664
+ # access.remove_writer_iam_member "entity@example.com"
665
+ # end
666
+ #
667
+ def remove_writer_iam_member identity
668
+ remove_access_role_scope_value :writer, :iam_member, identity
669
+ end
670
+
519
671
  ##
520
672
  # Remove writer access from a domain.
521
673
  #
@@ -594,6 +746,26 @@ module Google
594
746
  remove_access_role_scope_value :owner, :group, email
595
747
  end
596
748
 
749
+ ##
750
+ # Remove owner access from some other type of member that appears in the IAM
751
+ # Policy but isn't a user, group, domain, or special group.
752
+ #
753
+ # @param [String] identity The identity reference.
754
+ #
755
+ # @example
756
+ # require "google/cloud/bigquery"
757
+ #
758
+ # bigquery = Google::Cloud::Bigquery.new
759
+ # dataset = bigquery.dataset "my_dataset"
760
+ #
761
+ # dataset.access do |access|
762
+ # access.remove_owner_iam_member "entity@example.com"
763
+ # end
764
+ #
765
+ def remove_owner_iam_member identity
766
+ remove_access_role_scope_value :owner, :iam_member, identity
767
+ end
768
+
597
769
  ##
598
770
  # Remove owner access from a domain.
599
771
  #
@@ -670,6 +842,25 @@ module Google
670
842
  lookup_access_role_scope_value :reader, :group, email
671
843
  end
672
844
 
845
+ ##
846
+ # Checks reader access for some other type of member that appears in the IAM
847
+ # Policy but isn't a user, group, domain, or special group.
848
+ #
849
+ # @param [String] identity The identity reference.
850
+ #
851
+ # @example
852
+ # require "google/cloud/bigquery"
853
+ #
854
+ # bigquery = Google::Cloud::Bigquery.new
855
+ # dataset = bigquery.dataset "my_dataset"
856
+ #
857
+ # access = dataset.access
858
+ # access.reader_iam_member? "entity@example.com" #=> false
859
+ #
860
+ def reader_iam_member? identity
861
+ lookup_access_role_scope_value :reader, :iam_member, identity
862
+ end
863
+
673
864
  ##
674
865
  # Checks reader access for a domain.
675
866
  #
@@ -708,6 +899,32 @@ module Google
708
899
  lookup_access_role_scope_value :reader, :special, group
709
900
  end
710
901
 
902
+ ##
903
+ # Checks access for a routine from a different dataset. Queries executed
904
+ # against that routine will have read access to views/tables/routines
905
+ # in this dataset. Only UDF is supported for now. The role field is
906
+ # not required when this field is set. If that routine is updated by
907
+ # any user, access to the routine needs to be granted again via an
908
+ # update operation.
909
+ #
910
+ # @param [Google::Cloud::Bigquery::Routine] routine A routine object.
911
+ #
912
+ # @example
913
+ # require "google/cloud/bigquery"
914
+ #
915
+ # bigquery = Google::Cloud::Bigquery.new
916
+ # dataset = bigquery.dataset "my_dataset"
917
+ # other_dataset = bigquery.dataset "my_other_dataset", skip_lookup: true
918
+ #
919
+ # routine = other_dataset.routine "my_routine", skip_lookup: true
920
+ #
921
+ # access = dataset.access
922
+ # access.reader_routine? routine #=> false
923
+ #
924
+ def reader_routine? routine
925
+ lookup_access_routine routine
926
+ end
927
+
711
928
  ##
712
929
  # Checks reader access for a view.
713
930
  #
@@ -723,9 +940,9 @@ module Google
723
940
  #
724
941
  # bigquery = Google::Cloud::Bigquery.new
725
942
  # dataset = bigquery.dataset "my_dataset"
726
- # other_dataset = bigquery.dataset "my_other_dataset"
943
+ # other_dataset = bigquery.dataset "my_other_dataset", skip_lookup: true
727
944
  #
728
- # view = other_dataset.table "my_view"
945
+ # view = other_dataset.table "my_view", skip_lookup: true
729
946
  #
730
947
  # access = dataset.access
731
948
  # access.reader_view? view #=> false
@@ -770,6 +987,25 @@ module Google
770
987
  lookup_access_role_scope_value :writer, :group, email
771
988
  end
772
989
 
990
+ ##
991
+ # Checks writer access for some other type of member that appears in the IAM
992
+ # Policy but isn't a user, group, domain, or special group.
993
+ #
994
+ # @param [String] identity The identity reference.
995
+ #
996
+ # @example
997
+ # require "google/cloud/bigquery"
998
+ #
999
+ # bigquery = Google::Cloud::Bigquery.new
1000
+ # dataset = bigquery.dataset "my_dataset"
1001
+ #
1002
+ # access = dataset.access
1003
+ # access.writer_iam_member? "entity@example.com" #=> false
1004
+ #
1005
+ def writer_iam_member? identity
1006
+ lookup_access_role_scope_value :writer, :iam_member, identity
1007
+ end
1008
+
773
1009
  ##
774
1010
  # Checks writer access for a domain.
775
1011
  #
@@ -844,6 +1080,25 @@ module Google
844
1080
  lookup_access_role_scope_value :owner, :group, email
845
1081
  end
846
1082
 
1083
+ ##
1084
+ # Checks owner access for some other type of member that appears in the IAM
1085
+ # Policy but isn't a user, group, domain, or special group.
1086
+ #
1087
+ # @param [String] identity The identity reference.
1088
+ #
1089
+ # @example
1090
+ # require "google/cloud/bigquery"
1091
+ #
1092
+ # bigquery = Google::Cloud::Bigquery.new
1093
+ # dataset = bigquery.dataset "my_dataset"
1094
+ #
1095
+ # access = dataset.access
1096
+ # access.owner_iam_member? "entity@example.com" #=> false
1097
+ #
1098
+ def owner_iam_member? identity
1099
+ lookup_access_role_scope_value :owner, :iam_member, identity
1100
+ end
1101
+
847
1102
  ##
848
1103
  # Checks owner access for a domain.
849
1104
  #
@@ -942,12 +1197,22 @@ module Google
942
1197
  @rules << Google::Apis::BigqueryV2::Dataset::Access.new(opts)
943
1198
  end
944
1199
 
1200
+ # @private
1201
+ def add_access_routine routine
1202
+ value = routine.routine_ref
1203
+ # Remove existing routine rule, if any
1204
+ @rules.reject!(&find_by_scope_and_resource_ref(:routine, value))
1205
+ # Add new rule for this role, scope, and value
1206
+ opts = { routine: value }
1207
+ @rules << Google::Apis::BigqueryV2::Dataset::Access.new(opts)
1208
+ end
1209
+
945
1210
  # @private
946
1211
  def add_access_view value
947
1212
  # scope is view, make sure value is in the right format
948
1213
  value = validate_view value
949
1214
  # Remove existing view rule, if any
950
- @rules.reject!(&find_view(value))
1215
+ @rules.reject!(&find_by_scope_and_resource_ref(:view, value))
951
1216
  # Add new rule for this role, scope, and value
952
1217
  opts = { view: value }
953
1218
  @rules << Google::Apis::BigqueryV2::Dataset::Access.new(opts)
@@ -965,12 +1230,18 @@ module Google
965
1230
  )
966
1231
  end
967
1232
 
1233
+ # @private
1234
+ def remove_access_routine routine
1235
+ # Remove existing routine rule, if any
1236
+ @rules.reject!(&find_by_scope_and_resource_ref(:routine, routine.routine_ref))
1237
+ end
1238
+
968
1239
  # @private
969
1240
  def remove_access_view value
970
1241
  # scope is view, make sure value is in the right format
971
1242
  value = validate_view value
972
1243
  # Remove existing view rule, if any
973
- @rules.reject!(&find_view(value))
1244
+ @rules.reject!(&find_by_scope_and_resource_ref(:view, value))
974
1245
  end
975
1246
 
976
1247
  # @private
@@ -983,12 +1254,18 @@ module Google
983
1254
  !(!@rules.detect(&find_by_role_and_scope_and_value(role, scope, value)))
984
1255
  end
985
1256
 
1257
+ # @private
1258
+ def lookup_access_routine routine
1259
+ # Detect routine rule, if any
1260
+ !(!@rules.detect(&find_by_scope_and_resource_ref(:routine, routine.routine_ref)))
1261
+ end
1262
+
986
1263
  # @private
987
1264
  def lookup_access_view value
988
1265
  # scope is view, make sure value is in the right format
989
1266
  value = validate_view value
990
1267
  # Detect view rule, if any
991
- !(!@rules.detect(&find_view(value)))
1268
+ !(!@rules.detect(&find_by_scope_and_resource_ref(:view, value)))
992
1269
  end
993
1270
 
994
1271
  # @private
@@ -1007,11 +1284,11 @@ module Google
1007
1284
  end
1008
1285
  end
1009
1286
 
1010
- # @private
1011
- def find_view value
1287
+ # @private Compare hash representations to find table_ref, routine_ref.
1288
+ def find_by_scope_and_resource_ref scope, value
1012
1289
  lambda do |a|
1013
1290
  h = a.to_h
1014
- h[:view].to_h == value.to_h
1291
+ h[scope].to_h == value.to_h
1015
1292
  end
1016
1293
  end
1017
1294
  end