google-cloud-bigtable 1.2.1 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +1 -1
- data/CHANGELOG.md +57 -0
- data/TROUBLESHOOTING.md +2 -8
- data/lib/google-cloud-bigtable.rb +30 -27
- data/lib/google/cloud/bigtable.rb +18 -26
- data/lib/google/cloud/bigtable/app_profile.rb +3 -3
- data/lib/google/cloud/bigtable/app_profile/list.rb +6 -4
- data/lib/google/cloud/bigtable/backup.rb +445 -0
- data/lib/google/cloud/bigtable/backup/job.rb +87 -0
- data/lib/google/cloud/bigtable/backup/list.rb +167 -0
- data/lib/google/cloud/bigtable/chunk_processor.rb +1 -1
- data/lib/google/cloud/bigtable/cluster.rb +101 -2
- data/lib/google/cloud/bigtable/cluster/list.rb +2 -2
- data/lib/google/cloud/bigtable/column_family.rb +2 -2
- data/lib/google/cloud/bigtable/column_family_map.rb +11 -11
- data/lib/google/cloud/bigtable/column_range.rb +2 -2
- data/lib/google/cloud/bigtable/credentials.rb +36 -2
- data/lib/google/cloud/bigtable/gc_rule.rb +7 -7
- data/lib/google/cloud/bigtable/instance.rb +6 -6
- data/lib/google/cloud/bigtable/instance/cluster_map.rb +1 -1
- data/lib/google/cloud/bigtable/instance/list.rb +2 -2
- data/lib/google/cloud/bigtable/longrunning_job.rb +13 -2
- data/lib/google/cloud/bigtable/mutation_entry.rb +10 -9
- data/lib/google/cloud/bigtable/mutation_operations.rb +2 -2
- data/lib/google/cloud/bigtable/project.rb +1 -1
- data/lib/google/cloud/bigtable/read_modify_write_rule.rb +2 -2
- data/lib/google/cloud/bigtable/read_operations.rb +2 -2
- data/lib/google/cloud/bigtable/routing_policy.rb +2 -2
- data/lib/google/cloud/bigtable/row_filter/chain_filter.rb +3 -3
- data/lib/google/cloud/bigtable/row_filter/condition_filter.rb +3 -3
- data/lib/google/cloud/bigtable/row_filter/interleave_filter.rb +3 -3
- data/lib/google/cloud/bigtable/row_filter/simple_filter.rb +3 -3
- data/lib/google/cloud/bigtable/row_range.rb +2 -2
- data/lib/google/cloud/bigtable/rows_mutator.rb +3 -3
- data/lib/google/cloud/bigtable/rows_reader.rb +10 -10
- data/lib/google/cloud/bigtable/sample_row_key.rb +2 -2
- data/lib/google/cloud/bigtable/service.rb +282 -245
- data/lib/google/cloud/bigtable/table.rb +5 -4
- data/lib/google/cloud/bigtable/table/cluster_state.rb +27 -6
- data/lib/google/cloud/bigtable/table/list.rb +2 -2
- data/lib/google/cloud/bigtable/table/restore_job.rb +117 -0
- data/lib/google/cloud/bigtable/value_range.rb +2 -2
- data/lib/google/cloud/bigtable/version.rb +1 -1
- metadata +16 -94
- data/lib/google/bigtable/admin/v2/bigtable_instance_admin_pb.rb +0 -145
- data/lib/google/bigtable/admin/v2/bigtable_instance_admin_services_pb.rb +0 -90
- data/lib/google/bigtable/admin/v2/bigtable_table_admin_pb.rb +0 -208
- data/lib/google/bigtable/admin/v2/bigtable_table_admin_services_pb.rb +0 -154
- data/lib/google/bigtable/admin/v2/common_pb.rb +0 -30
- data/lib/google/bigtable/admin/v2/instance_pb.rb +0 -74
- data/lib/google/bigtable/admin/v2/table_pb.rb +0 -127
- data/lib/google/bigtable/v2/bigtable_pb.rb +0 -113
- data/lib/google/bigtable/v2/bigtable_services_pb.rb +0 -68
- data/lib/google/bigtable/v2/data_pb.rb +0 -156
- data/lib/google/cloud/bigtable/admin.rb +0 -202
- data/lib/google/cloud/bigtable/admin/credentials.rb +0 -27
- data/lib/google/cloud/bigtable/admin/v2.rb +0 -223
- data/lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb +0 -1451
- data/lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client_config.json +0 -139
- data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb +0 -1734
- data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client_config.json +0 -163
- data/lib/google/cloud/bigtable/admin/v2/credentials.rb +0 -51
- data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/bigtable_instance_admin.rb +0 -297
- data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/bigtable_table_admin.rb +0 -587
- data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/instance.rb +0 -193
- data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/table.rb +0 -303
- data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/iam_policy.rb +0 -64
- data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/options.rb +0 -33
- data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/policy.rb +0 -151
- data/lib/google/cloud/bigtable/admin/v2/doc/google/longrunning/operations.rb +0 -51
- data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/any.rb +0 -131
- data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/duration.rb +0 -91
- data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/empty.rb +0 -29
- data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/field_mask.rb +0 -222
- data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/timestamp.rb +0 -113
- data/lib/google/cloud/bigtable/admin/v2/doc/google/rpc/status.rb +0 -39
- data/lib/google/cloud/bigtable/admin/v2/doc/google/type/expr.rb +0 -45
- data/lib/google/cloud/bigtable/v2.rb +0 -146
- data/lib/google/cloud/bigtable/v2/bigtable_client.rb +0 -591
- data/lib/google/cloud/bigtable/v2/bigtable_client_config.json +0 -83
- data/lib/google/cloud/bigtable/v2/credentials.rb +0 -46
- data/lib/google/cloud/bigtable/v2/doc/google/bigtable/v2/bigtable.rb +0 -290
- data/lib/google/cloud/bigtable/v2/doc/google/bigtable/v2/data.rb +0 -493
- data/lib/google/cloud/bigtable/v2/doc/google/protobuf/any.rb +0 -131
- data/lib/google/cloud/bigtable/v2/doc/google/protobuf/wrappers.rb +0 -34
- data/lib/google/cloud/bigtable/v2/doc/google/rpc/status.rb +0 -39
@@ -57,7 +57,7 @@ module Google
|
|
57
57
|
# @private
|
58
58
|
# Creates a row range instance.
|
59
59
|
def initialize
|
60
|
-
@grpc = Google::Bigtable::V2::RowRange.new
|
60
|
+
@grpc = Google::Cloud::Bigtable::V2::RowRange.new
|
61
61
|
end
|
62
62
|
|
63
63
|
##
|
@@ -168,7 +168,7 @@ module Google
|
|
168
168
|
|
169
169
|
# @private
|
170
170
|
#
|
171
|
-
# @return [Google::Bigtable::V2::RowRange]
|
171
|
+
# @return [Google::Cloud::Bigtable::V2::RowRange]
|
172
172
|
#
|
173
173
|
def to_grpc
|
174
174
|
@grpc
|
@@ -53,7 +53,7 @@ module Google
|
|
53
53
|
##
|
54
54
|
# Applies mutations.
|
55
55
|
#
|
56
|
-
# @return [Array<Google::Bigtable::V2::MutateRowsResponse::Entry>]
|
56
|
+
# @return [Array<Google::Cloud::Bigtable::V2::MutateRowsResponse::Entry>]
|
57
57
|
#
|
58
58
|
def apply_mutations
|
59
59
|
@req_entries = @entries.map(&:to_grpc)
|
@@ -80,7 +80,7 @@ module Google
|
|
80
80
|
# Mutates rows.
|
81
81
|
#
|
82
82
|
# @param entries [Array<Google::Cloud::Bigtable::MutationEntry>]
|
83
|
-
# @return [Array<Google::Bigtable::V2::MutateRowsResponse::Entry>]
|
83
|
+
# @return [Array<Google::Cloud::Bigtable::V2::MutateRowsResponse::Entry>]
|
84
84
|
#
|
85
85
|
def mutate_rows entries
|
86
86
|
response = @table.service.mutate_rows @table.path, entries, app_profile_id: @table.app_profile_id
|
@@ -92,7 +92,7 @@ module Google
|
|
92
92
|
##
|
93
93
|
# Collects failed entries, retries mutation, and updates status.
|
94
94
|
#
|
95
|
-
# @param statuses [Array<Google::Bigtable::V2::MutateRowsResponse::Entry>]
|
95
|
+
# @param statuses [Array<Google::Cloud::Bigtable::V2::MutateRowsResponse::Entry>]
|
96
96
|
# @param indices [Array<Integer>]
|
97
97
|
# Retry entries position mapping list
|
98
98
|
# @return [Array<Integer>]
|
@@ -59,14 +59,14 @@ module Google
|
|
59
59
|
##
|
60
60
|
# Read rows
|
61
61
|
#
|
62
|
-
# @param rows [Google::Bigtable::V2::RowSet]
|
62
|
+
# @param rows [Google::Cloud::Bigtable::V2::RowSet]
|
63
63
|
# The row keys and/or ranges to read.
|
64
64
|
# If not specified, reads from all rows.
|
65
|
-
# Alternatively, provide a hash in the form of `Google::Bigtable::V2::RowSet`.
|
66
|
-
# @param filter [Google::Bigtable::V2::RowFilter | Hash]
|
65
|
+
# Alternatively, provide a hash in the form of `Google::Cloud::Bigtable::V2::RowSet`.
|
66
|
+
# @param filter [Google::Cloud::Bigtable::V2::RowFilter | Hash]
|
67
67
|
# The filter to apply to the contents of the specified row(s). If unset,
|
68
68
|
# reads the entirety of each row.
|
69
|
-
# A hash in the form of `Google::Bigtable::V2::RowFilter`
|
69
|
+
# A hash in the form of `Google::Cloud::Bigtable::V2::RowFilter`
|
70
70
|
# can also be provided.
|
71
71
|
# @param rows_limit [Integer]
|
72
72
|
# The read will terminate after committing to N rows' worth of results.
|
@@ -111,12 +111,12 @@ module Google
|
|
111
111
|
# @param rows_limit [Integer]
|
112
112
|
# The read will terminate after committing to N rows' worth of results.
|
113
113
|
# The default (zero) is to return all results.
|
114
|
-
# @param row_set [Google::Bigtable::V2::RowSet]
|
114
|
+
# @param row_set [Google::Cloud::Bigtable::V2::RowSet]
|
115
115
|
# The row keys and/or ranges to read.
|
116
116
|
# If not specified, reads from all rows.
|
117
|
-
# A hash of the same form as `Google::Bigtable::V2::RowSet`
|
117
|
+
# A hash of the same form as `Google::Cloud::Bigtable::V2::RowSet`
|
118
118
|
# can also be provided.
|
119
|
-
# @return [Integer, Google::Bigtable::V2::RowSet]
|
119
|
+
# @return [Integer, Google::Cloud::Bigtable::V2::RowSet]
|
120
120
|
#
|
121
121
|
def retry_options rows_limit, row_set
|
122
122
|
return [rows_limit, row_set] unless last_key
|
@@ -142,7 +142,7 @@ module Google
|
|
142
142
|
|
143
143
|
if row_set.row_ranges.empty?
|
144
144
|
row_set.row_ranges <<
|
145
|
-
Google::Bigtable::V2::RowRange.new(start_key_open: last_key)
|
145
|
+
Google::Cloud::Bigtable::V2::RowRange.new(start_key_open: last_key)
|
146
146
|
end
|
147
147
|
|
148
148
|
# 3. Remove all individual keys before and up to the last read key
|
@@ -166,7 +166,7 @@ module Google
|
|
166
166
|
##
|
167
167
|
# Checks if the start key was already read for the range.
|
168
168
|
#
|
169
|
-
# @param range [Google::Bigtable::V2::RowRange]
|
169
|
+
# @param range [Google::Cloud::Bigtable::V2::RowRange]
|
170
170
|
# @return [Boolean]
|
171
171
|
#
|
172
172
|
def start_key_read? range
|
@@ -182,7 +182,7 @@ module Google
|
|
182
182
|
##
|
183
183
|
# Checks if the end key was already read for the range.
|
184
184
|
#
|
185
|
-
# @param range [Google::Bigtable::V2::RowRange]
|
185
|
+
# @param range [Google::Cloud::Bigtable::V2::RowRange]
|
186
186
|
# @return [Boolean]
|
187
187
|
#
|
188
188
|
def end_key_read? range
|
@@ -72,8 +72,8 @@ module Google
|
|
72
72
|
# @private
|
73
73
|
#
|
74
74
|
# Creates a new SampleRowKey instance from a
|
75
|
-
# Google::Bigtable::V2::SampleRowKey.
|
76
|
-
# @param grpc [Google::Bigtable::V2::SampleRowKeysResponse]
|
75
|
+
# Google::Cloud::Bigtable::V2::SampleRowKey.
|
76
|
+
# @param grpc [Google::Cloud::Bigtable::V2::SampleRowKeysResponse]
|
77
77
|
# @return [Google::Cloud::Bigtable::SampleRowKey]
|
78
78
|
#
|
79
79
|
def self.from_grpc grpc
|
@@ -18,9 +18,8 @@
|
|
18
18
|
require "google/cloud/bigtable/version"
|
19
19
|
require "google/cloud/bigtable/errors"
|
20
20
|
require "google/cloud/bigtable/credentials"
|
21
|
-
require "google/cloud/bigtable/
|
22
|
-
require "google/cloud/bigtable/admin/v2
|
23
|
-
require "google/cloud/bigtable/v2/bigtable_client"
|
21
|
+
require "google/cloud/bigtable/v2"
|
22
|
+
require "google/cloud/bigtable/admin/v2"
|
24
23
|
|
25
24
|
module Google
|
26
25
|
module Cloud
|
@@ -29,7 +28,7 @@ module Google
|
|
29
28
|
# gRPC Cloud Bigtable service, including API methods.
|
30
29
|
class Service
|
31
30
|
# @private
|
32
|
-
attr_accessor :project_id, :credentials, :host, :
|
31
|
+
attr_accessor :project_id, :credentials, :host, :host_admin, :timeout
|
33
32
|
|
34
33
|
# @private
|
35
34
|
# Creates a new Service instance.
|
@@ -49,109 +48,74 @@ module Google
|
|
49
48
|
# generally, to give OAuth credentials.
|
50
49
|
# @param timeout [Integer]
|
51
50
|
# The default timeout, in seconds, for calls made through this client.
|
52
|
-
# @param client_config [Hash]
|
53
|
-
# A hash for call options for each method. See Google::Gax#construct_settings for the structure of this data.
|
54
|
-
# Falls back to the default config if not specified or the specified config is missing data points.
|
55
51
|
#
|
56
|
-
def initialize project_id, credentials, host: nil,
|
52
|
+
def initialize project_id, credentials, host: nil, host_admin: nil, timeout: nil
|
57
53
|
@project_id = project_id
|
58
54
|
@credentials = credentials
|
59
55
|
@host = host
|
56
|
+
@host_admin = host_admin
|
60
57
|
@timeout = timeout
|
61
|
-
@client_config = client_config || {}
|
62
58
|
end
|
63
59
|
|
64
|
-
def channel default_host
|
65
|
-
require "grpc"
|
66
|
-
GRPC::Core::Channel.new((host || default_host), chan_args, chan_creds)
|
67
|
-
end
|
68
|
-
|
69
|
-
def chan_args
|
70
|
-
{ "grpc.max_send_message_length" => -1,
|
71
|
-
"grpc.max_receive_message_length" => -1,
|
72
|
-
"grpc.service_config_disable_resolution" => 1 }
|
73
|
-
end
|
74
|
-
|
75
|
-
def chan_creds
|
76
|
-
return credentials if insecure?
|
77
|
-
require "grpc"
|
78
|
-
GRPC::Core::ChannelCredentials.new.compose GRPC::Core::CallCredentials.new credentials.client.updater_proc
|
79
|
-
end
|
80
|
-
|
81
|
-
##
|
82
|
-
# Creates or returns an instance of an instance admin client.
|
83
|
-
#
|
84
|
-
# @return [Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient]
|
85
|
-
#
|
86
60
|
def instances
|
87
61
|
return mocked_instances if mocked_instances
|
88
|
-
@instances ||= Admin::V2::
|
89
|
-
credentials
|
90
|
-
timeout
|
91
|
-
|
92
|
-
lib_name
|
93
|
-
lib_version
|
94
|
-
|
62
|
+
@instances ||= Admin::V2::BigtableInstanceAdmin::Client.new do |config|
|
63
|
+
config.credentials = credentials if credentials
|
64
|
+
config.timeout = timeout if timeout
|
65
|
+
config.endpoint = host_admin if host_admin
|
66
|
+
config.lib_name = "gccl"
|
67
|
+
config.lib_version = Google::Cloud::Bigtable::VERSION
|
68
|
+
config.metadata = { "google-cloud-resource-prefix": "projects/#{@project_id}" }
|
69
|
+
end
|
95
70
|
end
|
96
71
|
attr_accessor :mocked_instances
|
97
72
|
|
98
|
-
##
|
99
|
-
# Creates or returns an instance of a table admin client.
|
100
|
-
#
|
101
|
-
# @return [Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient]
|
102
|
-
#
|
103
73
|
def tables
|
104
74
|
return mocked_tables if mocked_tables
|
105
|
-
@tables ||= Admin::V2::
|
106
|
-
credentials
|
107
|
-
timeout
|
108
|
-
|
109
|
-
lib_name
|
110
|
-
lib_version
|
111
|
-
|
75
|
+
@tables ||= Admin::V2::BigtableTableAdmin::Client.new do |config|
|
76
|
+
config.credentials = credentials if credentials
|
77
|
+
config.timeout = timeout if timeout
|
78
|
+
config.endpoint = host_admin if host_admin
|
79
|
+
config.lib_name = "gccl"
|
80
|
+
config.lib_version = Google::Cloud::Bigtable::VERSION
|
81
|
+
config.metadata = { "google-cloud-resource-prefix": "projects/#{@project_id}" }
|
82
|
+
end
|
112
83
|
end
|
113
84
|
attr_accessor :mocked_tables
|
114
85
|
|
115
|
-
##
|
116
|
-
# Creates an instance of a data client.
|
117
|
-
#
|
118
|
-
# @return [Google::Cloud::Bigtable::V2::BigtableClient]
|
119
|
-
#
|
120
86
|
def client
|
121
87
|
return mocked_client if mocked_client
|
122
|
-
@client ||= V2::
|
123
|
-
credentials
|
124
|
-
timeout
|
125
|
-
|
126
|
-
lib_name
|
127
|
-
lib_version
|
128
|
-
|
88
|
+
@client ||= V2::Bigtable::Client.new do |config|
|
89
|
+
config.credentials = credentials if credentials
|
90
|
+
config.timeout = timeout if timeout
|
91
|
+
config.endpoint = host if host
|
92
|
+
config.lib_name = "gccl"
|
93
|
+
config.lib_version = Google::Cloud::Bigtable::VERSION
|
94
|
+
config.metadata = { "google-cloud-resource-prefix": "projects/#{@project_id}" }
|
95
|
+
end
|
129
96
|
end
|
130
97
|
attr_accessor :mocked_client
|
131
98
|
|
132
|
-
def insecure?
|
133
|
-
credentials == :this_channel_is_insecure
|
134
|
-
end
|
135
|
-
|
136
99
|
##
|
137
100
|
# Creates an instance within a project.
|
138
101
|
#
|
139
102
|
# @param instance_id [String]
|
140
103
|
# The permanent identifier to be used for the new instance.
|
141
104
|
#
|
142
|
-
# @param instance [Google::Bigtable::Admin::V2::Instance | Hash]
|
143
|
-
# @param clusters [Hash{String => Google::Bigtable::Admin::V2::Cluster | Hash}]
|
105
|
+
# @param instance [Google::Cloud::Bigtable::Admin::V2::Instance | Hash]
|
106
|
+
# @param clusters [Hash{String => Google::Cloud::Bigtable::Admin::V2::Cluster | Hash}]
|
144
107
|
# The clusters to be created in the instance.
|
145
108
|
# Note that the cluster ID is the last segment of a cluster name. In the
|
146
109
|
# following cluster name, 'mycluster' is the cluster ID:
|
147
110
|
# +projects/myproject/instances/myinstance/clusters/mycluster+.
|
148
|
-
# Alternatively, provide a hash in the form of `Google::Bigtable::Admin::V2::Cluster`
|
149
|
-
# @return [
|
111
|
+
# Alternatively, provide a hash in the form of `Google::Cloud::Bigtable::Admin::V2::Cluster`
|
112
|
+
# @return [Gapic::Operation]
|
150
113
|
#
|
151
114
|
def create_instance instance_id, instance, clusters
|
152
|
-
|
153
|
-
|
154
|
-
|
115
|
+
instances.create_instance parent: project_path,
|
116
|
+
instance_id: instance_id,
|
117
|
+
instance: instance,
|
118
|
+
clusters: clusters
|
155
119
|
end
|
156
120
|
|
157
121
|
##
|
@@ -159,12 +123,10 @@ module Google
|
|
159
123
|
#
|
160
124
|
# @param token [String]
|
161
125
|
# The value of +next_page_token+ returned by a previous call.
|
162
|
-
# @return [Google::Bigtable::Admin::V2::ListInstancesResponse]
|
126
|
+
# @return [Google::Cloud::Bigtable::Admin::V2::ListInstancesResponse]
|
163
127
|
#
|
164
128
|
def list_instances token: nil
|
165
|
-
|
166
|
-
instances.list_instances project_path, page_token: token
|
167
|
-
end
|
129
|
+
instances.list_instances parent: project_path, page_token: token
|
168
130
|
end
|
169
131
|
|
170
132
|
##
|
@@ -172,30 +134,26 @@ module Google
|
|
172
134
|
#
|
173
135
|
# @param instance_id [String]
|
174
136
|
# Unique ID of the requested instance.
|
175
|
-
# @return [Google::Bigtable::Admin::V2::Instance]
|
137
|
+
# @return [Google::Cloud::Bigtable::Admin::V2::Instance]
|
176
138
|
#
|
177
139
|
def get_instance instance_id
|
178
|
-
|
179
|
-
instances.get_instance instance_path(instance_id)
|
180
|
-
end
|
140
|
+
instances.get_instance name: instance_path(instance_id)
|
181
141
|
end
|
182
142
|
|
183
143
|
##
|
184
144
|
# Partially updates an instance.
|
185
145
|
#
|
186
|
-
# @param instance [Google::Bigtable::Admin::V2::Instance | Hash]
|
146
|
+
# @param instance [Google::Cloud::Bigtable::Admin::V2::Instance | Hash]
|
187
147
|
# The instance that will (partially) replace the current value.
|
188
|
-
# Alternatively, provide a hash in the form of `Google::Bigtable::Admin::V2::Instance.
|
148
|
+
# Alternatively, provide a hash in the form of `Google::Cloud::Bigtable::Admin::V2::Instance.
|
189
149
|
# @param update_mask [Google::Protobuf::FieldMask | Hash]
|
190
150
|
# List of instance properties to be replaced.
|
191
151
|
# Must be explicitly set.
|
192
152
|
# Alternatively, provide a hash in the form of `Google::Protobuf::FieldMask`.
|
193
|
-
# @return [
|
153
|
+
# @return [Gapic::Operation]
|
194
154
|
#
|
195
155
|
def partial_update_instance instance, update_mask
|
196
|
-
|
197
|
-
instances.partial_update_instance instance, update_mask
|
198
|
-
end
|
156
|
+
instances.partial_update_instance instance: instance, update_mask: update_mask
|
199
157
|
end
|
200
158
|
|
201
159
|
##
|
@@ -205,11 +163,7 @@ module Google
|
|
205
163
|
# Unique ID of the instance to be deleted.
|
206
164
|
#
|
207
165
|
def delete_instance instance_id
|
208
|
-
|
209
|
-
instances.delete_instance(
|
210
|
-
instance_path(instance_id)
|
211
|
-
)
|
212
|
-
end
|
166
|
+
instances.delete_instance name: instance_path(instance_id)
|
213
167
|
end
|
214
168
|
|
215
169
|
##
|
@@ -219,18 +173,16 @@ module Google
|
|
219
173
|
# Unique ID of the instance in which to create the new cluster
|
220
174
|
# @param cluster_id [String]
|
221
175
|
# Unique permanent identifier for the new cluster
|
222
|
-
# @param cluster [Google::Bigtable::Admin::V2::Cluster | Hash]
|
176
|
+
# @param cluster [Google::Cloud::Bigtable::Admin::V2::Cluster | Hash]
|
223
177
|
# The cluster to be created.
|
224
|
-
# Alternatively, provide a hash in the form of `Google::Bigtable::Admin::V2::Cluster`
|
178
|
+
# Alternatively, provide a hash in the form of `Google::Cloud::Bigtable::Admin::V2::Cluster`
|
225
179
|
#
|
226
|
-
# @return [
|
180
|
+
# @return [Gapic::Operation]
|
227
181
|
#
|
228
182
|
def create_cluster instance_id, cluster_id, cluster
|
229
183
|
cluster.location = location_path cluster.location unless cluster.location == ""
|
230
184
|
|
231
|
-
|
232
|
-
instances.create_cluster instance_path(instance_id), cluster_id, cluster
|
233
|
-
end
|
185
|
+
instances.create_cluster parent: instance_path(instance_id), cluster_id: cluster_id, cluster: cluster
|
234
186
|
end
|
235
187
|
|
236
188
|
##
|
@@ -240,12 +192,10 @@ module Google
|
|
240
192
|
# Unique ID of the instance for which a list of clusters is requested.
|
241
193
|
# @param token [String]
|
242
194
|
# The value of +next_page_token+ returned by a previous call.
|
243
|
-
# @return [Google::Bigtable::Admin::V2::ListClustersResponse]
|
195
|
+
# @return [Google::Cloud::Bigtable::Admin::V2::ListClustersResponse]
|
244
196
|
#
|
245
197
|
def list_clusters instance_id, token: nil
|
246
|
-
|
247
|
-
instances.list_clusters instance_path(instance_id), page_token: token
|
248
|
-
end
|
198
|
+
instances.list_clusters parent: instance_path(instance_id), page_token: token
|
249
199
|
end
|
250
200
|
|
251
201
|
##
|
@@ -255,12 +205,10 @@ module Google
|
|
255
205
|
# Unique ID of the instance the cluster is in.
|
256
206
|
# @param cluster_id [String]
|
257
207
|
# Unique ID of the requested cluster.
|
258
|
-
# @return [Google::Bigtable::Admin::V2::Cluster]
|
208
|
+
# @return [Google::Cloud::Bigtable::Admin::V2::Cluster]
|
259
209
|
#
|
260
210
|
def get_cluster instance_id, cluster_id
|
261
|
-
|
262
|
-
instances.get_cluster cluster_path(instance_id, cluster_id)
|
263
|
-
end
|
211
|
+
instances.get_cluster name: cluster_path(instance_id, cluster_id)
|
264
212
|
end
|
265
213
|
|
266
214
|
##
|
@@ -278,12 +226,12 @@ module Google
|
|
278
226
|
# @param serve_nodes [Integer]
|
279
227
|
# The number of nodes allocated to this cluster. More nodes enable higher
|
280
228
|
# throughput and more consistent performance.
|
281
|
-
# @return [
|
229
|
+
# @return [Gapic::Operation]
|
282
230
|
#
|
283
231
|
def update_cluster instance_id, cluster_id, location, serve_nodes
|
284
|
-
|
285
|
-
|
286
|
-
|
232
|
+
instances.update_cluster name: cluster_path(instance_id, cluster_id),
|
233
|
+
location: location,
|
234
|
+
serve_nodes: serve_nodes
|
287
235
|
end
|
288
236
|
|
289
237
|
##
|
@@ -295,9 +243,7 @@ module Google
|
|
295
243
|
# Unique ID of the cluster to be deleted.
|
296
244
|
#
|
297
245
|
def delete_cluster instance_id, cluster_id
|
298
|
-
|
299
|
-
instances.delete_cluster cluster_path(instance_id, cluster_id)
|
300
|
-
end
|
246
|
+
instances.delete_cluster name: cluster_path(instance_id, cluster_id)
|
301
247
|
end
|
302
248
|
|
303
249
|
##
|
@@ -308,10 +254,10 @@ module Google
|
|
308
254
|
# Unique ID of the instance to create the table in.
|
309
255
|
# @param table_id [String]
|
310
256
|
# Unique, permanent identifier for the new table.
|
311
|
-
# @param table [Google::Bigtable::Admin::V2::Table | Hash]
|
257
|
+
# @param table [Google::Cloud::Bigtable::Admin::V2::Table | Hash]
|
312
258
|
# The table to create.
|
313
|
-
# Alternatively, provide a hash in the form of `Google::Bigtable::Admin::V2::Table`.
|
314
|
-
# @param initial_splits [Array<Google::Bigtable::Admin::V2::CreateTableRequest::Split | Hash>]
|
259
|
+
# Alternatively, provide a hash in the form of `Google::Cloud::Bigtable::Admin::V2::Table`.
|
260
|
+
# @param initial_splits [Array<Google::Cloud::Bigtable::Admin::V2::CreateTableRequest::Split | Hash>]
|
315
261
|
# The optional list of row keys that will be used to initially split the
|
316
262
|
# table into several tablets (tablets are similar to HBase regions).
|
317
263
|
# Given two split keys, +s1+ and +s2+, three tablets will be created,
|
@@ -329,15 +275,20 @@ module Google
|
|
329
275
|
# * Tablet 4 +[customer_2, other) => {"customer_2"}.+
|
330
276
|
# * Tablet 5 +[other, ) => {"other", "zz"}.+
|
331
277
|
# Alternatively, provide a hash in the form of
|
332
|
-
# `Google::Bigtable::Admin::V2::CreateTableRequest::Split`
|
333
|
-
# @return [Google::Bigtable::Admin::V2::Table]
|
278
|
+
# `Google::Cloud::Bigtable::Admin::V2::CreateTableRequest::Split`
|
279
|
+
# @return [Google::Cloud::Bigtable::Admin::V2::Table]
|
334
280
|
#
|
335
281
|
def create_table instance_id, table_id, table, initial_splits: nil
|
336
282
|
initial_splits = initial_splits.map { |key| { key: key } } if initial_splits
|
337
283
|
|
338
|
-
|
339
|
-
|
340
|
-
|
284
|
+
tables.create_table(
|
285
|
+
{
|
286
|
+
parent: instance_path(instance_id),
|
287
|
+
table_id: table_id,
|
288
|
+
table: table,
|
289
|
+
initial_splits: initial_splits
|
290
|
+
}.delete_if { |_, v| v.nil? }
|
291
|
+
)
|
341
292
|
end
|
342
293
|
|
343
294
|
##
|
@@ -345,18 +296,16 @@ module Google
|
|
345
296
|
#
|
346
297
|
# @param instance_id [String]
|
347
298
|
# Unique ID of the instance for which tables should be listed.
|
348
|
-
# @param view [Google::Bigtable::Admin::V2::Table::View]
|
299
|
+
# @param view [Google::Cloud::Bigtable::Admin::V2::Table::View]
|
349
300
|
# View to be applied to the returned tables' fields.
|
350
301
|
# Defaults to +NAME_ONLY+ if unspecified; no others are currently supported.
|
351
|
-
# @return [
|
352
|
-
# An enumerable of Google::Bigtable::Admin::V2::Table instances.
|
353
|
-
# See
|
302
|
+
# @return [Gapic::PagedEnumerable<Google::Cloud::Bigtable::Admin::V2::Table>]
|
303
|
+
# An enumerable of Google::Cloud::Bigtable::Admin::V2::Table instances.
|
304
|
+
# See Gapic::PagedEnumerable documentation for other
|
354
305
|
# operations such as per-page iteration or access to the response.
|
355
306
|
#
|
356
307
|
def list_tables instance_id, view: nil
|
357
|
-
|
358
|
-
tables.list_tables instance_path(instance_id), view: view
|
359
|
-
end
|
308
|
+
tables.list_tables parent: instance_path(instance_id), view: view
|
360
309
|
end
|
361
310
|
|
362
311
|
##
|
@@ -366,15 +315,13 @@ module Google
|
|
366
315
|
# Unique ID of the instance the table is in.
|
367
316
|
# @param table_id [String]
|
368
317
|
# Unique ID of the requested table.
|
369
|
-
# @param view [Google::Bigtable::Admin::V2::Table::View]
|
318
|
+
# @param view [Google::Cloud::Bigtable::Admin::V2::Table::View]
|
370
319
|
# View to be applied to the returned table's fields.
|
371
320
|
# Defaults to +SCHEMA_VIEW+ if unspecified.
|
372
|
-
# @return [Google::Bigtable::Admin::V2::Table]
|
321
|
+
# @return [Google::Cloud::Bigtable::Admin::V2::Table]
|
373
322
|
#
|
374
323
|
def get_table instance_id, table_id, view: nil
|
375
|
-
|
376
|
-
tables.get_table table_path(instance_id, table_id), view: view
|
377
|
-
end
|
324
|
+
tables.get_table name: table_path(instance_id, table_id), view: view
|
378
325
|
end
|
379
326
|
|
380
327
|
##
|
@@ -386,9 +333,7 @@ module Google
|
|
386
333
|
# Unique ID of the table to be deleted.
|
387
334
|
#
|
388
335
|
def delete_table instance_id, table_id
|
389
|
-
|
390
|
-
tables.delete_table table_path(instance_id, table_id)
|
391
|
-
end
|
336
|
+
tables.delete_table name: table_path(instance_id, table_id)
|
392
337
|
end
|
393
338
|
|
394
339
|
##
|
@@ -401,19 +346,18 @@ module Google
|
|
401
346
|
# Unique ID of the instance the table is in.
|
402
347
|
# @param table_id [String]
|
403
348
|
# Unique ID of the table whose families should be modified.
|
404
|
-
# @param modifications
|
349
|
+
# @param modifications
|
350
|
+
# [Array<Google::Cloud::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification | Hash>]
|
405
351
|
# Modifications to be atomically applied to the specified table's families.
|
406
352
|
# Entries are applied in order, meaning that earlier modifications can be
|
407
353
|
# masked by later ones (in the case of repeated updates to the same family,
|
408
354
|
# for example).
|
409
355
|
# Alternatively, provide a hash in the form of
|
410
|
-
# `Google::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification`.
|
411
|
-
# @return [Google::Bigtable::Admin::V2::Table]
|
356
|
+
# `Google::Cloud::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification`.
|
357
|
+
# @return [Google::Cloud::Bigtable::Admin::V2::Table]
|
412
358
|
#
|
413
359
|
def modify_column_families instance_id, table_id, modifications
|
414
|
-
|
415
|
-
tables.modify_column_families table_path(instance_id, table_id), modifications
|
416
|
-
end
|
360
|
+
tables.modify_column_families name: table_path(instance_id, table_id), modifications: modifications
|
417
361
|
end
|
418
362
|
|
419
363
|
##
|
@@ -426,12 +370,10 @@ module Google
|
|
426
370
|
# Unique ID of the instance the table is in.
|
427
371
|
# @param table_id [String]
|
428
372
|
# Unique ID of the table the consistency token is for.
|
429
|
-
# @return [Google::Bigtable::Admin::V2::GenerateConsistencyTokenResponse]
|
373
|
+
# @return [Google::Cloud::Bigtable::Admin::V2::GenerateConsistencyTokenResponse]
|
430
374
|
#
|
431
375
|
def generate_consistency_token instance_id, table_id
|
432
|
-
|
433
|
-
tables.generate_consistency_token table_path(instance_id, table_id)
|
434
|
-
end
|
376
|
+
tables.generate_consistency_token name: table_path(instance_id, table_id)
|
435
377
|
end
|
436
378
|
|
437
379
|
##
|
@@ -445,12 +387,10 @@ module Google
|
|
445
387
|
# Unique ID of the table to check for replication consistency.
|
446
388
|
# @param token [String] Consistency token
|
447
389
|
# The token created for the table using GenerateConsistencyToken.
|
448
|
-
# @return [Google::Bigtable::Admin::V2::CheckConsistencyResponse]
|
390
|
+
# @return [Google::Cloud::Bigtable::Admin::V2::CheckConsistencyResponse]
|
449
391
|
#
|
450
392
|
def check_consistency instance_id, table_id, token
|
451
|
-
|
452
|
-
tables.check_consistency table_path(instance_id, table_id), token
|
453
|
-
end
|
393
|
+
tables.check_consistency name: table_path(instance_id, table_id), consistency_token: token
|
454
394
|
end
|
455
395
|
|
456
396
|
##
|
@@ -467,8 +407,7 @@ module Google
|
|
467
407
|
# Prefix cannot be zero length.
|
468
408
|
# @param delete_all_data_from_table [true, false]
|
469
409
|
# If true, delete all rows in the table. Setting this to false is a no-op.
|
470
|
-
# @param timeout [Integer]
|
471
|
-
# Sets the API call timeout if deadline exceeds exception.
|
410
|
+
# @param timeout [Integer] Seconds. Sets the API call timeout if deadline exceeds exception.
|
472
411
|
#
|
473
412
|
def drop_row_range instance_id, table_id, row_key_prefix: nil, delete_all_data_from_table: nil, timeout: nil
|
474
413
|
call_options = nil
|
@@ -476,21 +415,18 @@ module Google
|
|
476
415
|
# Pass a timeout with a larger value if the drop operation throws
|
477
416
|
# an error for timeout time.
|
478
417
|
if timeout
|
479
|
-
|
480
|
-
|
481
|
-
Google::Gax::BackoffSettings.new(0, 0, 0, timeout * 1000, 0, 0, 0)
|
482
|
-
)
|
483
|
-
call_options = Google::Gax::CallOptions.new retry_options: retry_options
|
418
|
+
retry_policy = Gapic::CallOptions::RetryPolicy.new max_delay: timeout * 1000
|
419
|
+
call_options = Gapic::CallOptions.new retry_policy: retry_policy
|
484
420
|
end
|
485
421
|
|
486
|
-
|
487
|
-
|
488
|
-
table_path(instance_id, table_id),
|
422
|
+
tables.drop_row_range(
|
423
|
+
{
|
424
|
+
name: table_path(instance_id, table_id),
|
489
425
|
row_key_prefix: row_key_prefix,
|
490
|
-
delete_all_data_from_table: delete_all_data_from_table
|
491
|
-
|
492
|
-
|
493
|
-
|
426
|
+
delete_all_data_from_table: delete_all_data_from_table
|
427
|
+
},
|
428
|
+
call_options
|
429
|
+
)
|
494
430
|
end
|
495
431
|
|
496
432
|
##
|
@@ -501,22 +437,18 @@ module Google
|
|
501
437
|
# @param app_profile_id [String]
|
502
438
|
# The permanent identifier for the new app profile within its
|
503
439
|
# instance.
|
504
|
-
# @param app_profile [Google::Bigtable::Admin::V2::AppProfile | Hash]
|
440
|
+
# @param app_profile [Google::Cloud::Bigtable::Admin::V2::AppProfile | Hash]
|
505
441
|
# The app profile to be created.
|
506
|
-
# Alternatively, provide a hash in the form of `Google::Bigtable::Admin::V2::AppProfile`.
|
442
|
+
# Alternatively, provide a hash in the form of `Google::Cloud::Bigtable::Admin::V2::AppProfile`.
|
507
443
|
# @param ignore_warnings [Boolean]
|
508
444
|
# If true, ignore safety checks when creating the app profile.
|
509
|
-
# @return [Google::Bigtable::Admin::V2::AppProfile]
|
445
|
+
# @return [Google::Cloud::Bigtable::Admin::V2::AppProfile]
|
510
446
|
#
|
511
447
|
def create_app_profile instance_id, app_profile_id, app_profile, ignore_warnings: nil
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
app_profile,
|
517
|
-
ignore_warnings: ignore_warnings
|
518
|
-
)
|
519
|
-
end
|
448
|
+
instances.create_app_profile parent: instance_path(instance_id),
|
449
|
+
app_profile_id: app_profile_id,
|
450
|
+
app_profile: app_profile,
|
451
|
+
ignore_warnings: ignore_warnings
|
520
452
|
end
|
521
453
|
|
522
454
|
##
|
@@ -526,12 +458,10 @@ module Google
|
|
526
458
|
# Unique ID of the instance.
|
527
459
|
# @param app_profile_id [String]
|
528
460
|
# Unique ID of the requested app profile.
|
529
|
-
# @return [Google::Bigtable::Admin::V2::AppProfile]
|
461
|
+
# @return [Google::Cloud::Bigtable::Admin::V2::AppProfile]
|
530
462
|
#
|
531
463
|
def get_app_profile instance_id, app_profile_id
|
532
|
-
|
533
|
-
instances.get_app_profile app_profile_path(instance_id, app_profile_id)
|
534
|
-
end
|
464
|
+
instances.get_app_profile name: app_profile_path(instance_id, app_profile_id)
|
535
465
|
end
|
536
466
|
|
537
467
|
##
|
@@ -539,25 +469,23 @@ module Google
|
|
539
469
|
#
|
540
470
|
# @param instance_id [String]
|
541
471
|
# Unique ID of the instance
|
542
|
-
# @return [
|
543
|
-
# An enumerable of Google::Bigtable::Admin::V2::AppProfile instances.
|
544
|
-
# See
|
472
|
+
# @return [Gapic::PagedEnumerable<Google::Cloud::Bigtable::Admin::V2::AppProfile>]
|
473
|
+
# An enumerable of Google::Cloud::Bigtable::Admin::V2::AppProfile instances.
|
474
|
+
# See Gapic::PagedEnumerable documentation for other
|
545
475
|
# operations such as per-page iteration or access to the response
|
546
476
|
# object.
|
547
477
|
#
|
548
478
|
def list_app_profiles instance_id
|
549
|
-
|
550
|
-
instances.list_app_profiles instance_path(instance_id)
|
551
|
-
end
|
479
|
+
instances.list_app_profiles parent: instance_path(instance_id)
|
552
480
|
end
|
553
481
|
|
554
482
|
##
|
555
483
|
# Updates an app profile within an instance.
|
556
484
|
#
|
557
|
-
# @param app_profile [Google::Bigtable::Admin::V2::AppProfile | Hash]
|
485
|
+
# @param app_profile [Google::Cloud::Bigtable::Admin::V2::AppProfile | Hash]
|
558
486
|
# The app profile that will (partially) replace the current value.
|
559
487
|
# Alternatively, provide a hash in the form of
|
560
|
-
# `Google::Bigtable::Admin::V2::AppProfile`.
|
488
|
+
# `Google::Cloud::Bigtable::Admin::V2::AppProfile`.
|
561
489
|
# @param update_mask [Google::Protobuf::FieldMask | Hash]
|
562
490
|
# The subset of app profile fields that should be replaced.
|
563
491
|
# If unset, all fields will be replaced.
|
@@ -567,9 +495,9 @@ module Google
|
|
567
495
|
# @return [Google::Longrunning::Operation]
|
568
496
|
#
|
569
497
|
def update_app_profile app_profile, update_mask, ignore_warnings: nil
|
570
|
-
|
571
|
-
|
572
|
-
|
498
|
+
instances.update_app_profile app_profile: app_profile,
|
499
|
+
update_mask: update_mask,
|
500
|
+
ignore_warnings: ignore_warnings
|
573
501
|
end
|
574
502
|
|
575
503
|
##
|
@@ -583,9 +511,49 @@ module Google
|
|
583
511
|
# If true, ignore safety checks when deleting the app profile.
|
584
512
|
#
|
585
513
|
def delete_app_profile instance_id, app_profile_id, ignore_warnings: nil
|
586
|
-
|
587
|
-
|
588
|
-
|
514
|
+
instances.delete_app_profile name: app_profile_path(instance_id, app_profile_id),
|
515
|
+
ignore_warnings: ignore_warnings
|
516
|
+
end
|
517
|
+
|
518
|
+
##
|
519
|
+
# Gets the access control policy for an backup resource. Returns an empty
|
520
|
+
# policy if an backup exists but does not have a policy set.
|
521
|
+
#
|
522
|
+
# @return [Google::Iam::V1::Policy]
|
523
|
+
#
|
524
|
+
def get_backup_policy instance_id, cluster_id, backup_id
|
525
|
+
tables.get_iam_policy resource: backup_path(instance_id, cluster_id, backup_id)
|
526
|
+
end
|
527
|
+
|
528
|
+
##
|
529
|
+
# Sets the access control policy on an backup resource. Replaces any
|
530
|
+
# existing policy.
|
531
|
+
#
|
532
|
+
# @param policy [Google::Iam::V1::Policy | Hash]
|
533
|
+
# REQUIRED: The complete policy to be applied to the +resource+. The size of
|
534
|
+
# the policy is limited to a few 10s of KB. An empty policy is valid
|
535
|
+
# for Cloud Bigtable, but certain Cloud Platform services (such as Projects)
|
536
|
+
# might reject an empty policy.
|
537
|
+
# Alternatively, provide a hash similar to `Google::Iam::V1::Policy`.
|
538
|
+
# @return [Google::Iam::V1::Policy]
|
539
|
+
#
|
540
|
+
def set_backup_policy instance_id, cluster_id, backup_id, policy
|
541
|
+
tables.set_iam_policy resource: backup_path(instance_id, cluster_id, backup_id), policy: policy
|
542
|
+
end
|
543
|
+
|
544
|
+
##
|
545
|
+
# Returns permissions that the caller has for the specified backup resource.
|
546
|
+
#
|
547
|
+
# @param permissions [Array<String>]
|
548
|
+
# The set of permissions to check for the +resource+. Permissions with
|
549
|
+
# wildcards (such as '*' or 'storage.*') are not allowed. For more
|
550
|
+
# information see
|
551
|
+
# [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
|
552
|
+
# @return [Google::Iam::V1::TestIamPermissionsResponse]
|
553
|
+
#
|
554
|
+
def test_backup_permissions instance_id, cluster_id, backup_id, permissions
|
555
|
+
tables.test_iam_permissions resource: backup_path(instance_id, cluster_id, backup_id),
|
556
|
+
permissions: permissions
|
589
557
|
end
|
590
558
|
|
591
559
|
##
|
@@ -597,9 +565,7 @@ module Google
|
|
597
565
|
# @return [Google::Iam::V1::Policy]
|
598
566
|
#
|
599
567
|
def get_instance_policy instance_id
|
600
|
-
|
601
|
-
instances.get_iam_policy instance_path(instance_id)
|
602
|
-
end
|
568
|
+
instances.get_iam_policy resource: instance_path(instance_id)
|
603
569
|
end
|
604
570
|
|
605
571
|
##
|
@@ -617,9 +583,7 @@ module Google
|
|
617
583
|
# @return [Google::Iam::V1::Policy]
|
618
584
|
#
|
619
585
|
def set_instance_policy instance_id, policy
|
620
|
-
|
621
|
-
instances.set_iam_policy instance_path(instance_id), policy
|
622
|
-
end
|
586
|
+
instances.set_iam_policy resource: instance_path(instance_id), policy: policy
|
623
587
|
end
|
624
588
|
|
625
589
|
##
|
@@ -635,9 +599,7 @@ module Google
|
|
635
599
|
# @return [Google::Iam::V1::TestIamPermissionsResponse]
|
636
600
|
#
|
637
601
|
def test_instance_permissions instance_id, permissions
|
638
|
-
|
639
|
-
instances.test_iam_permissions instance_path(instance_id), permissions
|
640
|
-
end
|
602
|
+
instances.test_iam_permissions resource: instance_path(instance_id), permissions: permissions
|
641
603
|
end
|
642
604
|
|
643
605
|
##
|
@@ -649,9 +611,7 @@ module Google
|
|
649
611
|
# @return [Google::Iam::V1::Policy]
|
650
612
|
#
|
651
613
|
def get_table_policy instance_id, table_id
|
652
|
-
|
653
|
-
tables.get_iam_policy table_path(instance_id, table_id)
|
654
|
-
end
|
614
|
+
tables.get_iam_policy resource: table_path(instance_id, table_id)
|
655
615
|
end
|
656
616
|
|
657
617
|
##
|
@@ -669,9 +629,7 @@ module Google
|
|
669
629
|
# @return [Google::Iam::V1::Policy]
|
670
630
|
#
|
671
631
|
def set_table_policy instance_id, table_id, policy
|
672
|
-
|
673
|
-
tables.set_iam_policy table_path(instance_id, table_id), policy
|
674
|
-
end
|
632
|
+
tables.set_iam_policy resource: table_path(instance_id, table_id), policy: policy
|
675
633
|
end
|
676
634
|
|
677
635
|
##
|
@@ -687,14 +645,11 @@ module Google
|
|
687
645
|
# @return [Google::Iam::V1::TestIamPermissionsResponse]
|
688
646
|
#
|
689
647
|
def test_table_permissions instance_id, table_id, permissions
|
690
|
-
|
691
|
-
tables.test_iam_permissions table_path(instance_id, table_id), permissions
|
692
|
-
end
|
648
|
+
tables.test_iam_permissions resource: table_path(instance_id, table_id), permissions: permissions
|
693
649
|
end
|
694
650
|
|
695
651
|
def read_rows instance_id, table_id, app_profile_id: nil, rows: nil, filter: nil, rows_limit: nil
|
696
|
-
|
697
|
-
client.read_rows table_path(instance_id, table_id),
|
652
|
+
client.read_rows table_name: table_path(instance_id, table_id),
|
698
653
|
rows: rows,
|
699
654
|
filter: filter,
|
700
655
|
rows_limit: rows_limit,
|
@@ -702,49 +657,114 @@ module Google
|
|
702
657
|
end
|
703
658
|
|
704
659
|
def sample_row_keys table_name, app_profile_id: nil
|
705
|
-
|
706
|
-
client.sample_row_keys table_name, app_profile_id: app_profile_id
|
707
|
-
end
|
660
|
+
client.sample_row_keys table_name: table_name, app_profile_id: app_profile_id
|
708
661
|
end
|
709
662
|
|
710
663
|
def mutate_row table_name, row_key, mutations, app_profile_id: nil
|
711
|
-
|
712
|
-
|
713
|
-
|
664
|
+
client.mutate_row(
|
665
|
+
{
|
666
|
+
table_name: table_name,
|
667
|
+
app_profile_id: app_profile_id,
|
668
|
+
row_key: row_key,
|
669
|
+
mutations: mutations
|
670
|
+
}.delete_if { |_, v| v.nil? }
|
671
|
+
)
|
714
672
|
end
|
715
673
|
|
716
674
|
def mutate_rows table_name, entries, app_profile_id: nil
|
717
|
-
|
718
|
-
|
719
|
-
|
675
|
+
client.mutate_rows(
|
676
|
+
{
|
677
|
+
table_name: table_name,
|
678
|
+
app_profile_id: app_profile_id,
|
679
|
+
entries: entries
|
680
|
+
}.delete_if { |_, v| v.nil? }
|
681
|
+
)
|
720
682
|
end
|
721
683
|
|
722
|
-
def check_and_mutate_row table_name,
|
684
|
+
def check_and_mutate_row table_name,
|
685
|
+
row_key,
|
686
|
+
app_profile_id: nil,
|
687
|
+
predicate_filter: nil,
|
688
|
+
true_mutations: nil,
|
723
689
|
false_mutations: nil
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
690
|
+
client.check_and_mutate_row(
|
691
|
+
{
|
692
|
+
table_name: table_name,
|
693
|
+
app_profile_id: app_profile_id,
|
694
|
+
row_key: row_key,
|
695
|
+
predicate_filter: predicate_filter,
|
696
|
+
true_mutations: true_mutations,
|
697
|
+
false_mutations: false_mutations
|
698
|
+
}.delete_if { |_, v| v.nil? }
|
699
|
+
)
|
729
700
|
end
|
730
701
|
|
731
702
|
def read_modify_write_row table_name, row_key, rules, app_profile_id: nil
|
732
|
-
|
733
|
-
|
734
|
-
|
703
|
+
client.read_modify_write_row(
|
704
|
+
{
|
705
|
+
table_name: table_name,
|
706
|
+
app_profile_id: app_profile_id,
|
707
|
+
row_key: row_key,
|
708
|
+
rules: rules
|
709
|
+
}.delete_if { |_, v| v.nil? }
|
710
|
+
)
|
735
711
|
end
|
736
712
|
|
737
713
|
##
|
738
|
-
#
|
714
|
+
# Starts creating a new backup. The underlying Google::Longrunning::Operation tracks creation of the backup.
|
739
715
|
#
|
740
|
-
# @
|
716
|
+
# @return [Gapic::Operation]
|
717
|
+
#
|
718
|
+
def create_backup instance_id:, cluster_id:, backup_id:, source_table_id:, expire_time:
|
719
|
+
backup = Google::Cloud::Bigtable::Admin::V2::Backup.new \
|
720
|
+
source_table: table_path(instance_id, source_table_id), expire_time: expire_time
|
721
|
+
tables.create_backup parent: cluster_path(instance_id, cluster_id), backup_id: backup_id, backup: backup
|
722
|
+
end
|
723
|
+
|
724
|
+
##
|
725
|
+
# @return [Google::Cloud::Bigtable::Admin::V2::Backup]
|
741
726
|
#
|
742
|
-
def
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
727
|
+
def get_backup instance_id, cluster_id, backup_id
|
728
|
+
tables.get_backup name: backup_path(instance_id, cluster_id, backup_id)
|
729
|
+
end
|
730
|
+
|
731
|
+
##
|
732
|
+
# @return [Gapic::PagedEnumerable<Google::Cloud::Bigtable::Admin::V2::Backup>]
|
733
|
+
#
|
734
|
+
def list_backups instance_id, cluster_id
|
735
|
+
tables.list_backups parent: cluster_path(instance_id, cluster_id)
|
736
|
+
end
|
737
|
+
|
738
|
+
##
|
739
|
+
# @param backup [Google::Cloud::Bigtable::Admin::V2::Backup | Hash]
|
740
|
+
# @param fields [Array(String|Symbol)] the paths of fields to be updated
|
741
|
+
#
|
742
|
+
def update_backup backup, fields
|
743
|
+
mask = Google::Protobuf::FieldMask.new paths: fields.map(&:to_s)
|
744
|
+
tables.update_backup backup: backup, update_mask: mask
|
745
|
+
end
|
746
|
+
|
747
|
+
def delete_backup instance_id, cluster_id, backup_id
|
748
|
+
tables.delete_backup name: backup_path(instance_id, cluster_id, backup_id)
|
749
|
+
end
|
750
|
+
|
751
|
+
##
|
752
|
+
# Create a new table by restoring from a completed backup.
|
753
|
+
#
|
754
|
+
# @param table_id [String] The table ID for the new table. This table must not yet exist.
|
755
|
+
# @param instance_id [String] The instance ID for the source backup. The table will be created in this instance.
|
756
|
+
# @param cluster_id [String] The cluster ID for the source backup.
|
757
|
+
# @param backup_id [String] The backup ID for the source backup.
|
758
|
+
#
|
759
|
+
# @return [Gapic::Operation] The {Google::Longrunning::Operation#metadata metadata} field type is
|
760
|
+
# {Google::Cloud::Bigtable::Admin::RestoreTableMetadata RestoreTableMetadata}. The
|
761
|
+
# {Google::Longrunning::Operation#response response} type is
|
762
|
+
# {Google::Cloud::Bigtable::Admin::V2::Table Table}, if successful.
|
763
|
+
#
|
764
|
+
def restore_table table_id, instance_id, cluster_id, backup_id
|
765
|
+
tables.restore_table parent: instance_path(instance_id),
|
766
|
+
table_id: table_id,
|
767
|
+
backup: backup_path(instance_id, cluster_id, backup_id)
|
748
768
|
end
|
749
769
|
|
750
770
|
##
|
@@ -755,7 +775,7 @@ module Google
|
|
755
775
|
# +projects/<project>+
|
756
776
|
#
|
757
777
|
def project_path
|
758
|
-
Admin::V2::
|
778
|
+
Admin::V2::BigtableInstanceAdmin::Paths.project_path project: project_id
|
759
779
|
end
|
760
780
|
|
761
781
|
##
|
@@ -767,7 +787,7 @@ module Google
|
|
767
787
|
# +projects/<project>/instances/[a-z][a-z0-9\\-]+[a-z0-9]+.
|
768
788
|
#
|
769
789
|
def instance_path instance_id
|
770
|
-
Admin::V2::
|
790
|
+
Admin::V2::BigtableInstanceAdmin::Paths.instance_path project: project_id, instance: instance_id
|
771
791
|
end
|
772
792
|
|
773
793
|
##
|
@@ -780,7 +800,9 @@ module Google
|
|
780
800
|
# +projects/<project>/instances/<instance>/clusters/<cluster>+.
|
781
801
|
#
|
782
802
|
def cluster_path instance_id, cluster_id
|
783
|
-
Admin::V2::
|
803
|
+
Admin::V2::BigtableInstanceAdmin::Paths.cluster_path project: project_id,
|
804
|
+
instance: instance_id,
|
805
|
+
cluster: cluster_id
|
784
806
|
end
|
785
807
|
|
786
808
|
##
|
@@ -793,7 +815,7 @@ module Google
|
|
793
815
|
# +projects/<project_id>/locations/<location>+.
|
794
816
|
#
|
795
817
|
def location_path location
|
796
|
-
Admin::V2::
|
818
|
+
Admin::V2::BigtableInstanceAdmin::Paths.location_path project: project_id, location: location
|
797
819
|
end
|
798
820
|
|
799
821
|
##
|
@@ -805,7 +827,7 @@ module Google
|
|
805
827
|
# +projects/<project>/instances/<instance>/tables/<table>+
|
806
828
|
#
|
807
829
|
def table_path instance_id, table_id
|
808
|
-
Admin::V2::
|
830
|
+
Admin::V2::BigtableTableAdmin::Paths.table_path project: project_id, instance: instance_id, table: table_id
|
809
831
|
end
|
810
832
|
|
811
833
|
##
|
@@ -818,7 +840,22 @@ module Google
|
|
818
840
|
# +projects/<project>/instances/<instance>/appProfiles/<app_profile>+
|
819
841
|
#
|
820
842
|
def app_profile_path instance_id, app_profile_id
|
821
|
-
Admin::V2::
|
843
|
+
Admin::V2::BigtableInstanceAdmin::Paths.app_profile_path project: project_id,
|
844
|
+
instance: instance_id,
|
845
|
+
app_profile: app_profile_id
|
846
|
+
end
|
847
|
+
|
848
|
+
##
|
849
|
+
# Creates a formatted backup path.
|
850
|
+
#
|
851
|
+
# @return [String] Formatted backup path
|
852
|
+
# `projects/<project>/instances/<instance>/clusters/<cluster>/backups/<backup>`
|
853
|
+
#
|
854
|
+
def backup_path instance_id, cluster_id, backup_id
|
855
|
+
Admin::V2::BigtableTableAdmin::Paths.backup_path project: project_id,
|
856
|
+
instance: instance_id,
|
857
|
+
cluster: cluster_id,
|
858
|
+
backup: backup_id
|
822
859
|
end
|
823
860
|
|
824
861
|
##
|