google-cloud-bigtable 1.2.0 → 2.1.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 +30 -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 -145
  47. data/lib/google/bigtable/admin/v2/bigtable_instance_admin_services_pb.rb +0 -90
  48. data/lib/google/bigtable/admin/v2/bigtable_table_admin_pb.rb +0 -144
  49. data/lib/google/bigtable/admin/v2/bigtable_table_admin_services_pb.rb +0 -128
  50. data/lib/google/bigtable/admin/v2/common_pb.rb +0 -25
  51. data/lib/google/bigtable/admin/v2/instance_pb.rb +0 -75
  52. data/lib/google/bigtable/admin/v2/table_pb.rb +0 -91
  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 -1451
  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 -1257
  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 -297
  65. data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/bigtable_table_admin.rb +0 -367
  66. data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/instance.rb +0 -193
  67. data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/table.rb +0 -200
  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 -591
  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": 300000,
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,1257 +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
- if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
261
- headers[:"x-goog-user-project"] = credentials.quota_project_id
262
- end
263
- headers.merge!(metadata) unless metadata.nil?
264
- client_config_file = Pathname.new(__dir__).join(
265
- "bigtable_table_admin_client_config.json"
266
- )
267
- defaults = client_config_file.open do |f|
268
- Google::Gax.construct_settings(
269
- "google.bigtable.admin.v2.BigtableTableAdmin",
270
- JSON.parse(f.read),
271
- client_config,
272
- Google::Gax::Grpc::STATUS_CODE_NAMES,
273
- timeout,
274
- page_descriptors: PAGE_DESCRIPTORS,
275
- errors: Google::Gax::Grpc::API_ERRORS,
276
- metadata: headers
277
- )
278
- end
279
-
280
- # Allow overriding the service path/port in subclasses.
281
- service_path = service_address || self.class::SERVICE_ADDRESS
282
- port = service_port || self.class::DEFAULT_SERVICE_PORT
283
- interceptors = self.class::GRPC_INTERCEPTORS
284
- @bigtable_table_admin_stub = Google::Gax::Grpc.create_stub(
285
- service_path,
286
- port,
287
- chan_creds: chan_creds,
288
- channel: channel,
289
- updater_proc: updater_proc,
290
- scopes: scopes,
291
- interceptors: interceptors,
292
- &Google::Bigtable::Admin::V2::BigtableTableAdmin::Stub.method(:new)
293
- )
294
-
295
- @create_table = Google::Gax.create_api_call(
296
- @bigtable_table_admin_stub.method(:create_table),
297
- defaults["create_table"],
298
- exception_transformer: exception_transformer,
299
- params_extractor: proc do |request|
300
- {'parent' => request.parent}
301
- end
302
- )
303
- @create_table_from_snapshot = Google::Gax.create_api_call(
304
- @bigtable_table_admin_stub.method(:create_table_from_snapshot),
305
- defaults["create_table_from_snapshot"],
306
- exception_transformer: exception_transformer,
307
- params_extractor: proc do |request|
308
- {'parent' => request.parent}
309
- end
310
- )
311
- @list_tables = Google::Gax.create_api_call(
312
- @bigtable_table_admin_stub.method(:list_tables),
313
- defaults["list_tables"],
314
- exception_transformer: exception_transformer,
315
- params_extractor: proc do |request|
316
- {'parent' => request.parent}
317
- end
318
- )
319
- @get_table = Google::Gax.create_api_call(
320
- @bigtable_table_admin_stub.method(:get_table),
321
- defaults["get_table"],
322
- exception_transformer: exception_transformer,
323
- params_extractor: proc do |request|
324
- {'name' => request.name}
325
- end
326
- )
327
- @delete_table = Google::Gax.create_api_call(
328
- @bigtable_table_admin_stub.method(:delete_table),
329
- defaults["delete_table"],
330
- exception_transformer: exception_transformer,
331
- params_extractor: proc do |request|
332
- {'name' => request.name}
333
- end
334
- )
335
- @modify_column_families = Google::Gax.create_api_call(
336
- @bigtable_table_admin_stub.method(:modify_column_families),
337
- defaults["modify_column_families"],
338
- exception_transformer: exception_transformer,
339
- params_extractor: proc do |request|
340
- {'name' => request.name}
341
- end
342
- )
343
- @drop_row_range = Google::Gax.create_api_call(
344
- @bigtable_table_admin_stub.method(:drop_row_range),
345
- defaults["drop_row_range"],
346
- exception_transformer: exception_transformer,
347
- params_extractor: proc do |request|
348
- {'name' => request.name}
349
- end
350
- )
351
- @generate_consistency_token = Google::Gax.create_api_call(
352
- @bigtable_table_admin_stub.method(:generate_consistency_token),
353
- defaults["generate_consistency_token"],
354
- exception_transformer: exception_transformer,
355
- params_extractor: proc do |request|
356
- {'name' => request.name}
357
- end
358
- )
359
- @check_consistency = Google::Gax.create_api_call(
360
- @bigtable_table_admin_stub.method(:check_consistency),
361
- defaults["check_consistency"],
362
- exception_transformer: exception_transformer,
363
- params_extractor: proc do |request|
364
- {'name' => request.name}
365
- end
366
- )
367
- @get_iam_policy = Google::Gax.create_api_call(
368
- @bigtable_table_admin_stub.method(:get_iam_policy),
369
- defaults["get_iam_policy"],
370
- exception_transformer: exception_transformer,
371
- params_extractor: proc do |request|
372
- {'resource' => request.resource}
373
- end
374
- )
375
- @set_iam_policy = Google::Gax.create_api_call(
376
- @bigtable_table_admin_stub.method(:set_iam_policy),
377
- defaults["set_iam_policy"],
378
- exception_transformer: exception_transformer,
379
- params_extractor: proc do |request|
380
- {'resource' => request.resource}
381
- end
382
- )
383
- @test_iam_permissions = Google::Gax.create_api_call(
384
- @bigtable_table_admin_stub.method(:test_iam_permissions),
385
- defaults["test_iam_permissions"],
386
- exception_transformer: exception_transformer,
387
- params_extractor: proc do |request|
388
- {'resource' => request.resource}
389
- end
390
- )
391
- @snapshot_table = Google::Gax.create_api_call(
392
- @bigtable_table_admin_stub.method(:snapshot_table),
393
- defaults["snapshot_table"],
394
- exception_transformer: exception_transformer,
395
- params_extractor: proc do |request|
396
- {'name' => request.name}
397
- end
398
- )
399
- @get_snapshot = Google::Gax.create_api_call(
400
- @bigtable_table_admin_stub.method(:get_snapshot),
401
- defaults["get_snapshot"],
402
- exception_transformer: exception_transformer,
403
- params_extractor: proc do |request|
404
- {'name' => request.name}
405
- end
406
- )
407
- @list_snapshots = Google::Gax.create_api_call(
408
- @bigtable_table_admin_stub.method(:list_snapshots),
409
- defaults["list_snapshots"],
410
- exception_transformer: exception_transformer,
411
- params_extractor: proc do |request|
412
- {'parent' => request.parent}
413
- end
414
- )
415
- @delete_snapshot = Google::Gax.create_api_call(
416
- @bigtable_table_admin_stub.method(:delete_snapshot),
417
- defaults["delete_snapshot"],
418
- exception_transformer: exception_transformer,
419
- params_extractor: proc do |request|
420
- {'name' => request.name}
421
- end
422
- )
423
- end
424
-
425
- # Service calls
426
-
427
- # Creates a new table in the specified instance.
428
- # The table can be created with a full set of initial column families,
429
- # specified in the request.
430
- #
431
- # @param parent [String]
432
- # Required. The unique name of the instance in which to create the table.
433
- # Values are of the form `projects/{project}/instances/{instance}`.
434
- # @param table_id [String]
435
- # Required. The name by which the new table should be referred to within the parent
436
- # instance, e.g., `foobar` rather than `{parent}/tables/foobar`.
437
- # Maximum 50 characters.
438
- # @param table [Google::Bigtable::Admin::V2::Table | Hash]
439
- # Required. The Table to create.
440
- # A hash of the same form as `Google::Bigtable::Admin::V2::Table`
441
- # can also be provided.
442
- # @param initial_splits [Array<Google::Bigtable::Admin::V2::CreateTableRequest::Split | Hash>]
443
- # The optional list of row keys that will be used to initially split the
444
- # table into several tablets (tablets are similar to HBase regions).
445
- # Given two split keys, `s1` and `s2`, three tablets will be created,
446
- # spanning the key ranges: `[, s1), [s1, s2), [s2, )`.
447
- #
448
- # Example:
449
- #
450
- # * Row keys := `["a", "apple", "custom", "customer_1", "customer_2",`
451
- # `"other", "zz"]`
452
- # * initial_split_keys := `["apple", "customer_1", "customer_2", "other"]`
453
- # * Key assignment:
454
- # * Tablet 1 `[, apple) => {"a"}.`
455
- # * Tablet 2 `[apple, customer_1) => {"apple", "custom"}.`
456
- # * Tablet 3 `[customer_1, customer_2) => {"customer_1"}.`
457
- # * Tablet 4 `[customer_2, other) => {"customer_2"}.`
458
- # * Tablet 5 `[other, ) => {"other", "zz"}.`
459
- # A hash of the same form as `Google::Bigtable::Admin::V2::CreateTableRequest::Split`
460
- # can also be provided.
461
- # @param options [Google::Gax::CallOptions]
462
- # Overrides the default settings for this call, e.g, timeout,
463
- # retries, etc.
464
- # @yield [result, operation] Access the result along with the RPC operation
465
- # @yieldparam result [Google::Bigtable::Admin::V2::Table]
466
- # @yieldparam operation [GRPC::ActiveCall::Operation]
467
- # @return [Google::Bigtable::Admin::V2::Table]
468
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
469
- # @example
470
- # require "google/cloud/bigtable/admin"
471
- #
472
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
473
- # formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
474
- #
475
- # # TODO: Initialize `table_id`:
476
- # table_id = ''
477
- #
478
- # # TODO: Initialize `table`:
479
- # table = {}
480
- # response = bigtable_table_admin_client.create_table(formatted_parent, table_id, table)
481
-
482
- def create_table \
483
- parent,
484
- table_id,
485
- table,
486
- initial_splits: nil,
487
- options: nil,
488
- &block
489
- req = {
490
- parent: parent,
491
- table_id: table_id,
492
- table: table,
493
- initial_splits: initial_splits
494
- }.delete_if { |_, v| v.nil? }
495
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::CreateTableRequest)
496
- @create_table.call(req, options, &block)
497
- end
498
-
499
- # Creates a new table from the specified snapshot. The target table must
500
- # not exist. The snapshot and the table must be in the same instance.
501
- #
502
- # Note: This is a private alpha release of Cloud Bigtable snapshots. This
503
- # feature is not currently available to most Cloud Bigtable customers. This
504
- # feature might be changed in backward-incompatible ways and is not
505
- # recommended for production use. It is not subject to any SLA or deprecation
506
- # policy.
507
- #
508
- # @param parent [String]
509
- # Required. The unique name of the instance in which to create the table.
510
- # Values are of the form `projects/{project}/instances/{instance}`.
511
- # @param table_id [String]
512
- # Required. The name by which the new table should be referred to within the parent
513
- # instance, e.g., `foobar` rather than `{parent}/tables/foobar`.
514
- # @param source_snapshot [String]
515
- # Required. The unique name of the snapshot from which to restore the table. The
516
- # snapshot and the table must be in the same instance.
517
- # Values are of the form
518
- # `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`.
519
- # @param options [Google::Gax::CallOptions]
520
- # Overrides the default settings for this call, e.g, timeout,
521
- # retries, etc.
522
- # @return [Google::Gax::Operation]
523
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
524
- # @example
525
- # require "google/cloud/bigtable/admin"
526
- #
527
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
528
- # formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
529
- #
530
- # # TODO: Initialize `table_id`:
531
- # table_id = ''
532
- #
533
- # # TODO: Initialize `source_snapshot`:
534
- # source_snapshot = ''
535
- #
536
- # # Register a callback during the method call.
537
- # operation = bigtable_table_admin_client.create_table_from_snapshot(formatted_parent, table_id, source_snapshot) do |op|
538
- # raise op.results.message if op.error?
539
- # op_results = op.results
540
- # # Process the results.
541
- #
542
- # metadata = op.metadata
543
- # # Process the metadata.
544
- # end
545
- #
546
- # # Or use the return value to register a callback.
547
- # operation.on_done do |op|
548
- # raise op.results.message if op.error?
549
- # op_results = op.results
550
- # # Process the results.
551
- #
552
- # metadata = op.metadata
553
- # # Process the metadata.
554
- # end
555
- #
556
- # # Manually reload the operation.
557
- # operation.reload!
558
- #
559
- # # Or block until the operation completes, triggering callbacks on
560
- # # completion.
561
- # operation.wait_until_done!
562
-
563
- def create_table_from_snapshot \
564
- parent,
565
- table_id,
566
- source_snapshot,
567
- options: nil
568
- req = {
569
- parent: parent,
570
- table_id: table_id,
571
- source_snapshot: source_snapshot
572
- }.delete_if { |_, v| v.nil? }
573
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::CreateTableFromSnapshotRequest)
574
- operation = Google::Gax::Operation.new(
575
- @create_table_from_snapshot.call(req, options),
576
- @operations_client,
577
- Google::Bigtable::Admin::V2::Table,
578
- Google::Bigtable::Admin::V2::CreateTableFromSnapshotMetadata,
579
- call_options: options
580
- )
581
- operation.on_done { |operation| yield(operation) } if block_given?
582
- operation
583
- end
584
-
585
- # Lists all tables served from a specified instance.
586
- #
587
- # @param parent [String]
588
- # Required. The unique name of the instance for which tables should be listed.
589
- # Values are of the form `projects/{project}/instances/{instance}`.
590
- # @param view [Google::Bigtable::Admin::V2::Table::View]
591
- # The view to be applied to the returned tables' fields.
592
- # Only NAME_ONLY view (default) and REPLICATION_VIEW are supported.
593
- # @param page_size [Integer]
594
- # Maximum number of results per page.
595
- #
596
- # A page_size of zero lets the server choose the number of items to return.
597
- # A page_size which is strictly positive will return at most that many items.
598
- # A negative page_size will cause an error.
599
- #
600
- # Following the first request, subsequent paginated calls are not required
601
- # to pass a page_size. If a page_size is set in subsequent calls, it must
602
- # match the page_size given in the first request.
603
- # @param options [Google::Gax::CallOptions]
604
- # Overrides the default settings for this call, e.g, timeout,
605
- # retries, etc.
606
- # @yield [result, operation] Access the result along with the RPC operation
607
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Bigtable::Admin::V2::Table>]
608
- # @yieldparam operation [GRPC::ActiveCall::Operation]
609
- # @return [Google::Gax::PagedEnumerable<Google::Bigtable::Admin::V2::Table>]
610
- # An enumerable of Google::Bigtable::Admin::V2::Table instances.
611
- # See Google::Gax::PagedEnumerable documentation for other
612
- # operations such as per-page iteration or access to the response
613
- # object.
614
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
615
- # @example
616
- # require "google/cloud/bigtable/admin"
617
- #
618
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
619
- # formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
620
- #
621
- # # Iterate over all results.
622
- # bigtable_table_admin_client.list_tables(formatted_parent).each do |element|
623
- # # Process element.
624
- # end
625
- #
626
- # # Or iterate over results one page at a time.
627
- # bigtable_table_admin_client.list_tables(formatted_parent).each_page do |page|
628
- # # Process each page at a time.
629
- # page.each do |element|
630
- # # Process element.
631
- # end
632
- # end
633
-
634
- def list_tables \
635
- parent,
636
- view: nil,
637
- page_size: nil,
638
- options: nil,
639
- &block
640
- req = {
641
- parent: parent,
642
- view: view,
643
- page_size: page_size
644
- }.delete_if { |_, v| v.nil? }
645
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::ListTablesRequest)
646
- @list_tables.call(req, options, &block)
647
- end
648
-
649
- # Gets metadata information about the specified table.
650
- #
651
- # @param name [String]
652
- # Required. The unique name of the requested table.
653
- # Values are of the form
654
- # `projects/{project}/instances/{instance}/tables/{table}`.
655
- # @param view [Google::Bigtable::Admin::V2::Table::View]
656
- # The view to be applied to the returned table's fields.
657
- # Defaults to `SCHEMA_VIEW` if unspecified.
658
- # @param options [Google::Gax::CallOptions]
659
- # Overrides the default settings for this call, e.g, timeout,
660
- # retries, etc.
661
- # @yield [result, operation] Access the result along with the RPC operation
662
- # @yieldparam result [Google::Bigtable::Admin::V2::Table]
663
- # @yieldparam operation [GRPC::ActiveCall::Operation]
664
- # @return [Google::Bigtable::Admin::V2::Table]
665
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
666
- # @example
667
- # require "google/cloud/bigtable/admin"
668
- #
669
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
670
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
671
- # response = bigtable_table_admin_client.get_table(formatted_name)
672
-
673
- def get_table \
674
- name,
675
- view: nil,
676
- options: nil,
677
- &block
678
- req = {
679
- name: name,
680
- view: view
681
- }.delete_if { |_, v| v.nil? }
682
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::GetTableRequest)
683
- @get_table.call(req, options, &block)
684
- end
685
-
686
- # Permanently deletes a specified table and all of its data.
687
- #
688
- # @param name [String]
689
- # Required. The unique name of the table to be deleted.
690
- # Values are of the form
691
- # `projects/{project}/instances/{instance}/tables/{table}`.
692
- # @param options [Google::Gax::CallOptions]
693
- # Overrides the default settings for this call, e.g, timeout,
694
- # retries, etc.
695
- # @yield [result, operation] Access the result along with the RPC operation
696
- # @yieldparam result []
697
- # @yieldparam operation [GRPC::ActiveCall::Operation]
698
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
699
- # @example
700
- # require "google/cloud/bigtable/admin"
701
- #
702
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
703
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
704
- # bigtable_table_admin_client.delete_table(formatted_name)
705
-
706
- def delete_table \
707
- name,
708
- options: nil,
709
- &block
710
- req = {
711
- name: name
712
- }.delete_if { |_, v| v.nil? }
713
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::DeleteTableRequest)
714
- @delete_table.call(req, options, &block)
715
- nil
716
- end
717
-
718
- # Performs a series of column family modifications on the specified table.
719
- # Either all or none of the modifications will occur before this method
720
- # returns, but data requests received prior to that point may see a table
721
- # where only some modifications have taken effect.
722
- #
723
- # @param name [String]
724
- # Required. The unique name of the table whose families should be modified.
725
- # Values are of the form
726
- # `projects/{project}/instances/{instance}/tables/{table}`.
727
- # @param modifications [Array<Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification | Hash>]
728
- # Required. Modifications to be atomically applied to the specified table's families.
729
- # Entries are applied in order, meaning that earlier modifications can be
730
- # masked by later ones (in the case of repeated updates to the same family,
731
- # for example).
732
- # A hash of the same form as `Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification`
733
- # can also be provided.
734
- # @param options [Google::Gax::CallOptions]
735
- # Overrides the default settings for this call, e.g, timeout,
736
- # retries, etc.
737
- # @yield [result, operation] Access the result along with the RPC operation
738
- # @yieldparam result [Google::Bigtable::Admin::V2::Table]
739
- # @yieldparam operation [GRPC::ActiveCall::Operation]
740
- # @return [Google::Bigtable::Admin::V2::Table]
741
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
742
- # @example
743
- # require "google/cloud/bigtable/admin"
744
- #
745
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
746
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
747
- #
748
- # # TODO: Initialize `modifications`:
749
- # modifications = []
750
- # response = bigtable_table_admin_client.modify_column_families(formatted_name, modifications)
751
-
752
- def modify_column_families \
753
- name,
754
- modifications,
755
- options: nil,
756
- &block
757
- req = {
758
- name: name,
759
- modifications: modifications
760
- }.delete_if { |_, v| v.nil? }
761
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest)
762
- @modify_column_families.call(req, options, &block)
763
- end
764
-
765
- # Permanently drop/delete a row range from a specified table. The request can
766
- # specify whether to delete all rows in a table, or only those that match a
767
- # particular prefix.
768
- #
769
- # @param name [String]
770
- # Required. The unique name of the table on which to drop a range of rows.
771
- # Values are of the form
772
- # `projects/{project}/instances/{instance}/tables/{table}`.
773
- # @param row_key_prefix [String]
774
- # Delete all rows that start with this row key prefix. Prefix cannot be
775
- # zero length.
776
- # @param delete_all_data_from_table [true, false]
777
- # Delete all rows in the table. Setting this to false is a no-op.
778
- # @param options [Google::Gax::CallOptions]
779
- # Overrides the default settings for this call, e.g, timeout,
780
- # retries, etc.
781
- # @yield [result, operation] Access the result along with the RPC operation
782
- # @yieldparam result []
783
- # @yieldparam operation [GRPC::ActiveCall::Operation]
784
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
785
- # @example
786
- # require "google/cloud/bigtable/admin"
787
- #
788
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
789
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
790
- # bigtable_table_admin_client.drop_row_range(formatted_name)
791
-
792
- def drop_row_range \
793
- name,
794
- row_key_prefix: nil,
795
- delete_all_data_from_table: nil,
796
- options: nil,
797
- &block
798
- req = {
799
- name: name,
800
- row_key_prefix: row_key_prefix,
801
- delete_all_data_from_table: delete_all_data_from_table
802
- }.delete_if { |_, v| v.nil? }
803
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::DropRowRangeRequest)
804
- @drop_row_range.call(req, options, &block)
805
- nil
806
- end
807
-
808
- # Generates a consistency token for a Table, which can be used in
809
- # CheckConsistency to check whether mutations to the table that finished
810
- # before this call started have been replicated. The tokens will be available
811
- # for 90 days.
812
- #
813
- # @param name [String]
814
- # Required. The unique name of the Table for which to create a consistency token.
815
- # Values are of the form
816
- # `projects/{project}/instances/{instance}/tables/{table}`.
817
- # @param options [Google::Gax::CallOptions]
818
- # Overrides the default settings for this call, e.g, timeout,
819
- # retries, etc.
820
- # @yield [result, operation] Access the result along with the RPC operation
821
- # @yieldparam result [Google::Bigtable::Admin::V2::GenerateConsistencyTokenResponse]
822
- # @yieldparam operation [GRPC::ActiveCall::Operation]
823
- # @return [Google::Bigtable::Admin::V2::GenerateConsistencyTokenResponse]
824
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
825
- # @example
826
- # require "google/cloud/bigtable/admin"
827
- #
828
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
829
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
830
- # response = bigtable_table_admin_client.generate_consistency_token(formatted_name)
831
-
832
- def generate_consistency_token \
833
- name,
834
- options: nil,
835
- &block
836
- req = {
837
- name: name
838
- }.delete_if { |_, v| v.nil? }
839
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::GenerateConsistencyTokenRequest)
840
- @generate_consistency_token.call(req, options, &block)
841
- end
842
-
843
- # Checks replication consistency based on a consistency token, that is, if
844
- # replication has caught up based on the conditions specified in the token
845
- # and the check request.
846
- #
847
- # @param name [String]
848
- # Required. The unique name of the Table for which to check replication consistency.
849
- # Values are of the form
850
- # `projects/{project}/instances/{instance}/tables/{table}`.
851
- # @param consistency_token [String]
852
- # Required. The token created using GenerateConsistencyToken for the Table.
853
- # @param options [Google::Gax::CallOptions]
854
- # Overrides the default settings for this call, e.g, timeout,
855
- # retries, etc.
856
- # @yield [result, operation] Access the result along with the RPC operation
857
- # @yieldparam result [Google::Bigtable::Admin::V2::CheckConsistencyResponse]
858
- # @yieldparam operation [GRPC::ActiveCall::Operation]
859
- # @return [Google::Bigtable::Admin::V2::CheckConsistencyResponse]
860
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
861
- # @example
862
- # require "google/cloud/bigtable/admin"
863
- #
864
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
865
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
866
- #
867
- # # TODO: Initialize `consistency_token`:
868
- # consistency_token = ''
869
- # response = bigtable_table_admin_client.check_consistency(formatted_name, consistency_token)
870
-
871
- def check_consistency \
872
- name,
873
- consistency_token,
874
- options: nil,
875
- &block
876
- req = {
877
- name: name,
878
- consistency_token: consistency_token
879
- }.delete_if { |_, v| v.nil? }
880
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::CheckConsistencyRequest)
881
- @check_consistency.call(req, options, &block)
882
- end
883
-
884
- # Gets the access control policy for a resource.
885
- # Returns an empty policy if the resource exists but does not have a policy
886
- # set.
887
- #
888
- # @param resource [String]
889
- # REQUIRED: The resource for which the policy is being requested.
890
- # See the operation documentation for the appropriate value for this field.
891
- # @param options_ [Google::Iam::V1::GetPolicyOptions | Hash]
892
- # OPTIONAL: A `GetPolicyOptions` object for specifying options to
893
- # `GetIamPolicy`. This field is only used by Cloud IAM.
894
- # A hash of the same form as `Google::Iam::V1::GetPolicyOptions`
895
- # can also be provided.
896
- # @param options [Google::Gax::CallOptions]
897
- # Overrides the default settings for this call, e.g, timeout,
898
- # retries, etc.
899
- # @yield [result, operation] Access the result along with the RPC operation
900
- # @yieldparam result [Google::Iam::V1::Policy]
901
- # @yieldparam operation [GRPC::ActiveCall::Operation]
902
- # @return [Google::Iam::V1::Policy]
903
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
904
- # @example
905
- # require "google/cloud/bigtable/admin"
906
- #
907
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
908
- # formatted_resource = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
909
- # response = bigtable_table_admin_client.get_iam_policy(formatted_resource)
910
-
911
- def get_iam_policy \
912
- resource,
913
- options_: nil,
914
- options: nil,
915
- &block
916
- req = {
917
- resource: resource,
918
- options: options_
919
- }.delete_if { |_, v| v.nil? }
920
- req = Google::Gax::to_proto(req, Google::Iam::V1::GetIamPolicyRequest)
921
- @get_iam_policy.call(req, options, &block)
922
- end
923
-
924
- # Sets the access control policy on a Table or Backup resource.
925
- # Replaces any existing policy.
926
- #
927
- # @param resource [String]
928
- # REQUIRED: The resource for which the policy is being specified.
929
- # See the operation documentation for the appropriate value for this field.
930
- # @param policy [Google::Iam::V1::Policy | Hash]
931
- # REQUIRED: The complete policy to be applied to the `resource`. The size of
932
- # the policy is limited to a few 10s of KB. An empty policy is a
933
- # valid policy but certain Cloud Platform services (such as Projects)
934
- # might reject them.
935
- # A hash of the same form as `Google::Iam::V1::Policy`
936
- # can also be provided.
937
- # @param options [Google::Gax::CallOptions]
938
- # Overrides the default settings for this call, e.g, timeout,
939
- # retries, etc.
940
- # @yield [result, operation] Access the result along with the RPC operation
941
- # @yieldparam result [Google::Iam::V1::Policy]
942
- # @yieldparam operation [GRPC::ActiveCall::Operation]
943
- # @return [Google::Iam::V1::Policy]
944
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
945
- # @example
946
- # require "google/cloud/bigtable/admin"
947
- #
948
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
949
- # formatted_resource = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
950
- #
951
- # # TODO: Initialize `policy`:
952
- # policy = {}
953
- # response = bigtable_table_admin_client.set_iam_policy(formatted_resource, policy)
954
-
955
- def set_iam_policy \
956
- resource,
957
- policy,
958
- options: nil,
959
- &block
960
- req = {
961
- resource: resource,
962
- policy: policy
963
- }.delete_if { |_, v| v.nil? }
964
- req = Google::Gax::to_proto(req, Google::Iam::V1::SetIamPolicyRequest)
965
- @set_iam_policy.call(req, options, &block)
966
- end
967
-
968
- # Returns permissions that the caller has on the specified table resource.
969
- #
970
- # @param resource [String]
971
- # REQUIRED: The resource for which the policy detail is being requested.
972
- # See the operation documentation for the appropriate value for this field.
973
- # @param permissions [Array<String>]
974
- # The set of permissions to check for the `resource`. Permissions with
975
- # wildcards (such as '*' or 'storage.*') are not allowed. For more
976
- # information see
977
- # [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
978
- # @param options [Google::Gax::CallOptions]
979
- # Overrides the default settings for this call, e.g, timeout,
980
- # retries, etc.
981
- # @yield [result, operation] Access the result along with the RPC operation
982
- # @yieldparam result [Google::Iam::V1::TestIamPermissionsResponse]
983
- # @yieldparam operation [GRPC::ActiveCall::Operation]
984
- # @return [Google::Iam::V1::TestIamPermissionsResponse]
985
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
986
- # @example
987
- # require "google/cloud/bigtable/admin"
988
- #
989
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
990
- # formatted_resource = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
991
- #
992
- # # TODO: Initialize `permissions`:
993
- # permissions = []
994
- # response = bigtable_table_admin_client.test_iam_permissions(formatted_resource, permissions)
995
-
996
- def test_iam_permissions \
997
- resource,
998
- permissions,
999
- options: nil,
1000
- &block
1001
- req = {
1002
- resource: resource,
1003
- permissions: permissions
1004
- }.delete_if { |_, v| v.nil? }
1005
- req = Google::Gax::to_proto(req, Google::Iam::V1::TestIamPermissionsRequest)
1006
- @test_iam_permissions.call(req, options, &block)
1007
- end
1008
-
1009
- # Creates a new snapshot in the specified cluster from the specified
1010
- # source table. The cluster and the table must be in the same instance.
1011
- #
1012
- # Note: This is a private alpha release of Cloud Bigtable snapshots. This
1013
- # feature is not currently available to most Cloud Bigtable customers. This
1014
- # feature might be changed in backward-incompatible ways and is not
1015
- # recommended for production use. It is not subject to any SLA or deprecation
1016
- # policy.
1017
- #
1018
- # @param name [String]
1019
- # The unique name of the table to have the snapshot taken.
1020
- # Values are of the form
1021
- # `projects/{project}/instances/{instance}/tables/{table}`.
1022
- # @param cluster [String]
1023
- # The name of the cluster where the snapshot will be created in.
1024
- # Values are of the form
1025
- # `projects/{project}/instances/{instance}/clusters/{cluster}`.
1026
- # @param snapshot_id [String]
1027
- # The ID by which the new snapshot should be referred to within the parent
1028
- # cluster, e.g., `mysnapshot` of the form: `[_a-zA-Z0-9][-_.a-zA-Z0-9]*`
1029
- # rather than
1030
- # `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/mysnapshot`.
1031
- # @param description [String]
1032
- # Description of the snapshot.
1033
- # @param ttl [Google::Protobuf::Duration | Hash]
1034
- # The amount of time that the new snapshot can stay active after it is
1035
- # created. Once 'ttl' expires, the snapshot will get deleted. The maximum
1036
- # amount of time a snapshot can stay active is 7 days. If 'ttl' is not
1037
- # specified, the default value of 24 hours will be used.
1038
- # A hash of the same form as `Google::Protobuf::Duration`
1039
- # can also be provided.
1040
- # @param options [Google::Gax::CallOptions]
1041
- # Overrides the default settings for this call, e.g, timeout,
1042
- # retries, etc.
1043
- # @return [Google::Gax::Operation]
1044
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1045
- # @example
1046
- # require "google/cloud/bigtable/admin"
1047
- #
1048
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
1049
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
1050
- #
1051
- # # TODO: Initialize `cluster`:
1052
- # cluster = ''
1053
- #
1054
- # # TODO: Initialize `snapshot_id`:
1055
- # snapshot_id = ''
1056
- #
1057
- # # TODO: Initialize `description`:
1058
- # description = ''
1059
- #
1060
- # # Register a callback during the method call.
1061
- # operation = bigtable_table_admin_client.snapshot_table(formatted_name, cluster, snapshot_id, description) do |op|
1062
- # raise op.results.message if op.error?
1063
- # op_results = op.results
1064
- # # Process the results.
1065
- #
1066
- # metadata = op.metadata
1067
- # # Process the metadata.
1068
- # end
1069
- #
1070
- # # Or use the return value to register a callback.
1071
- # operation.on_done do |op|
1072
- # raise op.results.message if op.error?
1073
- # op_results = op.results
1074
- # # Process the results.
1075
- #
1076
- # metadata = op.metadata
1077
- # # Process the metadata.
1078
- # end
1079
- #
1080
- # # Manually reload the operation.
1081
- # operation.reload!
1082
- #
1083
- # # Or block until the operation completes, triggering callbacks on
1084
- # # completion.
1085
- # operation.wait_until_done!
1086
-
1087
- def snapshot_table \
1088
- name,
1089
- cluster,
1090
- snapshot_id,
1091
- description,
1092
- ttl: nil,
1093
- options: nil
1094
- req = {
1095
- name: name,
1096
- cluster: cluster,
1097
- snapshot_id: snapshot_id,
1098
- description: description,
1099
- ttl: ttl
1100
- }.delete_if { |_, v| v.nil? }
1101
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::SnapshotTableRequest)
1102
- operation = Google::Gax::Operation.new(
1103
- @snapshot_table.call(req, options),
1104
- @operations_client,
1105
- Google::Bigtable::Admin::V2::Snapshot,
1106
- Google::Bigtable::Admin::V2::SnapshotTableMetadata,
1107
- call_options: options
1108
- )
1109
- operation.on_done { |operation| yield(operation) } if block_given?
1110
- operation
1111
- end
1112
-
1113
- # Gets metadata information about the specified snapshot.
1114
- #
1115
- # Note: This is a private alpha release of Cloud Bigtable snapshots. This
1116
- # feature is not currently available to most Cloud Bigtable customers. This
1117
- # feature might be changed in backward-incompatible ways and is not
1118
- # recommended for production use. It is not subject to any SLA or deprecation
1119
- # policy.
1120
- #
1121
- # @param name [String]
1122
- # Required. The unique name of the requested snapshot.
1123
- # Values are of the form
1124
- # `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`.
1125
- # @param options [Google::Gax::CallOptions]
1126
- # Overrides the default settings for this call, e.g, timeout,
1127
- # retries, etc.
1128
- # @yield [result, operation] Access the result along with the RPC operation
1129
- # @yieldparam result [Google::Bigtable::Admin::V2::Snapshot]
1130
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1131
- # @return [Google::Bigtable::Admin::V2::Snapshot]
1132
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1133
- # @example
1134
- # require "google/cloud/bigtable/admin"
1135
- #
1136
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
1137
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.snapshot_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]")
1138
- # response = bigtable_table_admin_client.get_snapshot(formatted_name)
1139
-
1140
- def get_snapshot \
1141
- name,
1142
- options: nil,
1143
- &block
1144
- req = {
1145
- name: name
1146
- }.delete_if { |_, v| v.nil? }
1147
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::GetSnapshotRequest)
1148
- @get_snapshot.call(req, options, &block)
1149
- end
1150
-
1151
- # Lists all snapshots associated with the specified cluster.
1152
- #
1153
- # Note: This is a private alpha release of Cloud Bigtable snapshots. This
1154
- # feature is not currently available to most Cloud Bigtable customers. This
1155
- # feature might be changed in backward-incompatible ways and is not
1156
- # recommended for production use. It is not subject to any SLA or deprecation
1157
- # policy.
1158
- #
1159
- # @param parent [String]
1160
- # Required. The unique name of the cluster for which snapshots should be listed.
1161
- # Values are of the form
1162
- # `projects/{project}/instances/{instance}/clusters/{cluster}`.
1163
- # Use `{cluster} = '-'` to list snapshots for all clusters in an instance,
1164
- # e.g., `projects/{project}/instances/{instance}/clusters/-`.
1165
- # @param page_size [Integer]
1166
- # The maximum number of resources contained in the underlying API
1167
- # response. If page streaming is performed per-resource, this
1168
- # parameter does not affect the return value. If page streaming is
1169
- # performed per-page, this determines the maximum number of
1170
- # resources in a page.
1171
- # @param options [Google::Gax::CallOptions]
1172
- # Overrides the default settings for this call, e.g, timeout,
1173
- # retries, etc.
1174
- # @yield [result, operation] Access the result along with the RPC operation
1175
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Bigtable::Admin::V2::Snapshot>]
1176
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1177
- # @return [Google::Gax::PagedEnumerable<Google::Bigtable::Admin::V2::Snapshot>]
1178
- # An enumerable of Google::Bigtable::Admin::V2::Snapshot instances.
1179
- # See Google::Gax::PagedEnumerable documentation for other
1180
- # operations such as per-page iteration or access to the response
1181
- # object.
1182
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1183
- # @example
1184
- # require "google/cloud/bigtable/admin"
1185
- #
1186
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
1187
- # formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.cluster_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]")
1188
- #
1189
- # # Iterate over all results.
1190
- # bigtable_table_admin_client.list_snapshots(formatted_parent).each do |element|
1191
- # # Process element.
1192
- # end
1193
- #
1194
- # # Or iterate over results one page at a time.
1195
- # bigtable_table_admin_client.list_snapshots(formatted_parent).each_page do |page|
1196
- # # Process each page at a time.
1197
- # page.each do |element|
1198
- # # Process element.
1199
- # end
1200
- # end
1201
-
1202
- def list_snapshots \
1203
- parent,
1204
- page_size: nil,
1205
- options: nil,
1206
- &block
1207
- req = {
1208
- parent: parent,
1209
- page_size: page_size
1210
- }.delete_if { |_, v| v.nil? }
1211
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::ListSnapshotsRequest)
1212
- @list_snapshots.call(req, options, &block)
1213
- end
1214
-
1215
- # Permanently deletes the specified snapshot.
1216
- #
1217
- # Note: This is a private alpha release of Cloud Bigtable snapshots. This
1218
- # feature is not currently available to most Cloud Bigtable customers. This
1219
- # feature might be changed in backward-incompatible ways and is not
1220
- # recommended for production use. It is not subject to any SLA or deprecation
1221
- # policy.
1222
- #
1223
- # @param name [String]
1224
- # Required. The unique name of the snapshot to be deleted.
1225
- # Values are of the form
1226
- # `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`.
1227
- # @param options [Google::Gax::CallOptions]
1228
- # Overrides the default settings for this call, e.g, timeout,
1229
- # retries, etc.
1230
- # @yield [result, operation] Access the result along with the RPC operation
1231
- # @yieldparam result []
1232
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1233
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1234
- # @example
1235
- # require "google/cloud/bigtable/admin"
1236
- #
1237
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
1238
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.snapshot_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]")
1239
- # bigtable_table_admin_client.delete_snapshot(formatted_name)
1240
-
1241
- def delete_snapshot \
1242
- name,
1243
- options: nil,
1244
- &block
1245
- req = {
1246
- name: name
1247
- }.delete_if { |_, v| v.nil? }
1248
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::DeleteSnapshotRequest)
1249
- @delete_snapshot.call(req, options, &block)
1250
- nil
1251
- end
1252
- end
1253
- end
1254
- end
1255
- end
1256
- end
1257
- end