google-cloud-bigtable 1.2.2 → 2.2.1

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