google-cloud-bigtable 0.6.1 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +4 -26
  3. data/CHANGELOG.md +85 -0
  4. data/CONTRIBUTING.md +1 -1
  5. data/OVERVIEW.md +388 -19
  6. data/lib/google-cloud-bigtable.rb +19 -22
  7. data/lib/google/bigtable/admin/v2/bigtable_table_admin_services_pb.rb +1 -1
  8. data/lib/google/bigtable/v2/bigtable_pb.rb +3 -0
  9. data/lib/google/bigtable/v2/bigtable_services_pb.rb +1 -1
  10. data/lib/google/cloud/bigtable.rb +11 -17
  11. data/lib/google/cloud/bigtable/admin.rb +1 -1
  12. data/lib/google/cloud/bigtable/admin/v2.rb +1 -1
  13. data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb +1 -1
  14. data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/policy.rb +42 -21
  15. data/lib/google/cloud/bigtable/app_profile.rb +162 -96
  16. data/lib/google/cloud/bigtable/app_profile/job.rb +5 -8
  17. data/lib/google/cloud/bigtable/app_profile/list.rb +18 -12
  18. data/lib/google/cloud/bigtable/chunk_processor.rb +24 -36
  19. data/lib/google/cloud/bigtable/cluster.rb +45 -18
  20. data/lib/google/cloud/bigtable/cluster/job.rb +3 -7
  21. data/lib/google/cloud/bigtable/cluster/list.rb +22 -20
  22. data/lib/google/cloud/bigtable/column_family.rb +18 -231
  23. data/lib/google/cloud/bigtable/column_family_map.rb +426 -0
  24. data/lib/google/cloud/bigtable/column_range.rb +15 -7
  25. data/lib/google/cloud/bigtable/convert.rb +12 -4
  26. data/lib/google/cloud/bigtable/errors.rb +4 -1
  27. data/lib/google/cloud/bigtable/gc_rule.rb +188 -69
  28. data/lib/google/cloud/bigtable/instance.rb +209 -189
  29. data/lib/google/cloud/bigtable/instance/cluster_map.rb +17 -13
  30. data/lib/google/cloud/bigtable/instance/job.rb +6 -5
  31. data/lib/google/cloud/bigtable/instance/list.rb +18 -13
  32. data/lib/google/cloud/bigtable/longrunning_job.rb +7 -1
  33. data/lib/google/cloud/bigtable/mutation_entry.rb +36 -39
  34. data/lib/google/cloud/bigtable/mutation_operations.rb +90 -73
  35. data/lib/google/cloud/bigtable/policy.rb +9 -5
  36. data/lib/google/cloud/bigtable/project.rb +87 -196
  37. data/lib/google/cloud/bigtable/read_modify_write_rule.rb +15 -10
  38. data/lib/google/cloud/bigtable/read_operations.rb +42 -59
  39. data/lib/google/cloud/bigtable/routing_policy.rb +172 -0
  40. data/lib/google/cloud/bigtable/row.rb +32 -21
  41. data/lib/google/cloud/bigtable/row_filter.rb +80 -35
  42. data/lib/google/cloud/bigtable/row_filter/chain_filter.rb +119 -68
  43. data/lib/google/cloud/bigtable/row_filter/condition_filter.rb +8 -2
  44. data/lib/google/cloud/bigtable/row_filter/interleave_filter.rb +117 -66
  45. data/lib/google/cloud/bigtable/row_filter/simple_filter.rb +24 -9
  46. data/lib/google/cloud/bigtable/row_range.rb +5 -0
  47. data/lib/google/cloud/bigtable/rows_mutator.rb +14 -21
  48. data/lib/google/cloud/bigtable/rows_reader.rb +23 -18
  49. data/lib/google/cloud/bigtable/sample_row_key.rb +6 -3
  50. data/lib/google/cloud/bigtable/service.rb +200 -253
  51. data/lib/google/cloud/bigtable/status.rb +76 -0
  52. data/lib/google/cloud/bigtable/table.rb +158 -262
  53. data/lib/google/cloud/bigtable/table/cluster_state.rb +17 -6
  54. data/lib/google/cloud/bigtable/table/list.rb +16 -9
  55. data/lib/google/cloud/bigtable/v2.rb +1 -1
  56. data/lib/google/cloud/bigtable/v2/bigtable_client.rb +12 -12
  57. data/lib/google/cloud/bigtable/v2/doc/google/bigtable/v2/bigtable.rb +16 -13
  58. data/lib/google/cloud/bigtable/value_range.rb +19 -13
  59. data/lib/google/cloud/bigtable/version.rb +1 -1
  60. metadata +67 -25
  61. data/lib/google/cloud/bigtable/table/column_family_map.rb +0 -70
@@ -35,30 +35,25 @@ module Google
35
35
  # Creates a new Service instance.
36
36
  #
37
37
  # @param project_id [String] Project identifier
38
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
39
- # The means for authenticating requests made by the client. This parameter can
40
- # be one of the following types.
41
- # `Google::Auth::Credentials` uses the properties of its represented keyfile for
42
- # authenticating requests made by this client.
43
- # `String` will be treated as the path to the keyfile to use to construct
44
- # credentials for this client.
45
- # `Hash` will be treated as the contents of a keyfile to use to construct
46
- # credentials for this client.
38
+ # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel,
39
+ # GRPC::Core::ChannelCredentials, Proc]
40
+ # The means for authenticating requests made by the client. This parameter can be one of the following types.
41
+ # `Google::Auth::Credentials` uses the properties of its represented keyfile for authenticating requests made
42
+ # by this client.
43
+ # `String` will be treated as the path to the keyfile to use to construct credentials for this client.
44
+ # `Hash` will be treated as the contents of a keyfile to use to construct credentials for this client.
47
45
  # `GRPC::Core::Channel` will be used to make calls through.
48
- # `GRPC::Core::ChannelCredentials` will be used to set up the gRPC client. The channel credentials
49
- # should already be composed with a `GRPC::Core::CallCredentials` object.
50
- # `Proc` will be used as an updater_proc for the gRPC channel. The proc transforms the
51
- # metadata for requests, generally, to give OAuth credentials.
46
+ # `GRPC::Core::ChannelCredentials` will be used to set up the gRPC client. The channel credentials should
47
+ # already be composed with a `GRPC::Core::CallCredentials` object.
48
+ # `Proc` will be used as an updater_proc for the gRPC channel. The proc transforms the metadata for requests,
49
+ # generally, to give OAuth credentials.
52
50
  # @param timeout [Integer]
53
51
  # The default timeout, in seconds, for calls made through this client.
54
52
  # @param client_config [Hash]
55
- # A hash for call options for each method.
56
- # See Google::Gax#construct_settings for the structure of
57
- # this data. Falls back to the default config if not specified
58
- # or the specified config is missing data points.
59
-
60
- def initialize project_id, credentials, host: nil, timeout: nil,
61
- client_config: nil
53
+ # A hash for call options for each method. See Google::Gax#construct_settings for the structure of this data.
54
+ # Falls back to the default config if not specified or the specified config is missing data points.
55
+ #
56
+ def initialize project_id, credentials, host: nil, timeout: nil, client_config: nil
62
57
  @project_id = project_id
63
58
  @credentials = credentials
64
59
  @host = host
@@ -72,74 +67,73 @@ module Google
72
67
  end
73
68
 
74
69
  def chan_args
75
- { "grpc.max_send_message_length" => -1,
76
- "grpc.max_receive_message_length" => -1,
70
+ { "grpc.max_send_message_length" => -1,
71
+ "grpc.max_receive_message_length" => -1,
77
72
  "grpc.service_config_disable_resolution" => 1 }
78
73
  end
79
74
 
80
75
  def chan_creds
81
76
  return credentials if insecure?
82
77
  require "grpc"
83
- GRPC::Core::ChannelCredentials.new.compose \
84
- GRPC::Core::CallCredentials.new credentials.client.updater_proc
78
+ GRPC::Core::ChannelCredentials.new.compose GRPC::Core::CallCredentials.new credentials.client.updater_proc
85
79
  end
86
80
 
81
+ ##
87
82
  # Creates or returns an instance of an instance admin client.
88
83
  #
89
84
  # @return [Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient]
90
-
85
+ #
91
86
  def instances
92
- @instances ||= begin
93
- instances_channel = channel(
94
- Admin::V2::BigtableInstanceAdminClient::SERVICE_ADDRESS
95
- )
96
- Admin::V2::BigtableInstanceAdminClient.new(
97
- credentials: instances_channel,
98
- timeout: timeout,
99
- client_config: client_config,
100
- lib_name: "gccl",
101
- lib_version: Google::Cloud::Bigtable::VERSION
102
- )
103
- end
87
+ return mocked_instances if mocked_instances
88
+ @instances ||= Admin::V2::BigtableInstanceAdminClient.new(
89
+ credentials: channel(Admin::V2::BigtableInstanceAdminClient::SERVICE_ADDRESS),
90
+ timeout: timeout,
91
+ client_config: client_config,
92
+ lib_name: "gccl",
93
+ lib_version: Google::Cloud::Bigtable::VERSION
94
+ )
104
95
  end
96
+ attr_accessor :mocked_instances
105
97
 
98
+ ##
106
99
  # Creates or returns an instance of a table admin client.
107
100
  #
108
101
  # @return [Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient]
109
-
102
+ #
110
103
  def tables
111
- @tables ||= begin
112
- tables_channel = channel(
113
- Admin::V2::BigtableTableAdminClient::SERVICE_ADDRESS
114
- )
115
- Admin::V2::BigtableTableAdminClient.new(
116
- credentials: tables_channel,
117
- timeout: timeout,
118
- client_config: client_config,
119
- lib_name: "gccl",
120
- lib_version: Google::Cloud::Bigtable::VERSION
121
- )
122
- end
104
+ return mocked_tables if mocked_tables
105
+ @tables ||= Admin::V2::BigtableTableAdminClient.new(
106
+ credentials: channel(Admin::V2::BigtableTableAdminClient::SERVICE_ADDRESS),
107
+ timeout: timeout,
108
+ client_config: client_config,
109
+ lib_name: "gccl",
110
+ lib_version: Google::Cloud::Bigtable::VERSION
111
+ )
123
112
  end
113
+ attr_accessor :mocked_tables
124
114
 
115
+ ##
125
116
  # Creates an instance of a data client.
126
117
  #
127
118
  # @return [Google::Cloud::Bigtable::V2::BigtableClient]
128
-
119
+ #
129
120
  def client
130
- @client ||= \
131
- V2::BigtableClient.new(
132
- credentials: channel(V2::BigtableClient::SERVICE_ADDRESS),
133
- timeout: timeout,
134
- client_config: client_config,
135
- lib_name: "gccl",
136
- lib_version: Google::Cloud::Bigtable::VERSION
137
- )
121
+ return mocked_client if mocked_client
122
+ @client ||= V2::BigtableClient.new(
123
+ credentials: channel(V2::BigtableClient::SERVICE_ADDRESS),
124
+ timeout: timeout,
125
+ client_config: client_config,
126
+ lib_name: "gccl",
127
+ lib_version: Google::Cloud::Bigtable::VERSION
128
+ )
138
129
  end
130
+ attr_accessor :mocked_client
139
131
 
140
132
  def insecure?
141
133
  credentials == :this_channel_is_insecure
142
134
  end
135
+
136
+ ##
143
137
  # Creates an instance within a project.
144
138
  #
145
139
  # @param instance_id [String]
@@ -153,50 +147,40 @@ module Google
153
147
  # +projects/myproject/instances/myinstance/clusters/mycluster+.
154
148
  # Alternatively, provide a hash in the form of `Google::Bigtable::Admin::V2::Cluster`
155
149
  # @return [Google::Gax::Operation]
156
-
157
- def create_instance \
158
- instance_id,
159
- instance,
160
- clusters
150
+ #
151
+ def create_instance instance_id, instance, clusters
161
152
  execute do
162
- instances.create_instance(
163
- project_path,
164
- instance_id,
165
- instance,
166
- clusters
167
- )
153
+ instances.create_instance project_path, instance_id, instance, clusters
168
154
  end
169
155
  end
170
156
 
157
+ ##
171
158
  # Lists the instances in a project.
172
159
  #
173
160
  # @param token [String]
174
161
  # The value of +next_page_token+ returned by a previous call.
175
162
  # @return [Google::Bigtable::Admin::V2::ListInstancesResponse]
176
-
163
+ #
177
164
  def list_instances token: nil
178
165
  execute do
179
- instances.list_instances(
180
- project_path,
181
- page_token: token
182
- )
166
+ instances.list_instances project_path, page_token: token
183
167
  end
184
168
  end
185
169
 
170
+ ##
186
171
  # Gets information about an instance.
187
172
  #
188
173
  # @param instance_id [String]
189
174
  # Unique ID of the requested instance.
190
175
  # @return [Google::Bigtable::Admin::V2::Instance]
191
-
176
+ #
192
177
  def get_instance instance_id
193
178
  execute do
194
- instances.get_instance(
195
- instance_path(instance_id)
196
- )
179
+ instances.get_instance instance_path(instance_id)
197
180
  end
198
181
  end
199
182
 
183
+ ##
200
184
  # Partially updates an instance.
201
185
  #
202
186
  # @param instance [Google::Bigtable::Admin::V2::Instance | Hash]
@@ -207,18 +191,19 @@ module Google
207
191
  # Must be explicitly set.
208
192
  # Alternatively, provide a hash in the form of `Google::Protobuf::FieldMask`.
209
193
  # @return [Google::Gax::Operation]
210
-
194
+ #
211
195
  def partial_update_instance instance, update_mask
212
196
  execute do
213
- instances.partial_update_instance(instance, update_mask)
197
+ instances.partial_update_instance instance, update_mask
214
198
  end
215
199
  end
216
200
 
201
+ ##
217
202
  # Deletes an instance from a project.
218
203
  #
219
204
  # @param instance_id [String]
220
205
  # Unique ID of the instance to be deleted.
221
-
206
+ #
222
207
  def delete_instance instance_id
223
208
  execute do
224
209
  instances.delete_instance(
@@ -227,6 +212,7 @@ module Google
227
212
  end
228
213
  end
229
214
 
215
+ ##
230
216
  # Creates a cluster within an instance.
231
217
  #
232
218
  # @param instance_id [String]
@@ -238,21 +224,16 @@ module Google
238
224
  # Alternatively, provide a hash in the form of `Google::Bigtable::Admin::V2::Cluster`
239
225
  #
240
226
  # @return [Google::Gax::Operation]
241
-
227
+ #
242
228
  def create_cluster instance_id, cluster_id, cluster
243
- unless cluster.location == ""
244
- cluster.location = location_path(cluster.location)
245
- end
229
+ cluster.location = location_path cluster.location unless cluster.location == ""
246
230
 
247
231
  execute do
248
- instances.create_cluster(
249
- instance_path(instance_id),
250
- cluster_id,
251
- cluster
252
- )
232
+ instances.create_cluster instance_path(instance_id), cluster_id, cluster
253
233
  end
254
234
  end
255
235
 
236
+ ##
256
237
  # Lists information about clusters in an instance.
257
238
  #
258
239
  # @param instance_id [String]
@@ -260,16 +241,14 @@ module Google
260
241
  # @param token [String]
261
242
  # The value of +next_page_token+ returned by a previous call.
262
243
  # @return [Google::Bigtable::Admin::V2::ListClustersResponse]
263
-
244
+ #
264
245
  def list_clusters instance_id, token: nil
265
246
  execute do
266
- instances.list_clusters(
267
- instance_path(instance_id),
268
- page_token: token
269
- )
247
+ instances.list_clusters instance_path(instance_id), page_token: token
270
248
  end
271
249
  end
272
250
 
251
+ ##
273
252
  # Gets information about a cluster.
274
253
  #
275
254
  # @param instance_id [String]
@@ -277,15 +256,14 @@ module Google
277
256
  # @param cluster_id [String]
278
257
  # Unique ID of the requested cluster.
279
258
  # @return [Google::Bigtable::Admin::V2::Cluster]
280
-
259
+ #
281
260
  def get_cluster instance_id, cluster_id
282
261
  execute do
283
- instances.get_cluster(
284
- cluster_path(instance_id, cluster_id)
285
- )
262
+ instances.get_cluster cluster_path(instance_id, cluster_id)
286
263
  end
287
264
  end
288
265
 
266
+ ##
289
267
  # Updates a cluster within an instance.
290
268
  #
291
269
  # @param instance_id [String]
@@ -301,32 +279,28 @@ module Google
301
279
  # The number of nodes allocated to this cluster. More nodes enable higher
302
280
  # throughput and more consistent performance.
303
281
  # @return [Google::Gax::Operation]
304
-
282
+ #
305
283
  def update_cluster instance_id, cluster_id, location, serve_nodes
306
284
  execute do
307
- instances.update_cluster(
308
- cluster_path(instance_id, cluster_id),
309
- location,
310
- serve_nodes
311
- )
285
+ instances.update_cluster cluster_path(instance_id, cluster_id), location, serve_nodes
312
286
  end
313
287
  end
314
288
 
289
+ ##
315
290
  # Deletes a cluster from an instance.
316
291
  #
317
292
  # @param instance_id [String]
318
293
  # Unique ID of the instance the cluster is in.
319
294
  # @param cluster_id [String]
320
295
  # Unique ID of the cluster to be deleted.
321
-
296
+ #
322
297
  def delete_cluster instance_id, cluster_id
323
298
  execute do
324
- instances.delete_cluster(
325
- cluster_path(instance_id, cluster_id)
326
- )
299
+ instances.delete_cluster cluster_path(instance_id, cluster_id)
327
300
  end
328
301
  end
329
302
 
303
+ ##
330
304
  # Creates a new table in the specified instance.
331
305
  # Optionally, creates the table with a full set of initial column families.
332
306
  #
@@ -357,26 +331,16 @@ module Google
357
331
  # Alternatively, provide a hash in the form of
358
332
  # `Google::Bigtable::Admin::V2::CreateTableRequest::Split`
359
333
  # @return [Google::Bigtable::Admin::V2::Table]
360
-
361
- def create_table \
362
- instance_id,
363
- table_id,
364
- table,
365
- initial_splits: nil
366
- if initial_splits
367
- initial_splits = initial_splits.map { |key| { key: key } }
368
- end
334
+ #
335
+ def create_table instance_id, table_id, table, initial_splits: nil
336
+ initial_splits = initial_splits.map { |key| { key: key } } if initial_splits
369
337
 
370
338
  execute do
371
- tables.create_table(
372
- instance_path(instance_id),
373
- table_id,
374
- table,
375
- initial_splits: initial_splits
376
- )
339
+ tables.create_table instance_path(instance_id), table_id, table, initial_splits: initial_splits
377
340
  end
378
341
  end
379
342
 
343
+ ##
380
344
  # Lists all tables in an instance.
381
345
  #
382
346
  # @param instance_id [String]
@@ -388,16 +352,14 @@ module Google
388
352
  # An enumerable of Google::Bigtable::Admin::V2::Table instances.
389
353
  # See Google::Gax::PagedEnumerable documentation for other
390
354
  # operations such as per-page iteration or access to the response.
391
-
355
+ #
392
356
  def list_tables instance_id, view: nil
393
357
  execute do
394
- tables.list_tables(
395
- instance_path(instance_id),
396
- view: view
397
- )
358
+ tables.list_tables instance_path(instance_id), view: view
398
359
  end
399
360
  end
400
361
 
362
+ ##
401
363
  # Gets metadata about the specified table.
402
364
  #
403
365
  # @param instance_id [String]
@@ -408,31 +370,28 @@ module Google
408
370
  # View to be applied to the returned table's fields.
409
371
  # Defaults to +SCHEMA_VIEW+ if unspecified.
410
372
  # @return [Google::Bigtable::Admin::V2::Table]
411
-
373
+ #
412
374
  def get_table instance_id, table_id, view: nil
413
375
  execute do
414
- tables.get_table(
415
- table_path(instance_id, table_id),
416
- view: view
417
- )
376
+ tables.get_table table_path(instance_id, table_id), view: view
418
377
  end
419
378
  end
420
379
 
380
+ ##
421
381
  # Permanently deletes a table and all of its data.
422
382
  #
423
383
  # @param instance_id [String]
424
384
  # Unique ID of the instance the table is in.
425
385
  # @param table_id [String]
426
386
  # Unique ID of the table to be deleted.
427
-
387
+ #
428
388
  def delete_table instance_id, table_id
429
389
  execute do
430
- tables.delete_table(
431
- table_path(instance_id, table_id)
432
- )
390
+ tables.delete_table table_path(instance_id, table_id)
433
391
  end
434
392
  end
435
393
 
394
+ ##
436
395
  # Performs a series of column family modifications on the specified table.
437
396
  # Either all or none of the modifications will occur before this method
438
397
  # returns. Data requests received prior to completion of this method may reach a table
@@ -450,16 +409,14 @@ module Google
450
409
  # Alternatively, provide a hash in the form of
451
410
  # `Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification`.
452
411
  # @return [Google::Bigtable::Admin::V2::Table]
453
-
412
+ #
454
413
  def modify_column_families instance_id, table_id, modifications
455
414
  execute do
456
- tables.modify_column_families(
457
- table_path(instance_id, table_id),
458
- modifications
459
- )
415
+ tables.modify_column_families table_path(instance_id, table_id), modifications
460
416
  end
461
417
  end
462
418
 
419
+ ##
463
420
  # Generates a consistency token for a table.
464
421
  # The consistency token can be be used in CheckConsistency to check whether
465
422
  # mutations to the table that finished before this call started have been replicated.
@@ -470,15 +427,14 @@ module Google
470
427
  # @param table_id [String]
471
428
  # Unique ID of the table the consistency token is for.
472
429
  # @return [Google::Bigtable::Admin::V2::GenerateConsistencyTokenResponse]
473
-
430
+ #
474
431
  def generate_consistency_token instance_id, table_id
475
432
  execute do
476
- tables.generate_consistency_token(
477
- table_path(instance_id, table_id)
478
- )
433
+ tables.generate_consistency_token table_path(instance_id, table_id)
479
434
  end
480
435
  end
481
436
 
437
+ ##
482
438
  # Checks replication consistency based on a consistency token.
483
439
  # Determines if replication has caught up, based on the conditions in the token
484
440
  # and the check request.
@@ -490,16 +446,14 @@ module Google
490
446
  # @param token [String] Consistency token
491
447
  # The token created for the table using GenerateConsistencyToken.
492
448
  # @return [Google::Bigtable::Admin::V2::CheckConsistencyResponse]
493
-
449
+ #
494
450
  def check_consistency instance_id, table_id, token
495
451
  execute do
496
- tables.check_consistency(
497
- table_path(instance_id, table_id),
498
- token
499
- )
452
+ tables.check_consistency table_path(instance_id, table_id), token
500
453
  end
501
454
  end
502
455
 
456
+ ##
503
457
  # Permanently deletes a row range from a table. The request can
504
458
  # specify whether to delete all rows in a table or only rows that match a
505
459
  # particular row key prefix.
@@ -515,13 +469,8 @@ module Google
515
469
  # If true, delete all rows in the table. Setting this to false is a no-op.
516
470
  # @param timeout [Integer]
517
471
  # Sets the API call timeout if deadline exceeds exception.
518
-
519
- def drop_row_range \
520
- instance_id,
521
- table_id,
522
- row_key_prefix: nil,
523
- delete_all_data_from_table: nil,
524
- timeout: nil
472
+ #
473
+ def drop_row_range instance_id, table_id, row_key_prefix: nil, delete_all_data_from_table: nil, timeout: nil
525
474
  call_options = nil
526
475
 
527
476
  # Pass a timeout with a larger value if the drop operation throws
@@ -531,21 +480,20 @@ module Google
531
480
  [],
532
481
  Google::Gax::BackoffSettings.new(0, 0, 0, timeout * 1000, 0, 0, 0)
533
482
  )
534
- call_options = Google::Gax::CallOptions.new(
535
- retry_options: retry_options
536
- )
483
+ call_options = Google::Gax::CallOptions.new retry_options: retry_options
537
484
  end
538
485
 
539
486
  execute do
540
487
  tables.drop_row_range(
541
488
  table_path(instance_id, table_id),
542
- row_key_prefix: row_key_prefix,
489
+ row_key_prefix: row_key_prefix,
543
490
  delete_all_data_from_table: delete_all_data_from_table,
544
- options: call_options
491
+ options: call_options
545
492
  )
546
493
  end
547
494
  end
548
495
 
496
+ ##
549
497
  # Creates an app profile within an instance.
550
498
  #
551
499
  # @param instance_id [String]
@@ -559,12 +507,8 @@ module Google
559
507
  # @param ignore_warnings [Boolean]
560
508
  # If true, ignore safety checks when creating the app profile.
561
509
  # @return [Google::Bigtable::Admin::V2::AppProfile]
562
-
563
- def create_app_profile \
564
- instance_id,
565
- app_profile_id,
566
- app_profile,
567
- ignore_warnings: nil
510
+ #
511
+ def create_app_profile instance_id, app_profile_id, app_profile, ignore_warnings: nil
568
512
  execute do
569
513
  instances.create_app_profile(
570
514
  instance_path(instance_id),
@@ -575,6 +519,7 @@ module Google
575
519
  end
576
520
  end
577
521
 
522
+ ##
578
523
  # Gets information about an app profile.
579
524
  #
580
525
  # @param instance_id [String]
@@ -582,15 +527,14 @@ module Google
582
527
  # @param app_profile_id [String]
583
528
  # Unique ID of the requested app profile.
584
529
  # @return [Google::Bigtable::Admin::V2::AppProfile]
585
-
530
+ #
586
531
  def get_app_profile instance_id, app_profile_id
587
532
  execute do
588
- instances.get_app_profile(
589
- app_profile_path(instance_id, app_profile_id)
590
- )
533
+ instances.get_app_profile app_profile_path(instance_id, app_profile_id)
591
534
  end
592
535
  end
593
536
 
537
+ ##
594
538
  # Lists information about app profiles in an instance.
595
539
  #
596
540
  # @param instance_id [String]
@@ -600,14 +544,14 @@ module Google
600
544
  # See Google::Gax::PagedEnumerable documentation for other
601
545
  # operations such as per-page iteration or access to the response
602
546
  # object.
547
+ #
603
548
  def list_app_profiles instance_id
604
549
  execute do
605
- instances.list_app_profiles(
606
- instance_path(instance_id)
607
- )
550
+ instances.list_app_profiles instance_path(instance_id)
608
551
  end
609
552
  end
610
553
 
554
+ ##
611
555
  # Updates an app profile within an instance.
612
556
  #
613
557
  # @param app_profile [Google::Bigtable::Admin::V2::AppProfile | Hash]
@@ -621,17 +565,14 @@ module Google
621
565
  # @param ignore_warnings [Boolean]
622
566
  # If true, ignore safety checks when updating the app profile.
623
567
  # @return [Google::Longrunning::Operation]
624
-
568
+ #
625
569
  def update_app_profile app_profile, update_mask, ignore_warnings: nil
626
570
  execute do
627
- instances.update_app_profile(
628
- app_profile,
629
- update_mask,
630
- ignore_warnings: ignore_warnings
631
- )
571
+ instances.update_app_profile app_profile, update_mask, ignore_warnings: ignore_warnings
632
572
  end
633
573
  end
634
574
 
575
+ ##
635
576
  # Deletes an app profile from an instance.
636
577
  #
637
578
  # @param instance_id [String]
@@ -640,31 +581,28 @@ module Google
640
581
  # Unique ID of the app profile to be deleted.
641
582
  # @param ignore_warnings [Boolean]
642
583
  # If true, ignore safety checks when deleting the app profile.
643
-
584
+ #
644
585
  def delete_app_profile instance_id, app_profile_id, ignore_warnings: nil
645
586
  execute do
646
- instances.delete_app_profile(
647
- app_profile_path(instance_id, app_profile_id),
648
- ignore_warnings
649
- )
587
+ instances.delete_app_profile app_profile_path(instance_id, app_profile_id), ignore_warnings
650
588
  end
651
589
  end
652
590
 
591
+ ##
653
592
  # Gets the access control policy for an instance resource. Returns an empty
654
593
  # policy if an instance exists but does not have a policy set.
655
594
  #
656
595
  # @param instance_id [String]
657
596
  # Unique ID of the instance for which the policy is being requested.
658
597
  # @return [Google::Iam::V1::Policy]
659
-
598
+ #
660
599
  def get_instance_policy instance_id
661
600
  execute do
662
- instances.get_iam_policy(
663
- instance_path(instance_id)
664
- )
601
+ instances.get_iam_policy instance_path(instance_id)
665
602
  end
666
603
  end
667
604
 
605
+ ##
668
606
  # Sets the access control policy on an instance resource. Replaces any
669
607
  # existing policy.
670
608
  #
@@ -677,16 +615,14 @@ module Google
677
615
  # might reject an empty policy.
678
616
  # Alternatively, provide a hash similar to `Google::Iam::V1::Policy`.
679
617
  # @return [Google::Iam::V1::Policy]
680
-
618
+ #
681
619
  def set_instance_policy instance_id, policy
682
620
  execute do
683
- instances.set_iam_policy(
684
- instance_path(instance_id),
685
- policy
686
- )
621
+ instances.set_iam_policy instance_path(instance_id), policy
687
622
  end
688
623
  end
689
624
 
625
+ ##
690
626
  # Returns permissions that the caller has for the specified instance resource.
691
627
  #
692
628
  # @param instance_id [String]
@@ -697,20 +633,60 @@ module Google
697
633
  # information see
698
634
  # [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
699
635
  # @return [Google::Iam::V1::TestIamPermissionsResponse]
700
-
636
+ #
701
637
  def test_instance_permissions instance_id, permissions
702
638
  execute do
703
- instances.test_iam_permissions(
704
- instance_path(instance_id),
705
- permissions
706
- )
639
+ instances.test_iam_permissions instance_path(instance_id), permissions
640
+ end
641
+ end
642
+
643
+ def read_rows instance_id, table_id, app_profile_id: nil, rows: nil, filter: nil, rows_limit: nil
644
+ # execute is not used because error handling is in ReadOperations#read_rows
645
+ client.read_rows table_path(instance_id, table_id),
646
+ rows: rows,
647
+ filter: filter,
648
+ rows_limit: rows_limit,
649
+ app_profile_id: app_profile_id
650
+ end
651
+
652
+ def sample_row_keys table_name, app_profile_id: nil
653
+ execute do
654
+ client.sample_row_keys table_name, app_profile_id: app_profile_id
655
+ end
656
+ end
657
+
658
+ def mutate_row table_name, row_key, mutations, app_profile_id: nil
659
+ execute do
660
+ client.mutate_row table_name, row_key, mutations, app_profile_id: app_profile_id
661
+ end
662
+ end
663
+
664
+ def mutate_rows table_name, entries, app_profile_id: nil
665
+ execute do
666
+ client.mutate_rows table_name, entries, app_profile_id: app_profile_id
667
+ end
668
+ end
669
+
670
+ def check_and_mutate_row table_name, row_key, app_profile_id: nil, predicate_filter: nil, true_mutations: nil,
671
+ false_mutations: nil
672
+ execute do
673
+ client.check_and_mutate_row table_name, row_key, app_profile_id: app_profile_id,
674
+ predicate_filter: predicate_filter, true_mutations: true_mutations,
675
+ false_mutations: false_mutations
676
+ end
677
+ end
678
+
679
+ def read_modify_write_row table_name, row_key, rules, app_profile_id: nil
680
+ execute do
681
+ client.read_modify_write_row table_name, row_key, rules, app_profile_id: app_profile_id
707
682
  end
708
683
  end
709
684
 
685
+ ##
710
686
  # Executes the API call and wrap errors to {Google::Cloud::Error}.
711
687
  #
712
688
  # @raise [Google::Cloud::Error]
713
-
689
+ #
714
690
  def execute
715
691
  yield
716
692
  rescue Google::Gax::GaxError => e
@@ -719,30 +695,30 @@ module Google
719
695
  raise Google::Cloud::Error.from_error(e)
720
696
  end
721
697
 
698
+ ##
722
699
  # Creates a formatted project path.
723
700
  #
724
701
  # @return [String]
725
702
  # Formatted project path
726
703
  # +projects/<project>+
727
-
704
+ #
728
705
  def project_path
729
- Admin::V2::BigtableInstanceAdminClient.project_path(project_id)
706
+ Admin::V2::BigtableInstanceAdminClient.project_path project_id
730
707
  end
731
708
 
709
+ ##
732
710
  # Creates a formatted instance path.
733
711
  #
734
712
  # @param instance_id [String]
735
713
  # @return [String]
736
714
  # Formatted instance path
737
715
  # +projects/<project>/instances/[a-z][a-z0-9\\-]+[a-z0-9]+.
738
-
716
+ #
739
717
  def instance_path instance_id
740
- Admin::V2::BigtableInstanceAdminClient.instance_path(
741
- project_id,
742
- instance_id
743
- )
718
+ Admin::V2::BigtableInstanceAdminClient.instance_path project_id, instance_id
744
719
  end
745
720
 
721
+ ##
746
722
  # Creates a formatted cluster path.
747
723
  #
748
724
  # @param instance_id [String]
@@ -750,15 +726,12 @@ module Google
750
726
  # @return [String]
751
727
  # Formatted cluster path
752
728
  # +projects/<project>/instances/<instance>/clusters/<cluster>+.
753
-
729
+ #
754
730
  def cluster_path instance_id, cluster_id
755
- Admin::V2::BigtableInstanceAdminClient.cluster_path(
756
- project_id,
757
- instance_id,
758
- cluster_id
759
- )
731
+ Admin::V2::BigtableInstanceAdminClient.cluster_path project_id, instance_id, cluster_id
760
732
  end
761
733
 
734
+ ##
762
735
  # Creates a formatted location path.
763
736
  #
764
737
  # @param location [String]
@@ -766,47 +739,24 @@ module Google
766
739
  # @return [String]
767
740
  # Formatted location path
768
741
  # +projects/<project_id>/locations/<location>+.
769
-
742
+ #
770
743
  def location_path location
771
- Admin::V2::BigtableInstanceAdminClient.location_path(
772
- project_id,
773
- location
774
- )
744
+ Admin::V2::BigtableInstanceAdminClient.location_path project_id, location
775
745
  end
776
746
 
747
+ ##
777
748
  # Creates a formatted table path.
778
749
  #
779
750
  # @param table_id [String]
780
751
  # @return [String]
781
752
  # Formatted table path
782
753
  # +projects/<project>/instances/<instance>/tables/<table>+
783
-
784
- def table_path instance_id, table_id
785
- Admin::V2::BigtableTableAdminClient.table_path(
786
- project_id,
787
- instance_id,
788
- table_id
789
- )
790
- end
791
-
792
- # Creates a formatted snapshot path.
793
754
  #
794
- # @param instance_id [String]
795
- # @param cluster_id [String]
796
- # @param snapshot_id [String]
797
- # @return [String]
798
- # Formatted snapshot path
799
- # +projects/<project>/instances/<instance>/clusters/<cluster>/snapshots/<snapshot>+
800
-
801
- def snapshot_path instance_id, cluster_id, snapshot_id
802
- Admin::V2::BigtableTableAdminClient.snapshot_path(
803
- project_id,
804
- instance_id,
805
- cluster_id,
806
- snapshot_id
807
- )
755
+ def table_path instance_id, table_id
756
+ Admin::V2::BigtableTableAdminClient.table_path project_id, instance_id, table_id
808
757
  end
809
758
 
759
+ ##
810
760
  # Creates a formatted app profile path.
811
761
  #
812
762
  # @param instance_id [String]
@@ -814,18 +764,15 @@ module Google
814
764
  # @return [String]
815
765
  # Formatted snapshot path
816
766
  # +projects/<project>/instances/<instance>/appProfiles/<app_profile>+
817
-
767
+ #
818
768
  def app_profile_path instance_id, app_profile_id
819
- Admin::V2::BigtableInstanceAdminClient.app_profile_path(
820
- project_id,
821
- instance_id,
822
- app_profile_id
823
- )
769
+ Admin::V2::BigtableInstanceAdminClient.app_profile_path project_id, instance_id, app_profile_id
824
770
  end
825
771
 
772
+ ##
826
773
  # Inspects the service object.
827
774
  # @return [String]
828
-
775
+ #
829
776
  def inspect
830
777
  "#{self.class}(#{@project_id})"
831
778
  end