google-cloud-bigtable 0.6.2 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) 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 +2 -2
  12. data/lib/google/cloud/bigtable/admin/v2.rb +2 -2
  13. data/lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb +1 -1
  14. data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb +2 -2
  15. data/lib/google/cloud/bigtable/admin/v2/credentials.rb +1 -1
  16. data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/bigtable_instance_admin.rb +1 -1
  17. data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/bigtable_table_admin.rb +1 -1
  18. data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/instance.rb +1 -1
  19. data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/table.rb +1 -1
  20. data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/iam_policy.rb +1 -1
  21. data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/options.rb +1 -1
  22. data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/policy.rb +7 -6
  23. data/lib/google/cloud/bigtable/admin/v2/doc/google/longrunning/operations.rb +2 -2
  24. data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/any.rb +1 -1
  25. data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/duration.rb +1 -1
  26. data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/empty.rb +1 -1
  27. data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/field_mask.rb +1 -1
  28. data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/timestamp.rb +1 -1
  29. data/lib/google/cloud/bigtable/admin/v2/doc/google/rpc/status.rb +7 -55
  30. data/lib/google/cloud/bigtable/admin/v2/doc/google/type/expr.rb +1 -1
  31. data/lib/google/cloud/bigtable/app_profile.rb +162 -96
  32. data/lib/google/cloud/bigtable/app_profile/job.rb +5 -8
  33. data/lib/google/cloud/bigtable/app_profile/list.rb +18 -12
  34. data/lib/google/cloud/bigtable/chunk_processor.rb +24 -36
  35. data/lib/google/cloud/bigtable/cluster.rb +45 -18
  36. data/lib/google/cloud/bigtable/cluster/job.rb +3 -7
  37. data/lib/google/cloud/bigtable/cluster/list.rb +22 -20
  38. data/lib/google/cloud/bigtable/column_family.rb +18 -231
  39. data/lib/google/cloud/bigtable/column_family_map.rb +426 -0
  40. data/lib/google/cloud/bigtable/column_range.rb +15 -7
  41. data/lib/google/cloud/bigtable/convert.rb +12 -4
  42. data/lib/google/cloud/bigtable/errors.rb +4 -1
  43. data/lib/google/cloud/bigtable/gc_rule.rb +188 -69
  44. data/lib/google/cloud/bigtable/instance.rb +209 -189
  45. data/lib/google/cloud/bigtable/instance/cluster_map.rb +17 -13
  46. data/lib/google/cloud/bigtable/instance/job.rb +6 -5
  47. data/lib/google/cloud/bigtable/instance/list.rb +18 -13
  48. data/lib/google/cloud/bigtable/longrunning_job.rb +7 -1
  49. data/lib/google/cloud/bigtable/mutation_entry.rb +36 -39
  50. data/lib/google/cloud/bigtable/mutation_operations.rb +90 -73
  51. data/lib/google/cloud/bigtable/policy.rb +9 -5
  52. data/lib/google/cloud/bigtable/project.rb +87 -196
  53. data/lib/google/cloud/bigtable/read_modify_write_rule.rb +15 -10
  54. data/lib/google/cloud/bigtable/read_operations.rb +42 -59
  55. data/lib/google/cloud/bigtable/routing_policy.rb +172 -0
  56. data/lib/google/cloud/bigtable/row.rb +32 -21
  57. data/lib/google/cloud/bigtable/row_filter.rb +80 -35
  58. data/lib/google/cloud/bigtable/row_filter/chain_filter.rb +119 -68
  59. data/lib/google/cloud/bigtable/row_filter/condition_filter.rb +8 -2
  60. data/lib/google/cloud/bigtable/row_filter/interleave_filter.rb +117 -66
  61. data/lib/google/cloud/bigtable/row_filter/simple_filter.rb +24 -9
  62. data/lib/google/cloud/bigtable/row_range.rb +5 -0
  63. data/lib/google/cloud/bigtable/rows_mutator.rb +14 -21
  64. data/lib/google/cloud/bigtable/rows_reader.rb +23 -18
  65. data/lib/google/cloud/bigtable/sample_row_key.rb +6 -3
  66. data/lib/google/cloud/bigtable/service.rb +200 -253
  67. data/lib/google/cloud/bigtable/status.rb +76 -0
  68. data/lib/google/cloud/bigtable/table.rb +158 -262
  69. data/lib/google/cloud/bigtable/table/cluster_state.rb +17 -6
  70. data/lib/google/cloud/bigtable/table/list.rb +16 -9
  71. data/lib/google/cloud/bigtable/v2.rb +2 -2
  72. data/lib/google/cloud/bigtable/v2/bigtable_client.rb +13 -13
  73. data/lib/google/cloud/bigtable/v2/credentials.rb +1 -1
  74. data/lib/google/cloud/bigtable/v2/doc/google/bigtable/v2/bigtable.rb +17 -14
  75. data/lib/google/cloud/bigtable/v2/doc/google/bigtable/v2/data.rb +1 -1
  76. data/lib/google/cloud/bigtable/v2/doc/google/protobuf/any.rb +1 -1
  77. data/lib/google/cloud/bigtable/v2/doc/google/protobuf/wrappers.rb +1 -1
  78. data/lib/google/cloud/bigtable/v2/doc/google/rpc/status.rb +7 -55
  79. data/lib/google/cloud/bigtable/value_range.rb +19 -13
  80. data/lib/google/cloud/bigtable/version.rb +1 -1
  81. metadata +67 -25
  82. data/lib/google/cloud/bigtable/table/column_family_map.rb +0 -70
@@ -1,4 +1,4 @@
1
- # Copyright 2019 Google LLC
1
+ # Copyright 2020 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -17,10 +17,12 @@
17
17
 
18
18
  require "google/cloud/bigtable/app_profile/list"
19
19
  require "google/cloud/bigtable/app_profile/job"
20
+ require "google/cloud/bigtable/routing_policy"
20
21
 
21
22
  module Google
22
23
  module Cloud
23
24
  module Bigtable
25
+ ##
24
26
  # # AppProfile
25
27
  #
26
28
  # A configuration object describing how Cloud Bigtable should treat traffic
@@ -33,7 +35,7 @@ module Google
33
35
  #
34
36
  # instance = bigtable.instance("my-instance")
35
37
  #
36
- # app_profile = bigtable.app_profile("my-instance", "my-app-profile")
38
+ # app_profile = instance.app_profile("my-app-profile")
37
39
  #
38
40
  # # Update
39
41
  # app_profile.description = "User data instance app profile"
@@ -58,88 +60,115 @@ module Google
58
60
  @changed_fields = {}
59
61
  end
60
62
 
61
- # The unique identifier for the project.
63
+ ##
64
+ # The unique identifier for the project to which the app profile belongs.
62
65
  #
63
66
  # @return [String]
67
+ #
64
68
  def project_id
65
69
  @grpc.name.split("/")[1]
66
70
  end
67
71
 
68
- # The unique identifier for the instance.
72
+ ##
73
+ # The unique identifier for the instance to which the app profile belongs.
69
74
  #
70
75
  # @return [String]
76
+ #
71
77
  def instance_id
72
78
  @grpc.name.split("/")[3]
73
79
  end
74
80
 
81
+ ##
75
82
  # The unique identifier for the app profile.
76
83
  #
77
84
  # @return [String]
85
+ #
78
86
  def name
79
87
  @grpc.name.split("/")[5]
80
88
  end
81
89
 
82
- # The full path for the instance resource. Values are of the form
83
- # `projects/<project_id>/instances/<instance_id>`.
90
+ ##
91
+ # The full path for the app profile resource. Values are of the form:
92
+ # `projects/<project_id>/instances/<instance_id>/appProfiles/<app_profile_name>`.
84
93
  #
85
94
  # @return [String]
95
+ #
86
96
  def path
87
97
  @grpc.name
88
98
  end
89
99
 
100
+ ##
90
101
  # Etag for optimistic concurrency control.
91
102
  #
92
103
  # @return [String]
104
+ #
93
105
  def etag
94
106
  @grpc.etag
95
107
  end
96
108
 
97
- # Description of the AppProfile.
109
+ ##
110
+ # Description of the app profile.
98
111
  #
99
112
  # @return [String]
113
+ #
100
114
  def description
101
115
  @grpc.description
102
116
  end
103
117
 
104
- # Set description of the AppProfile.
118
+ ##
119
+ # Sets the description of the app profile.
105
120
  #
106
121
  # @param text [String] Description text
122
+ #
107
123
  def description= text
108
124
  @grpc.description = text
109
125
  @changed_fields["description"] = "description"
110
126
  end
111
127
 
112
- # Get value of multi-cluster routing policy.
128
+ ##
129
+ # Gets the multi-cluster routing policy, if present.
130
+ #
131
+ # @return [Google::Cloud::Bigtable::MultiClusterRoutingUseAny, nil]
113
132
  #
114
- # @return [Google::Bigtable::Admin::V2::AppProfile::MultiClusterRoutingUseAny]
115
133
  def multi_cluster_routing
116
- @grpc.multi_cluster_routing_use_any
134
+ return nil unless @grpc.multi_cluster_routing_use_any
135
+
136
+ Google::Cloud::Bigtable::MultiClusterRoutingUseAny.new
117
137
  end
118
138
 
119
- # Get value of single cluster routing policy.
139
+ ##
140
+ # Gets the single cluster routing policy, if present.
141
+ #
142
+ # @return [Google::Cloud::Bigtable::SingleClusterRouting, nil]
120
143
  #
121
- # @return [Google::Bigtable::Admin::V2::AppProfile::SingleClusterRouting]
122
144
  def single_cluster_routing
123
- @grpc.single_cluster_routing
145
+ return nil unless @grpc.single_cluster_routing
146
+
147
+ Google::Cloud::Bigtable::SingleClusterRouting.new(
148
+ @grpc.single_cluster_routing.cluster_id,
149
+ @grpc.single_cluster_routing.allow_transactional_writes
150
+ )
124
151
  end
125
152
 
126
- # Set routing policy.
153
+ ##
154
+ # Sets the routing policy for the app profile.
127
155
  #
128
- # @param policy [Google::Bigtable::Admin::V2::AppProfile::SingleClusterRouting | Google::Bigtable::Admin::V2::AppProfile::MultiClusterRoutingUseAny]
129
- # The routing policy for all read/write requests that use this app profile.
130
- # A value must be explicitly set.
156
+ # @param policy [Google::Cloud::Bigtable::RoutingPolicy]
157
+ # The routing policy for all read/write requests that use this app profile. A value must be explicitly set.
131
158
  #
132
159
  # Routing Policies:
133
- # * `multi_cluster_routing` - Read/write requests may be routed to any
134
- # cluster in the instance and will fail over to another cluster in the event
135
- # of transient errors or delays. Choosing this option sacrifices
136
- # read-your-writes consistency to improve availability.
137
- # * `single_cluster_routing` - Unconditionally routes all read/write requests
138
- # to a specific cluster. This option preserves read-your-writes consistency
139
- # but does not improve availability.
140
- # The value contains `cluster_id` and optional field `allow_transactional_writes`.
141
- #
142
- # @example Set multi cluster routing policy
160
+ # * {Google::Cloud::Bigtable::MultiClusterRoutingUseAny} - Read/write
161
+ # requests may be routed to any cluster in the instance and will
162
+ # fail over to another cluster in the event of transient errors or
163
+ # delays. Choosing this option sacrifices read-your-writes
164
+ # consistency to improve availability.
165
+ # * {Google::Cloud::Bigtable::SingleClusterRouting} - Unconditionally
166
+ # routes all read/write requests to a specific cluster. This option
167
+ # preserves read-your-writes consistency but does not improve
168
+ # availability. Value contains `cluster_id` and optional field
169
+ # `allow_transactional_writes`.
170
+ #
171
+ # @example Set multi cluster routing policy.
143
172
  # require "google/cloud/bigtable"
144
173
  #
145
174
  # bigtable = Google::Cloud::Bigtable.new
@@ -149,7 +178,7 @@ module Google
149
178
  # routing_policy = Google::Cloud::Bigtable::AppProfile.multi_cluster_routing
150
179
  # app_profile.routing_policy = routing_policy
151
180
  #
152
- # @example Set single cluster routing policy
181
+ # @example Set single cluster routing policy.
153
182
  # require "google/cloud/bigtable"
154
183
  #
155
184
  # bigtable = Google::Cloud::Bigtable.new
@@ -157,31 +186,62 @@ module Google
157
186
  # app_profile = instance.app_profile("my-app-profile")
158
187
  #
159
188
  # routing_policy = Google::Cloud::Bigtable::AppProfile.single_cluster_routing(
160
- # "my-instance-cluster-1"
189
+ # "my-instance-cluster-1",
161
190
  # allow_transactional_writes: true
162
191
  # )
163
192
  # app_profile.routing_policy = routing_policy
164
193
  #
165
194
  def routing_policy= policy
166
- if policy.is_a?(Google::Bigtable::Admin::V2::AppProfile:: \
167
- SingleClusterRouting)
168
- @grpc.single_cluster_routing = policy
195
+ routing_policy_grpc = policy.to_grpc
196
+ if routing_policy_grpc.is_a? Google::Bigtable::Admin::V2::AppProfile::SingleClusterRouting
197
+ @grpc.single_cluster_routing = routing_policy_grpc
169
198
  @changed_fields["routing_policy"] = "single_cluster_routing"
170
199
  else
171
- @grpc.multi_cluster_routing_use_any = policy
200
+ @grpc.multi_cluster_routing_use_any = routing_policy_grpc
172
201
  @changed_fields["routing_policy"] = "multi_cluster_routing_use_any"
173
202
  end
174
203
  end
175
204
 
176
- # Get routing policy.
205
+ ##
206
+ # Gets the routing policy for all read/write requests that use the app
207
+ # profile.
208
+ #
209
+ # Routing Policies:
210
+ # * {Google::Cloud::Bigtable::MultiClusterRoutingUseAny} - Read/write
211
+ # requests may be routed to any cluster in the instance and will
212
+ # fail over to another cluster in the event of transient errors or
213
+ # delays. Choosing this option sacrifices read-your-writes
214
+ # consistency to improve availability.
215
+ # * {Google::Cloud::Bigtable::SingleClusterRouting} - Unconditionally
216
+ # routes all read/write requests to a specific cluster. This option
217
+ # preserves read-your-writes consistency but does not improve
218
+ # availability. Value contains `cluster_id` and optional field
219
+ # `allow_transactional_writes`.
220
+ #
221
+ # @return [Google::Cloud::Bigtable::RoutingPolicy]
222
+ #
223
+ # @example
224
+ # require "google/cloud/bigtable"
225
+ #
226
+ # bigtable = Google::Cloud::Bigtable.new
227
+ #
228
+ # instance = bigtable.instance("my-instance")
229
+ #
230
+ # routing_policy = Google::Cloud::Bigtable::AppProfile.multi_cluster_routing
177
231
  #
178
- # @return [Google::Bigtable::Admin::V2::AppProfile::SingleClusterRouting, Google::Bigtable::Admin::V2::AppProfile::MultiClusterRoutingUseAny]
232
+ # app_profile = instance.create_app_profile(
233
+ # "my-app-profile",
234
+ # routing_policy,
235
+ # description: "App profile for user data instance"
236
+ # )
237
+ # puts app_profile.routing_policy
179
238
  #
180
239
  def routing_policy
181
- @grpc.single_cluster_routing || @grpc.multi_cluster_routing_use_any
240
+ single_cluster_routing || multi_cluster_routing
182
241
  end
183
242
 
184
- # Delete app profile.
243
+ ##
244
+ # Deletes the app profile.
185
245
  #
186
246
  # @param ignore_warnings [Boolean]
187
247
  # Default value is false. If true, ignore safety checks when deleting
@@ -194,7 +254,8 @@ module Google
194
254
  # bigtable = Google::Cloud::Bigtable.new
195
255
  #
196
256
  # instance = bigtable.instance("my-instance")
197
- # app_profile = bigtable.instance("my-app-profile")
257
+ #
258
+ # app_profile = instance.app_profile("my-app-profile")
198
259
  #
199
260
  # app_profile.delete(ignore_warnings: true) # Ignore warnings.
200
261
  #
@@ -203,27 +264,26 @@ module Google
203
264
  #
204
265
  def delete ignore_warnings: false
205
266
  ensure_service!
206
- service.delete_app_profile(
207
- instance_id,
208
- name,
209
- ignore_warnings: ignore_warnings
210
- )
267
+ service.delete_app_profile instance_id, name, ignore_warnings: ignore_warnings
211
268
  true
212
269
  end
213
270
 
214
- # Update app profile.
271
+ ##
272
+ # Updates the app profile.
215
273
  #
216
274
  # @param ignore_warnings [Boolean]
217
275
  # Default value is false. If true, ignore safety checks when updating
218
276
  # the app profile.
219
277
  # @return [Google::Cloud::Bigtable::AppProfile::Job]
220
278
  #
221
- # @example Update
279
+ # @example
222
280
  # require "google/cloud/bigtable"
223
281
  #
224
282
  # bigtable = Google::Cloud::Bigtable.new
225
283
  #
226
- # app_profile = bigtable.app_profile("my-app-profile")
284
+ # instance = bigtable.instance("my-instance")
285
+ #
286
+ # app_profile = instance.app_profile("my-app-profile")
227
287
  #
228
288
  # app_profile.description = "User data instance app profile"
229
289
  # app_profile.routing_policy = \
@@ -238,17 +298,13 @@ module Google
238
298
  # app_profile = job.app_profile
239
299
  # end
240
300
  #
241
- # # OR - Update with ignoring warnings.
242
- # job = app_profile.save(ignore_warnings: true)
243
- # job.wait_until_done!
244
- #
245
- # @example Update with single cluster routing
301
+ # @example Update with single cluster routing.
246
302
  # require "google/cloud/bigtable"
247
303
  #
248
304
  # bigtable = Google::Cloud::Bigtable.new
249
305
  #
250
306
  # instance = bigtable.instance("my-instance")
251
- # app_profile = bigtable.instance("my-app-profile")
307
+ # app_profile = instance.app_profile("my-app-profile")
252
308
  #
253
309
  # app_profile.description = "User data instance app profile"
254
310
  # routing_policy = Google::Cloud::Bigtable::AppProfile.single_cluster_routing(
@@ -261,10 +317,6 @@ module Google
261
317
  #
262
318
  # job.done? #=> false
263
319
  # job.reload!
264
- # job.done? #=> false
265
- #
266
- # # Reload job until completion.
267
- # job.wait_until_done!
268
320
  # job.done? #=> true
269
321
  #
270
322
  # if job.error?
@@ -273,52 +325,62 @@ module Google
273
325
  # app_profile = job.app_profile
274
326
  # puts app_profile.name
275
327
  # end
276
-
328
+ #
277
329
  def save ignore_warnings: false
278
330
  ensure_service!
279
- update_mask = Google::Protobuf::FieldMask.new(
280
- paths: @changed_fields.values
281
- )
282
- grpc = service.update_app_profile(
283
- @grpc,
284
- update_mask,
285
- ignore_warnings: ignore_warnings
286
- )
331
+ update_mask = Google::Protobuf::FieldMask.new paths: @changed_fields.values
332
+ grpc = service.update_app_profile @grpc, update_mask, ignore_warnings: ignore_warnings
287
333
  @changed_fields.clear
288
- AppProfile::Job.from_grpc(grpc, service)
334
+ AppProfile::Job.from_grpc grpc, service
289
335
  end
290
336
  alias update save
291
337
 
292
- # Reload app profile information.
338
+ ##
339
+ # Reloads the app profile data.
293
340
  #
294
341
  # @return [Google::Cloud::Bigtable::AppProfile]
295
-
342
+ #
296
343
  def reload!
297
- @grpc = service.get_app_profile(instance_id, name)
344
+ @grpc = service.get_app_profile instance_id, name
298
345
  self
299
346
  end
300
347
 
301
- # Create instance of multi cluster routing policy.
348
+ ##
349
+ # Creates an instance of the multi cluster routing policy.
350
+ #
351
+ # Read/write requests may be routed to any cluster in the instance and
352
+ # will fail over to another cluster in the event of transient errors or
353
+ # delays. Choosing this option sacrifices read-your-writes consistency
354
+ # to improve availability.
302
355
  #
303
- # Read/write requests may be routed to any cluster in the instance and will
304
- # fail over to another cluster in the event of transient errors or delays.
305
- # Choosing this option sacrifices read-your-writes consistency to improve
306
- # availability.
307
- # @return [Google::Bigtable::Admin::V2::AppProfile::MultiClusterRoutingUseAny]
356
+ # @return [Google::Cloud::Bigtable::MultiClusterRoutingUseAny]
357
+ #
358
+ # @example
359
+ # require "google/cloud/bigtable"
308
360
  #
309
- # @example Create instance of multi cluster routing
361
+ # bigtable = Google::Cloud::Bigtable.new
310
362
  #
311
- # Google::Cloud::Bigtable::AppProfile.multi_cluster_routing
363
+ # instance = bigtable.instance("my-instance")
364
+ #
365
+ # routing_policy = Google::Cloud::Bigtable::AppProfile.multi_cluster_routing
366
+ #
367
+ # app_profile = instance.create_app_profile(
368
+ # "my-app-profile",
369
+ # routing_policy,
370
+ # description: "App profile for user data instance"
371
+ # )
372
+ # puts app_profile.routing_policy
312
373
  #
313
374
  def self.multi_cluster_routing
314
- Google::Bigtable::Admin::V2::AppProfile::MultiClusterRoutingUseAny.new
375
+ Google::Cloud::Bigtable::MultiClusterRoutingUseAny.new
315
376
  end
316
377
 
317
- # Create instance of single cluster routing.
378
+ ##
379
+ # Creates an instance of the single cluster routing policy.
318
380
  #
319
381
  # Unconditionally routes all read/write requests to a specific cluster.
320
- # This option preserves read-your-writes consistency but does not improve
321
- # availability.
382
+ # This option preserves read-your-writes consistency but does not
383
+ # improve availability.
322
384
  #
323
385
  # @param cluster_id [String]
324
386
  # The cluster to which read/write requests should be routed.
@@ -327,25 +389,29 @@ module Google
327
389
  # allowed by this app profile. It is unsafe to send these requests to
328
390
  # the same table/row/column in multiple clusters.
329
391
  # Default value is false.
330
- # @return [Google::Bigtable::Admin::V2::AppProfile::SingleClusterRouting]
392
+ # @return [Google::Cloud::Bigtable::SingleClusterRouting]
331
393
  #
332
- # @example Create instance of single cluster routing
394
+ # @example
395
+ # require "google/cloud/bigtable"
333
396
  #
334
- # Google::Cloud::Bigtable::AppProfile.single_cluster_routing("my-cluster")
397
+ # bigtable = Google::Cloud::Bigtable.new
335
398
  #
336
- # # With allowed transactional writes
337
- # Google::Cloud::Bigtable::AppProfile.single_cluster_routing(
338
- # "my-cluster",
399
+ # instance = bigtable.instance("my-instance")
400
+ #
401
+ # routing_policy = Google::Cloud::Bigtable::AppProfile.single_cluster_routing(
402
+ # "my-instance-cluster-1",
339
403
  # allow_transactional_writes: true
340
404
  # )
341
-
342
- def self.single_cluster_routing \
343
- cluster_id,
344
- allow_transactional_writes: false
345
- Google::Bigtable::Admin::V2::AppProfile::SingleClusterRouting.new(
346
- cluster_id: cluster_id,
347
- allow_transactional_writes: allow_transactional_writes
348
- )
405
+ #
406
+ # app_profile = instance.create_app_profile(
407
+ # "my-app-profile",
408
+ # routing_policy,
409
+ # description: "App profile for user data instance"
410
+ # )
411
+ # puts app_profile.routing_policy
412
+ #
413
+ def self.single_cluster_routing cluster_id, allow_transactional_writes: false
414
+ Google::Cloud::Bigtable::SingleClusterRouting.new cluster_id, allow_transactional_writes
349
415
  end
350
416
 
351
417
  # @private
@@ -356,7 +422,7 @@ module Google
356
422
  # @param service [Google::Cloud::Bigtable::Service]
357
423
  # @return [Google::Cloud::Bigtable::Table]
358
424
  def self.from_grpc grpc, service
359
- new(grpc, service)
425
+ new grpc, service
360
426
  end
361
427
 
362
428
  protected