google-cloud-bigtable 1.0.1 → 1.2.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +31 -0
- data/TROUBLESHOOTING.md +2 -8
- data/lib/google/bigtable/admin/v2/bigtable_instance_admin_pb.rb +3 -0
- data/lib/google/bigtable/admin/v2/bigtable_instance_admin_services_pb.rb +6 -3
- data/lib/google/bigtable/admin/v2/bigtable_table_admin_pb.rb +67 -0
- data/lib/google/bigtable/admin/v2/bigtable_table_admin_services_pb.rb +33 -6
- data/lib/google/bigtable/admin/v2/common_pb.rb +6 -1
- data/lib/google/bigtable/admin/v2/instance_pb.rb +2 -1
- data/lib/google/bigtable/admin/v2/table_pb.rb +39 -1
- data/lib/google/cloud/bigtable/admin.rb +4 -4
- data/lib/google/cloud/bigtable/admin/v2.rb +5 -4
- data/lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb +61 -51
- data/lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client_config.json +1 -1
- data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb +548 -59
- data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client_config.json +31 -1
- data/lib/google/cloud/bigtable/admin/v2/credentials.rb +1 -1
- data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/bigtable_instance_admin.rb +47 -40
- data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/bigtable_table_admin.rb +282 -54
- data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/instance.rb +16 -18
- data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/table.rb +120 -27
- data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/iam_policy.rb +1 -1
- data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/options.rb +1 -1
- data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/policy.rb +1 -1
- data/lib/google/cloud/bigtable/admin/v2/doc/google/longrunning/operations.rb +2 -2
- data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/any.rb +1 -1
- data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/duration.rb +1 -1
- data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/empty.rb +1 -1
- data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/field_mask.rb +1 -1
- data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/timestamp.rb +1 -1
- data/lib/google/cloud/bigtable/admin/v2/doc/google/rpc/status.rb +7 -55
- data/lib/google/cloud/bigtable/admin/v2/doc/google/type/expr.rb +1 -1
- data/lib/google/cloud/bigtable/instance.rb +4 -7
- data/lib/google/cloud/bigtable/policy.rb +1 -1
- data/lib/google/cloud/bigtable/service.rb +52 -0
- data/lib/google/cloud/bigtable/table.rb +112 -0
- data/lib/google/cloud/bigtable/v2.rb +2 -2
- data/lib/google/cloud/bigtable/v2/bigtable_client.rb +4 -1
- data/lib/google/cloud/bigtable/v2/bigtable_client_config.json +7 -7
- data/lib/google/cloud/bigtable/v2/credentials.rb +1 -1
- data/lib/google/cloud/bigtable/v2/doc/google/bigtable/v2/bigtable.rb +1 -1
- data/lib/google/cloud/bigtable/v2/doc/google/bigtable/v2/data.rb +1 -1
- data/lib/google/cloud/bigtable/v2/doc/google/protobuf/any.rb +1 -1
- data/lib/google/cloud/bigtable/v2/doc/google/protobuf/wrappers.rb +1 -1
- data/lib/google/cloud/bigtable/v2/doc/google/rpc/status.rb +7 -55
- data/lib/google/cloud/bigtable/version.rb +1 -1
- metadata +4 -4
@@ -854,7 +854,7 @@ module Google
|
|
854
854
|
# policy.add("roles/owner", "user:owner@example.com")
|
855
855
|
# updated_policy = instance.update_policy(policy)
|
856
856
|
#
|
857
|
-
# puts
|
857
|
+
# puts updated_policy.roles
|
858
858
|
#
|
859
859
|
def update_policy new_policy
|
860
860
|
ensure_service!
|
@@ -884,7 +884,7 @@ module Google
|
|
884
884
|
# * bigtable.tables.get
|
885
885
|
# * bigtable.tables.list
|
886
886
|
#
|
887
|
-
# @return [Array<
|
887
|
+
# @return [Array<String>] The permissions that are configured for the policy.
|
888
888
|
#
|
889
889
|
# @example
|
890
890
|
# require "google/cloud/bigtable"
|
@@ -902,11 +902,8 @@ module Google
|
|
902
902
|
#
|
903
903
|
def test_iam_permissions *permissions
|
904
904
|
ensure_service!
|
905
|
-
grpc = service.test_instance_permissions
|
906
|
-
|
907
|
-
Array(permissions).flatten
|
908
|
-
)
|
909
|
-
grpc.permissions
|
905
|
+
grpc = service.test_instance_permissions instance_id, permissions.flatten
|
906
|
+
grpc.permissions.to_a
|
910
907
|
end
|
911
908
|
|
912
909
|
# @private
|
@@ -19,7 +19,7 @@ module Google
|
|
19
19
|
##
|
20
20
|
# # Policy
|
21
21
|
#
|
22
|
-
# Represents a Cloud IAM Policy for Bigtable
|
22
|
+
# Represents a Cloud IAM Policy for Bigtable resources.
|
23
23
|
#
|
24
24
|
# A common pattern for updating a resource's metadata, such as its policy,
|
25
25
|
# is to read the current data from the service, update the data locally,
|
@@ -640,6 +640,58 @@ module Google
|
|
640
640
|
end
|
641
641
|
end
|
642
642
|
|
643
|
+
##
|
644
|
+
# Gets the access control policy for an table resource. Returns an empty
|
645
|
+
# policy if an table exists but does not have a policy set.
|
646
|
+
#
|
647
|
+
# @param table_id [String]
|
648
|
+
# Unique ID of the table for which the policy is being requested.
|
649
|
+
# @return [Google::Iam::V1::Policy]
|
650
|
+
#
|
651
|
+
def get_table_policy instance_id, table_id
|
652
|
+
execute do
|
653
|
+
tables.get_iam_policy table_path(instance_id, table_id)
|
654
|
+
end
|
655
|
+
end
|
656
|
+
|
657
|
+
##
|
658
|
+
# Sets the access control policy on an table resource. Replaces any
|
659
|
+
# existing policy.
|
660
|
+
#
|
661
|
+
# @param table_id [String]
|
662
|
+
# Unique ID of the table the policy is for.
|
663
|
+
# @param policy [Google::Iam::V1::Policy | Hash]
|
664
|
+
# REQUIRED: The complete policy to be applied to the +resource+. The size of
|
665
|
+
# the policy is limited to a few 10s of KB. An empty policy is valid
|
666
|
+
# for Cloud Bigtable, but certain Cloud Platform services (such as Projects)
|
667
|
+
# might reject an empty policy.
|
668
|
+
# Alternatively, provide a hash similar to `Google::Iam::V1::Policy`.
|
669
|
+
# @return [Google::Iam::V1::Policy]
|
670
|
+
#
|
671
|
+
def set_table_policy instance_id, table_id, policy
|
672
|
+
execute do
|
673
|
+
tables.set_iam_policy table_path(instance_id, table_id), policy
|
674
|
+
end
|
675
|
+
end
|
676
|
+
|
677
|
+
##
|
678
|
+
# Returns permissions that the caller has for the specified table resource.
|
679
|
+
#
|
680
|
+
# @param table_id [String]
|
681
|
+
# The table ID that the policy detail is being requested for.
|
682
|
+
# @param permissions [Array<String>]
|
683
|
+
# The set of permissions to check for the +resource+. Permissions with
|
684
|
+
# wildcards (such as '*' or 'storage.*') are not allowed. For more
|
685
|
+
# information see
|
686
|
+
# [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
|
687
|
+
# @return [Google::Iam::V1::TestIamPermissionsResponse]
|
688
|
+
#
|
689
|
+
def test_table_permissions instance_id, table_id, permissions
|
690
|
+
execute do
|
691
|
+
tables.test_iam_permissions table_path(instance_id, table_id), permissions
|
692
|
+
end
|
693
|
+
end
|
694
|
+
|
643
695
|
def read_rows instance_id, table_id, app_profile_id: nil, rows: nil, filter: nil, rows_limit: nil
|
644
696
|
# execute is not used because error handling is in ReadOperations#read_rows
|
645
697
|
client.read_rows table_path(instance_id, table_id),
|
@@ -20,6 +20,7 @@ require "google/cloud/bigtable/table/cluster_state"
|
|
20
20
|
require "google/cloud/bigtable/column_family_map"
|
21
21
|
require "google/cloud/bigtable/gc_rule"
|
22
22
|
require "google/cloud/bigtable/mutation_operations"
|
23
|
+
require "google/cloud/bigtable/policy"
|
23
24
|
require "google/cloud/bigtable/read_operations"
|
24
25
|
|
25
26
|
module Google
|
@@ -239,6 +240,117 @@ module Google
|
|
239
240
|
granularity == :MILLIS
|
240
241
|
end
|
241
242
|
|
243
|
+
##
|
244
|
+
# Gets the [Cloud IAM](https://cloud.google.com/iam/) access control
|
245
|
+
# policy for the table.
|
246
|
+
#
|
247
|
+
# @see https://cloud.google.com/bigtable/docs/access-control
|
248
|
+
#
|
249
|
+
# @yield [policy] A block for updating the policy. The latest policy
|
250
|
+
# will be read from the Bigtable service and passed to the block. After
|
251
|
+
# the block completes, the modified policy will be written to the
|
252
|
+
# service.
|
253
|
+
# @yieldparam [Policy] policy the current Cloud IAM Policy for this
|
254
|
+
# table.
|
255
|
+
#
|
256
|
+
# @return [Policy] The current Cloud IAM Policy for the table.
|
257
|
+
#
|
258
|
+
# @example
|
259
|
+
# require "google/cloud/bigtable"
|
260
|
+
#
|
261
|
+
# bigtable = Google::Cloud::Bigtable.new
|
262
|
+
#
|
263
|
+
# table = bigtable.table("my-instance", "my-table", perform_lookup: true)
|
264
|
+
# policy = table.policy
|
265
|
+
#
|
266
|
+
# @example Update the policy by passing a block.
|
267
|
+
# require "google/cloud/bigtable"
|
268
|
+
#
|
269
|
+
# bigtable = Google::Cloud::Bigtable.new
|
270
|
+
#
|
271
|
+
# table = bigtable.table("my-instance", "my-table", perform_lookup: true)
|
272
|
+
#
|
273
|
+
# table.policy do |p|
|
274
|
+
# p.add("roles/owner", "user:owner@example.com")
|
275
|
+
# end # 2 API calls
|
276
|
+
#
|
277
|
+
def policy
|
278
|
+
ensure_service!
|
279
|
+
grpc = service.get_table_policy instance_id, name
|
280
|
+
policy = Policy.from_grpc grpc
|
281
|
+
return policy unless block_given?
|
282
|
+
yield policy
|
283
|
+
update_policy policy
|
284
|
+
end
|
285
|
+
|
286
|
+
##
|
287
|
+
# Updates the [Cloud IAM](https://cloud.google.com/iam/) access control
|
288
|
+
# policy for the table. The policy should be read from {#policy}.
|
289
|
+
# See {Google::Cloud::Bigtable::Policy} for an explanation of the policy
|
290
|
+
# `etag` property and how to modify policies.
|
291
|
+
#
|
292
|
+
# You can also update the policy by passing a block to {#policy}, which
|
293
|
+
# will call this method internally after the block completes.
|
294
|
+
#
|
295
|
+
# @param new_policy [Policy] a new or modified Cloud IAM Policy for this
|
296
|
+
# table
|
297
|
+
#
|
298
|
+
# @return [Policy] The policy returned by the API update operation.
|
299
|
+
#
|
300
|
+
# @example
|
301
|
+
# require "google/cloud/bigtable"
|
302
|
+
#
|
303
|
+
# bigtable = Google::Cloud::Bigtable.new
|
304
|
+
#
|
305
|
+
# table = bigtable.table("my-instance", "my-table", perform_lookup: true)
|
306
|
+
#
|
307
|
+
# policy = table.policy
|
308
|
+
# policy.add("roles/owner", "user:owner@example.com")
|
309
|
+
# updated_policy = table.update_policy(policy)
|
310
|
+
#
|
311
|
+
# puts updated_policy.roles
|
312
|
+
#
|
313
|
+
def update_policy new_policy
|
314
|
+
ensure_service!
|
315
|
+
grpc = service.set_table_policy instance_id, name, new_policy.to_grpc
|
316
|
+
Policy.from_grpc grpc
|
317
|
+
end
|
318
|
+
alias policy= update_policy
|
319
|
+
|
320
|
+
##
|
321
|
+
# Tests the specified permissions against the [Cloud
|
322
|
+
# IAM](https://cloud.google.com/iam/) access control policy.
|
323
|
+
#
|
324
|
+
# @see https://cloud.google.com/iam/docs/managing-policies Managing Policies
|
325
|
+
# @see https://cloud.google.com/bigtable/docs/access-control Access Control
|
326
|
+
#
|
327
|
+
# @param permissions [String, Array<String>] permissions The set of permissions to
|
328
|
+
# check access for. Permissions with wildcards (such as `*` or
|
329
|
+
# `bigtable.*`) are not allowed.
|
330
|
+
# See [Access Control](https://cloud.google.com/bigtable/docs/access-control).
|
331
|
+
#
|
332
|
+
# @return [Array<String>] The permissions that are configured for the policy.
|
333
|
+
#
|
334
|
+
# @example
|
335
|
+
# require "google/cloud/bigtable"
|
336
|
+
#
|
337
|
+
# bigtable = Google::Cloud::Bigtable.new
|
338
|
+
#
|
339
|
+
# table = bigtable.table("my-instance", "my-table", perform_lookup: true)
|
340
|
+
#
|
341
|
+
# permissions = table.test_iam_permissions(
|
342
|
+
# "bigtable.tables.delete",
|
343
|
+
# "bigtable.tables.get"
|
344
|
+
# )
|
345
|
+
# permissions.include? "bigtable.tables.delete" #=> false
|
346
|
+
# permissions.include? "bigtable.tables.get" #=> true
|
347
|
+
#
|
348
|
+
def test_iam_permissions *permissions
|
349
|
+
ensure_service!
|
350
|
+
grpc = service.test_table_permissions instance_id, name, permissions.flatten
|
351
|
+
grpc.permissions.to_a
|
352
|
+
end
|
353
|
+
|
242
354
|
##
|
243
355
|
# Permanently deletes the table from a instance.
|
244
356
|
#
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2020 Google LLC
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -21,7 +21,7 @@ module Google
|
|
21
21
|
# rubocop:disable LineLength
|
22
22
|
|
23
23
|
##
|
24
|
-
# # Ruby Client for Cloud Bigtable API
|
24
|
+
# # Ruby Client for Cloud Bigtable API
|
25
25
|
#
|
26
26
|
# [Cloud Bigtable API][Product Documentation]:
|
27
27
|
# API for reading and writing the contents of Bigtables associated with a
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2020 Google LLC
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -160,6 +160,9 @@ module Google
|
|
160
160
|
google_api_client.freeze
|
161
161
|
|
162
162
|
headers = { :"x-goog-api-client" => google_api_client }
|
163
|
+
if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
|
164
|
+
headers[:"x-goog-user-project"] = credentials.quota_project_id
|
165
|
+
end
|
163
166
|
headers.merge!(metadata) unless metadata.nil?
|
164
167
|
client_config_file = Pathname.new(__dir__).join(
|
165
168
|
"bigtable_client_config.json"
|
@@ -49,22 +49,22 @@
|
|
49
49
|
"methods": {
|
50
50
|
"ReadRows": {
|
51
51
|
"timeout_millis": 43200000,
|
52
|
-
"retry_codes_name": "
|
52
|
+
"retry_codes_name": "non_idempotent",
|
53
53
|
"retry_params_name": "read_rows_params"
|
54
54
|
},
|
55
55
|
"SampleRowKeys": {
|
56
|
-
"timeout_millis":
|
57
|
-
"retry_codes_name": "
|
58
|
-
"retry_params_name": "
|
56
|
+
"timeout_millis": 60000,
|
57
|
+
"retry_codes_name": "non_idempotent",
|
58
|
+
"retry_params_name": "non_idempotent_params"
|
59
59
|
},
|
60
60
|
"MutateRow": {
|
61
|
-
"timeout_millis":
|
61
|
+
"timeout_millis": 60000,
|
62
62
|
"retry_codes_name": "idempotent",
|
63
63
|
"retry_params_name": "idempotent_params"
|
64
64
|
},
|
65
65
|
"MutateRows": {
|
66
|
-
"timeout_millis":
|
67
|
-
"retry_codes_name": "
|
66
|
+
"timeout_millis": 600000,
|
67
|
+
"retry_codes_name": "non_idempotent",
|
68
68
|
"retry_params_name": "mutate_rows_params"
|
69
69
|
},
|
70
70
|
"CheckAndMutateRow": {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2020 Google LLC
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -17,67 +17,19 @@ module Google
|
|
17
17
|
module Rpc
|
18
18
|
# The `Status` type defines a logical error model that is suitable for
|
19
19
|
# different programming environments, including REST APIs and RPC APIs. It is
|
20
|
-
# used by [gRPC](https://github.com/grpc).
|
20
|
+
# used by [gRPC](https://github.com/grpc). Each `Status` message contains
|
21
|
+
# three pieces of data: error code, error message, and error details.
|
21
22
|
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
# = Overview
|
26
|
-
#
|
27
|
-
# The `Status` message contains three pieces of data: error code, error
|
28
|
-
# message, and error details. The error code should be an enum value of
|
29
|
-
# {Google::Rpc::Code}, but it may accept additional error codes
|
30
|
-
# if needed. The error message should be a developer-facing English message
|
31
|
-
# that helps developers *understand* and *resolve* the error. If a localized
|
32
|
-
# user-facing error message is needed, put the localized message in the error
|
33
|
-
# details or localize it in the client. The optional error details may contain
|
34
|
-
# arbitrary information about the error. There is a predefined set of error
|
35
|
-
# detail types in the package `google.rpc` that can be used for common error
|
36
|
-
# conditions.
|
37
|
-
#
|
38
|
-
# = Language mapping
|
39
|
-
#
|
40
|
-
# The `Status` message is the logical representation of the error model, but it
|
41
|
-
# is not necessarily the actual wire format. When the `Status` message is
|
42
|
-
# exposed in different client libraries and different wire protocols, it can be
|
43
|
-
# mapped differently. For example, it will likely be mapped to some exceptions
|
44
|
-
# in Java, but more likely mapped to some error codes in C.
|
45
|
-
#
|
46
|
-
# = Other uses
|
47
|
-
#
|
48
|
-
# The error model and the `Status` message can be used in a variety of
|
49
|
-
# environments, either with or without APIs, to provide a
|
50
|
-
# consistent developer experience across different environments.
|
51
|
-
#
|
52
|
-
# Example uses of this error model include:
|
53
|
-
#
|
54
|
-
# * Partial errors. If a service needs to return partial errors to the client,
|
55
|
-
# it may embed the `Status` in the normal response to indicate the partial
|
56
|
-
# errors.
|
57
|
-
#
|
58
|
-
# * Workflow errors. A typical workflow has multiple steps. Each step may
|
59
|
-
# have a `Status` message for error reporting.
|
60
|
-
#
|
61
|
-
# * Batch operations. If a client uses batch request and batch response, the
|
62
|
-
# `Status` message should be used directly inside batch response, one for
|
63
|
-
# each error sub-response.
|
64
|
-
#
|
65
|
-
# * Asynchronous operations. If an API call embeds asynchronous operation
|
66
|
-
# results in its response, the status of those operations should be
|
67
|
-
# represented directly using the `Status` message.
|
68
|
-
#
|
69
|
-
# * Logging. If some API errors are stored in logs, the message `Status` could
|
70
|
-
# be used directly after any stripping needed for security/privacy reasons.
|
23
|
+
# You can find out more about this error model and how to work with it in the
|
24
|
+
# [API Design Guide](https://cloud.google.com/apis/design/errors).
|
71
25
|
# @!attribute [rw] code
|
72
26
|
# @return [Integer]
|
73
|
-
# The status code, which should be an enum value of
|
74
|
-
# {Google::Rpc::Code}.
|
27
|
+
# The status code, which should be an enum value of {Google::Rpc::Code}.
|
75
28
|
# @!attribute [rw] message
|
76
29
|
# @return [String]
|
77
30
|
# A developer-facing error message, which should be in English. Any
|
78
31
|
# user-facing error message should be localized and sent in the
|
79
|
-
# {Google::Rpc::Status#details} field, or localized
|
80
|
-
# by the client.
|
32
|
+
# {Google::Rpc::Status#details} field, or localized by the client.
|
81
33
|
# @!attribute [rw] details
|
82
34
|
# @return [Array<Google::Protobuf::Any>]
|
83
35
|
# A list of messages that carry the error details. There is a common set of
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-bigtable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Google LLC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-cloud-core
|
@@ -112,14 +112,14 @@ dependencies:
|
|
112
112
|
requirements:
|
113
113
|
- - "~>"
|
114
114
|
- !ruby/object:Gem::Version
|
115
|
-
version: '5.
|
115
|
+
version: '5.14'
|
116
116
|
type: :development
|
117
117
|
prerelease: false
|
118
118
|
version_requirements: !ruby/object:Gem::Requirement
|
119
119
|
requirements:
|
120
120
|
- - "~>"
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
-
version: '5.
|
122
|
+
version: '5.14'
|
123
123
|
- !ruby/object:Gem::Dependency
|
124
124
|
name: minitest-focus
|
125
125
|
requirement: !ruby/object:Gem::Requirement
|