google-cloud-bigtable 1.1.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,139 +0,0 @@
1
- {
2
- "interfaces": {
3
- "google.bigtable.admin.v2.BigtableInstanceAdmin": {
4
- "retry_codes": {
5
- "idempotent": [
6
- "DEADLINE_EXCEEDED",
7
- "UNAVAILABLE"
8
- ],
9
- "non_idempotent": []
10
- },
11
- "retry_params": {
12
- "idempotent_params": {
13
- "initial_retry_delay_millis": 1000,
14
- "retry_delay_multiplier": 2.0,
15
- "max_retry_delay_millis": 60000,
16
- "initial_rpc_timeout_millis": 60000,
17
- "rpc_timeout_multiplier": 1.0,
18
- "max_rpc_timeout_millis": 60000,
19
- "total_timeout_millis": 600000
20
- },
21
- "non_idempotent_params": {
22
- "initial_retry_delay_millis": 0,
23
- "retry_delay_multiplier": 1.0,
24
- "max_retry_delay_millis": 0,
25
- "initial_rpc_timeout_millis": 60000,
26
- "rpc_timeout_multiplier": 1.0,
27
- "max_rpc_timeout_millis": 60000,
28
- "total_timeout_millis": 60000
29
- },
30
- "non_idempotent_heavy_params": {
31
- "initial_retry_delay_millis": 0,
32
- "retry_delay_multiplier": 1.0,
33
- "max_retry_delay_millis": 0,
34
- "initial_rpc_timeout_millis": 300000,
35
- "rpc_timeout_multiplier": 1.0,
36
- "max_rpc_timeout_millis": 300000,
37
- "total_timeout_millis": 300000
38
- }
39
- },
40
- "methods": {
41
- "CreateInstance": {
42
- "timeout_millis": 60000,
43
- "retry_codes_name": "non_idempotent",
44
- "retry_params_name": "non_idempotent_heavy_params"
45
- },
46
- "GetInstance": {
47
- "timeout_millis": 60000,
48
- "retry_codes_name": "idempotent",
49
- "retry_params_name": "idempotent_params"
50
- },
51
- "ListInstances": {
52
- "timeout_millis": 60000,
53
- "retry_codes_name": "idempotent",
54
- "retry_params_name": "idempotent_params"
55
- },
56
- "UpdateInstance": {
57
- "timeout_millis": 60000,
58
- "retry_codes_name": "idempotent",
59
- "retry_params_name": "idempotent_params"
60
- },
61
- "PartialUpdateInstance": {
62
- "timeout_millis": 60000,
63
- "retry_codes_name": "idempotent",
64
- "retry_params_name": "idempotent_params"
65
- },
66
- "DeleteInstance": {
67
- "timeout_millis": 60000,
68
- "retry_codes_name": "non_idempotent",
69
- "retry_params_name": "non_idempotent_params"
70
- },
71
- "CreateCluster": {
72
- "timeout_millis": 60000,
73
- "retry_codes_name": "non_idempotent",
74
- "retry_params_name": "non_idempotent_params"
75
- },
76
- "GetCluster": {
77
- "timeout_millis": 60000,
78
- "retry_codes_name": "idempotent",
79
- "retry_params_name": "idempotent_params"
80
- },
81
- "ListClusters": {
82
- "timeout_millis": 60000,
83
- "retry_codes_name": "idempotent",
84
- "retry_params_name": "idempotent_params"
85
- },
86
- "UpdateCluster": {
87
- "timeout_millis": 60000,
88
- "retry_codes_name": "idempotent",
89
- "retry_params_name": "idempotent_params"
90
- },
91
- "DeleteCluster": {
92
- "timeout_millis": 60000,
93
- "retry_codes_name": "non_idempotent",
94
- "retry_params_name": "non_idempotent_params"
95
- },
96
- "CreateAppProfile": {
97
- "timeout_millis": 60000,
98
- "retry_codes_name": "non_idempotent",
99
- "retry_params_name": "non_idempotent_params"
100
- },
101
- "GetAppProfile": {
102
- "timeout_millis": 60000,
103
- "retry_codes_name": "idempotent",
104
- "retry_params_name": "idempotent_params"
105
- },
106
- "ListAppProfiles": {
107
- "timeout_millis": 60000,
108
- "retry_codes_name": "idempotent",
109
- "retry_params_name": "idempotent_params"
110
- },
111
- "UpdateAppProfile": {
112
- "timeout_millis": 60000,
113
- "retry_codes_name": "idempotent",
114
- "retry_params_name": "idempotent_params"
115
- },
116
- "DeleteAppProfile": {
117
- "timeout_millis": 60000,
118
- "retry_codes_name": "non_idempotent",
119
- "retry_params_name": "non_idempotent_params"
120
- },
121
- "GetIamPolicy": {
122
- "timeout_millis": 60000,
123
- "retry_codes_name": "idempotent",
124
- "retry_params_name": "idempotent_params"
125
- },
126
- "SetIamPolicy": {
127
- "timeout_millis": 60000,
128
- "retry_codes_name": "non_idempotent",
129
- "retry_params_name": "non_idempotent_params"
130
- },
131
- "TestIamPermissions": {
132
- "timeout_millis": 60000,
133
- "retry_codes_name": "idempotent",
134
- "retry_params_name": "idempotent_params"
135
- }
136
- }
137
- }
138
- }
139
- }
@@ -1,1245 +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_table_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_table_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 tables.
40
- #
41
- #
42
- # Provides access to the table schemas only, not the data stored within
43
- # the tables.
44
- #
45
- # @!attribute [r] bigtable_table_admin_stub
46
- # @return [Google::Bigtable::Admin::V2::BigtableTableAdmin::Stub]
47
- class BigtableTableAdminClient
48
- # @private
49
- attr_reader :bigtable_table_admin_stub
50
-
51
- # The default address of the service.
52
- SERVICE_ADDRESS = "bigtableadmin.googleapis.com".freeze
53
-
54
- # The default port of the service.
55
- DEFAULT_SERVICE_PORT = 443
56
-
57
- # The default set of gRPC interceptors.
58
- GRPC_INTERCEPTORS = []
59
-
60
- DEFAULT_TIMEOUT = 30
61
-
62
- PAGE_DESCRIPTORS = {
63
- "list_tables" => Google::Gax::PageDescriptor.new(
64
- "page_token",
65
- "next_page_token",
66
- "tables"),
67
- "list_snapshots" => Google::Gax::PageDescriptor.new(
68
- "page_token",
69
- "next_page_token",
70
- "snapshots")
71
- }.freeze
72
-
73
- private_constant :PAGE_DESCRIPTORS
74
-
75
- # The scopes needed to make gRPC calls to all of the methods defined in
76
- # this service.
77
- ALL_SCOPES = [
78
- "https://www.googleapis.com/auth/bigtable.admin",
79
- "https://www.googleapis.com/auth/bigtable.admin.cluster",
80
- "https://www.googleapis.com/auth/bigtable.admin.instance",
81
- "https://www.googleapis.com/auth/bigtable.admin.table",
82
- "https://www.googleapis.com/auth/cloud-bigtable.admin",
83
- "https://www.googleapis.com/auth/cloud-bigtable.admin.cluster",
84
- "https://www.googleapis.com/auth/cloud-bigtable.admin.table",
85
- "https://www.googleapis.com/auth/cloud-platform",
86
- "https://www.googleapis.com/auth/cloud-platform.read-only"
87
- ].freeze
88
-
89
- # @private
90
- class OperationsClient < Google::Longrunning::OperationsClient
91
- self::SERVICE_ADDRESS = BigtableTableAdminClient::SERVICE_ADDRESS
92
- self::GRPC_INTERCEPTORS = BigtableTableAdminClient::GRPC_INTERCEPTORS
93
- end
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
- SNAPSHOT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
108
- "projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}"
109
- )
110
-
111
- private_constant :SNAPSHOT_PATH_TEMPLATE
112
-
113
- TABLE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
114
- "projects/{project}/instances/{instance}/tables/{table}"
115
- )
116
-
117
- private_constant :TABLE_PATH_TEMPLATE
118
-
119
- # Returns a fully-qualified cluster resource name string.
120
- # @param project [String]
121
- # @param instance [String]
122
- # @param cluster [String]
123
- # @return [String]
124
- def self.cluster_path project, instance, cluster
125
- CLUSTER_PATH_TEMPLATE.render(
126
- :"project" => project,
127
- :"instance" => instance,
128
- :"cluster" => cluster
129
- )
130
- end
131
-
132
- # Returns a fully-qualified instance resource name string.
133
- # @param project [String]
134
- # @param instance [String]
135
- # @return [String]
136
- def self.instance_path project, instance
137
- INSTANCE_PATH_TEMPLATE.render(
138
- :"project" => project,
139
- :"instance" => instance
140
- )
141
- end
142
-
143
- # Returns a fully-qualified snapshot resource name string.
144
- # @param project [String]
145
- # @param instance [String]
146
- # @param cluster [String]
147
- # @param snapshot [String]
148
- # @return [String]
149
- def self.snapshot_path project, instance, cluster, snapshot
150
- SNAPSHOT_PATH_TEMPLATE.render(
151
- :"project" => project,
152
- :"instance" => instance,
153
- :"cluster" => cluster,
154
- :"snapshot" => snapshot
155
- )
156
- end
157
-
158
- # Returns a fully-qualified table resource name string.
159
- # @param project [String]
160
- # @param instance [String]
161
- # @param table [String]
162
- # @return [String]
163
- def self.table_path project, instance, table
164
- TABLE_PATH_TEMPLATE.render(
165
- :"project" => project,
166
- :"instance" => instance,
167
- :"table" => table
168
- )
169
- end
170
-
171
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
172
- # Provides the means for authenticating requests made by the client. This parameter can
173
- # be many types.
174
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
175
- # authenticating requests made by this client.
176
- # A `String` will be treated as the path to the keyfile to be used for the construction of
177
- # credentials for this client.
178
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
179
- # credentials for this client.
180
- # A `GRPC::Core::Channel` will be used to make calls through.
181
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
182
- # should already be composed with a `GRPC::Core::CallCredentials` object.
183
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
184
- # metadata for requests, generally, to give OAuth credentials.
185
- # @param scopes [Array<String>]
186
- # The OAuth scopes for this service. This parameter is ignored if
187
- # an updater_proc is supplied.
188
- # @param client_config [Hash]
189
- # A Hash for call options for each method. See
190
- # Google::Gax#construct_settings for the structure of
191
- # this data. Falls back to the default config if not specified
192
- # or the specified config is missing data points.
193
- # @param timeout [Numeric]
194
- # The default timeout, in seconds, for calls made through this client.
195
- # @param metadata [Hash]
196
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
197
- # @param service_address [String]
198
- # Override for the service hostname, or `nil` to leave as the default.
199
- # @param service_port [Integer]
200
- # Override for the service port, or `nil` to leave as the default.
201
- # @param exception_transformer [Proc]
202
- # An optional proc that intercepts any exceptions raised during an API call to inject
203
- # custom error handling.
204
- def initialize \
205
- credentials: nil,
206
- scopes: ALL_SCOPES,
207
- client_config: {},
208
- timeout: DEFAULT_TIMEOUT,
209
- metadata: nil,
210
- service_address: nil,
211
- service_port: nil,
212
- exception_transformer: nil,
213
- lib_name: nil,
214
- lib_version: ""
215
- # These require statements are intentionally placed here to initialize
216
- # the gRPC module only when it's required.
217
- # See https://github.com/googleapis/toolkit/issues/446
218
- require "google/gax/grpc"
219
- require "google/bigtable/admin/v2/bigtable_table_admin_services_pb"
220
-
221
- credentials ||= Google::Cloud::Bigtable::Admin::V2::Credentials.default
222
-
223
- @operations_client = OperationsClient.new(
224
- credentials: credentials,
225
- scopes: scopes,
226
- client_config: client_config,
227
- timeout: timeout,
228
- lib_name: lib_name,
229
- service_address: service_address,
230
- service_port: service_port,
231
- lib_version: lib_version,
232
- metadata: metadata,
233
- )
234
-
235
- if credentials.is_a?(String) || credentials.is_a?(Hash)
236
- updater_proc = Google::Cloud::Bigtable::Admin::V2::Credentials.new(credentials).updater_proc
237
- end
238
- if credentials.is_a?(GRPC::Core::Channel)
239
- channel = credentials
240
- end
241
- if credentials.is_a?(GRPC::Core::ChannelCredentials)
242
- chan_creds = credentials
243
- end
244
- if credentials.is_a?(Proc)
245
- updater_proc = credentials
246
- end
247
- if credentials.is_a?(Google::Auth::Credentials)
248
- updater_proc = credentials.updater_proc
249
- end
250
-
251
- package_version = Google::Cloud::Bigtable::VERSION
252
-
253
- google_api_client = "gl-ruby/#{RUBY_VERSION}"
254
- google_api_client << " #{lib_name}/#{lib_version}" if lib_name
255
- google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
256
- google_api_client << " grpc/#{GRPC::VERSION}"
257
- google_api_client.freeze
258
-
259
- headers = { :"x-goog-api-client" => google_api_client }
260
- headers.merge!(metadata) unless metadata.nil?
261
- client_config_file = Pathname.new(__dir__).join(
262
- "bigtable_table_admin_client_config.json"
263
- )
264
- defaults = client_config_file.open do |f|
265
- Google::Gax.construct_settings(
266
- "google.bigtable.admin.v2.BigtableTableAdmin",
267
- JSON.parse(f.read),
268
- client_config,
269
- Google::Gax::Grpc::STATUS_CODE_NAMES,
270
- timeout,
271
- page_descriptors: PAGE_DESCRIPTORS,
272
- errors: Google::Gax::Grpc::API_ERRORS,
273
- metadata: headers
274
- )
275
- end
276
-
277
- # Allow overriding the service path/port in subclasses.
278
- service_path = service_address || self.class::SERVICE_ADDRESS
279
- port = service_port || self.class::DEFAULT_SERVICE_PORT
280
- interceptors = self.class::GRPC_INTERCEPTORS
281
- @bigtable_table_admin_stub = Google::Gax::Grpc.create_stub(
282
- service_path,
283
- port,
284
- chan_creds: chan_creds,
285
- channel: channel,
286
- updater_proc: updater_proc,
287
- scopes: scopes,
288
- interceptors: interceptors,
289
- &Google::Bigtable::Admin::V2::BigtableTableAdmin::Stub.method(:new)
290
- )
291
-
292
- @create_table = Google::Gax.create_api_call(
293
- @bigtable_table_admin_stub.method(:create_table),
294
- defaults["create_table"],
295
- exception_transformer: exception_transformer,
296
- params_extractor: proc do |request|
297
- {'parent' => request.parent}
298
- end
299
- )
300
- @create_table_from_snapshot = Google::Gax.create_api_call(
301
- @bigtable_table_admin_stub.method(:create_table_from_snapshot),
302
- defaults["create_table_from_snapshot"],
303
- exception_transformer: exception_transformer,
304
- params_extractor: proc do |request|
305
- {'parent' => request.parent}
306
- end
307
- )
308
- @list_tables = Google::Gax.create_api_call(
309
- @bigtable_table_admin_stub.method(:list_tables),
310
- defaults["list_tables"],
311
- exception_transformer: exception_transformer,
312
- params_extractor: proc do |request|
313
- {'parent' => request.parent}
314
- end
315
- )
316
- @get_table = Google::Gax.create_api_call(
317
- @bigtable_table_admin_stub.method(:get_table),
318
- defaults["get_table"],
319
- exception_transformer: exception_transformer,
320
- params_extractor: proc do |request|
321
- {'name' => request.name}
322
- end
323
- )
324
- @delete_table = Google::Gax.create_api_call(
325
- @bigtable_table_admin_stub.method(:delete_table),
326
- defaults["delete_table"],
327
- exception_transformer: exception_transformer,
328
- params_extractor: proc do |request|
329
- {'name' => request.name}
330
- end
331
- )
332
- @modify_column_families = Google::Gax.create_api_call(
333
- @bigtable_table_admin_stub.method(:modify_column_families),
334
- defaults["modify_column_families"],
335
- exception_transformer: exception_transformer,
336
- params_extractor: proc do |request|
337
- {'name' => request.name}
338
- end
339
- )
340
- @drop_row_range = Google::Gax.create_api_call(
341
- @bigtable_table_admin_stub.method(:drop_row_range),
342
- defaults["drop_row_range"],
343
- exception_transformer: exception_transformer,
344
- params_extractor: proc do |request|
345
- {'name' => request.name}
346
- end
347
- )
348
- @generate_consistency_token = Google::Gax.create_api_call(
349
- @bigtable_table_admin_stub.method(:generate_consistency_token),
350
- defaults["generate_consistency_token"],
351
- exception_transformer: exception_transformer,
352
- params_extractor: proc do |request|
353
- {'name' => request.name}
354
- end
355
- )
356
- @check_consistency = Google::Gax.create_api_call(
357
- @bigtable_table_admin_stub.method(:check_consistency),
358
- defaults["check_consistency"],
359
- exception_transformer: exception_transformer,
360
- params_extractor: proc do |request|
361
- {'name' => request.name}
362
- end
363
- )
364
- @get_iam_policy = Google::Gax.create_api_call(
365
- @bigtable_table_admin_stub.method(:get_iam_policy),
366
- defaults["get_iam_policy"],
367
- exception_transformer: exception_transformer,
368
- params_extractor: proc do |request|
369
- {'resource' => request.resource}
370
- end
371
- )
372
- @set_iam_policy = Google::Gax.create_api_call(
373
- @bigtable_table_admin_stub.method(:set_iam_policy),
374
- defaults["set_iam_policy"],
375
- exception_transformer: exception_transformer,
376
- params_extractor: proc do |request|
377
- {'resource' => request.resource}
378
- end
379
- )
380
- @test_iam_permissions = Google::Gax.create_api_call(
381
- @bigtable_table_admin_stub.method(:test_iam_permissions),
382
- defaults["test_iam_permissions"],
383
- exception_transformer: exception_transformer,
384
- params_extractor: proc do |request|
385
- {'resource' => request.resource}
386
- end
387
- )
388
- @snapshot_table = Google::Gax.create_api_call(
389
- @bigtable_table_admin_stub.method(:snapshot_table),
390
- defaults["snapshot_table"],
391
- exception_transformer: exception_transformer,
392
- params_extractor: proc do |request|
393
- {'name' => request.name}
394
- end
395
- )
396
- @get_snapshot = Google::Gax.create_api_call(
397
- @bigtable_table_admin_stub.method(:get_snapshot),
398
- defaults["get_snapshot"],
399
- exception_transformer: exception_transformer,
400
- params_extractor: proc do |request|
401
- {'name' => request.name}
402
- end
403
- )
404
- @list_snapshots = Google::Gax.create_api_call(
405
- @bigtable_table_admin_stub.method(:list_snapshots),
406
- defaults["list_snapshots"],
407
- exception_transformer: exception_transformer,
408
- params_extractor: proc do |request|
409
- {'parent' => request.parent}
410
- end
411
- )
412
- @delete_snapshot = Google::Gax.create_api_call(
413
- @bigtable_table_admin_stub.method(:delete_snapshot),
414
- defaults["delete_snapshot"],
415
- exception_transformer: exception_transformer,
416
- params_extractor: proc do |request|
417
- {'name' => request.name}
418
- end
419
- )
420
- end
421
-
422
- # Service calls
423
-
424
- # Creates a new table in the specified instance.
425
- # The table can be created with a full set of initial column families,
426
- # specified in the request.
427
- #
428
- # @param parent [String]
429
- # The unique name of the instance in which to create the table.
430
- # Values are of the form `projects/<project>/instances/<instance>`.
431
- # @param table_id [String]
432
- # The name by which the new table should be referred to within the parent
433
- # instance, e.g., `foobar` rather than `<parent>/tables/foobar`.
434
- # @param table [Google::Bigtable::Admin::V2::Table | Hash]
435
- # The Table to create.
436
- # A hash of the same form as `Google::Bigtable::Admin::V2::Table`
437
- # can also be provided.
438
- # @param initial_splits [Array<Google::Bigtable::Admin::V2::CreateTableRequest::Split | Hash>]
439
- # The optional list of row keys that will be used to initially split the
440
- # table into several tablets (tablets are similar to HBase regions).
441
- # Given two split keys, `s1` and `s2`, three tablets will be created,
442
- # spanning the key ranges: `[, s1), [s1, s2), [s2, )`.
443
- #
444
- # Example:
445
- #
446
- # * Row keys := `["a", "apple", "custom", "customer_1", "customer_2",`
447
- # `"other", "zz"]`
448
- # * initial_split_keys := `["apple", "customer_1", "customer_2", "other"]`
449
- # * Key assignment:
450
- # * Tablet 1 `[, apple) => {"a"}.`
451
- # * Tablet 2 `[apple, customer_1) => {"apple", "custom"}.`
452
- # * Tablet 3 `[customer_1, customer_2) => {"customer_1"}.`
453
- # * Tablet 4 `[customer_2, other) => {"customer_2"}.`
454
- # * Tablet 5 `[other, ) => {"other", "zz"}.`
455
- # A hash of the same form as `Google::Bigtable::Admin::V2::CreateTableRequest::Split`
456
- # can also be provided.
457
- # @param options [Google::Gax::CallOptions]
458
- # Overrides the default settings for this call, e.g, timeout,
459
- # retries, etc.
460
- # @yield [result, operation] Access the result along with the RPC operation
461
- # @yieldparam result [Google::Bigtable::Admin::V2::Table]
462
- # @yieldparam operation [GRPC::ActiveCall::Operation]
463
- # @return [Google::Bigtable::Admin::V2::Table]
464
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
465
- # @example
466
- # require "google/cloud/bigtable/admin"
467
- #
468
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
469
- # formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
470
- #
471
- # # TODO: Initialize `table_id`:
472
- # table_id = ''
473
- #
474
- # # TODO: Initialize `table`:
475
- # table = {}
476
- # response = bigtable_table_admin_client.create_table(formatted_parent, table_id, table)
477
-
478
- def create_table \
479
- parent,
480
- table_id,
481
- table,
482
- initial_splits: nil,
483
- options: nil,
484
- &block
485
- req = {
486
- parent: parent,
487
- table_id: table_id,
488
- table: table,
489
- initial_splits: initial_splits
490
- }.delete_if { |_, v| v.nil? }
491
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::CreateTableRequest)
492
- @create_table.call(req, options, &block)
493
- end
494
-
495
- # Creates a new table from the specified snapshot. The target table must
496
- # not exist. The snapshot and the table must be in the same instance.
497
- #
498
- # Note: This is a private alpha release of Cloud Bigtable snapshots. This
499
- # feature is not currently available to most Cloud Bigtable customers. This
500
- # feature might be changed in backward-incompatible ways and is not
501
- # recommended for production use. It is not subject to any SLA or deprecation
502
- # policy.
503
- #
504
- # @param parent [String]
505
- # The unique name of the instance in which to create the table.
506
- # Values are of the form `projects/<project>/instances/<instance>`.
507
- # @param table_id [String]
508
- # The name by which the new table should be referred to within the parent
509
- # instance, e.g., `foobar` rather than `<parent>/tables/foobar`.
510
- # @param source_snapshot [String]
511
- # The unique name of the snapshot from which to restore the table. The
512
- # snapshot and the table must be in the same instance.
513
- # Values are of the form
514
- # `projects/<project>/instances/<instance>/clusters/<cluster>/snapshots/<snapshot>`.
515
- # @param options [Google::Gax::CallOptions]
516
- # Overrides the default settings for this call, e.g, timeout,
517
- # retries, etc.
518
- # @return [Google::Gax::Operation]
519
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
520
- # @example
521
- # require "google/cloud/bigtable/admin"
522
- #
523
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
524
- # formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
525
- #
526
- # # TODO: Initialize `table_id`:
527
- # table_id = ''
528
- #
529
- # # TODO: Initialize `source_snapshot`:
530
- # source_snapshot = ''
531
- #
532
- # # Register a callback during the method call.
533
- # operation = bigtable_table_admin_client.create_table_from_snapshot(formatted_parent, table_id, source_snapshot) do |op|
534
- # raise op.results.message if op.error?
535
- # op_results = op.results
536
- # # Process the results.
537
- #
538
- # metadata = op.metadata
539
- # # Process the metadata.
540
- # end
541
- #
542
- # # Or use the return value to register a callback.
543
- # operation.on_done do |op|
544
- # raise op.results.message if op.error?
545
- # op_results = op.results
546
- # # Process the results.
547
- #
548
- # metadata = op.metadata
549
- # # Process the metadata.
550
- # end
551
- #
552
- # # Manually reload the operation.
553
- # operation.reload!
554
- #
555
- # # Or block until the operation completes, triggering callbacks on
556
- # # completion.
557
- # operation.wait_until_done!
558
-
559
- def create_table_from_snapshot \
560
- parent,
561
- table_id,
562
- source_snapshot,
563
- options: nil
564
- req = {
565
- parent: parent,
566
- table_id: table_id,
567
- source_snapshot: source_snapshot
568
- }.delete_if { |_, v| v.nil? }
569
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::CreateTableFromSnapshotRequest)
570
- operation = Google::Gax::Operation.new(
571
- @create_table_from_snapshot.call(req, options),
572
- @operations_client,
573
- Google::Bigtable::Admin::V2::Table,
574
- Google::Bigtable::Admin::V2::CreateTableFromSnapshotMetadata,
575
- call_options: options
576
- )
577
- operation.on_done { |operation| yield(operation) } if block_given?
578
- operation
579
- end
580
-
581
- # Lists all tables served from a specified instance.
582
- #
583
- # @param parent [String]
584
- # The unique name of the instance for which tables should be listed.
585
- # Values are of the form `projects/<project>/instances/<instance>`.
586
- # @param view [Google::Bigtable::Admin::V2::Table::View]
587
- # The view to be applied to the returned tables' fields.
588
- # Defaults to `NAME_ONLY` if unspecified; no others are currently supported.
589
- # @param page_size [Integer]
590
- # Maximum number of results per page.
591
- # CURRENTLY UNIMPLEMENTED AND IGNORED.
592
- # @param options [Google::Gax::CallOptions]
593
- # Overrides the default settings for this call, e.g, timeout,
594
- # retries, etc.
595
- # @yield [result, operation] Access the result along with the RPC operation
596
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Bigtable::Admin::V2::Table>]
597
- # @yieldparam operation [GRPC::ActiveCall::Operation]
598
- # @return [Google::Gax::PagedEnumerable<Google::Bigtable::Admin::V2::Table>]
599
- # An enumerable of Google::Bigtable::Admin::V2::Table instances.
600
- # See Google::Gax::PagedEnumerable documentation for other
601
- # operations such as per-page iteration or access to the response
602
- # object.
603
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
604
- # @example
605
- # require "google/cloud/bigtable/admin"
606
- #
607
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
608
- # formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
609
- #
610
- # # Iterate over all results.
611
- # bigtable_table_admin_client.list_tables(formatted_parent).each do |element|
612
- # # Process element.
613
- # end
614
- #
615
- # # Or iterate over results one page at a time.
616
- # bigtable_table_admin_client.list_tables(formatted_parent).each_page do |page|
617
- # # Process each page at a time.
618
- # page.each do |element|
619
- # # Process element.
620
- # end
621
- # end
622
-
623
- def list_tables \
624
- parent,
625
- view: nil,
626
- page_size: nil,
627
- options: nil,
628
- &block
629
- req = {
630
- parent: parent,
631
- view: view,
632
- page_size: page_size
633
- }.delete_if { |_, v| v.nil? }
634
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::ListTablesRequest)
635
- @list_tables.call(req, options, &block)
636
- end
637
-
638
- # Gets metadata information about the specified table.
639
- #
640
- # @param name [String]
641
- # The unique name of the requested table.
642
- # Values are of the form
643
- # `projects/<project>/instances/<instance>/tables/<table>`.
644
- # @param view [Google::Bigtable::Admin::V2::Table::View]
645
- # The view to be applied to the returned table's fields.
646
- # Defaults to `SCHEMA_VIEW` if unspecified.
647
- # @param options [Google::Gax::CallOptions]
648
- # Overrides the default settings for this call, e.g, timeout,
649
- # retries, etc.
650
- # @yield [result, operation] Access the result along with the RPC operation
651
- # @yieldparam result [Google::Bigtable::Admin::V2::Table]
652
- # @yieldparam operation [GRPC::ActiveCall::Operation]
653
- # @return [Google::Bigtable::Admin::V2::Table]
654
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
655
- # @example
656
- # require "google/cloud/bigtable/admin"
657
- #
658
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
659
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
660
- # response = bigtable_table_admin_client.get_table(formatted_name)
661
-
662
- def get_table \
663
- name,
664
- view: nil,
665
- options: nil,
666
- &block
667
- req = {
668
- name: name,
669
- view: view
670
- }.delete_if { |_, v| v.nil? }
671
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::GetTableRequest)
672
- @get_table.call(req, options, &block)
673
- end
674
-
675
- # Permanently deletes a specified table and all of its data.
676
- #
677
- # @param name [String]
678
- # The unique name of the table to be deleted.
679
- # Values are of the form
680
- # `projects/<project>/instances/<instance>/tables/<table>`.
681
- # @param options [Google::Gax::CallOptions]
682
- # Overrides the default settings for this call, e.g, timeout,
683
- # retries, etc.
684
- # @yield [result, operation] Access the result along with the RPC operation
685
- # @yieldparam result []
686
- # @yieldparam operation [GRPC::ActiveCall::Operation]
687
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
688
- # @example
689
- # require "google/cloud/bigtable/admin"
690
- #
691
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
692
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
693
- # bigtable_table_admin_client.delete_table(formatted_name)
694
-
695
- def delete_table \
696
- name,
697
- options: nil,
698
- &block
699
- req = {
700
- name: name
701
- }.delete_if { |_, v| v.nil? }
702
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::DeleteTableRequest)
703
- @delete_table.call(req, options, &block)
704
- nil
705
- end
706
-
707
- # Performs a series of column family modifications on the specified table.
708
- # Either all or none of the modifications will occur before this method
709
- # returns, but data requests received prior to that point may see a table
710
- # where only some modifications have taken effect.
711
- #
712
- # @param name [String]
713
- # The unique name of the table whose families should be modified.
714
- # Values are of the form
715
- # `projects/<project>/instances/<instance>/tables/<table>`.
716
- # @param modifications [Array<Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification | Hash>]
717
- # Modifications to be atomically applied to the specified table's families.
718
- # Entries are applied in order, meaning that earlier modifications can be
719
- # masked by later ones (in the case of repeated updates to the same family,
720
- # for example).
721
- # A hash of the same form as `Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification`
722
- # can also be provided.
723
- # @param options [Google::Gax::CallOptions]
724
- # Overrides the default settings for this call, e.g, timeout,
725
- # retries, etc.
726
- # @yield [result, operation] Access the result along with the RPC operation
727
- # @yieldparam result [Google::Bigtable::Admin::V2::Table]
728
- # @yieldparam operation [GRPC::ActiveCall::Operation]
729
- # @return [Google::Bigtable::Admin::V2::Table]
730
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
731
- # @example
732
- # require "google/cloud/bigtable/admin"
733
- #
734
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
735
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
736
- #
737
- # # TODO: Initialize `modifications`:
738
- # modifications = []
739
- # response = bigtable_table_admin_client.modify_column_families(formatted_name, modifications)
740
-
741
- def modify_column_families \
742
- name,
743
- modifications,
744
- options: nil,
745
- &block
746
- req = {
747
- name: name,
748
- modifications: modifications
749
- }.delete_if { |_, v| v.nil? }
750
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest)
751
- @modify_column_families.call(req, options, &block)
752
- end
753
-
754
- # Permanently drop/delete a row range from a specified table. The request can
755
- # specify whether to delete all rows in a table, or only those that match a
756
- # particular prefix.
757
- #
758
- # @param name [String]
759
- # The unique name of the table on which to drop a range of rows.
760
- # Values are of the form
761
- # `projects/<project>/instances/<instance>/tables/<table>`.
762
- # @param row_key_prefix [String]
763
- # Delete all rows that start with this row key prefix. Prefix cannot be
764
- # zero length.
765
- # @param delete_all_data_from_table [true, false]
766
- # Delete all rows in the table. Setting this to false is a no-op.
767
- # @param options [Google::Gax::CallOptions]
768
- # Overrides the default settings for this call, e.g, timeout,
769
- # retries, etc.
770
- # @yield [result, operation] Access the result along with the RPC operation
771
- # @yieldparam result []
772
- # @yieldparam operation [GRPC::ActiveCall::Operation]
773
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
774
- # @example
775
- # require "google/cloud/bigtable/admin"
776
- #
777
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
778
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
779
- # bigtable_table_admin_client.drop_row_range(formatted_name)
780
-
781
- def drop_row_range \
782
- name,
783
- row_key_prefix: nil,
784
- delete_all_data_from_table: nil,
785
- options: nil,
786
- &block
787
- req = {
788
- name: name,
789
- row_key_prefix: row_key_prefix,
790
- delete_all_data_from_table: delete_all_data_from_table
791
- }.delete_if { |_, v| v.nil? }
792
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::DropRowRangeRequest)
793
- @drop_row_range.call(req, options, &block)
794
- nil
795
- end
796
-
797
- # Generates a consistency token for a Table, which can be used in
798
- # CheckConsistency to check whether mutations to the table that finished
799
- # before this call started have been replicated. The tokens will be available
800
- # for 90 days.
801
- #
802
- # @param name [String]
803
- # The unique name of the Table for which to create a consistency token.
804
- # Values are of the form
805
- # `projects/<project>/instances/<instance>/tables/<table>`.
806
- # @param options [Google::Gax::CallOptions]
807
- # Overrides the default settings for this call, e.g, timeout,
808
- # retries, etc.
809
- # @yield [result, operation] Access the result along with the RPC operation
810
- # @yieldparam result [Google::Bigtable::Admin::V2::GenerateConsistencyTokenResponse]
811
- # @yieldparam operation [GRPC::ActiveCall::Operation]
812
- # @return [Google::Bigtable::Admin::V2::GenerateConsistencyTokenResponse]
813
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
814
- # @example
815
- # require "google/cloud/bigtable/admin"
816
- #
817
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
818
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
819
- # response = bigtable_table_admin_client.generate_consistency_token(formatted_name)
820
-
821
- def generate_consistency_token \
822
- name,
823
- options: nil,
824
- &block
825
- req = {
826
- name: name
827
- }.delete_if { |_, v| v.nil? }
828
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::GenerateConsistencyTokenRequest)
829
- @generate_consistency_token.call(req, options, &block)
830
- end
831
-
832
- # Checks replication consistency based on a consistency token, that is, if
833
- # replication has caught up based on the conditions specified in the token
834
- # and the check request.
835
- #
836
- # @param name [String]
837
- # The unique name of the Table for which to check replication consistency.
838
- # Values are of the form
839
- # `projects/<project>/instances/<instance>/tables/<table>`.
840
- # @param consistency_token [String]
841
- # The token created using GenerateConsistencyToken for the Table.
842
- # @param options [Google::Gax::CallOptions]
843
- # Overrides the default settings for this call, e.g, timeout,
844
- # retries, etc.
845
- # @yield [result, operation] Access the result along with the RPC operation
846
- # @yieldparam result [Google::Bigtable::Admin::V2::CheckConsistencyResponse]
847
- # @yieldparam operation [GRPC::ActiveCall::Operation]
848
- # @return [Google::Bigtable::Admin::V2::CheckConsistencyResponse]
849
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
850
- # @example
851
- # require "google/cloud/bigtable/admin"
852
- #
853
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
854
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
855
- #
856
- # # TODO: Initialize `consistency_token`:
857
- # consistency_token = ''
858
- # response = bigtable_table_admin_client.check_consistency(formatted_name, consistency_token)
859
-
860
- def check_consistency \
861
- name,
862
- consistency_token,
863
- options: nil,
864
- &block
865
- req = {
866
- name: name,
867
- consistency_token: consistency_token
868
- }.delete_if { |_, v| v.nil? }
869
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::CheckConsistencyRequest)
870
- @check_consistency.call(req, options, &block)
871
- end
872
-
873
- # Gets the access control policy for a table resource. Returns an empty
874
- # policy if an table exists but does not have a policy set.
875
- #
876
- # @param resource [String]
877
- # REQUIRED: The resource for which the policy is being requested.
878
- # See the operation documentation for the appropriate value for this field.
879
- # @param options_ [Google::Iam::V1::GetPolicyOptions | Hash]
880
- # OPTIONAL: A `GetPolicyOptions` object for specifying options to
881
- # `GetIamPolicy`. This field is only used by Cloud IAM.
882
- # A hash of the same form as `Google::Iam::V1::GetPolicyOptions`
883
- # can also be provided.
884
- # @param options [Google::Gax::CallOptions]
885
- # Overrides the default settings for this call, e.g, timeout,
886
- # retries, etc.
887
- # @yield [result, operation] Access the result along with the RPC operation
888
- # @yieldparam result [Google::Iam::V1::Policy]
889
- # @yieldparam operation [GRPC::ActiveCall::Operation]
890
- # @return [Google::Iam::V1::Policy]
891
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
892
- # @example
893
- # require "google/cloud/bigtable/admin"
894
- #
895
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
896
- # formatted_resource = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
897
- # response = bigtable_table_admin_client.get_iam_policy(formatted_resource)
898
-
899
- def get_iam_policy \
900
- resource,
901
- options_: nil,
902
- options: nil,
903
- &block
904
- req = {
905
- resource: resource,
906
- options: options_
907
- }.delete_if { |_, v| v.nil? }
908
- req = Google::Gax::to_proto(req, Google::Iam::V1::GetIamPolicyRequest)
909
- @get_iam_policy.call(req, options, &block)
910
- end
911
-
912
- # Sets the access control policy on a table resource. Replaces any existing
913
- # policy.
914
- #
915
- # @param resource [String]
916
- # REQUIRED: The resource for which the policy is being specified.
917
- # See the operation documentation for the appropriate value for this field.
918
- # @param policy [Google::Iam::V1::Policy | Hash]
919
- # REQUIRED: The complete policy to be applied to the `resource`. The size of
920
- # the policy is limited to a few 10s of KB. An empty policy is a
921
- # valid policy but certain Cloud Platform services (such as Projects)
922
- # might reject them.
923
- # A hash of the same form as `Google::Iam::V1::Policy`
924
- # can also be provided.
925
- # @param options [Google::Gax::CallOptions]
926
- # Overrides the default settings for this call, e.g, timeout,
927
- # retries, etc.
928
- # @yield [result, operation] Access the result along with the RPC operation
929
- # @yieldparam result [Google::Iam::V1::Policy]
930
- # @yieldparam operation [GRPC::ActiveCall::Operation]
931
- # @return [Google::Iam::V1::Policy]
932
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
933
- # @example
934
- # require "google/cloud/bigtable/admin"
935
- #
936
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
937
- # formatted_resource = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
938
- #
939
- # # TODO: Initialize `policy`:
940
- # policy = {}
941
- # response = bigtable_table_admin_client.set_iam_policy(formatted_resource, policy)
942
-
943
- def set_iam_policy \
944
- resource,
945
- policy,
946
- options: nil,
947
- &block
948
- req = {
949
- resource: resource,
950
- policy: policy
951
- }.delete_if { |_, v| v.nil? }
952
- req = Google::Gax::to_proto(req, Google::Iam::V1::SetIamPolicyRequest)
953
- @set_iam_policy.call(req, options, &block)
954
- end
955
-
956
- # Returns permissions that the caller has on the specified table resource.
957
- #
958
- # @param resource [String]
959
- # REQUIRED: The resource for which the policy detail is being requested.
960
- # See the operation documentation for the appropriate value for this field.
961
- # @param permissions [Array<String>]
962
- # The set of permissions to check for the `resource`. Permissions with
963
- # wildcards (such as '*' or 'storage.*') are not allowed. For more
964
- # information see
965
- # [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
966
- # @param options [Google::Gax::CallOptions]
967
- # Overrides the default settings for this call, e.g, timeout,
968
- # retries, etc.
969
- # @yield [result, operation] Access the result along with the RPC operation
970
- # @yieldparam result [Google::Iam::V1::TestIamPermissionsResponse]
971
- # @yieldparam operation [GRPC::ActiveCall::Operation]
972
- # @return [Google::Iam::V1::TestIamPermissionsResponse]
973
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
974
- # @example
975
- # require "google/cloud/bigtable/admin"
976
- #
977
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
978
- # formatted_resource = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
979
- #
980
- # # TODO: Initialize `permissions`:
981
- # permissions = []
982
- # response = bigtable_table_admin_client.test_iam_permissions(formatted_resource, permissions)
983
-
984
- def test_iam_permissions \
985
- resource,
986
- permissions,
987
- options: nil,
988
- &block
989
- req = {
990
- resource: resource,
991
- permissions: permissions
992
- }.delete_if { |_, v| v.nil? }
993
- req = Google::Gax::to_proto(req, Google::Iam::V1::TestIamPermissionsRequest)
994
- @test_iam_permissions.call(req, options, &block)
995
- end
996
-
997
- # Creates a new snapshot in the specified cluster from the specified
998
- # source table. The cluster and the table must be in the same instance.
999
- #
1000
- # Note: This is a private alpha release of Cloud Bigtable snapshots. This
1001
- # feature is not currently available to most Cloud Bigtable customers. This
1002
- # feature might be changed in backward-incompatible ways and is not
1003
- # recommended for production use. It is not subject to any SLA or deprecation
1004
- # policy.
1005
- #
1006
- # @param name [String]
1007
- # The unique name of the table to have the snapshot taken.
1008
- # Values are of the form
1009
- # `projects/<project>/instances/<instance>/tables/<table>`.
1010
- # @param cluster [String]
1011
- # The name of the cluster where the snapshot will be created in.
1012
- # Values are of the form
1013
- # `projects/<project>/instances/<instance>/clusters/<cluster>`.
1014
- # @param snapshot_id [String]
1015
- # The ID by which the new snapshot should be referred to within the parent
1016
- # cluster, e.g., `mysnapshot` of the form: `[_a-zA-Z0-9][-_.a-zA-Z0-9]*`
1017
- # rather than
1018
- # `projects/<project>/instances/<instance>/clusters/<cluster>/snapshots/mysnapshot`.
1019
- # @param description [String]
1020
- # Description of the snapshot.
1021
- # @param ttl [Google::Protobuf::Duration | Hash]
1022
- # The amount of time that the new snapshot can stay active after it is
1023
- # created. Once 'ttl' expires, the snapshot will get deleted. The maximum
1024
- # amount of time a snapshot can stay active is 7 days. If 'ttl' is not
1025
- # specified, the default value of 24 hours will be used.
1026
- # A hash of the same form as `Google::Protobuf::Duration`
1027
- # can also be provided.
1028
- # @param options [Google::Gax::CallOptions]
1029
- # Overrides the default settings for this call, e.g, timeout,
1030
- # retries, etc.
1031
- # @return [Google::Gax::Operation]
1032
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1033
- # @example
1034
- # require "google/cloud/bigtable/admin"
1035
- #
1036
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
1037
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
1038
- #
1039
- # # TODO: Initialize `cluster`:
1040
- # cluster = ''
1041
- #
1042
- # # TODO: Initialize `snapshot_id`:
1043
- # snapshot_id = ''
1044
- #
1045
- # # TODO: Initialize `description`:
1046
- # description = ''
1047
- #
1048
- # # Register a callback during the method call.
1049
- # operation = bigtable_table_admin_client.snapshot_table(formatted_name, cluster, snapshot_id, description) do |op|
1050
- # raise op.results.message if op.error?
1051
- # op_results = op.results
1052
- # # Process the results.
1053
- #
1054
- # metadata = op.metadata
1055
- # # Process the metadata.
1056
- # end
1057
- #
1058
- # # Or use the return value to register a callback.
1059
- # operation.on_done do |op|
1060
- # raise op.results.message if op.error?
1061
- # op_results = op.results
1062
- # # Process the results.
1063
- #
1064
- # metadata = op.metadata
1065
- # # Process the metadata.
1066
- # end
1067
- #
1068
- # # Manually reload the operation.
1069
- # operation.reload!
1070
- #
1071
- # # Or block until the operation completes, triggering callbacks on
1072
- # # completion.
1073
- # operation.wait_until_done!
1074
-
1075
- def snapshot_table \
1076
- name,
1077
- cluster,
1078
- snapshot_id,
1079
- description,
1080
- ttl: nil,
1081
- options: nil
1082
- req = {
1083
- name: name,
1084
- cluster: cluster,
1085
- snapshot_id: snapshot_id,
1086
- description: description,
1087
- ttl: ttl
1088
- }.delete_if { |_, v| v.nil? }
1089
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::SnapshotTableRequest)
1090
- operation = Google::Gax::Operation.new(
1091
- @snapshot_table.call(req, options),
1092
- @operations_client,
1093
- Google::Bigtable::Admin::V2::Snapshot,
1094
- Google::Bigtable::Admin::V2::SnapshotTableMetadata,
1095
- call_options: options
1096
- )
1097
- operation.on_done { |operation| yield(operation) } if block_given?
1098
- operation
1099
- end
1100
-
1101
- # Gets metadata information about the specified snapshot.
1102
- #
1103
- # Note: This is a private alpha release of Cloud Bigtable snapshots. This
1104
- # feature is not currently available to most Cloud Bigtable customers. This
1105
- # feature might be changed in backward-incompatible ways and is not
1106
- # recommended for production use. It is not subject to any SLA or deprecation
1107
- # policy.
1108
- #
1109
- # @param name [String]
1110
- # The unique name of the requested snapshot.
1111
- # Values are of the form
1112
- # `projects/<project>/instances/<instance>/clusters/<cluster>/snapshots/<snapshot>`.
1113
- # @param options [Google::Gax::CallOptions]
1114
- # Overrides the default settings for this call, e.g, timeout,
1115
- # retries, etc.
1116
- # @yield [result, operation] Access the result along with the RPC operation
1117
- # @yieldparam result [Google::Bigtable::Admin::V2::Snapshot]
1118
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1119
- # @return [Google::Bigtable::Admin::V2::Snapshot]
1120
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1121
- # @example
1122
- # require "google/cloud/bigtable/admin"
1123
- #
1124
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
1125
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.snapshot_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]")
1126
- # response = bigtable_table_admin_client.get_snapshot(formatted_name)
1127
-
1128
- def get_snapshot \
1129
- name,
1130
- options: nil,
1131
- &block
1132
- req = {
1133
- name: name
1134
- }.delete_if { |_, v| v.nil? }
1135
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::GetSnapshotRequest)
1136
- @get_snapshot.call(req, options, &block)
1137
- end
1138
-
1139
- # Lists all snapshots associated with the specified cluster.
1140
- #
1141
- # Note: This is a private alpha release of Cloud Bigtable snapshots. This
1142
- # feature is not currently available to most Cloud Bigtable customers. This
1143
- # feature might be changed in backward-incompatible ways and is not
1144
- # recommended for production use. It is not subject to any SLA or deprecation
1145
- # policy.
1146
- #
1147
- # @param parent [String]
1148
- # The unique name of the cluster for which snapshots should be listed.
1149
- # Values are of the form
1150
- # `projects/<project>/instances/<instance>/clusters/<cluster>`.
1151
- # Use `<cluster> = '-'` to list snapshots for all clusters in an instance,
1152
- # e.g., `projects/<project>/instances/<instance>/clusters/-`.
1153
- # @param page_size [Integer]
1154
- # The maximum number of resources contained in the underlying API
1155
- # response. If page streaming is performed per-resource, this
1156
- # parameter does not affect the return value. If page streaming is
1157
- # performed per-page, this determines the maximum number of
1158
- # resources in a page.
1159
- # @param options [Google::Gax::CallOptions]
1160
- # Overrides the default settings for this call, e.g, timeout,
1161
- # retries, etc.
1162
- # @yield [result, operation] Access the result along with the RPC operation
1163
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Bigtable::Admin::V2::Snapshot>]
1164
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1165
- # @return [Google::Gax::PagedEnumerable<Google::Bigtable::Admin::V2::Snapshot>]
1166
- # An enumerable of Google::Bigtable::Admin::V2::Snapshot instances.
1167
- # See Google::Gax::PagedEnumerable documentation for other
1168
- # operations such as per-page iteration or access to the response
1169
- # object.
1170
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1171
- # @example
1172
- # require "google/cloud/bigtable/admin"
1173
- #
1174
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
1175
- # formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.cluster_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]")
1176
- #
1177
- # # Iterate over all results.
1178
- # bigtable_table_admin_client.list_snapshots(formatted_parent).each do |element|
1179
- # # Process element.
1180
- # end
1181
- #
1182
- # # Or iterate over results one page at a time.
1183
- # bigtable_table_admin_client.list_snapshots(formatted_parent).each_page do |page|
1184
- # # Process each page at a time.
1185
- # page.each do |element|
1186
- # # Process element.
1187
- # end
1188
- # end
1189
-
1190
- def list_snapshots \
1191
- parent,
1192
- page_size: nil,
1193
- options: nil,
1194
- &block
1195
- req = {
1196
- parent: parent,
1197
- page_size: page_size
1198
- }.delete_if { |_, v| v.nil? }
1199
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::ListSnapshotsRequest)
1200
- @list_snapshots.call(req, options, &block)
1201
- end
1202
-
1203
- # Permanently deletes the specified snapshot.
1204
- #
1205
- # Note: This is a private alpha release of Cloud Bigtable snapshots. This
1206
- # feature is not currently available to most Cloud Bigtable customers. This
1207
- # feature might be changed in backward-incompatible ways and is not
1208
- # recommended for production use. It is not subject to any SLA or deprecation
1209
- # policy.
1210
- #
1211
- # @param name [String]
1212
- # The unique name of the snapshot to be deleted.
1213
- # Values are of the form
1214
- # `projects/<project>/instances/<instance>/clusters/<cluster>/snapshots/<snapshot>`.
1215
- # @param options [Google::Gax::CallOptions]
1216
- # Overrides the default settings for this call, e.g, timeout,
1217
- # retries, etc.
1218
- # @yield [result, operation] Access the result along with the RPC operation
1219
- # @yieldparam result []
1220
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1221
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1222
- # @example
1223
- # require "google/cloud/bigtable/admin"
1224
- #
1225
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
1226
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.snapshot_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]")
1227
- # bigtable_table_admin_client.delete_snapshot(formatted_name)
1228
-
1229
- def delete_snapshot \
1230
- name,
1231
- options: nil,
1232
- &block
1233
- req = {
1234
- name: name
1235
- }.delete_if { |_, v| v.nil? }
1236
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::DeleteSnapshotRequest)
1237
- @delete_snapshot.call(req, options, &block)
1238
- nil
1239
- end
1240
- end
1241
- end
1242
- end
1243
- end
1244
- end
1245
- end