google-cloud-bigtable 1.1.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +1 -1
  3. data/CHANGELOG.md +54 -0
  4. data/TROUBLESHOOTING.md +2 -8
  5. data/lib/google-cloud-bigtable.rb +29 -27
  6. data/lib/google/cloud/bigtable.rb +18 -26
  7. data/lib/google/cloud/bigtable/app_profile.rb +3 -3
  8. data/lib/google/cloud/bigtable/app_profile/list.rb +6 -4
  9. data/lib/google/cloud/bigtable/backup.rb +324 -0
  10. data/lib/google/cloud/bigtable/backup/job.rb +87 -0
  11. data/lib/google/cloud/bigtable/backup/list.rb +167 -0
  12. data/lib/google/cloud/bigtable/chunk_processor.rb +1 -1
  13. data/lib/google/cloud/bigtable/cluster.rb +101 -2
  14. data/lib/google/cloud/bigtable/cluster/list.rb +2 -2
  15. data/lib/google/cloud/bigtable/column_family.rb +2 -2
  16. data/lib/google/cloud/bigtable/column_family_map.rb +11 -11
  17. data/lib/google/cloud/bigtable/column_range.rb +2 -2
  18. data/lib/google/cloud/bigtable/credentials.rb +36 -2
  19. data/lib/google/cloud/bigtable/gc_rule.rb +7 -7
  20. data/lib/google/cloud/bigtable/instance.rb +6 -6
  21. data/lib/google/cloud/bigtable/instance/cluster_map.rb +1 -1
  22. data/lib/google/cloud/bigtable/instance/list.rb +2 -2
  23. data/lib/google/cloud/bigtable/longrunning_job.rb +13 -2
  24. data/lib/google/cloud/bigtable/mutation_entry.rb +10 -9
  25. data/lib/google/cloud/bigtable/mutation_operations.rb +2 -2
  26. data/lib/google/cloud/bigtable/project.rb +1 -1
  27. data/lib/google/cloud/bigtable/read_modify_write_rule.rb +2 -2
  28. data/lib/google/cloud/bigtable/read_operations.rb +2 -2
  29. data/lib/google/cloud/bigtable/routing_policy.rb +2 -2
  30. data/lib/google/cloud/bigtable/row_filter/chain_filter.rb +3 -3
  31. data/lib/google/cloud/bigtable/row_filter/condition_filter.rb +3 -3
  32. data/lib/google/cloud/bigtable/row_filter/interleave_filter.rb +3 -3
  33. data/lib/google/cloud/bigtable/row_filter/simple_filter.rb +3 -3
  34. data/lib/google/cloud/bigtable/row_range.rb +2 -2
  35. data/lib/google/cloud/bigtable/rows_mutator.rb +3 -3
  36. data/lib/google/cloud/bigtable/rows_reader.rb +10 -10
  37. data/lib/google/cloud/bigtable/sample_row_key.rb +2 -2
  38. data/lib/google/cloud/bigtable/service.rb +241 -245
  39. data/lib/google/cloud/bigtable/table.rb +5 -4
  40. data/lib/google/cloud/bigtable/table/cluster_state.rb +27 -6
  41. data/lib/google/cloud/bigtable/table/list.rb +2 -2
  42. data/lib/google/cloud/bigtable/table/restore_job.rb +117 -0
  43. data/lib/google/cloud/bigtable/value_range.rb +2 -2
  44. data/lib/google/cloud/bigtable/version.rb +1 -1
  45. metadata +18 -96
  46. data/lib/google/bigtable/admin/v2/bigtable_instance_admin_pb.rb +0 -142
  47. data/lib/google/bigtable/admin/v2/bigtable_instance_admin_services_pb.rb +0 -87
  48. data/lib/google/bigtable/admin/v2/bigtable_table_admin_pb.rb +0 -141
  49. data/lib/google/bigtable/admin/v2/bigtable_table_admin_services_pb.rb +0 -127
  50. data/lib/google/bigtable/admin/v2/common_pb.rb +0 -25
  51. data/lib/google/bigtable/admin/v2/instance_pb.rb +0 -73
  52. data/lib/google/bigtable/admin/v2/table_pb.rb +0 -89
  53. data/lib/google/bigtable/v2/bigtable_pb.rb +0 -113
  54. data/lib/google/bigtable/v2/bigtable_services_pb.rb +0 -68
  55. data/lib/google/bigtable/v2/data_pb.rb +0 -156
  56. data/lib/google/cloud/bigtable/admin.rb +0 -202
  57. data/lib/google/cloud/bigtable/admin/credentials.rb +0 -27
  58. data/lib/google/cloud/bigtable/admin/v2.rb +0 -222
  59. data/lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb +0 -1441
  60. data/lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client_config.json +0 -139
  61. data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb +0 -1245
  62. data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client_config.json +0 -133
  63. data/lib/google/cloud/bigtable/admin/v2/credentials.rb +0 -51
  64. data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/bigtable_instance_admin.rb +0 -290
  65. data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/bigtable_table_admin.rb +0 -359
  66. data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/instance.rb +0 -195
  67. data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/table.rb +0 -210
  68. data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/iam_policy.rb +0 -64
  69. data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/options.rb +0 -33
  70. data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/policy.rb +0 -151
  71. data/lib/google/cloud/bigtable/admin/v2/doc/google/longrunning/operations.rb +0 -51
  72. data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/any.rb +0 -131
  73. data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/duration.rb +0 -91
  74. data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/empty.rb +0 -29
  75. data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/field_mask.rb +0 -222
  76. data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/timestamp.rb +0 -113
  77. data/lib/google/cloud/bigtable/admin/v2/doc/google/rpc/status.rb +0 -39
  78. data/lib/google/cloud/bigtable/admin/v2/doc/google/type/expr.rb +0 -45
  79. data/lib/google/cloud/bigtable/v2.rb +0 -146
  80. data/lib/google/cloud/bigtable/v2/bigtable_client.rb +0 -588
  81. data/lib/google/cloud/bigtable/v2/bigtable_client_config.json +0 -83
  82. data/lib/google/cloud/bigtable/v2/credentials.rb +0 -46
  83. data/lib/google/cloud/bigtable/v2/doc/google/bigtable/v2/bigtable.rb +0 -290
  84. data/lib/google/cloud/bigtable/v2/doc/google/bigtable/v2/data.rb +0 -493
  85. data/lib/google/cloud/bigtable/v2/doc/google/protobuf/any.rb +0 -131
  86. data/lib/google/cloud/bigtable/v2/doc/google/protobuf/wrappers.rb +0 -34
  87. data/lib/google/cloud/bigtable/v2/doc/google/rpc/status.rb +0 -39
@@ -1,1441 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- #
15
- # EDITING INSTRUCTIONS
16
- # This file was generated from the file
17
- # https://github.com/googleapis/googleapis/blob/master/google/bigtable/admin/v2/bigtable_instance_admin.proto,
18
- # and updates to that file get reflected here through a refresh process.
19
- # For the short term, the refresh process will only be runnable by Google
20
- # engineers.
21
-
22
-
23
- require "json"
24
- require "pathname"
25
-
26
- require "google/gax"
27
- require "google/gax/operation"
28
- require "google/longrunning/operations_client"
29
-
30
- require "google/bigtable/admin/v2/bigtable_instance_admin_pb"
31
- require "google/cloud/bigtable/admin/v2/credentials"
32
- require "google/cloud/bigtable/version"
33
-
34
- module Google
35
- module Cloud
36
- module Bigtable
37
- module Admin
38
- module V2
39
- # Service for creating, configuring, and deleting Cloud Bigtable Instances and
40
- # Clusters. Provides access to the Instance and Cluster schemas only, not the
41
- # tables' metadata or data stored in those tables.
42
- #
43
- # @!attribute [r] bigtable_instance_admin_stub
44
- # @return [Google::Bigtable::Admin::V2::BigtableInstanceAdmin::Stub]
45
- class BigtableInstanceAdminClient
46
- # @private
47
- attr_reader :bigtable_instance_admin_stub
48
-
49
- # The default address of the service.
50
- SERVICE_ADDRESS = "bigtableadmin.googleapis.com".freeze
51
-
52
- # The default port of the service.
53
- DEFAULT_SERVICE_PORT = 443
54
-
55
- # The default set of gRPC interceptors.
56
- GRPC_INTERCEPTORS = []
57
-
58
- DEFAULT_TIMEOUT = 30
59
-
60
- PAGE_DESCRIPTORS = {
61
- "list_app_profiles" => Google::Gax::PageDescriptor.new(
62
- "page_token",
63
- "next_page_token",
64
- "app_profiles")
65
- }.freeze
66
-
67
- private_constant :PAGE_DESCRIPTORS
68
-
69
- # The scopes needed to make gRPC calls to all of the methods defined in
70
- # this service.
71
- ALL_SCOPES = [
72
- "https://www.googleapis.com/auth/bigtable.admin",
73
- "https://www.googleapis.com/auth/bigtable.admin.cluster",
74
- "https://www.googleapis.com/auth/bigtable.admin.instance",
75
- "https://www.googleapis.com/auth/bigtable.admin.table",
76
- "https://www.googleapis.com/auth/cloud-bigtable.admin",
77
- "https://www.googleapis.com/auth/cloud-bigtable.admin.cluster",
78
- "https://www.googleapis.com/auth/cloud-bigtable.admin.table",
79
- "https://www.googleapis.com/auth/cloud-platform",
80
- "https://www.googleapis.com/auth/cloud-platform.read-only"
81
- ].freeze
82
-
83
- # @private
84
- class OperationsClient < Google::Longrunning::OperationsClient
85
- self::SERVICE_ADDRESS = BigtableInstanceAdminClient::SERVICE_ADDRESS
86
- self::GRPC_INTERCEPTORS = BigtableInstanceAdminClient::GRPC_INTERCEPTORS
87
- end
88
-
89
- APP_PROFILE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
90
- "projects/{project}/instances/{instance}/appProfiles/{app_profile}"
91
- )
92
-
93
- private_constant :APP_PROFILE_PATH_TEMPLATE
94
-
95
- CLUSTER_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
96
- "projects/{project}/instances/{instance}/clusters/{cluster}"
97
- )
98
-
99
- private_constant :CLUSTER_PATH_TEMPLATE
100
-
101
- INSTANCE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
102
- "projects/{project}/instances/{instance}"
103
- )
104
-
105
- private_constant :INSTANCE_PATH_TEMPLATE
106
-
107
- LOCATION_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
108
- "projects/{project}/locations/{location}"
109
- )
110
-
111
- private_constant :LOCATION_PATH_TEMPLATE
112
-
113
- PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
114
- "projects/{project}"
115
- )
116
-
117
- private_constant :PROJECT_PATH_TEMPLATE
118
-
119
- # Returns a fully-qualified app_profile resource name string.
120
- # @param project [String]
121
- # @param instance [String]
122
- # @param app_profile [String]
123
- # @return [String]
124
- def self.app_profile_path project, instance, app_profile
125
- APP_PROFILE_PATH_TEMPLATE.render(
126
- :"project" => project,
127
- :"instance" => instance,
128
- :"app_profile" => app_profile
129
- )
130
- end
131
-
132
- # Returns a fully-qualified cluster resource name string.
133
- # @param project [String]
134
- # @param instance [String]
135
- # @param cluster [String]
136
- # @return [String]
137
- def self.cluster_path project, instance, cluster
138
- CLUSTER_PATH_TEMPLATE.render(
139
- :"project" => project,
140
- :"instance" => instance,
141
- :"cluster" => cluster
142
- )
143
- end
144
-
145
- # Returns a fully-qualified instance resource name string.
146
- # @param project [String]
147
- # @param instance [String]
148
- # @return [String]
149
- def self.instance_path project, instance
150
- INSTANCE_PATH_TEMPLATE.render(
151
- :"project" => project,
152
- :"instance" => instance
153
- )
154
- end
155
-
156
- # Returns a fully-qualified location resource name string.
157
- # @param project [String]
158
- # @param location [String]
159
- # @return [String]
160
- def self.location_path project, location
161
- LOCATION_PATH_TEMPLATE.render(
162
- :"project" => project,
163
- :"location" => location
164
- )
165
- end
166
-
167
- # Returns a fully-qualified project resource name string.
168
- # @param project [String]
169
- # @return [String]
170
- def self.project_path project
171
- PROJECT_PATH_TEMPLATE.render(
172
- :"project" => project
173
- )
174
- end
175
-
176
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
177
- # Provides the means for authenticating requests made by the client. This parameter can
178
- # be many types.
179
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
180
- # authenticating requests made by this client.
181
- # A `String` will be treated as the path to the keyfile to be used for the construction of
182
- # credentials for this client.
183
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
184
- # credentials for this client.
185
- # A `GRPC::Core::Channel` will be used to make calls through.
186
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
187
- # should already be composed with a `GRPC::Core::CallCredentials` object.
188
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
189
- # metadata for requests, generally, to give OAuth credentials.
190
- # @param scopes [Array<String>]
191
- # The OAuth scopes for this service. This parameter is ignored if
192
- # an updater_proc is supplied.
193
- # @param client_config [Hash]
194
- # A Hash for call options for each method. See
195
- # Google::Gax#construct_settings for the structure of
196
- # this data. Falls back to the default config if not specified
197
- # or the specified config is missing data points.
198
- # @param timeout [Numeric]
199
- # The default timeout, in seconds, for calls made through this client.
200
- # @param metadata [Hash]
201
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
202
- # @param service_address [String]
203
- # Override for the service hostname, or `nil` to leave as the default.
204
- # @param service_port [Integer]
205
- # Override for the service port, or `nil` to leave as the default.
206
- # @param exception_transformer [Proc]
207
- # An optional proc that intercepts any exceptions raised during an API call to inject
208
- # custom error handling.
209
- def initialize \
210
- credentials: nil,
211
- scopes: ALL_SCOPES,
212
- client_config: {},
213
- timeout: DEFAULT_TIMEOUT,
214
- metadata: nil,
215
- service_address: nil,
216
- service_port: nil,
217
- exception_transformer: nil,
218
- lib_name: nil,
219
- lib_version: ""
220
- # These require statements are intentionally placed here to initialize
221
- # the gRPC module only when it's required.
222
- # See https://github.com/googleapis/toolkit/issues/446
223
- require "google/gax/grpc"
224
- require "google/bigtable/admin/v2/bigtable_instance_admin_services_pb"
225
-
226
- credentials ||= Google::Cloud::Bigtable::Admin::V2::Credentials.default
227
-
228
- @operations_client = OperationsClient.new(
229
- credentials: credentials,
230
- scopes: scopes,
231
- client_config: client_config,
232
- timeout: timeout,
233
- lib_name: lib_name,
234
- service_address: service_address,
235
- service_port: service_port,
236
- lib_version: lib_version,
237
- metadata: metadata,
238
- )
239
-
240
- if credentials.is_a?(String) || credentials.is_a?(Hash)
241
- updater_proc = Google::Cloud::Bigtable::Admin::V2::Credentials.new(credentials).updater_proc
242
- end
243
- if credentials.is_a?(GRPC::Core::Channel)
244
- channel = credentials
245
- end
246
- if credentials.is_a?(GRPC::Core::ChannelCredentials)
247
- chan_creds = credentials
248
- end
249
- if credentials.is_a?(Proc)
250
- updater_proc = credentials
251
- end
252
- if credentials.is_a?(Google::Auth::Credentials)
253
- updater_proc = credentials.updater_proc
254
- end
255
-
256
- package_version = Google::Cloud::Bigtable::VERSION
257
-
258
- google_api_client = "gl-ruby/#{RUBY_VERSION}"
259
- google_api_client << " #{lib_name}/#{lib_version}" if lib_name
260
- google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
261
- google_api_client << " grpc/#{GRPC::VERSION}"
262
- google_api_client.freeze
263
-
264
- headers = { :"x-goog-api-client" => google_api_client }
265
- headers.merge!(metadata) unless metadata.nil?
266
- client_config_file = Pathname.new(__dir__).join(
267
- "bigtable_instance_admin_client_config.json"
268
- )
269
- defaults = client_config_file.open do |f|
270
- Google::Gax.construct_settings(
271
- "google.bigtable.admin.v2.BigtableInstanceAdmin",
272
- JSON.parse(f.read),
273
- client_config,
274
- Google::Gax::Grpc::STATUS_CODE_NAMES,
275
- timeout,
276
- page_descriptors: PAGE_DESCRIPTORS,
277
- errors: Google::Gax::Grpc::API_ERRORS,
278
- metadata: headers
279
- )
280
- end
281
-
282
- # Allow overriding the service path/port in subclasses.
283
- service_path = service_address || self.class::SERVICE_ADDRESS
284
- port = service_port || self.class::DEFAULT_SERVICE_PORT
285
- interceptors = self.class::GRPC_INTERCEPTORS
286
- @bigtable_instance_admin_stub = Google::Gax::Grpc.create_stub(
287
- service_path,
288
- port,
289
- chan_creds: chan_creds,
290
- channel: channel,
291
- updater_proc: updater_proc,
292
- scopes: scopes,
293
- interceptors: interceptors,
294
- &Google::Bigtable::Admin::V2::BigtableInstanceAdmin::Stub.method(:new)
295
- )
296
-
297
- @create_instance = Google::Gax.create_api_call(
298
- @bigtable_instance_admin_stub.method(:create_instance),
299
- defaults["create_instance"],
300
- exception_transformer: exception_transformer,
301
- params_extractor: proc do |request|
302
- {'parent' => request.parent}
303
- end
304
- )
305
- @get_instance = Google::Gax.create_api_call(
306
- @bigtable_instance_admin_stub.method(:get_instance),
307
- defaults["get_instance"],
308
- exception_transformer: exception_transformer,
309
- params_extractor: proc do |request|
310
- {'name' => request.name}
311
- end
312
- )
313
- @list_instances = Google::Gax.create_api_call(
314
- @bigtable_instance_admin_stub.method(:list_instances),
315
- defaults["list_instances"],
316
- exception_transformer: exception_transformer,
317
- params_extractor: proc do |request|
318
- {'parent' => request.parent}
319
- end
320
- )
321
- @update_instance = Google::Gax.create_api_call(
322
- @bigtable_instance_admin_stub.method(:update_instance),
323
- defaults["update_instance"],
324
- exception_transformer: exception_transformer,
325
- params_extractor: proc do |request|
326
- {'name' => request.name}
327
- end
328
- )
329
- @partial_update_instance = Google::Gax.create_api_call(
330
- @bigtable_instance_admin_stub.method(:partial_update_instance),
331
- defaults["partial_update_instance"],
332
- exception_transformer: exception_transformer,
333
- params_extractor: proc do |request|
334
- {'instance.name' => request.instance.name}
335
- end
336
- )
337
- @delete_instance = Google::Gax.create_api_call(
338
- @bigtable_instance_admin_stub.method(:delete_instance),
339
- defaults["delete_instance"],
340
- exception_transformer: exception_transformer,
341
- params_extractor: proc do |request|
342
- {'name' => request.name}
343
- end
344
- )
345
- @create_cluster = Google::Gax.create_api_call(
346
- @bigtable_instance_admin_stub.method(:create_cluster),
347
- defaults["create_cluster"],
348
- exception_transformer: exception_transformer,
349
- params_extractor: proc do |request|
350
- {'parent' => request.parent}
351
- end
352
- )
353
- @get_cluster = Google::Gax.create_api_call(
354
- @bigtable_instance_admin_stub.method(:get_cluster),
355
- defaults["get_cluster"],
356
- exception_transformer: exception_transformer,
357
- params_extractor: proc do |request|
358
- {'name' => request.name}
359
- end
360
- )
361
- @list_clusters = Google::Gax.create_api_call(
362
- @bigtable_instance_admin_stub.method(:list_clusters),
363
- defaults["list_clusters"],
364
- exception_transformer: exception_transformer,
365
- params_extractor: proc do |request|
366
- {'parent' => request.parent}
367
- end
368
- )
369
- @update_cluster = Google::Gax.create_api_call(
370
- @bigtable_instance_admin_stub.method(:update_cluster),
371
- defaults["update_cluster"],
372
- exception_transformer: exception_transformer,
373
- params_extractor: proc do |request|
374
- {'name' => request.name}
375
- end
376
- )
377
- @delete_cluster = Google::Gax.create_api_call(
378
- @bigtable_instance_admin_stub.method(:delete_cluster),
379
- defaults["delete_cluster"],
380
- exception_transformer: exception_transformer,
381
- params_extractor: proc do |request|
382
- {'name' => request.name}
383
- end
384
- )
385
- @create_app_profile = Google::Gax.create_api_call(
386
- @bigtable_instance_admin_stub.method(:create_app_profile),
387
- defaults["create_app_profile"],
388
- exception_transformer: exception_transformer,
389
- params_extractor: proc do |request|
390
- {'parent' => request.parent}
391
- end
392
- )
393
- @get_app_profile = Google::Gax.create_api_call(
394
- @bigtable_instance_admin_stub.method(:get_app_profile),
395
- defaults["get_app_profile"],
396
- exception_transformer: exception_transformer,
397
- params_extractor: proc do |request|
398
- {'name' => request.name}
399
- end
400
- )
401
- @list_app_profiles = Google::Gax.create_api_call(
402
- @bigtable_instance_admin_stub.method(:list_app_profiles),
403
- defaults["list_app_profiles"],
404
- exception_transformer: exception_transformer,
405
- params_extractor: proc do |request|
406
- {'parent' => request.parent}
407
- end
408
- )
409
- @update_app_profile = Google::Gax.create_api_call(
410
- @bigtable_instance_admin_stub.method(:update_app_profile),
411
- defaults["update_app_profile"],
412
- exception_transformer: exception_transformer,
413
- params_extractor: proc do |request|
414
- {'app_profile.name' => request.app_profile.name}
415
- end
416
- )
417
- @delete_app_profile = Google::Gax.create_api_call(
418
- @bigtable_instance_admin_stub.method(:delete_app_profile),
419
- defaults["delete_app_profile"],
420
- exception_transformer: exception_transformer,
421
- params_extractor: proc do |request|
422
- {'name' => request.name}
423
- end
424
- )
425
- @get_iam_policy = Google::Gax.create_api_call(
426
- @bigtable_instance_admin_stub.method(:get_iam_policy),
427
- defaults["get_iam_policy"],
428
- exception_transformer: exception_transformer,
429
- params_extractor: proc do |request|
430
- {'resource' => request.resource}
431
- end
432
- )
433
- @set_iam_policy = Google::Gax.create_api_call(
434
- @bigtable_instance_admin_stub.method(:set_iam_policy),
435
- defaults["set_iam_policy"],
436
- exception_transformer: exception_transformer,
437
- params_extractor: proc do |request|
438
- {'resource' => request.resource}
439
- end
440
- )
441
- @test_iam_permissions = Google::Gax.create_api_call(
442
- @bigtable_instance_admin_stub.method(:test_iam_permissions),
443
- defaults["test_iam_permissions"],
444
- exception_transformer: exception_transformer,
445
- params_extractor: proc do |request|
446
- {'resource' => request.resource}
447
- end
448
- )
449
- end
450
-
451
- # Service calls
452
-
453
- # Create an instance within a project.
454
- #
455
- # @param parent [String]
456
- # The unique name of the project in which to create the new instance.
457
- # Values are of the form `projects/<project>`.
458
- # @param instance_id [String]
459
- # The ID to be used when referring to the new instance within its project,
460
- # e.g., just `myinstance` rather than
461
- # `projects/myproject/instances/myinstance`.
462
- # @param instance [Google::Bigtable::Admin::V2::Instance | Hash]
463
- # The instance to create.
464
- # Fields marked `OutputOnly` must be left blank.
465
- # A hash of the same form as `Google::Bigtable::Admin::V2::Instance`
466
- # can also be provided.
467
- # @param clusters [Hash{String => Google::Bigtable::Admin::V2::Cluster | Hash}]
468
- # The clusters to be created within the instance, mapped by desired
469
- # cluster ID, e.g., just `mycluster` rather than
470
- # `projects/myproject/instances/myinstance/clusters/mycluster`.
471
- # Fields marked `OutputOnly` must be left blank.
472
- # Currently, at most two clusters can be specified.
473
- # A hash of the same form as `Google::Bigtable::Admin::V2::Cluster`
474
- # can also be provided.
475
- # @param options [Google::Gax::CallOptions]
476
- # Overrides the default settings for this call, e.g, timeout,
477
- # retries, etc.
478
- # @return [Google::Gax::Operation]
479
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
480
- # @example
481
- # require "google/cloud/bigtable/admin"
482
- #
483
- # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
484
- # formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.project_path("[PROJECT]")
485
- #
486
- # # TODO: Initialize `instance_id`:
487
- # instance_id = ''
488
- #
489
- # # TODO: Initialize `instance`:
490
- # instance = {}
491
- #
492
- # # TODO: Initialize `clusters`:
493
- # clusters = {}
494
- #
495
- # # Register a callback during the method call.
496
- # operation = bigtable_instance_admin_client.create_instance(formatted_parent, instance_id, instance, clusters) do |op|
497
- # raise op.results.message if op.error?
498
- # op_results = op.results
499
- # # Process the results.
500
- #
501
- # metadata = op.metadata
502
- # # Process the metadata.
503
- # end
504
- #
505
- # # Or use the return value to register a callback.
506
- # operation.on_done do |op|
507
- # raise op.results.message if op.error?
508
- # op_results = op.results
509
- # # Process the results.
510
- #
511
- # metadata = op.metadata
512
- # # Process the metadata.
513
- # end
514
- #
515
- # # Manually reload the operation.
516
- # operation.reload!
517
- #
518
- # # Or block until the operation completes, triggering callbacks on
519
- # # completion.
520
- # operation.wait_until_done!
521
-
522
- def create_instance \
523
- parent,
524
- instance_id,
525
- instance,
526
- clusters,
527
- options: nil
528
- req = {
529
- parent: parent,
530
- instance_id: instance_id,
531
- instance: instance,
532
- clusters: clusters
533
- }.delete_if { |_, v| v.nil? }
534
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::CreateInstanceRequest)
535
- operation = Google::Gax::Operation.new(
536
- @create_instance.call(req, options),
537
- @operations_client,
538
- Google::Bigtable::Admin::V2::Instance,
539
- Google::Bigtable::Admin::V2::CreateInstanceMetadata,
540
- call_options: options
541
- )
542
- operation.on_done { |operation| yield(operation) } if block_given?
543
- operation
544
- end
545
-
546
- # Gets information about an instance.
547
- #
548
- # @param name [String]
549
- # The unique name of the requested instance. Values are of the form
550
- # `projects/<project>/instances/<instance>`.
551
- # @param options [Google::Gax::CallOptions]
552
- # Overrides the default settings for this call, e.g, timeout,
553
- # retries, etc.
554
- # @yield [result, operation] Access the result along with the RPC operation
555
- # @yieldparam result [Google::Bigtable::Admin::V2::Instance]
556
- # @yieldparam operation [GRPC::ActiveCall::Operation]
557
- # @return [Google::Bigtable::Admin::V2::Instance]
558
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
559
- # @example
560
- # require "google/cloud/bigtable/admin"
561
- #
562
- # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
563
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
564
- # response = bigtable_instance_admin_client.get_instance(formatted_name)
565
-
566
- def get_instance \
567
- name,
568
- options: nil,
569
- &block
570
- req = {
571
- name: name
572
- }.delete_if { |_, v| v.nil? }
573
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::GetInstanceRequest)
574
- @get_instance.call(req, options, &block)
575
- end
576
-
577
- # Lists information about instances in a project.
578
- #
579
- # @param parent [String]
580
- # The unique name of the project for which a list of instances is requested.
581
- # Values are of the form `projects/<project>`.
582
- # @param page_token [String]
583
- # DEPRECATED: This field is unused and ignored.
584
- # @param options [Google::Gax::CallOptions]
585
- # Overrides the default settings for this call, e.g, timeout,
586
- # retries, etc.
587
- # @yield [result, operation] Access the result along with the RPC operation
588
- # @yieldparam result [Google::Bigtable::Admin::V2::ListInstancesResponse]
589
- # @yieldparam operation [GRPC::ActiveCall::Operation]
590
- # @return [Google::Bigtable::Admin::V2::ListInstancesResponse]
591
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
592
- # @example
593
- # require "google/cloud/bigtable/admin"
594
- #
595
- # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
596
- # formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.project_path("[PROJECT]")
597
- # response = bigtable_instance_admin_client.list_instances(formatted_parent)
598
-
599
- def list_instances \
600
- parent,
601
- page_token: nil,
602
- options: nil,
603
- &block
604
- req = {
605
- parent: parent,
606
- page_token: page_token
607
- }.delete_if { |_, v| v.nil? }
608
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::ListInstancesRequest)
609
- @list_instances.call(req, options, &block)
610
- end
611
-
612
- # Updates an instance within a project.
613
- #
614
- # @param name [String]
615
- # (`OutputOnly`)
616
- # The unique name of the instance. Values are of the form
617
- # `projects/<project>/instances/[a-z][a-z0-9\\-]+[a-z0-9]`.
618
- # @param display_name [String]
619
- # The descriptive name for this instance as it appears in UIs.
620
- # Can be changed at any time, but should be kept globally unique
621
- # to avoid confusion.
622
- # @param type [Google::Bigtable::Admin::V2::Instance::Type]
623
- # The type of the instance. Defaults to `PRODUCTION`.
624
- # @param labels [Hash{String => String}]
625
- # Labels are a flexible and lightweight mechanism for organizing cloud
626
- # resources into groups that reflect a customer's organizational needs and
627
- # deployment strategies. They can be used to filter resources and aggregate
628
- # metrics.
629
- #
630
- # * Label keys must be between 1 and 63 characters long and must conform to
631
- # the regular expression: `[\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}`.
632
- # * Label values must be between 0 and 63 characters long and must conform to
633
- # the regular expression: `[\p{Ll}\p{Lo}\p{N}_-]{0,63}`.
634
- # * No more than 64 labels can be associated with a given resource.
635
- # * Keys and values must both be under 128 bytes.
636
- # @param state [Google::Bigtable::Admin::V2::Instance::State]
637
- # (`OutputOnly`)
638
- # The current state of the instance.
639
- # @param options [Google::Gax::CallOptions]
640
- # Overrides the default settings for this call, e.g, timeout,
641
- # retries, etc.
642
- # @yield [result, operation] Access the result along with the RPC operation
643
- # @yieldparam result [Google::Bigtable::Admin::V2::Instance]
644
- # @yieldparam operation [GRPC::ActiveCall::Operation]
645
- # @return [Google::Bigtable::Admin::V2::Instance]
646
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
647
- # @example
648
- # require "google/cloud/bigtable/admin"
649
- #
650
- # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
651
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
652
- #
653
- # # TODO: Initialize `display_name`:
654
- # display_name = ''
655
- #
656
- # # TODO: Initialize `type`:
657
- # type = :TYPE_UNSPECIFIED
658
- #
659
- # # TODO: Initialize `labels`:
660
- # labels = {}
661
- # response = bigtable_instance_admin_client.update_instance(formatted_name, display_name, type, labels)
662
-
663
- def update_instance \
664
- name,
665
- display_name,
666
- type,
667
- labels,
668
- state: nil,
669
- options: nil,
670
- &block
671
- req = {
672
- name: name,
673
- display_name: display_name,
674
- type: type,
675
- labels: labels,
676
- state: state
677
- }.delete_if { |_, v| v.nil? }
678
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::Instance)
679
- @update_instance.call(req, options, &block)
680
- end
681
-
682
- # Partially updates an instance within a project.
683
- #
684
- # @param instance [Google::Bigtable::Admin::V2::Instance | Hash]
685
- # The Instance which will (partially) replace the current value.
686
- # A hash of the same form as `Google::Bigtable::Admin::V2::Instance`
687
- # can also be provided.
688
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
689
- # The subset of Instance fields which should be replaced.
690
- # Must be explicitly set.
691
- # A hash of the same form as `Google::Protobuf::FieldMask`
692
- # can also be provided.
693
- # @param options [Google::Gax::CallOptions]
694
- # Overrides the default settings for this call, e.g, timeout,
695
- # retries, etc.
696
- # @return [Google::Gax::Operation]
697
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
698
- # @example
699
- # require "google/cloud/bigtable/admin"
700
- #
701
- # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
702
- #
703
- # # TODO: Initialize `instance`:
704
- # instance = {}
705
- #
706
- # # TODO: Initialize `update_mask`:
707
- # update_mask = {}
708
- #
709
- # # Register a callback during the method call.
710
- # operation = bigtable_instance_admin_client.partial_update_instance(instance, update_mask) do |op|
711
- # raise op.results.message if op.error?
712
- # op_results = op.results
713
- # # Process the results.
714
- #
715
- # metadata = op.metadata
716
- # # Process the metadata.
717
- # end
718
- #
719
- # # Or use the return value to register a callback.
720
- # operation.on_done do |op|
721
- # raise op.results.message if op.error?
722
- # op_results = op.results
723
- # # Process the results.
724
- #
725
- # metadata = op.metadata
726
- # # Process the metadata.
727
- # end
728
- #
729
- # # Manually reload the operation.
730
- # operation.reload!
731
- #
732
- # # Or block until the operation completes, triggering callbacks on
733
- # # completion.
734
- # operation.wait_until_done!
735
-
736
- def partial_update_instance \
737
- instance,
738
- update_mask,
739
- options: nil
740
- req = {
741
- instance: instance,
742
- update_mask: update_mask
743
- }.delete_if { |_, v| v.nil? }
744
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::PartialUpdateInstanceRequest)
745
- operation = Google::Gax::Operation.new(
746
- @partial_update_instance.call(req, options),
747
- @operations_client,
748
- Google::Bigtable::Admin::V2::Instance,
749
- Google::Bigtable::Admin::V2::UpdateInstanceMetadata,
750
- call_options: options
751
- )
752
- operation.on_done { |operation| yield(operation) } if block_given?
753
- operation
754
- end
755
-
756
- # Delete an instance from a project.
757
- #
758
- # @param name [String]
759
- # The unique name of the instance to be deleted.
760
- # Values are of the form `projects/<project>/instances/<instance>`.
761
- # @param options [Google::Gax::CallOptions]
762
- # Overrides the default settings for this call, e.g, timeout,
763
- # retries, etc.
764
- # @yield [result, operation] Access the result along with the RPC operation
765
- # @yieldparam result []
766
- # @yieldparam operation [GRPC::ActiveCall::Operation]
767
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
768
- # @example
769
- # require "google/cloud/bigtable/admin"
770
- #
771
- # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
772
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
773
- # bigtable_instance_admin_client.delete_instance(formatted_name)
774
-
775
- def delete_instance \
776
- name,
777
- options: nil,
778
- &block
779
- req = {
780
- name: name
781
- }.delete_if { |_, v| v.nil? }
782
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::DeleteInstanceRequest)
783
- @delete_instance.call(req, options, &block)
784
- nil
785
- end
786
-
787
- # Creates a cluster within an instance.
788
- #
789
- # @param parent [String]
790
- # The unique name of the instance in which to create the new cluster.
791
- # Values are of the form
792
- # `projects/<project>/instances/<instance>`.
793
- # @param cluster_id [String]
794
- # The ID to be used when referring to the new cluster within its instance,
795
- # e.g., just `mycluster` rather than
796
- # `projects/myproject/instances/myinstance/clusters/mycluster`.
797
- # @param cluster [Google::Bigtable::Admin::V2::Cluster | Hash]
798
- # The cluster to be created.
799
- # Fields marked `OutputOnly` must be left blank.
800
- # A hash of the same form as `Google::Bigtable::Admin::V2::Cluster`
801
- # can also be provided.
802
- # @param options [Google::Gax::CallOptions]
803
- # Overrides the default settings for this call, e.g, timeout,
804
- # retries, etc.
805
- # @return [Google::Gax::Operation]
806
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
807
- # @example
808
- # require "google/cloud/bigtable/admin"
809
- #
810
- # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
811
- # formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
812
- #
813
- # # TODO: Initialize `cluster_id`:
814
- # cluster_id = ''
815
- #
816
- # # TODO: Initialize `cluster`:
817
- # cluster = {}
818
- #
819
- # # Register a callback during the method call.
820
- # operation = bigtable_instance_admin_client.create_cluster(formatted_parent, cluster_id, cluster) do |op|
821
- # raise op.results.message if op.error?
822
- # op_results = op.results
823
- # # Process the results.
824
- #
825
- # metadata = op.metadata
826
- # # Process the metadata.
827
- # end
828
- #
829
- # # Or use the return value to register a callback.
830
- # operation.on_done do |op|
831
- # raise op.results.message if op.error?
832
- # op_results = op.results
833
- # # Process the results.
834
- #
835
- # metadata = op.metadata
836
- # # Process the metadata.
837
- # end
838
- #
839
- # # Manually reload the operation.
840
- # operation.reload!
841
- #
842
- # # Or block until the operation completes, triggering callbacks on
843
- # # completion.
844
- # operation.wait_until_done!
845
-
846
- def create_cluster \
847
- parent,
848
- cluster_id,
849
- cluster,
850
- options: nil
851
- req = {
852
- parent: parent,
853
- cluster_id: cluster_id,
854
- cluster: cluster
855
- }.delete_if { |_, v| v.nil? }
856
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::CreateClusterRequest)
857
- operation = Google::Gax::Operation.new(
858
- @create_cluster.call(req, options),
859
- @operations_client,
860
- Google::Bigtable::Admin::V2::Cluster,
861
- Google::Bigtable::Admin::V2::CreateClusterMetadata,
862
- call_options: options
863
- )
864
- operation.on_done { |operation| yield(operation) } if block_given?
865
- operation
866
- end
867
-
868
- # Gets information about a cluster.
869
- #
870
- # @param name [String]
871
- # The unique name of the requested cluster. Values are of the form
872
- # `projects/<project>/instances/<instance>/clusters/<cluster>`.
873
- # @param options [Google::Gax::CallOptions]
874
- # Overrides the default settings for this call, e.g, timeout,
875
- # retries, etc.
876
- # @yield [result, operation] Access the result along with the RPC operation
877
- # @yieldparam result [Google::Bigtable::Admin::V2::Cluster]
878
- # @yieldparam operation [GRPC::ActiveCall::Operation]
879
- # @return [Google::Bigtable::Admin::V2::Cluster]
880
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
881
- # @example
882
- # require "google/cloud/bigtable/admin"
883
- #
884
- # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
885
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.cluster_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]")
886
- # response = bigtable_instance_admin_client.get_cluster(formatted_name)
887
-
888
- def get_cluster \
889
- name,
890
- options: nil,
891
- &block
892
- req = {
893
- name: name
894
- }.delete_if { |_, v| v.nil? }
895
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::GetClusterRequest)
896
- @get_cluster.call(req, options, &block)
897
- end
898
-
899
- # Lists information about clusters in an instance.
900
- #
901
- # @param parent [String]
902
- # The unique name of the instance for which a list of clusters is requested.
903
- # Values are of the form `projects/<project>/instances/<instance>`.
904
- # Use `<instance> = '-'` to list Clusters for all Instances in a project,
905
- # e.g., `projects/myproject/instances/-`.
906
- # @param page_token [String]
907
- # DEPRECATED: This field is unused and ignored.
908
- # @param options [Google::Gax::CallOptions]
909
- # Overrides the default settings for this call, e.g, timeout,
910
- # retries, etc.
911
- # @yield [result, operation] Access the result along with the RPC operation
912
- # @yieldparam result [Google::Bigtable::Admin::V2::ListClustersResponse]
913
- # @yieldparam operation [GRPC::ActiveCall::Operation]
914
- # @return [Google::Bigtable::Admin::V2::ListClustersResponse]
915
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
916
- # @example
917
- # require "google/cloud/bigtable/admin"
918
- #
919
- # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
920
- # formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
921
- # response = bigtable_instance_admin_client.list_clusters(formatted_parent)
922
-
923
- def list_clusters \
924
- parent,
925
- page_token: nil,
926
- options: nil,
927
- &block
928
- req = {
929
- parent: parent,
930
- page_token: page_token
931
- }.delete_if { |_, v| v.nil? }
932
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::ListClustersRequest)
933
- @list_clusters.call(req, options, &block)
934
- end
935
-
936
- # Updates a cluster within an instance.
937
- #
938
- # @param name [String]
939
- # (`OutputOnly`)
940
- # The unique name of the cluster. Values are of the form
941
- # `projects/<project>/instances/<instance>/clusters/[a-z][-a-z0-9]*`.
942
- # @param serve_nodes [Integer]
943
- # The number of nodes allocated to this cluster. More nodes enable higher
944
- # throughput and more consistent performance.
945
- # @param location [String]
946
- # (`CreationOnly`)
947
- # The location where this cluster's nodes and storage reside. For best
948
- # performance, clients should be located as close as possible to this
949
- # cluster. Currently only zones are supported, so values should be of the
950
- # form `projects/<project>/locations/<zone>`.
951
- # @param state [Google::Bigtable::Admin::V2::Cluster::State]
952
- # (`OutputOnly`)
953
- # The current state of the cluster.
954
- # @param default_storage_type [Google::Bigtable::Admin::V2::StorageType]
955
- # (`CreationOnly`)
956
- # The type of storage used by this cluster to serve its
957
- # parent instance's tables, unless explicitly overridden.
958
- # @param options [Google::Gax::CallOptions]
959
- # Overrides the default settings for this call, e.g, timeout,
960
- # retries, etc.
961
- # @return [Google::Gax::Operation]
962
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
963
- # @example
964
- # require "google/cloud/bigtable/admin"
965
- #
966
- # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
967
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.cluster_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]")
968
- #
969
- # # TODO: Initialize `serve_nodes`:
970
- # serve_nodes = 0
971
- #
972
- # # Register a callback during the method call.
973
- # operation = bigtable_instance_admin_client.update_cluster(formatted_name, serve_nodes) do |op|
974
- # raise op.results.message if op.error?
975
- # op_results = op.results
976
- # # Process the results.
977
- #
978
- # metadata = op.metadata
979
- # # Process the metadata.
980
- # end
981
- #
982
- # # Or use the return value to register a callback.
983
- # operation.on_done do |op|
984
- # raise op.results.message if op.error?
985
- # op_results = op.results
986
- # # Process the results.
987
- #
988
- # metadata = op.metadata
989
- # # Process the metadata.
990
- # end
991
- #
992
- # # Manually reload the operation.
993
- # operation.reload!
994
- #
995
- # # Or block until the operation completes, triggering callbacks on
996
- # # completion.
997
- # operation.wait_until_done!
998
-
999
- def update_cluster \
1000
- name,
1001
- serve_nodes,
1002
- location: nil,
1003
- state: nil,
1004
- default_storage_type: nil,
1005
- options: nil
1006
- req = {
1007
- name: name,
1008
- serve_nodes: serve_nodes,
1009
- location: location,
1010
- state: state,
1011
- default_storage_type: default_storage_type
1012
- }.delete_if { |_, v| v.nil? }
1013
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::Cluster)
1014
- operation = Google::Gax::Operation.new(
1015
- @update_cluster.call(req, options),
1016
- @operations_client,
1017
- Google::Bigtable::Admin::V2::Cluster,
1018
- Google::Bigtable::Admin::V2::UpdateClusterMetadata,
1019
- call_options: options
1020
- )
1021
- operation.on_done { |operation| yield(operation) } if block_given?
1022
- operation
1023
- end
1024
-
1025
- # Deletes a cluster from an instance.
1026
- #
1027
- # @param name [String]
1028
- # The unique name of the cluster to be deleted. Values are of the form
1029
- # `projects/<project>/instances/<instance>/clusters/<cluster>`.
1030
- # @param options [Google::Gax::CallOptions]
1031
- # Overrides the default settings for this call, e.g, timeout,
1032
- # retries, etc.
1033
- # @yield [result, operation] Access the result along with the RPC operation
1034
- # @yieldparam result []
1035
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1036
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1037
- # @example
1038
- # require "google/cloud/bigtable/admin"
1039
- #
1040
- # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
1041
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.cluster_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]")
1042
- # bigtable_instance_admin_client.delete_cluster(formatted_name)
1043
-
1044
- def delete_cluster \
1045
- name,
1046
- options: nil,
1047
- &block
1048
- req = {
1049
- name: name
1050
- }.delete_if { |_, v| v.nil? }
1051
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::DeleteClusterRequest)
1052
- @delete_cluster.call(req, options, &block)
1053
- nil
1054
- end
1055
-
1056
- # Creates an app profile within an instance.
1057
- #
1058
- # @param parent [String]
1059
- # The unique name of the instance in which to create the new app profile.
1060
- # Values are of the form
1061
- # `projects/<project>/instances/<instance>`.
1062
- # @param app_profile_id [String]
1063
- # The ID to be used when referring to the new app profile within its
1064
- # instance, e.g., just `myprofile` rather than
1065
- # `projects/myproject/instances/myinstance/appProfiles/myprofile`.
1066
- # @param app_profile [Google::Bigtable::Admin::V2::AppProfile | Hash]
1067
- # The app profile to be created.
1068
- # Fields marked `OutputOnly` will be ignored.
1069
- # A hash of the same form as `Google::Bigtable::Admin::V2::AppProfile`
1070
- # can also be provided.
1071
- # @param ignore_warnings [true, false]
1072
- # If true, ignore safety checks when creating the app profile.
1073
- # @param options [Google::Gax::CallOptions]
1074
- # Overrides the default settings for this call, e.g, timeout,
1075
- # retries, etc.
1076
- # @yield [result, operation] Access the result along with the RPC operation
1077
- # @yieldparam result [Google::Bigtable::Admin::V2::AppProfile]
1078
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1079
- # @return [Google::Bigtable::Admin::V2::AppProfile]
1080
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1081
- # @example
1082
- # require "google/cloud/bigtable/admin"
1083
- #
1084
- # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
1085
- # formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
1086
- #
1087
- # # TODO: Initialize `app_profile_id`:
1088
- # app_profile_id = ''
1089
- #
1090
- # # TODO: Initialize `app_profile`:
1091
- # app_profile = {}
1092
- # response = bigtable_instance_admin_client.create_app_profile(formatted_parent, app_profile_id, app_profile)
1093
-
1094
- def create_app_profile \
1095
- parent,
1096
- app_profile_id,
1097
- app_profile,
1098
- ignore_warnings: nil,
1099
- options: nil,
1100
- &block
1101
- req = {
1102
- parent: parent,
1103
- app_profile_id: app_profile_id,
1104
- app_profile: app_profile,
1105
- ignore_warnings: ignore_warnings
1106
- }.delete_if { |_, v| v.nil? }
1107
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::CreateAppProfileRequest)
1108
- @create_app_profile.call(req, options, &block)
1109
- end
1110
-
1111
- # Gets information about an app profile.
1112
- #
1113
- # @param name [String]
1114
- # The unique name of the requested app profile. Values are of the form
1115
- # `projects/<project>/instances/<instance>/appProfiles/<app_profile>`.
1116
- # @param options [Google::Gax::CallOptions]
1117
- # Overrides the default settings for this call, e.g, timeout,
1118
- # retries, etc.
1119
- # @yield [result, operation] Access the result along with the RPC operation
1120
- # @yieldparam result [Google::Bigtable::Admin::V2::AppProfile]
1121
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1122
- # @return [Google::Bigtable::Admin::V2::AppProfile]
1123
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1124
- # @example
1125
- # require "google/cloud/bigtable/admin"
1126
- #
1127
- # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
1128
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.app_profile_path("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]")
1129
- # response = bigtable_instance_admin_client.get_app_profile(formatted_name)
1130
-
1131
- def get_app_profile \
1132
- name,
1133
- options: nil,
1134
- &block
1135
- req = {
1136
- name: name
1137
- }.delete_if { |_, v| v.nil? }
1138
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::GetAppProfileRequest)
1139
- @get_app_profile.call(req, options, &block)
1140
- end
1141
-
1142
- # Lists information about app profiles in an instance.
1143
- #
1144
- # @param parent [String]
1145
- # The unique name of the instance for which a list of app profiles is
1146
- # requested. Values are of the form
1147
- # `projects/<project>/instances/<instance>`.
1148
- # Use `<instance> = '-'` to list AppProfiles for all Instances in a project,
1149
- # e.g., `projects/myproject/instances/-`.
1150
- # @param page_size [Integer]
1151
- # Maximum number of results per page.
1152
- # CURRENTLY UNIMPLEMENTED AND IGNORED.
1153
- # @param options [Google::Gax::CallOptions]
1154
- # Overrides the default settings for this call, e.g, timeout,
1155
- # retries, etc.
1156
- # @yield [result, operation] Access the result along with the RPC operation
1157
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Bigtable::Admin::V2::AppProfile>]
1158
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1159
- # @return [Google::Gax::PagedEnumerable<Google::Bigtable::Admin::V2::AppProfile>]
1160
- # An enumerable of Google::Bigtable::Admin::V2::AppProfile instances.
1161
- # See Google::Gax::PagedEnumerable documentation for other
1162
- # operations such as per-page iteration or access to the response
1163
- # object.
1164
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1165
- # @example
1166
- # require "google/cloud/bigtable/admin"
1167
- #
1168
- # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
1169
- # formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
1170
- #
1171
- # # Iterate over all results.
1172
- # bigtable_instance_admin_client.list_app_profiles(formatted_parent).each do |element|
1173
- # # Process element.
1174
- # end
1175
- #
1176
- # # Or iterate over results one page at a time.
1177
- # bigtable_instance_admin_client.list_app_profiles(formatted_parent).each_page do |page|
1178
- # # Process each page at a time.
1179
- # page.each do |element|
1180
- # # Process element.
1181
- # end
1182
- # end
1183
-
1184
- def list_app_profiles \
1185
- parent,
1186
- page_size: nil,
1187
- options: nil,
1188
- &block
1189
- req = {
1190
- parent: parent,
1191
- page_size: page_size
1192
- }.delete_if { |_, v| v.nil? }
1193
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::ListAppProfilesRequest)
1194
- @list_app_profiles.call(req, options, &block)
1195
- end
1196
-
1197
- # Updates an app profile within an instance.
1198
- #
1199
- # @param app_profile [Google::Bigtable::Admin::V2::AppProfile | Hash]
1200
- # The app profile which will (partially) replace the current value.
1201
- # A hash of the same form as `Google::Bigtable::Admin::V2::AppProfile`
1202
- # can also be provided.
1203
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
1204
- # The subset of app profile fields which should be replaced.
1205
- # If unset, all fields will be replaced.
1206
- # A hash of the same form as `Google::Protobuf::FieldMask`
1207
- # can also be provided.
1208
- # @param ignore_warnings [true, false]
1209
- # If true, ignore safety checks when updating the app profile.
1210
- # @param options [Google::Gax::CallOptions]
1211
- # Overrides the default settings for this call, e.g, timeout,
1212
- # retries, etc.
1213
- # @return [Google::Gax::Operation]
1214
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1215
- # @example
1216
- # require "google/cloud/bigtable/admin"
1217
- #
1218
- # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
1219
- #
1220
- # # TODO: Initialize `app_profile`:
1221
- # app_profile = {}
1222
- #
1223
- # # TODO: Initialize `update_mask`:
1224
- # update_mask = {}
1225
- #
1226
- # # Register a callback during the method call.
1227
- # operation = bigtable_instance_admin_client.update_app_profile(app_profile, update_mask) do |op|
1228
- # raise op.results.message if op.error?
1229
- # op_results = op.results
1230
- # # Process the results.
1231
- #
1232
- # metadata = op.metadata
1233
- # # Process the metadata.
1234
- # end
1235
- #
1236
- # # Or use the return value to register a callback.
1237
- # operation.on_done do |op|
1238
- # raise op.results.message if op.error?
1239
- # op_results = op.results
1240
- # # Process the results.
1241
- #
1242
- # metadata = op.metadata
1243
- # # Process the metadata.
1244
- # end
1245
- #
1246
- # # Manually reload the operation.
1247
- # operation.reload!
1248
- #
1249
- # # Or block until the operation completes, triggering callbacks on
1250
- # # completion.
1251
- # operation.wait_until_done!
1252
-
1253
- def update_app_profile \
1254
- app_profile,
1255
- update_mask,
1256
- ignore_warnings: nil,
1257
- options: nil
1258
- req = {
1259
- app_profile: app_profile,
1260
- update_mask: update_mask,
1261
- ignore_warnings: ignore_warnings
1262
- }.delete_if { |_, v| v.nil? }
1263
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::UpdateAppProfileRequest)
1264
- operation = Google::Gax::Operation.new(
1265
- @update_app_profile.call(req, options),
1266
- @operations_client,
1267
- Google::Bigtable::Admin::V2::AppProfile,
1268
- Google::Bigtable::Admin::V2::UpdateAppProfileMetadata,
1269
- call_options: options
1270
- )
1271
- operation.on_done { |operation| yield(operation) } if block_given?
1272
- operation
1273
- end
1274
-
1275
- # Deletes an app profile from an instance.
1276
- #
1277
- # @param name [String]
1278
- # The unique name of the app profile to be deleted. Values are of the form
1279
- # `projects/<project>/instances/<instance>/appProfiles/<app_profile>`.
1280
- # @param ignore_warnings [true, false]
1281
- # If true, ignore safety checks when deleting the app profile.
1282
- # @param options [Google::Gax::CallOptions]
1283
- # Overrides the default settings for this call, e.g, timeout,
1284
- # retries, etc.
1285
- # @yield [result, operation] Access the result along with the RPC operation
1286
- # @yieldparam result []
1287
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1288
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1289
- # @example
1290
- # require "google/cloud/bigtable/admin"
1291
- #
1292
- # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
1293
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.app_profile_path("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]")
1294
- #
1295
- # # TODO: Initialize `ignore_warnings`:
1296
- # ignore_warnings = false
1297
- # bigtable_instance_admin_client.delete_app_profile(formatted_name, ignore_warnings)
1298
-
1299
- def delete_app_profile \
1300
- name,
1301
- ignore_warnings,
1302
- options: nil,
1303
- &block
1304
- req = {
1305
- name: name,
1306
- ignore_warnings: ignore_warnings
1307
- }.delete_if { |_, v| v.nil? }
1308
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::DeleteAppProfileRequest)
1309
- @delete_app_profile.call(req, options, &block)
1310
- nil
1311
- end
1312
-
1313
- # Gets the access control policy for an instance resource. Returns an empty
1314
- # policy if an instance exists but does not have a policy set.
1315
- #
1316
- # @param resource [String]
1317
- # REQUIRED: The resource for which the policy is being requested.
1318
- # See the operation documentation for the appropriate value for this field.
1319
- # @param options_ [Google::Iam::V1::GetPolicyOptions | Hash]
1320
- # OPTIONAL: A `GetPolicyOptions` object for specifying options to
1321
- # `GetIamPolicy`. This field is only used by Cloud IAM.
1322
- # A hash of the same form as `Google::Iam::V1::GetPolicyOptions`
1323
- # can also be provided.
1324
- # @param options [Google::Gax::CallOptions]
1325
- # Overrides the default settings for this call, e.g, timeout,
1326
- # retries, etc.
1327
- # @yield [result, operation] Access the result along with the RPC operation
1328
- # @yieldparam result [Google::Iam::V1::Policy]
1329
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1330
- # @return [Google::Iam::V1::Policy]
1331
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1332
- # @example
1333
- # require "google/cloud/bigtable/admin"
1334
- #
1335
- # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
1336
- # formatted_resource = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
1337
- # response = bigtable_instance_admin_client.get_iam_policy(formatted_resource)
1338
-
1339
- def get_iam_policy \
1340
- resource,
1341
- options_: nil,
1342
- options: nil,
1343
- &block
1344
- req = {
1345
- resource: resource,
1346
- options: options_
1347
- }.delete_if { |_, v| v.nil? }
1348
- req = Google::Gax::to_proto(req, Google::Iam::V1::GetIamPolicyRequest)
1349
- @get_iam_policy.call(req, options, &block)
1350
- end
1351
-
1352
- # Sets the access control policy on an instance resource. Replaces any
1353
- # existing policy.
1354
- #
1355
- # @param resource [String]
1356
- # REQUIRED: The resource for which the policy is being specified.
1357
- # See the operation documentation for the appropriate value for this field.
1358
- # @param policy [Google::Iam::V1::Policy | Hash]
1359
- # REQUIRED: The complete policy to be applied to the `resource`. The size of
1360
- # the policy is limited to a few 10s of KB. An empty policy is a
1361
- # valid policy but certain Cloud Platform services (such as Projects)
1362
- # might reject them.
1363
- # A hash of the same form as `Google::Iam::V1::Policy`
1364
- # can also be provided.
1365
- # @param options [Google::Gax::CallOptions]
1366
- # Overrides the default settings for this call, e.g, timeout,
1367
- # retries, etc.
1368
- # @yield [result, operation] Access the result along with the RPC operation
1369
- # @yieldparam result [Google::Iam::V1::Policy]
1370
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1371
- # @return [Google::Iam::V1::Policy]
1372
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1373
- # @example
1374
- # require "google/cloud/bigtable/admin"
1375
- #
1376
- # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
1377
- # formatted_resource = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
1378
- #
1379
- # # TODO: Initialize `policy`:
1380
- # policy = {}
1381
- # response = bigtable_instance_admin_client.set_iam_policy(formatted_resource, policy)
1382
-
1383
- def set_iam_policy \
1384
- resource,
1385
- policy,
1386
- options: nil,
1387
- &block
1388
- req = {
1389
- resource: resource,
1390
- policy: policy
1391
- }.delete_if { |_, v| v.nil? }
1392
- req = Google::Gax::to_proto(req, Google::Iam::V1::SetIamPolicyRequest)
1393
- @set_iam_policy.call(req, options, &block)
1394
- end
1395
-
1396
- # Returns permissions that the caller has on the specified instance resource.
1397
- #
1398
- # @param resource [String]
1399
- # REQUIRED: The resource for which the policy detail is being requested.
1400
- # See the operation documentation for the appropriate value for this field.
1401
- # @param permissions [Array<String>]
1402
- # The set of permissions to check for the `resource`. Permissions with
1403
- # wildcards (such as '*' or 'storage.*') are not allowed. For more
1404
- # information see
1405
- # [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
1406
- # @param options [Google::Gax::CallOptions]
1407
- # Overrides the default settings for this call, e.g, timeout,
1408
- # retries, etc.
1409
- # @yield [result, operation] Access the result along with the RPC operation
1410
- # @yieldparam result [Google::Iam::V1::TestIamPermissionsResponse]
1411
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1412
- # @return [Google::Iam::V1::TestIamPermissionsResponse]
1413
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1414
- # @example
1415
- # require "google/cloud/bigtable/admin"
1416
- #
1417
- # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
1418
- # formatted_resource = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
1419
- #
1420
- # # TODO: Initialize `permissions`:
1421
- # permissions = []
1422
- # response = bigtable_instance_admin_client.test_iam_permissions(formatted_resource, permissions)
1423
-
1424
- def test_iam_permissions \
1425
- resource,
1426
- permissions,
1427
- options: nil,
1428
- &block
1429
- req = {
1430
- resource: resource,
1431
- permissions: permissions
1432
- }.delete_if { |_, v| v.nil? }
1433
- req = Google::Gax::to_proto(req, Google::Iam::V1::TestIamPermissionsRequest)
1434
- @test_iam_permissions.call(req, options, &block)
1435
- end
1436
- end
1437
- end
1438
- end
1439
- end
1440
- end
1441
- end