google-cloud-bigtable 1.2.1 → 2.2.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 +57 -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 +445 -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 +282 -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 +16 -94
  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 -208
  49. data/lib/google/bigtable/admin/v2/bigtable_table_admin_services_pb.rb +0 -154
  50. data/lib/google/bigtable/admin/v2/common_pb.rb +0 -30
  51. data/lib/google/bigtable/admin/v2/instance_pb.rb +0 -74
  52. data/lib/google/bigtable/admin/v2/table_pb.rb +0 -127
  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 -223
  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 -1734
  62. data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client_config.json +0 -163
  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 -587
  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 -303
  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,1734 +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
- "list_backups" => Google::Gax::PageDescriptor.new(
72
- "page_token",
73
- "next_page_token",
74
- "backups")
75
- }.freeze
76
-
77
- private_constant :PAGE_DESCRIPTORS
78
-
79
- # The scopes needed to make gRPC calls to all of the methods defined in
80
- # this service.
81
- ALL_SCOPES = [
82
- "https://www.googleapis.com/auth/bigtable.admin",
83
- "https://www.googleapis.com/auth/bigtable.admin.cluster",
84
- "https://www.googleapis.com/auth/bigtable.admin.instance",
85
- "https://www.googleapis.com/auth/bigtable.admin.table",
86
- "https://www.googleapis.com/auth/cloud-bigtable.admin",
87
- "https://www.googleapis.com/auth/cloud-bigtable.admin.cluster",
88
- "https://www.googleapis.com/auth/cloud-bigtable.admin.table",
89
- "https://www.googleapis.com/auth/cloud-platform",
90
- "https://www.googleapis.com/auth/cloud-platform.read-only"
91
- ].freeze
92
-
93
- # @private
94
- class OperationsClient < Google::Longrunning::OperationsClient
95
- self::SERVICE_ADDRESS = BigtableTableAdminClient::SERVICE_ADDRESS
96
- self::GRPC_INTERCEPTORS = BigtableTableAdminClient::GRPC_INTERCEPTORS
97
- end
98
-
99
- BACKUP_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
100
- "projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}"
101
- )
102
-
103
- private_constant :BACKUP_PATH_TEMPLATE
104
-
105
- CLUSTER_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
106
- "projects/{project}/instances/{instance}/clusters/{cluster}"
107
- )
108
-
109
- private_constant :CLUSTER_PATH_TEMPLATE
110
-
111
- INSTANCE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
112
- "projects/{project}/instances/{instance}"
113
- )
114
-
115
- private_constant :INSTANCE_PATH_TEMPLATE
116
-
117
- SNAPSHOT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
118
- "projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}"
119
- )
120
-
121
- private_constant :SNAPSHOT_PATH_TEMPLATE
122
-
123
- TABLE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
124
- "projects/{project}/instances/{instance}/tables/{table}"
125
- )
126
-
127
- private_constant :TABLE_PATH_TEMPLATE
128
-
129
- # Returns a fully-qualified backup resource name string.
130
- # @param project [String]
131
- # @param instance [String]
132
- # @param cluster [String]
133
- # @param backup [String]
134
- # @return [String]
135
- def self.backup_path project, instance, cluster, backup
136
- BACKUP_PATH_TEMPLATE.render(
137
- :"project" => project,
138
- :"instance" => instance,
139
- :"cluster" => cluster,
140
- :"backup" => backup
141
- )
142
- end
143
-
144
- # Returns a fully-qualified cluster resource name string.
145
- # @param project [String]
146
- # @param instance [String]
147
- # @param cluster [String]
148
- # @return [String]
149
- def self.cluster_path project, instance, cluster
150
- CLUSTER_PATH_TEMPLATE.render(
151
- :"project" => project,
152
- :"instance" => instance,
153
- :"cluster" => cluster
154
- )
155
- end
156
-
157
- # Returns a fully-qualified instance resource name string.
158
- # @param project [String]
159
- # @param instance [String]
160
- # @return [String]
161
- def self.instance_path project, instance
162
- INSTANCE_PATH_TEMPLATE.render(
163
- :"project" => project,
164
- :"instance" => instance
165
- )
166
- end
167
-
168
- # Returns a fully-qualified snapshot resource name string.
169
- # @param project [String]
170
- # @param instance [String]
171
- # @param cluster [String]
172
- # @param snapshot [String]
173
- # @return [String]
174
- def self.snapshot_path project, instance, cluster, snapshot
175
- SNAPSHOT_PATH_TEMPLATE.render(
176
- :"project" => project,
177
- :"instance" => instance,
178
- :"cluster" => cluster,
179
- :"snapshot" => snapshot
180
- )
181
- end
182
-
183
- # Returns a fully-qualified table resource name string.
184
- # @param project [String]
185
- # @param instance [String]
186
- # @param table [String]
187
- # @return [String]
188
- def self.table_path project, instance, table
189
- TABLE_PATH_TEMPLATE.render(
190
- :"project" => project,
191
- :"instance" => instance,
192
- :"table" => table
193
- )
194
- end
195
-
196
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
197
- # Provides the means for authenticating requests made by the client. This parameter can
198
- # be many types.
199
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
200
- # authenticating requests made by this client.
201
- # A `String` will be treated as the path to the keyfile to be used for the construction of
202
- # credentials for this client.
203
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
204
- # credentials for this client.
205
- # A `GRPC::Core::Channel` will be used to make calls through.
206
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
207
- # should already be composed with a `GRPC::Core::CallCredentials` object.
208
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
209
- # metadata for requests, generally, to give OAuth credentials.
210
- # @param scopes [Array<String>]
211
- # The OAuth scopes for this service. This parameter is ignored if
212
- # an updater_proc is supplied.
213
- # @param client_config [Hash]
214
- # A Hash for call options for each method. See
215
- # Google::Gax#construct_settings for the structure of
216
- # this data. Falls back to the default config if not specified
217
- # or the specified config is missing data points.
218
- # @param timeout [Numeric]
219
- # The default timeout, in seconds, for calls made through this client.
220
- # @param metadata [Hash]
221
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
222
- # @param service_address [String]
223
- # Override for the service hostname, or `nil` to leave as the default.
224
- # @param service_port [Integer]
225
- # Override for the service port, or `nil` to leave as the default.
226
- # @param exception_transformer [Proc]
227
- # An optional proc that intercepts any exceptions raised during an API call to inject
228
- # custom error handling.
229
- def initialize \
230
- credentials: nil,
231
- scopes: ALL_SCOPES,
232
- client_config: {},
233
- timeout: DEFAULT_TIMEOUT,
234
- metadata: nil,
235
- service_address: nil,
236
- service_port: nil,
237
- exception_transformer: nil,
238
- lib_name: nil,
239
- lib_version: ""
240
- # These require statements are intentionally placed here to initialize
241
- # the gRPC module only when it's required.
242
- # See https://github.com/googleapis/toolkit/issues/446
243
- require "google/gax/grpc"
244
- require "google/bigtable/admin/v2/bigtable_table_admin_services_pb"
245
-
246
- credentials ||= Google::Cloud::Bigtable::Admin::V2::Credentials.default
247
-
248
- @operations_client = OperationsClient.new(
249
- credentials: credentials,
250
- scopes: scopes,
251
- client_config: client_config,
252
- timeout: timeout,
253
- lib_name: lib_name,
254
- service_address: service_address,
255
- service_port: service_port,
256
- lib_version: lib_version,
257
- metadata: metadata,
258
- )
259
-
260
- if credentials.is_a?(String) || credentials.is_a?(Hash)
261
- updater_proc = Google::Cloud::Bigtable::Admin::V2::Credentials.new(credentials).updater_proc
262
- end
263
- if credentials.is_a?(GRPC::Core::Channel)
264
- channel = credentials
265
- end
266
- if credentials.is_a?(GRPC::Core::ChannelCredentials)
267
- chan_creds = credentials
268
- end
269
- if credentials.is_a?(Proc)
270
- updater_proc = credentials
271
- end
272
- if credentials.is_a?(Google::Auth::Credentials)
273
- updater_proc = credentials.updater_proc
274
- end
275
-
276
- package_version = Google::Cloud::Bigtable::VERSION
277
-
278
- google_api_client = "gl-ruby/#{RUBY_VERSION}"
279
- google_api_client << " #{lib_name}/#{lib_version}" if lib_name
280
- google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
281
- google_api_client << " grpc/#{GRPC::VERSION}"
282
- google_api_client.freeze
283
-
284
- headers = { :"x-goog-api-client" => google_api_client }
285
- if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
286
- headers[:"x-goog-user-project"] = credentials.quota_project_id
287
- end
288
- headers.merge!(metadata) unless metadata.nil?
289
- client_config_file = Pathname.new(__dir__).join(
290
- "bigtable_table_admin_client_config.json"
291
- )
292
- defaults = client_config_file.open do |f|
293
- Google::Gax.construct_settings(
294
- "google.bigtable.admin.v2.BigtableTableAdmin",
295
- JSON.parse(f.read),
296
- client_config,
297
- Google::Gax::Grpc::STATUS_CODE_NAMES,
298
- timeout,
299
- page_descriptors: PAGE_DESCRIPTORS,
300
- errors: Google::Gax::Grpc::API_ERRORS,
301
- metadata: headers
302
- )
303
- end
304
-
305
- # Allow overriding the service path/port in subclasses.
306
- service_path = service_address || self.class::SERVICE_ADDRESS
307
- port = service_port || self.class::DEFAULT_SERVICE_PORT
308
- interceptors = self.class::GRPC_INTERCEPTORS
309
- @bigtable_table_admin_stub = Google::Gax::Grpc.create_stub(
310
- service_path,
311
- port,
312
- chan_creds: chan_creds,
313
- channel: channel,
314
- updater_proc: updater_proc,
315
- scopes: scopes,
316
- interceptors: interceptors,
317
- &Google::Bigtable::Admin::V2::BigtableTableAdmin::Stub.method(:new)
318
- )
319
-
320
- @create_table = Google::Gax.create_api_call(
321
- @bigtable_table_admin_stub.method(:create_table),
322
- defaults["create_table"],
323
- exception_transformer: exception_transformer,
324
- params_extractor: proc do |request|
325
- {'parent' => request.parent}
326
- end
327
- )
328
- @create_table_from_snapshot = Google::Gax.create_api_call(
329
- @bigtable_table_admin_stub.method(:create_table_from_snapshot),
330
- defaults["create_table_from_snapshot"],
331
- exception_transformer: exception_transformer,
332
- params_extractor: proc do |request|
333
- {'parent' => request.parent}
334
- end
335
- )
336
- @list_tables = Google::Gax.create_api_call(
337
- @bigtable_table_admin_stub.method(:list_tables),
338
- defaults["list_tables"],
339
- exception_transformer: exception_transformer,
340
- params_extractor: proc do |request|
341
- {'parent' => request.parent}
342
- end
343
- )
344
- @get_table = Google::Gax.create_api_call(
345
- @bigtable_table_admin_stub.method(:get_table),
346
- defaults["get_table"],
347
- exception_transformer: exception_transformer,
348
- params_extractor: proc do |request|
349
- {'name' => request.name}
350
- end
351
- )
352
- @delete_table = Google::Gax.create_api_call(
353
- @bigtable_table_admin_stub.method(:delete_table),
354
- defaults["delete_table"],
355
- exception_transformer: exception_transformer,
356
- params_extractor: proc do |request|
357
- {'name' => request.name}
358
- end
359
- )
360
- @modify_column_families = Google::Gax.create_api_call(
361
- @bigtable_table_admin_stub.method(:modify_column_families),
362
- defaults["modify_column_families"],
363
- exception_transformer: exception_transformer,
364
- params_extractor: proc do |request|
365
- {'name' => request.name}
366
- end
367
- )
368
- @drop_row_range = Google::Gax.create_api_call(
369
- @bigtable_table_admin_stub.method(:drop_row_range),
370
- defaults["drop_row_range"],
371
- exception_transformer: exception_transformer,
372
- params_extractor: proc do |request|
373
- {'name' => request.name}
374
- end
375
- )
376
- @generate_consistency_token = Google::Gax.create_api_call(
377
- @bigtable_table_admin_stub.method(:generate_consistency_token),
378
- defaults["generate_consistency_token"],
379
- exception_transformer: exception_transformer,
380
- params_extractor: proc do |request|
381
- {'name' => request.name}
382
- end
383
- )
384
- @check_consistency = Google::Gax.create_api_call(
385
- @bigtable_table_admin_stub.method(:check_consistency),
386
- defaults["check_consistency"],
387
- exception_transformer: exception_transformer,
388
- params_extractor: proc do |request|
389
- {'name' => request.name}
390
- end
391
- )
392
- @get_iam_policy = Google::Gax.create_api_call(
393
- @bigtable_table_admin_stub.method(:get_iam_policy),
394
- defaults["get_iam_policy"],
395
- exception_transformer: exception_transformer,
396
- params_extractor: proc do |request|
397
- {'resource' => request.resource}
398
- end
399
- )
400
- @set_iam_policy = Google::Gax.create_api_call(
401
- @bigtable_table_admin_stub.method(:set_iam_policy),
402
- defaults["set_iam_policy"],
403
- exception_transformer: exception_transformer,
404
- params_extractor: proc do |request|
405
- {'resource' => request.resource}
406
- end
407
- )
408
- @test_iam_permissions = Google::Gax.create_api_call(
409
- @bigtable_table_admin_stub.method(:test_iam_permissions),
410
- defaults["test_iam_permissions"],
411
- exception_transformer: exception_transformer,
412
- params_extractor: proc do |request|
413
- {'resource' => request.resource}
414
- end
415
- )
416
- @snapshot_table = Google::Gax.create_api_call(
417
- @bigtable_table_admin_stub.method(:snapshot_table),
418
- defaults["snapshot_table"],
419
- exception_transformer: exception_transformer,
420
- params_extractor: proc do |request|
421
- {'name' => request.name}
422
- end
423
- )
424
- @get_snapshot = Google::Gax.create_api_call(
425
- @bigtable_table_admin_stub.method(:get_snapshot),
426
- defaults["get_snapshot"],
427
- exception_transformer: exception_transformer,
428
- params_extractor: proc do |request|
429
- {'name' => request.name}
430
- end
431
- )
432
- @list_snapshots = Google::Gax.create_api_call(
433
- @bigtable_table_admin_stub.method(:list_snapshots),
434
- defaults["list_snapshots"],
435
- exception_transformer: exception_transformer,
436
- params_extractor: proc do |request|
437
- {'parent' => request.parent}
438
- end
439
- )
440
- @delete_snapshot = Google::Gax.create_api_call(
441
- @bigtable_table_admin_stub.method(:delete_snapshot),
442
- defaults["delete_snapshot"],
443
- exception_transformer: exception_transformer,
444
- params_extractor: proc do |request|
445
- {'name' => request.name}
446
- end
447
- )
448
- @create_backup = Google::Gax.create_api_call(
449
- @bigtable_table_admin_stub.method(:create_backup),
450
- defaults["create_backup"],
451
- exception_transformer: exception_transformer,
452
- params_extractor: proc do |request|
453
- {'parent' => request.parent}
454
- end
455
- )
456
- @get_backup = Google::Gax.create_api_call(
457
- @bigtable_table_admin_stub.method(:get_backup),
458
- defaults["get_backup"],
459
- exception_transformer: exception_transformer,
460
- params_extractor: proc do |request|
461
- {'name' => request.name}
462
- end
463
- )
464
- @list_backups = Google::Gax.create_api_call(
465
- @bigtable_table_admin_stub.method(:list_backups),
466
- defaults["list_backups"],
467
- exception_transformer: exception_transformer,
468
- params_extractor: proc do |request|
469
- {'parent' => request.parent}
470
- end
471
- )
472
- @update_backup = Google::Gax.create_api_call(
473
- @bigtable_table_admin_stub.method(:update_backup),
474
- defaults["update_backup"],
475
- exception_transformer: exception_transformer,
476
- params_extractor: proc do |request|
477
- {'backup.name' => request.backup.name}
478
- end
479
- )
480
- @delete_backup = Google::Gax.create_api_call(
481
- @bigtable_table_admin_stub.method(:delete_backup),
482
- defaults["delete_backup"],
483
- exception_transformer: exception_transformer,
484
- params_extractor: proc do |request|
485
- {'name' => request.name}
486
- end
487
- )
488
- @restore_table = Google::Gax.create_api_call(
489
- @bigtable_table_admin_stub.method(:restore_table),
490
- defaults["restore_table"],
491
- exception_transformer: exception_transformer,
492
- params_extractor: proc do |request|
493
- {'parent' => request.parent}
494
- end
495
- )
496
- end
497
-
498
- # Service calls
499
-
500
- # Creates a new table in the specified instance.
501
- # The table can be created with a full set of initial column families,
502
- # specified in the request.
503
- #
504
- # @param parent [String]
505
- # Required. 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
- # Required. The name by which the new table should be referred to within the
509
- # parent instance, e.g., `foobar` rather than `{parent}/tables/foobar`.
510
- # Maximum 50 characters.
511
- # @param table [Google::Bigtable::Admin::V2::Table | Hash]
512
- # Required. The Table to create.
513
- # A hash of the same form as `Google::Bigtable::Admin::V2::Table`
514
- # can also be provided.
515
- # @param initial_splits [Array<Google::Bigtable::Admin::V2::CreateTableRequest::Split | Hash>]
516
- # The optional list of row keys that will be used to initially split the
517
- # table into several tablets (tablets are similar to HBase regions).
518
- # Given two split keys, `s1` and `s2`, three tablets will be created,
519
- # spanning the key ranges: `[, s1), [s1, s2), [s2, )`.
520
- #
521
- # Example:
522
- #
523
- # * Row keys := `["a", "apple", "custom", "customer_1", "customer_2",`
524
- # `"other", "zz"]`
525
- # * initial_split_keys := `["apple", "customer_1", "customer_2", "other"]`
526
- # * Key assignment:
527
- # * Tablet 1 `[, apple) => {"a"}.`
528
- # * Tablet 2 `[apple, customer_1) => {"apple", "custom"}.`
529
- # * Tablet 3 `[customer_1, customer_2) => {"customer_1"}.`
530
- # * Tablet 4 `[customer_2, other) => {"customer_2"}.`
531
- # * Tablet 5 `[other, ) => {"other", "zz"}.`
532
- # A hash of the same form as `Google::Bigtable::Admin::V2::CreateTableRequest::Split`
533
- # can also be provided.
534
- # @param options [Google::Gax::CallOptions]
535
- # Overrides the default settings for this call, e.g, timeout,
536
- # retries, etc.
537
- # @yield [result, operation] Access the result along with the RPC operation
538
- # @yieldparam result [Google::Bigtable::Admin::V2::Table]
539
- # @yieldparam operation [GRPC::ActiveCall::Operation]
540
- # @return [Google::Bigtable::Admin::V2::Table]
541
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
542
- # @example
543
- # require "google/cloud/bigtable/admin"
544
- #
545
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
546
- # formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
547
- #
548
- # # TODO: Initialize `table_id`:
549
- # table_id = ''
550
- #
551
- # # TODO: Initialize `table`:
552
- # table = {}
553
- # response = bigtable_table_admin_client.create_table(formatted_parent, table_id, table)
554
-
555
- def create_table \
556
- parent,
557
- table_id,
558
- table,
559
- initial_splits: nil,
560
- options: nil,
561
- &block
562
- req = {
563
- parent: parent,
564
- table_id: table_id,
565
- table: table,
566
- initial_splits: initial_splits
567
- }.delete_if { |_, v| v.nil? }
568
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::CreateTableRequest)
569
- @create_table.call(req, options, &block)
570
- end
571
-
572
- # Creates a new table from the specified snapshot. The target table must
573
- # not exist. The snapshot and the table must be in the same instance.
574
- #
575
- # Note: This is a private alpha release of Cloud Bigtable snapshots. This
576
- # feature is not currently available to most Cloud Bigtable customers. This
577
- # feature might be changed in backward-incompatible ways and is not
578
- # recommended for production use. It is not subject to any SLA or deprecation
579
- # policy.
580
- #
581
- # @param parent [String]
582
- # Required. The unique name of the instance in which to create the table.
583
- # Values are of the form `projects/{project}/instances/{instance}`.
584
- # @param table_id [String]
585
- # Required. The name by which the new table should be referred to within the
586
- # parent instance, e.g., `foobar` rather than `{parent}/tables/foobar`.
587
- # @param source_snapshot [String]
588
- # Required. The unique name of the snapshot from which to restore the table.
589
- # The snapshot and the table must be in the same instance. Values are of the
590
- # form
591
- # `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`.
592
- # @param options [Google::Gax::CallOptions]
593
- # Overrides the default settings for this call, e.g, timeout,
594
- # retries, etc.
595
- # @return [Google::Gax::Operation]
596
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
597
- # @example
598
- # require "google/cloud/bigtable/admin"
599
- #
600
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
601
- # formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
602
- #
603
- # # TODO: Initialize `table_id`:
604
- # table_id = ''
605
- #
606
- # # TODO: Initialize `source_snapshot`:
607
- # source_snapshot = ''
608
- #
609
- # # Register a callback during the method call.
610
- # operation = bigtable_table_admin_client.create_table_from_snapshot(formatted_parent, table_id, source_snapshot) do |op|
611
- # raise op.results.message if op.error?
612
- # op_results = op.results
613
- # # Process the results.
614
- #
615
- # metadata = op.metadata
616
- # # Process the metadata.
617
- # end
618
- #
619
- # # Or use the return value to register a callback.
620
- # operation.on_done do |op|
621
- # raise op.results.message if op.error?
622
- # op_results = op.results
623
- # # Process the results.
624
- #
625
- # metadata = op.metadata
626
- # # Process the metadata.
627
- # end
628
- #
629
- # # Manually reload the operation.
630
- # operation.reload!
631
- #
632
- # # Or block until the operation completes, triggering callbacks on
633
- # # completion.
634
- # operation.wait_until_done!
635
-
636
- def create_table_from_snapshot \
637
- parent,
638
- table_id,
639
- source_snapshot,
640
- options: nil
641
- req = {
642
- parent: parent,
643
- table_id: table_id,
644
- source_snapshot: source_snapshot
645
- }.delete_if { |_, v| v.nil? }
646
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::CreateTableFromSnapshotRequest)
647
- operation = Google::Gax::Operation.new(
648
- @create_table_from_snapshot.call(req, options),
649
- @operations_client,
650
- Google::Bigtable::Admin::V2::Table,
651
- Google::Bigtable::Admin::V2::CreateTableFromSnapshotMetadata,
652
- call_options: options
653
- )
654
- operation.on_done { |operation| yield(operation) } if block_given?
655
- operation
656
- end
657
-
658
- # Lists all tables served from a specified instance.
659
- #
660
- # @param parent [String]
661
- # Required. The unique name of the instance for which tables should be
662
- # listed. Values are of the form `projects/{project}/instances/{instance}`.
663
- # @param view [Google::Bigtable::Admin::V2::Table::View]
664
- # The view to be applied to the returned tables' fields.
665
- # Only NAME_ONLY view (default) and REPLICATION_VIEW are supported.
666
- # @param page_size [Integer]
667
- # Maximum number of results per page.
668
- #
669
- # A page_size of zero lets the server choose the number of items to return.
670
- # A page_size which is strictly positive will return at most that many items.
671
- # A negative page_size will cause an error.
672
- #
673
- # Following the first request, subsequent paginated calls are not required
674
- # to pass a page_size. If a page_size is set in subsequent calls, it must
675
- # match the page_size given in the first request.
676
- # @param options [Google::Gax::CallOptions]
677
- # Overrides the default settings for this call, e.g, timeout,
678
- # retries, etc.
679
- # @yield [result, operation] Access the result along with the RPC operation
680
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Bigtable::Admin::V2::Table>]
681
- # @yieldparam operation [GRPC::ActiveCall::Operation]
682
- # @return [Google::Gax::PagedEnumerable<Google::Bigtable::Admin::V2::Table>]
683
- # An enumerable of Google::Bigtable::Admin::V2::Table instances.
684
- # See Google::Gax::PagedEnumerable documentation for other
685
- # operations such as per-page iteration or access to the response
686
- # object.
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_parent = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
693
- #
694
- # # Iterate over all results.
695
- # bigtable_table_admin_client.list_tables(formatted_parent).each do |element|
696
- # # Process element.
697
- # end
698
- #
699
- # # Or iterate over results one page at a time.
700
- # bigtable_table_admin_client.list_tables(formatted_parent).each_page do |page|
701
- # # Process each page at a time.
702
- # page.each do |element|
703
- # # Process element.
704
- # end
705
- # end
706
-
707
- def list_tables \
708
- parent,
709
- view: nil,
710
- page_size: nil,
711
- options: nil,
712
- &block
713
- req = {
714
- parent: parent,
715
- view: view,
716
- page_size: page_size
717
- }.delete_if { |_, v| v.nil? }
718
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::ListTablesRequest)
719
- @list_tables.call(req, options, &block)
720
- end
721
-
722
- # Gets metadata information about the specified table.
723
- #
724
- # @param name [String]
725
- # Required. The unique name of the requested table.
726
- # Values are of the form
727
- # `projects/{project}/instances/{instance}/tables/{table}`.
728
- # @param view [Google::Bigtable::Admin::V2::Table::View]
729
- # The view to be applied to the returned table's fields.
730
- # Defaults to `SCHEMA_VIEW` if unspecified.
731
- # @param options [Google::Gax::CallOptions]
732
- # Overrides the default settings for this call, e.g, timeout,
733
- # retries, etc.
734
- # @yield [result, operation] Access the result along with the RPC operation
735
- # @yieldparam result [Google::Bigtable::Admin::V2::Table]
736
- # @yieldparam operation [GRPC::ActiveCall::Operation]
737
- # @return [Google::Bigtable::Admin::V2::Table]
738
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
739
- # @example
740
- # require "google/cloud/bigtable/admin"
741
- #
742
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
743
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
744
- # response = bigtable_table_admin_client.get_table(formatted_name)
745
-
746
- def get_table \
747
- name,
748
- view: nil,
749
- options: nil,
750
- &block
751
- req = {
752
- name: name,
753
- view: view
754
- }.delete_if { |_, v| v.nil? }
755
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::GetTableRequest)
756
- @get_table.call(req, options, &block)
757
- end
758
-
759
- # Permanently deletes a specified table and all of its data.
760
- #
761
- # @param name [String]
762
- # Required. The unique name of the table to be deleted.
763
- # Values are of the form
764
- # `projects/{project}/instances/{instance}/tables/{table}`.
765
- # @param options [Google::Gax::CallOptions]
766
- # Overrides the default settings for this call, e.g, timeout,
767
- # retries, etc.
768
- # @yield [result, operation] Access the result along with the RPC operation
769
- # @yieldparam result []
770
- # @yieldparam operation [GRPC::ActiveCall::Operation]
771
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
772
- # @example
773
- # require "google/cloud/bigtable/admin"
774
- #
775
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
776
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
777
- # bigtable_table_admin_client.delete_table(formatted_name)
778
-
779
- def delete_table \
780
- name,
781
- options: nil,
782
- &block
783
- req = {
784
- name: name
785
- }.delete_if { |_, v| v.nil? }
786
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::DeleteTableRequest)
787
- @delete_table.call(req, options, &block)
788
- nil
789
- end
790
-
791
- # Performs a series of column family modifications on the specified table.
792
- # Either all or none of the modifications will occur before this method
793
- # returns, but data requests received prior to that point may see a table
794
- # where only some modifications have taken effect.
795
- #
796
- # @param name [String]
797
- # Required. The unique name of the table whose families should be modified.
798
- # Values are of the form
799
- # `projects/{project}/instances/{instance}/tables/{table}`.
800
- # @param modifications [Array<Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification | Hash>]
801
- # Required. Modifications to be atomically applied to the specified table's
802
- # families. Entries are applied in order, meaning that earlier modifications
803
- # can be masked by later ones (in the case of repeated updates to the same
804
- # family, for example).
805
- # A hash of the same form as `Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification`
806
- # can also be provided.
807
- # @param options [Google::Gax::CallOptions]
808
- # Overrides the default settings for this call, e.g, timeout,
809
- # retries, etc.
810
- # @yield [result, operation] Access the result along with the RPC operation
811
- # @yieldparam result [Google::Bigtable::Admin::V2::Table]
812
- # @yieldparam operation [GRPC::ActiveCall::Operation]
813
- # @return [Google::Bigtable::Admin::V2::Table]
814
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
815
- # @example
816
- # require "google/cloud/bigtable/admin"
817
- #
818
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
819
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
820
- #
821
- # # TODO: Initialize `modifications`:
822
- # modifications = []
823
- # response = bigtable_table_admin_client.modify_column_families(formatted_name, modifications)
824
-
825
- def modify_column_families \
826
- name,
827
- modifications,
828
- options: nil,
829
- &block
830
- req = {
831
- name: name,
832
- modifications: modifications
833
- }.delete_if { |_, v| v.nil? }
834
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest)
835
- @modify_column_families.call(req, options, &block)
836
- end
837
-
838
- # Permanently drop/delete a row range from a specified table. The request can
839
- # specify whether to delete all rows in a table, or only those that match a
840
- # particular prefix.
841
- #
842
- # @param name [String]
843
- # Required. The unique name of the table on which to drop a range of rows.
844
- # Values are of the form
845
- # `projects/{project}/instances/{instance}/tables/{table}`.
846
- # @param row_key_prefix [String]
847
- # Delete all rows that start with this row key prefix. Prefix cannot be
848
- # zero length.
849
- # @param delete_all_data_from_table [true, false]
850
- # Delete all rows in the table. Setting this to false is a no-op.
851
- # @param options [Google::Gax::CallOptions]
852
- # Overrides the default settings for this call, e.g, timeout,
853
- # retries, etc.
854
- # @yield [result, operation] Access the result along with the RPC operation
855
- # @yieldparam result []
856
- # @yieldparam operation [GRPC::ActiveCall::Operation]
857
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
858
- # @example
859
- # require "google/cloud/bigtable/admin"
860
- #
861
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
862
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
863
- # bigtable_table_admin_client.drop_row_range(formatted_name)
864
-
865
- def drop_row_range \
866
- name,
867
- row_key_prefix: nil,
868
- delete_all_data_from_table: nil,
869
- options: nil,
870
- &block
871
- req = {
872
- name: name,
873
- row_key_prefix: row_key_prefix,
874
- delete_all_data_from_table: delete_all_data_from_table
875
- }.delete_if { |_, v| v.nil? }
876
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::DropRowRangeRequest)
877
- @drop_row_range.call(req, options, &block)
878
- nil
879
- end
880
-
881
- # Generates a consistency token for a Table, which can be used in
882
- # CheckConsistency to check whether mutations to the table that finished
883
- # before this call started have been replicated. The tokens will be available
884
- # for 90 days.
885
- #
886
- # @param name [String]
887
- # Required. The unique name of the Table for which to create a consistency
888
- # token. Values are of the form
889
- # `projects/{project}/instances/{instance}/tables/{table}`.
890
- # @param options [Google::Gax::CallOptions]
891
- # Overrides the default settings for this call, e.g, timeout,
892
- # retries, etc.
893
- # @yield [result, operation] Access the result along with the RPC operation
894
- # @yieldparam result [Google::Bigtable::Admin::V2::GenerateConsistencyTokenResponse]
895
- # @yieldparam operation [GRPC::ActiveCall::Operation]
896
- # @return [Google::Bigtable::Admin::V2::GenerateConsistencyTokenResponse]
897
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
898
- # @example
899
- # require "google/cloud/bigtable/admin"
900
- #
901
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
902
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
903
- # response = bigtable_table_admin_client.generate_consistency_token(formatted_name)
904
-
905
- def generate_consistency_token \
906
- name,
907
- options: nil,
908
- &block
909
- req = {
910
- name: name
911
- }.delete_if { |_, v| v.nil? }
912
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::GenerateConsistencyTokenRequest)
913
- @generate_consistency_token.call(req, options, &block)
914
- end
915
-
916
- # Checks replication consistency based on a consistency token, that is, if
917
- # replication has caught up based on the conditions specified in the token
918
- # and the check request.
919
- #
920
- # @param name [String]
921
- # Required. The unique name of the Table for which to check replication
922
- # consistency. Values are of the form
923
- # `projects/{project}/instances/{instance}/tables/{table}`.
924
- # @param consistency_token [String]
925
- # Required. The token created using GenerateConsistencyToken for the Table.
926
- # @param options [Google::Gax::CallOptions]
927
- # Overrides the default settings for this call, e.g, timeout,
928
- # retries, etc.
929
- # @yield [result, operation] Access the result along with the RPC operation
930
- # @yieldparam result [Google::Bigtable::Admin::V2::CheckConsistencyResponse]
931
- # @yieldparam operation [GRPC::ActiveCall::Operation]
932
- # @return [Google::Bigtable::Admin::V2::CheckConsistencyResponse]
933
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
934
- # @example
935
- # require "google/cloud/bigtable/admin"
936
- #
937
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
938
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
939
- #
940
- # # TODO: Initialize `consistency_token`:
941
- # consistency_token = ''
942
- # response = bigtable_table_admin_client.check_consistency(formatted_name, consistency_token)
943
-
944
- def check_consistency \
945
- name,
946
- consistency_token,
947
- options: nil,
948
- &block
949
- req = {
950
- name: name,
951
- consistency_token: consistency_token
952
- }.delete_if { |_, v| v.nil? }
953
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::CheckConsistencyRequest)
954
- @check_consistency.call(req, options, &block)
955
- end
956
-
957
- # Gets the access control policy for a resource.
958
- # Returns an empty policy if the resource exists but does not have a policy
959
- # set.
960
- #
961
- # @param resource [String]
962
- # REQUIRED: The resource for which the policy is being requested.
963
- # See the operation documentation for the appropriate value for this field.
964
- # @param options_ [Google::Iam::V1::GetPolicyOptions | Hash]
965
- # OPTIONAL: A `GetPolicyOptions` object for specifying options to
966
- # `GetIamPolicy`. This field is only used by Cloud IAM.
967
- # A hash of the same form as `Google::Iam::V1::GetPolicyOptions`
968
- # can also be provided.
969
- # @param options [Google::Gax::CallOptions]
970
- # Overrides the default settings for this call, e.g, timeout,
971
- # retries, etc.
972
- # @yield [result, operation] Access the result along with the RPC operation
973
- # @yieldparam result [Google::Iam::V1::Policy]
974
- # @yieldparam operation [GRPC::ActiveCall::Operation]
975
- # @return [Google::Iam::V1::Policy]
976
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
977
- # @example
978
- # require "google/cloud/bigtable/admin"
979
- #
980
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
981
- # formatted_resource = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
982
- # response = bigtable_table_admin_client.get_iam_policy(formatted_resource)
983
-
984
- def get_iam_policy \
985
- resource,
986
- options_: nil,
987
- options: nil,
988
- &block
989
- req = {
990
- resource: resource,
991
- options: options_
992
- }.delete_if { |_, v| v.nil? }
993
- req = Google::Gax::to_proto(req, Google::Iam::V1::GetIamPolicyRequest)
994
- @get_iam_policy.call(req, options, &block)
995
- end
996
-
997
- # Sets the access control policy on a Table or Backup resource.
998
- # Replaces any existing policy.
999
- #
1000
- # @param resource [String]
1001
- # REQUIRED: The resource for which the policy is being specified.
1002
- # See the operation documentation for the appropriate value for this field.
1003
- # @param policy [Google::Iam::V1::Policy | Hash]
1004
- # REQUIRED: The complete policy to be applied to the `resource`. The size of
1005
- # the policy is limited to a few 10s of KB. An empty policy is a
1006
- # valid policy but certain Cloud Platform services (such as Projects)
1007
- # might reject them.
1008
- # A hash of the same form as `Google::Iam::V1::Policy`
1009
- # can also be provided.
1010
- # @param options [Google::Gax::CallOptions]
1011
- # Overrides the default settings for this call, e.g, timeout,
1012
- # retries, etc.
1013
- # @yield [result, operation] Access the result along with the RPC operation
1014
- # @yieldparam result [Google::Iam::V1::Policy]
1015
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1016
- # @return [Google::Iam::V1::Policy]
1017
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1018
- # @example
1019
- # require "google/cloud/bigtable/admin"
1020
- #
1021
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
1022
- # formatted_resource = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
1023
- #
1024
- # # TODO: Initialize `policy`:
1025
- # policy = {}
1026
- # response = bigtable_table_admin_client.set_iam_policy(formatted_resource, policy)
1027
-
1028
- def set_iam_policy \
1029
- resource,
1030
- policy,
1031
- options: nil,
1032
- &block
1033
- req = {
1034
- resource: resource,
1035
- policy: policy
1036
- }.delete_if { |_, v| v.nil? }
1037
- req = Google::Gax::to_proto(req, Google::Iam::V1::SetIamPolicyRequest)
1038
- @set_iam_policy.call(req, options, &block)
1039
- end
1040
-
1041
- # Returns permissions that the caller has on the specified table resource.
1042
- #
1043
- # @param resource [String]
1044
- # REQUIRED: The resource for which the policy detail is being requested.
1045
- # See the operation documentation for the appropriate value for this field.
1046
- # @param permissions [Array<String>]
1047
- # The set of permissions to check for the `resource`. Permissions with
1048
- # wildcards (such as '*' or 'storage.*') are not allowed. For more
1049
- # information see
1050
- # [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
1051
- # @param options [Google::Gax::CallOptions]
1052
- # Overrides the default settings for this call, e.g, timeout,
1053
- # retries, etc.
1054
- # @yield [result, operation] Access the result along with the RPC operation
1055
- # @yieldparam result [Google::Iam::V1::TestIamPermissionsResponse]
1056
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1057
- # @return [Google::Iam::V1::TestIamPermissionsResponse]
1058
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1059
- # @example
1060
- # require "google/cloud/bigtable/admin"
1061
- #
1062
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
1063
- # formatted_resource = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
1064
- #
1065
- # # TODO: Initialize `permissions`:
1066
- # permissions = []
1067
- # response = bigtable_table_admin_client.test_iam_permissions(formatted_resource, permissions)
1068
-
1069
- def test_iam_permissions \
1070
- resource,
1071
- permissions,
1072
- options: nil,
1073
- &block
1074
- req = {
1075
- resource: resource,
1076
- permissions: permissions
1077
- }.delete_if { |_, v| v.nil? }
1078
- req = Google::Gax::to_proto(req, Google::Iam::V1::TestIamPermissionsRequest)
1079
- @test_iam_permissions.call(req, options, &block)
1080
- end
1081
-
1082
- # Creates a new snapshot in the specified cluster from the specified
1083
- # source table. The cluster and the table must be in the same instance.
1084
- #
1085
- # Note: This is a private alpha release of Cloud Bigtable snapshots. This
1086
- # feature is not currently available to most Cloud Bigtable customers. This
1087
- # feature might be changed in backward-incompatible ways and is not
1088
- # recommended for production use. It is not subject to any SLA or deprecation
1089
- # policy.
1090
- #
1091
- # @param name [String]
1092
- # Required. The unique name of the table to have the snapshot taken.
1093
- # Values are of the form
1094
- # `projects/{project}/instances/{instance}/tables/{table}`.
1095
- # @param cluster [String]
1096
- # Required. The name of the cluster where the snapshot will be created in.
1097
- # Values are of the form
1098
- # `projects/{project}/instances/{instance}/clusters/{cluster}`.
1099
- # @param snapshot_id [String]
1100
- # Required. The ID by which the new snapshot should be referred to within the
1101
- # parent cluster, e.g., `mysnapshot` of the form:
1102
- # `[_a-zA-Z0-9][-_.a-zA-Z0-9]*` rather than
1103
- # `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/mysnapshot`.
1104
- # @param description [String]
1105
- # Description of the snapshot.
1106
- # @param ttl [Google::Protobuf::Duration | Hash]
1107
- # The amount of time that the new snapshot can stay active after it is
1108
- # created. Once 'ttl' expires, the snapshot will get deleted. The maximum
1109
- # amount of time a snapshot can stay active is 7 days. If 'ttl' is not
1110
- # specified, the default value of 24 hours will be used.
1111
- # A hash of the same form as `Google::Protobuf::Duration`
1112
- # can also be provided.
1113
- # @param options [Google::Gax::CallOptions]
1114
- # Overrides the default settings for this call, e.g, timeout,
1115
- # retries, etc.
1116
- # @return [Google::Gax::Operation]
1117
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1118
- # @example
1119
- # require "google/cloud/bigtable/admin"
1120
- #
1121
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
1122
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.table_path("[PROJECT]", "[INSTANCE]", "[TABLE]")
1123
- #
1124
- # # TODO: Initialize `cluster`:
1125
- # cluster = ''
1126
- #
1127
- # # TODO: Initialize `snapshot_id`:
1128
- # snapshot_id = ''
1129
- #
1130
- # # TODO: Initialize `description`:
1131
- # description = ''
1132
- #
1133
- # # Register a callback during the method call.
1134
- # operation = bigtable_table_admin_client.snapshot_table(formatted_name, cluster, snapshot_id, description) do |op|
1135
- # raise op.results.message if op.error?
1136
- # op_results = op.results
1137
- # # Process the results.
1138
- #
1139
- # metadata = op.metadata
1140
- # # Process the metadata.
1141
- # end
1142
- #
1143
- # # Or use the return value to register a callback.
1144
- # operation.on_done do |op|
1145
- # raise op.results.message if op.error?
1146
- # op_results = op.results
1147
- # # Process the results.
1148
- #
1149
- # metadata = op.metadata
1150
- # # Process the metadata.
1151
- # end
1152
- #
1153
- # # Manually reload the operation.
1154
- # operation.reload!
1155
- #
1156
- # # Or block until the operation completes, triggering callbacks on
1157
- # # completion.
1158
- # operation.wait_until_done!
1159
-
1160
- def snapshot_table \
1161
- name,
1162
- cluster,
1163
- snapshot_id,
1164
- description,
1165
- ttl: nil,
1166
- options: nil
1167
- req = {
1168
- name: name,
1169
- cluster: cluster,
1170
- snapshot_id: snapshot_id,
1171
- description: description,
1172
- ttl: ttl
1173
- }.delete_if { |_, v| v.nil? }
1174
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::SnapshotTableRequest)
1175
- operation = Google::Gax::Operation.new(
1176
- @snapshot_table.call(req, options),
1177
- @operations_client,
1178
- Google::Bigtable::Admin::V2::Snapshot,
1179
- Google::Bigtable::Admin::V2::SnapshotTableMetadata,
1180
- call_options: options
1181
- )
1182
- operation.on_done { |operation| yield(operation) } if block_given?
1183
- operation
1184
- end
1185
-
1186
- # Gets metadata information about the specified snapshot.
1187
- #
1188
- # Note: This is a private alpha release of Cloud Bigtable snapshots. This
1189
- # feature is not currently available to most Cloud Bigtable customers. This
1190
- # feature might be changed in backward-incompatible ways and is not
1191
- # recommended for production use. It is not subject to any SLA or deprecation
1192
- # policy.
1193
- #
1194
- # @param name [String]
1195
- # Required. The unique name of the requested snapshot.
1196
- # Values are of the form
1197
- # `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`.
1198
- # @param options [Google::Gax::CallOptions]
1199
- # Overrides the default settings for this call, e.g, timeout,
1200
- # retries, etc.
1201
- # @yield [result, operation] Access the result along with the RPC operation
1202
- # @yieldparam result [Google::Bigtable::Admin::V2::Snapshot]
1203
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1204
- # @return [Google::Bigtable::Admin::V2::Snapshot]
1205
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1206
- # @example
1207
- # require "google/cloud/bigtable/admin"
1208
- #
1209
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
1210
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.snapshot_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]")
1211
- # response = bigtable_table_admin_client.get_snapshot(formatted_name)
1212
-
1213
- def get_snapshot \
1214
- name,
1215
- options: nil,
1216
- &block
1217
- req = {
1218
- name: name
1219
- }.delete_if { |_, v| v.nil? }
1220
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::GetSnapshotRequest)
1221
- @get_snapshot.call(req, options, &block)
1222
- end
1223
-
1224
- # Lists all snapshots associated with the specified cluster.
1225
- #
1226
- # Note: This is a private alpha release of Cloud Bigtable snapshots. This
1227
- # feature is not currently available to most Cloud Bigtable customers. This
1228
- # feature might be changed in backward-incompatible ways and is not
1229
- # recommended for production use. It is not subject to any SLA or deprecation
1230
- # policy.
1231
- #
1232
- # @param parent [String]
1233
- # Required. The unique name of the cluster for which snapshots should be
1234
- # listed. Values are of the form
1235
- # `projects/{project}/instances/{instance}/clusters/{cluster}`.
1236
- # Use `{cluster} = '-'` to list snapshots for all clusters in an instance,
1237
- # e.g., `projects/{project}/instances/{instance}/clusters/-`.
1238
- # @param page_size [Integer]
1239
- # The maximum number of resources contained in the underlying API
1240
- # response. If page streaming is performed per-resource, this
1241
- # parameter does not affect the return value. If page streaming is
1242
- # performed per-page, this determines the maximum number of
1243
- # resources in a page.
1244
- # @param options [Google::Gax::CallOptions]
1245
- # Overrides the default settings for this call, e.g, timeout,
1246
- # retries, etc.
1247
- # @yield [result, operation] Access the result along with the RPC operation
1248
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Bigtable::Admin::V2::Snapshot>]
1249
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1250
- # @return [Google::Gax::PagedEnumerable<Google::Bigtable::Admin::V2::Snapshot>]
1251
- # An enumerable of Google::Bigtable::Admin::V2::Snapshot instances.
1252
- # See Google::Gax::PagedEnumerable documentation for other
1253
- # operations such as per-page iteration or access to the response
1254
- # object.
1255
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1256
- # @example
1257
- # require "google/cloud/bigtable/admin"
1258
- #
1259
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
1260
- # formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.cluster_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]")
1261
- #
1262
- # # Iterate over all results.
1263
- # bigtable_table_admin_client.list_snapshots(formatted_parent).each do |element|
1264
- # # Process element.
1265
- # end
1266
- #
1267
- # # Or iterate over results one page at a time.
1268
- # bigtable_table_admin_client.list_snapshots(formatted_parent).each_page do |page|
1269
- # # Process each page at a time.
1270
- # page.each do |element|
1271
- # # Process element.
1272
- # end
1273
- # end
1274
-
1275
- def list_snapshots \
1276
- parent,
1277
- page_size: nil,
1278
- options: nil,
1279
- &block
1280
- req = {
1281
- parent: parent,
1282
- page_size: page_size
1283
- }.delete_if { |_, v| v.nil? }
1284
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::ListSnapshotsRequest)
1285
- @list_snapshots.call(req, options, &block)
1286
- end
1287
-
1288
- # Permanently deletes the specified snapshot.
1289
- #
1290
- # Note: This is a private alpha release of Cloud Bigtable snapshots. This
1291
- # feature is not currently available to most Cloud Bigtable customers. This
1292
- # feature might be changed in backward-incompatible ways and is not
1293
- # recommended for production use. It is not subject to any SLA or deprecation
1294
- # policy.
1295
- #
1296
- # @param name [String]
1297
- # Required. The unique name of the snapshot to be deleted.
1298
- # Values are of the form
1299
- # `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`.
1300
- # @param options [Google::Gax::CallOptions]
1301
- # Overrides the default settings for this call, e.g, timeout,
1302
- # retries, etc.
1303
- # @yield [result, operation] Access the result along with the RPC operation
1304
- # @yieldparam result []
1305
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1306
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1307
- # @example
1308
- # require "google/cloud/bigtable/admin"
1309
- #
1310
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
1311
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.snapshot_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]")
1312
- # bigtable_table_admin_client.delete_snapshot(formatted_name)
1313
-
1314
- def delete_snapshot \
1315
- name,
1316
- options: nil,
1317
- &block
1318
- req = {
1319
- name: name
1320
- }.delete_if { |_, v| v.nil? }
1321
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::DeleteSnapshotRequest)
1322
- @delete_snapshot.call(req, options, &block)
1323
- nil
1324
- end
1325
-
1326
- # Starts creating a new Cloud Bigtable Backup. The returned backup
1327
- # {Google::Longrunning::Operation long-running operation} can be used to
1328
- # track creation of the backup. The
1329
- # {Google::Longrunning::Operation#metadata metadata} field type is
1330
- # {Google::Bigtable::Admin::V2::CreateBackupMetadata CreateBackupMetadata}. The
1331
- # {Google::Longrunning::Operation#response response} field type is
1332
- # {Google::Bigtable::Admin::V2::Backup Backup}, if successful. Cancelling the
1333
- # returned operation will stop the creation and delete the backup.
1334
- #
1335
- # @param parent [String]
1336
- # Required. This must be one of the clusters in the instance in which this
1337
- # table is located. The backup will be stored in this cluster. Values are
1338
- # of the form `projects/{project}/instances/{instance}/clusters/{cluster}`.
1339
- # @param backup_id [String]
1340
- # Required. The id of the backup to be created. The `backup_id` along with
1341
- # the parent `parent` are combined as \\{parent}/backups/\\{backup_id} to create
1342
- # the full backup name, of the form:
1343
- # `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup_id}`.
1344
- # This string must be between 1 and 50 characters in length and match the
1345
- # regex [_a-zA-Z0-9][-_.a-zA-Z0-9]*.
1346
- # @param backup [Google::Bigtable::Admin::V2::Backup | Hash]
1347
- # Required. The backup to create.
1348
- # A hash of the same form as `Google::Bigtable::Admin::V2::Backup`
1349
- # can also be provided.
1350
- # @param options [Google::Gax::CallOptions]
1351
- # Overrides the default settings for this call, e.g, timeout,
1352
- # retries, etc.
1353
- # @return [Google::Gax::Operation]
1354
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1355
- # @example
1356
- # require "google/cloud/bigtable/admin"
1357
- #
1358
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
1359
- # formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.cluster_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]")
1360
- #
1361
- # # TODO: Initialize `backup_id`:
1362
- # backup_id = ''
1363
- #
1364
- # # TODO: Initialize `backup`:
1365
- # backup = {}
1366
- #
1367
- # # Register a callback during the method call.
1368
- # operation = bigtable_table_admin_client.create_backup(formatted_parent, backup_id, backup) do |op|
1369
- # raise op.results.message if op.error?
1370
- # op_results = op.results
1371
- # # Process the results.
1372
- #
1373
- # metadata = op.metadata
1374
- # # Process the metadata.
1375
- # end
1376
- #
1377
- # # Or use the return value to register a callback.
1378
- # operation.on_done do |op|
1379
- # raise op.results.message if op.error?
1380
- # op_results = op.results
1381
- # # Process the results.
1382
- #
1383
- # metadata = op.metadata
1384
- # # Process the metadata.
1385
- # end
1386
- #
1387
- # # Manually reload the operation.
1388
- # operation.reload!
1389
- #
1390
- # # Or block until the operation completes, triggering callbacks on
1391
- # # completion.
1392
- # operation.wait_until_done!
1393
-
1394
- def create_backup \
1395
- parent,
1396
- backup_id,
1397
- backup,
1398
- options: nil
1399
- req = {
1400
- parent: parent,
1401
- backup_id: backup_id,
1402
- backup: backup
1403
- }.delete_if { |_, v| v.nil? }
1404
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::CreateBackupRequest)
1405
- operation = Google::Gax::Operation.new(
1406
- @create_backup.call(req, options),
1407
- @operations_client,
1408
- Google::Bigtable::Admin::V2::Backup,
1409
- Google::Bigtable::Admin::V2::CreateBackupMetadata,
1410
- call_options: options
1411
- )
1412
- operation.on_done { |operation| yield(operation) } if block_given?
1413
- operation
1414
- end
1415
-
1416
- # Gets metadata on a pending or completed Cloud Bigtable Backup.
1417
- #
1418
- # @param name [String]
1419
- # Required. Name of the backup.
1420
- # Values are of the form
1421
- # `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}`.
1422
- # @param options [Google::Gax::CallOptions]
1423
- # Overrides the default settings for this call, e.g, timeout,
1424
- # retries, etc.
1425
- # @yield [result, operation] Access the result along with the RPC operation
1426
- # @yieldparam result [Google::Bigtable::Admin::V2::Backup]
1427
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1428
- # @return [Google::Bigtable::Admin::V2::Backup]
1429
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1430
- # @example
1431
- # require "google/cloud/bigtable/admin"
1432
- #
1433
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
1434
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.backup_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]")
1435
- # response = bigtable_table_admin_client.get_backup(formatted_name)
1436
-
1437
- def get_backup \
1438
- name,
1439
- options: nil,
1440
- &block
1441
- req = {
1442
- name: name
1443
- }.delete_if { |_, v| v.nil? }
1444
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::GetBackupRequest)
1445
- @get_backup.call(req, options, &block)
1446
- end
1447
-
1448
- # Lists Cloud Bigtable backups. Returns both completed and pending
1449
- # backups.
1450
- #
1451
- # @param parent [String]
1452
- # Required. The cluster to list backups from. Values are of the
1453
- # form `projects/{project}/instances/{instance}/clusters/{cluster}`.
1454
- # Use `{cluster} = '-'` to list backups for all clusters in an instance,
1455
- # e.g., `projects/{project}/instances/{instance}/clusters/-`.
1456
- # @param filter [String]
1457
- # A filter expression that filters backups listed in the response.
1458
- # The expression must specify the field name, a comparison operator,
1459
- # and the value that you want to use for filtering. The value must be a
1460
- # string, a number, or a boolean. The comparison operator must be
1461
- # <, >, <=, >=, !=, =, or :. Colon ‘:’ represents a HAS operator which is
1462
- # roughly synonymous with equality. Filter rules are case insensitive.
1463
- #
1464
- # The fields eligible for filtering are:
1465
- # * `name`
1466
- # * `source_table`
1467
- # * `state`
1468
- # * `start_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
1469
- # * `end_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
1470
- # * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
1471
- # * `size_bytes`
1472
- #
1473
- # To filter on multiple expressions, provide each separate expression within
1474
- # parentheses. By default, each expression is an AND expression. However,
1475
- # you can include AND, OR, and NOT expressions explicitly.
1476
- #
1477
- # Some examples of using filters are:
1478
- #
1479
- # * `name:"exact"` --> The backup's name is the string "exact".
1480
- # * `name:howl` --> The backup's name contains the string "howl".
1481
- # * `source_table:prod`
1482
- # --> The source_table's name contains the string "prod".
1483
- # * `state:CREATING` --> The backup is pending creation.
1484
- # * `state:READY` --> The backup is fully created and ready for use.
1485
- # * `(name:howl) AND (start_time < \"2018-03-28T14:50:00Z\")`
1486
- # --> The backup name contains the string "howl" and start_time
1487
- # of the backup is before 2018-03-28T14:50:00Z.
1488
- # * `size_bytes > 10000000000` --> The backup's size is greater than 10GB
1489
- # @param order_by [String]
1490
- # An expression for specifying the sort order of the results of the request.
1491
- # The string value should specify one or more fields in
1492
- # {Google::Bigtable::Admin::V2::Backup Backup}. The full syntax is described at
1493
- # https://aip.dev/132#ordering.
1494
- #
1495
- # Fields supported are:
1496
- # * name
1497
- # * source_table
1498
- # * expire_time
1499
- # * start_time
1500
- # * end_time
1501
- # * size_bytes
1502
- # * state
1503
- #
1504
- # For example, "start_time". The default sorting order is ascending.
1505
- # To specify descending order for the field, a suffix " desc" should
1506
- # be appended to the field name. For example, "start_time desc".
1507
- # Redundant space characters in the syntax are insigificant.
1508
- #
1509
- # If order_by is empty, results will be sorted by `start_time` in descending
1510
- # order starting from the most recently created backup.
1511
- # @param page_size [Integer]
1512
- # The maximum number of resources contained in the underlying API
1513
- # response. If page streaming is performed per-resource, this
1514
- # parameter does not affect the return value. If page streaming is
1515
- # performed per-page, this determines the maximum number of
1516
- # resources in a page.
1517
- # @param options [Google::Gax::CallOptions]
1518
- # Overrides the default settings for this call, e.g, timeout,
1519
- # retries, etc.
1520
- # @yield [result, operation] Access the result along with the RPC operation
1521
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Bigtable::Admin::V2::Backup>]
1522
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1523
- # @return [Google::Gax::PagedEnumerable<Google::Bigtable::Admin::V2::Backup>]
1524
- # An enumerable of Google::Bigtable::Admin::V2::Backup instances.
1525
- # See Google::Gax::PagedEnumerable documentation for other
1526
- # operations such as per-page iteration or access to the response
1527
- # object.
1528
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1529
- # @example
1530
- # require "google/cloud/bigtable/admin"
1531
- #
1532
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
1533
- # formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.cluster_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]")
1534
- #
1535
- # # Iterate over all results.
1536
- # bigtable_table_admin_client.list_backups(formatted_parent).each do |element|
1537
- # # Process element.
1538
- # end
1539
- #
1540
- # # Or iterate over results one page at a time.
1541
- # bigtable_table_admin_client.list_backups(formatted_parent).each_page do |page|
1542
- # # Process each page at a time.
1543
- # page.each do |element|
1544
- # # Process element.
1545
- # end
1546
- # end
1547
-
1548
- def list_backups \
1549
- parent,
1550
- filter: nil,
1551
- order_by: nil,
1552
- page_size: nil,
1553
- options: nil,
1554
- &block
1555
- req = {
1556
- parent: parent,
1557
- filter: filter,
1558
- order_by: order_by,
1559
- page_size: page_size
1560
- }.delete_if { |_, v| v.nil? }
1561
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::ListBackupsRequest)
1562
- @list_backups.call(req, options, &block)
1563
- end
1564
-
1565
- # Updates a pending or completed Cloud Bigtable Backup.
1566
- #
1567
- # @param backup [Google::Bigtable::Admin::V2::Backup | Hash]
1568
- # Required. The backup to update. `backup.name`, and the fields to be updated
1569
- # as specified by `update_mask` are required. Other fields are ignored.
1570
- # Update is only supported for the following fields:
1571
- # * `backup.expire_time`.
1572
- # A hash of the same form as `Google::Bigtable::Admin::V2::Backup`
1573
- # can also be provided.
1574
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
1575
- # Required. A mask specifying which fields (e.g. `expire_time`) in the
1576
- # Backup resource should be updated. This mask is relative to the Backup
1577
- # resource, not to the request message. The field mask must always be
1578
- # specified; this prevents any future fields from being erased accidentally
1579
- # by clients that do not know about them.
1580
- # A hash of the same form as `Google::Protobuf::FieldMask`
1581
- # can also be provided.
1582
- # @param options [Google::Gax::CallOptions]
1583
- # Overrides the default settings for this call, e.g, timeout,
1584
- # retries, etc.
1585
- # @yield [result, operation] Access the result along with the RPC operation
1586
- # @yieldparam result [Google::Bigtable::Admin::V2::Backup]
1587
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1588
- # @return [Google::Bigtable::Admin::V2::Backup]
1589
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1590
- # @example
1591
- # require "google/cloud/bigtable/admin"
1592
- #
1593
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
1594
- #
1595
- # # TODO: Initialize `backup`:
1596
- # backup = {}
1597
- #
1598
- # # TODO: Initialize `update_mask`:
1599
- # update_mask = {}
1600
- # response = bigtable_table_admin_client.update_backup(backup, update_mask)
1601
-
1602
- def update_backup \
1603
- backup,
1604
- update_mask,
1605
- options: nil,
1606
- &block
1607
- req = {
1608
- backup: backup,
1609
- update_mask: update_mask
1610
- }.delete_if { |_, v| v.nil? }
1611
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::UpdateBackupRequest)
1612
- @update_backup.call(req, options, &block)
1613
- end
1614
-
1615
- # Deletes a pending or completed Cloud Bigtable backup.
1616
- #
1617
- # @param name [String]
1618
- # Required. Name of the backup to delete.
1619
- # Values are of the form
1620
- # `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}`.
1621
- # @param options [Google::Gax::CallOptions]
1622
- # Overrides the default settings for this call, e.g, timeout,
1623
- # retries, etc.
1624
- # @yield [result, operation] Access the result along with the RPC operation
1625
- # @yieldparam result []
1626
- # @yieldparam operation [GRPC::ActiveCall::Operation]
1627
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1628
- # @example
1629
- # require "google/cloud/bigtable/admin"
1630
- #
1631
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
1632
- # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.backup_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]")
1633
- # bigtable_table_admin_client.delete_backup(formatted_name)
1634
-
1635
- def delete_backup \
1636
- name,
1637
- options: nil,
1638
- &block
1639
- req = {
1640
- name: name
1641
- }.delete_if { |_, v| v.nil? }
1642
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::DeleteBackupRequest)
1643
- @delete_backup.call(req, options, &block)
1644
- nil
1645
- end
1646
-
1647
- # Create a new table by restoring from a completed backup. The new table
1648
- # must be in the same instance as the instance containing the backup. The
1649
- # returned table {Google::Longrunning::Operation long-running operation} can
1650
- # be used to track the progress of the operation, and to cancel it. The
1651
- # {Google::Longrunning::Operation#metadata metadata} field type is
1652
- # {Google::Bigtable::Admin::RestoreTableMetadata RestoreTableMetadata}. The
1653
- # {Google::Longrunning::Operation#response response} type is
1654
- # {Google::Bigtable::Admin::V2::Table Table}, if successful.
1655
- #
1656
- # @param parent [String]
1657
- # Required. The name of the instance in which to create the restored
1658
- # table. This instance must be the parent of the source backup. Values are
1659
- # of the form `projects/<project>/instances/<instance>`.
1660
- # @param table_id [String]
1661
- # Required. The id of the table to create and restore to. This
1662
- # table must not already exist. The `table_id` appended to
1663
- # `parent` forms the full table name of the form
1664
- # `projects/<project>/instances/<instance>/tables/<table_id>`.
1665
- # @param backup [String]
1666
- # Name of the backup from which to restore. Values are of the form
1667
- # `projects/<project>/instances/<instance>/clusters/<cluster>/backups/<backup>`.
1668
- # @param options [Google::Gax::CallOptions]
1669
- # Overrides the default settings for this call, e.g, timeout,
1670
- # retries, etc.
1671
- # @return [Google::Gax::Operation]
1672
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
1673
- # @example
1674
- # require "google/cloud/bigtable/admin"
1675
- #
1676
- # bigtable_table_admin_client = Google::Cloud::Bigtable::Admin::BigtableTableAdmin.new(version: :v2)
1677
- #
1678
- # # TODO: Initialize `parent`:
1679
- # parent = ''
1680
- #
1681
- # # Register a callback during the method call.
1682
- # operation = bigtable_table_admin_client.restore_table(parent) do |op|
1683
- # raise op.results.message if op.error?
1684
- # op_results = op.results
1685
- # # Process the results.
1686
- #
1687
- # metadata = op.metadata
1688
- # # Process the metadata.
1689
- # end
1690
- #
1691
- # # Or use the return value to register a callback.
1692
- # operation.on_done do |op|
1693
- # raise op.results.message if op.error?
1694
- # op_results = op.results
1695
- # # Process the results.
1696
- #
1697
- # metadata = op.metadata
1698
- # # Process the metadata.
1699
- # end
1700
- #
1701
- # # Manually reload the operation.
1702
- # operation.reload!
1703
- #
1704
- # # Or block until the operation completes, triggering callbacks on
1705
- # # completion.
1706
- # operation.wait_until_done!
1707
-
1708
- def restore_table \
1709
- parent,
1710
- table_id: nil,
1711
- backup: nil,
1712
- options: nil
1713
- req = {
1714
- parent: parent,
1715
- table_id: table_id,
1716
- backup: backup
1717
- }.delete_if { |_, v| v.nil? }
1718
- req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::RestoreTableRequest)
1719
- operation = Google::Gax::Operation.new(
1720
- @restore_table.call(req, options),
1721
- @operations_client,
1722
- Google::Bigtable::Admin::V2::Table,
1723
- Google::Bigtable::Admin::V2::RestoreTableMetadata,
1724
- call_options: options
1725
- )
1726
- operation.on_done { |operation| yield(operation) } if block_given?
1727
- operation
1728
- end
1729
- end
1730
- end
1731
- end
1732
- end
1733
- end
1734
- end