google-cloud-bigtable 2.4.1 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d2ceaa917a67e31cae160f8cfb03ecb1617aebf24c634d89a3f5805589d3f46
4
- data.tar.gz: c2c614ffbd788256c15037c22ff9f7fd09208399a49ee85149e9515e0976f0f9
3
+ metadata.gz: 87e7128a687d06d1e5dc3e74f2b529ab43b3c9ea28717d738c433ea86fb297ad
4
+ data.tar.gz: a04ca13f900445078568a3a1cf64ef84d57686a494f3a652cc6ec461af41712e
5
5
  SHA512:
6
- metadata.gz: 6e019a7ad97017938d2960b52951dda90911d5f84c6d3c95cd09abd0086d35b68f8f4139d5626c92065928eec8493758aa0fb6d6185cf89a149eadde53c54675
7
- data.tar.gz: f3eeec0098bd030dad2a8cd07b08dae4d58d02753ead572d552eaf7543a93776ca48576bb7c37199a7cd181f6f23e98f989778a0f7ee8e9e614522f97fbf23e8
6
+ metadata.gz: dc329bd4e9f0d1ed5c5376c40da2924a41f83681df93803aafcadd9ed846bdd2119b913661054b95cfc70cbbfada891b58563b3146396acd872ae2fa79cbff2b
7
+ data.tar.gz: af466ef435035adae503c5368b0e7c899e84424151044d49efb51f2920e121854ca8af51708c9fce7181e1116410408c635a040442b8b004df45d76b5184c721
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Release History
2
2
 
3
+ ### 2.5.0 / 2021-04-20
4
+
5
+ #### Features
6
+
7
+ * Add CMEK support
8
+ * Add kms_key to ClusterMap#add
9
+ * Add Cluster#kms_key
10
+ * Add EncryptionInfo
11
+ * Add ClusterState#encryption_infos
12
+ * Add ENCRYPTION_VIEW support to Table
13
+ * Update docs in Table::ClusterState
14
+ * Add Backup#encryption_info
15
+
3
16
  ### 2.4.1 / 2021-04-01
4
17
 
5
18
  #### Bug Fixes
data/CONTRIBUTING.md CHANGED
@@ -119,15 +119,14 @@ If you alter an example's title, you may encounter breaking tests.
119
119
  ### Bigtable Acceptance Tests
120
120
 
121
121
  The Bigtable acceptance tests interact with the live service API. Follow the
122
- instructions in the {file:AUTHENTICATION.md Authentication guide} for enabling
122
+ instructions in the {file:AUTHENTICATION.md Authentication Guide} for enabling
123
123
  the Bigtable API. Occasionally, some API features may not yet be generally
124
124
  available, making it difficult for some contributors to successfully run the
125
125
  entire acceptance test suite. However, please ensure that you do successfully
126
126
  run acceptance tests for any code areas covered by your pull request.
127
127
 
128
128
  To run the acceptance tests, first create and configure a project in the Google
129
- Developers Console, as described in the {file:AUTHENTICATION.md Authentication
130
- guide}. Be sure to download the JSON KEY file. Make note of the PROJECT_ID and
129
+ Developers Console, as described in the {file:AUTHENTICATION.md Authentication Guide}. Be sure to download the JSON KEY file. Make note of the PROJECT_ID and
131
130
  the KEYFILE location on your system.
132
131
 
133
132
  Before you can run the Bigtable acceptance tests, you must first create indexes
data/OVERVIEW.md CHANGED
@@ -396,5 +396,5 @@ instance.delete
396
396
  ## Additional information
397
397
 
398
398
  Google Bigtable can be configured to use an emulator or to enable gRPC's
399
- logging. To learn more, see the {file:EMULATOR.md Emulator guide} and
399
+ logging. To learn more, see the {file:EMULATOR.md Emulator guide}} and
400
400
  {file:LOGGING.md Logging guide}.
@@ -18,10 +18,10 @@
18
18
  require "google/cloud/bigtable/backup/job"
19
19
  require "google/cloud/bigtable/backup/list"
20
20
  require "google/cloud/bigtable/convert"
21
+ require "google/cloud/bigtable/encryption_info"
21
22
  require "google/cloud/bigtable/policy"
22
23
  require "google/cloud/bigtable/table/restore_job"
23
24
 
24
-
25
25
  module Google
26
26
  module Cloud
27
27
  module Bigtable
@@ -207,6 +207,27 @@ module Google
207
207
  state == :READY
208
208
  end
209
209
 
210
+ ##
211
+ # The encryption information for the backup. See also {Instance::ClusterMap#add}.
212
+ #
213
+ # @return [Google::Cloud::Bigtable::EncryptionInfo] The encryption information for the backup.
214
+ #
215
+ # @example
216
+ # require "google/cloud/bigtable"
217
+ #
218
+ # bigtable = Google::Cloud::Bigtable.new
219
+ # instance = bigtable.instance("my-instance")
220
+ # cluster = instance.cluster("my-cluster")
221
+ #
222
+ # backup = cluster.backup("my-backup")
223
+ #
224
+ # encryption_info = backup.encryption_info
225
+ # encryption_info.encryption_type #=> :GOOGLE_DEFAULT_ENCRYPTION
226
+ #
227
+ def encryption_info
228
+ EncryptionInfo.from_grpc @grpc.encryption_info
229
+ end
230
+
210
231
  ##
211
232
  # Gets the [Cloud IAM](https://cloud.google.com/iam/) access control
212
233
  # policy for the backup.
@@ -168,8 +168,10 @@ module Google
168
168
  ##
169
169
  # The type of storage used by this cluster to serve its
170
170
  # parent instance's tables, unless explicitly overridden.
171
- # Valid values are `:SSD`(Flash (SSD) storage should be used),
172
- # `:HDD`(Magnetic drive (HDD) storage should be used)
171
+ # Valid values are:
172
+ #
173
+ # * `:SSD` - Flash (SSD) storage should be used.
174
+ # * `:HDD` - Magnetic drive (HDD) storage should be used.
173
175
  #
174
176
  # @return [Symbol]
175
177
  #
@@ -197,6 +199,24 @@ module Google
197
199
  @grpc.location
198
200
  end
199
201
 
202
+ ##
203
+ # The full name of the Cloud KMS encryption key for the cluster, if it is CMEK-protected, in the format
204
+ # `projects/{key_project_id}/locations/{location}/keyRings/{ring_name}/cryptoKeys/{key_name}`.
205
+ #
206
+ # The requirements for this key are:
207
+ #
208
+ # 1. The Cloud Bigtable service account associated with the project that contains this cluster must be granted
209
+ # the `cloudkms.cryptoKeyEncrypterDecrypter` role on the CMEK key.
210
+ # 2. Only regional keys can be used and the region of the CMEK key must match the region of the cluster.
211
+ # 3. All clusters within an instance must use the same CMEK key.
212
+ #
213
+ # @return [String, nil] The full name of the Cloud KMS encryption key, or `nil` if the cluster is not
214
+ # CMEK-protected.
215
+ #
216
+ def kms_key
217
+ @grpc.encryption_config&.kms_key_name
218
+ end
219
+
200
220
  ##
201
221
  # Creates a new Cloud Bigtable Backup.
202
222
  #
@@ -0,0 +1,118 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+
18
+ require "google/cloud/bigtable/status"
19
+
20
+ module Google
21
+ module Cloud
22
+ module Bigtable
23
+ ##
24
+ # # EncryptionInfo
25
+ #
26
+ # Encryption information for a given resource.
27
+ #
28
+ # See {Backup#encryption_info} and {Table::ClusterState#encryption_infos}.
29
+ #
30
+ # @example
31
+ # require "google/cloud/bigtable"
32
+ #
33
+ # bigtable = Google::Cloud::Bigtable.new
34
+ # instance = bigtable.instance("my-instance")
35
+ # cluster = instance.cluster("my-cluster")
36
+ #
37
+ # backup = cluster.backup("my-backup")
38
+ #
39
+ # encryption_info = backup.encryption_info
40
+ # encryption_info.encryption_type #=> :GOOGLE_DEFAULT_ENCRYPTION
41
+ #
42
+ # @example Retrieve a table with cluster states containing encryption info.
43
+ # require "google/cloud/bigtable"
44
+ #
45
+ # bigtable = Google::Cloud::Bigtable.new
46
+ #
47
+ # table = bigtable.table("my-instance", "my-table", view: :ENCRYPTION_VIEW, perform_lookup: true)
48
+ #
49
+ # table.cluster_states.each do |cs|
50
+ # puts cs.cluster_name
51
+ # puts cs.encryption_infos.first.encryption_type
52
+ # end
53
+ #
54
+ class EncryptionInfo
55
+ # @private
56
+ #
57
+ # Creates a new EncryptionInfo instance.
58
+ def initialize grpc
59
+ @grpc = grpc
60
+ end
61
+
62
+ ##
63
+ # The type of encryption used to protect the resource. Possible values:
64
+ #
65
+ # * `ENCRYPTION_TYPE_UNSPECIFIED` - Encryption type was not specified, though data at rest remains encrypted.
66
+ # * `GOOGLE_DEFAULT_ENCRYPTION` - The data backing the resource is encrypted at rest with a key that is
67
+ # fully managed by Google. No key version or status will be populated. This is the default state.
68
+ # * `CUSTOMER_MANAGED_ENCRYPTION` - The data backing the resource is encrypted at rest with a key that is
69
+ # managed by the customer. The in-use version of the key and its status are populated for CMEK-protected
70
+ # tables. CMEK-protected backups are pinned to the key version that was in use at the time the backup was
71
+ # taken. This key version is populated but its status is not tracked and is reported as `UNKNOWN`.
72
+ #
73
+ # See also {#encryption_status}, {#kms_key_version} and {Instance::ClusterMap#add}.
74
+ #
75
+ # @return [Symbol] The encryption type code as an uppercase symbol.
76
+ #
77
+ def encryption_type
78
+ @grpc.encryption_type
79
+ end
80
+
81
+ ##
82
+ # The status of encrypt/decrypt calls on underlying data for the resource. Regardless of status, the existing
83
+ # data is always encrypted at rest.
84
+ #
85
+ # See also {#encryption_type}, {#kms_key_version} and {Instance::ClusterMap#add}.
86
+ #
87
+ # @return [Google::Cloud::Bigtable::Status, nil] The encryption status object, or `nil` if not present.
88
+ #
89
+ def encryption_status
90
+ status_grpc = @grpc.encryption_status
91
+ Status.from_grpc status_grpc if status_grpc
92
+ end
93
+
94
+ ##
95
+ # The version of the Cloud KMS key specified in the parent cluster that is in use for the data underlying the
96
+ # table.
97
+ #
98
+ # See also {#encryption_type}, {#encryption_status} and {Instance::ClusterMap#add}.
99
+ #
100
+ # @return [String, nil] The Cloud KMS key version, or `nil` if not present.
101
+ #
102
+ def kms_key_version
103
+ @grpc.kms_key_version unless @grpc.kms_key_version.empty?
104
+ end
105
+
106
+ # @private
107
+ #
108
+ # Creates a new EncryptionInfo instance from a Google::Cloud::Bigtable::Admin::V2::EncryptionInfo.
109
+ #
110
+ # @param grpc [Google::Cloud::Bigtable::Admin::V2::EncryptionInfo]
111
+ # @return [Google::Cloud::Bigtable::EncryptionInfo]
112
+ def self.from_grpc grpc
113
+ new grpc
114
+ end
115
+ end
116
+ end
117
+ end
118
+ end
@@ -15,28 +15,31 @@
15
15
  # limitations under the License.
16
16
 
17
17
 
18
+ require "google/cloud/bigtable/admin/v2"
19
+
18
20
  module Google
19
21
  module Cloud
20
22
  module Bigtable
21
23
  class Instance
22
24
  ##
23
- # Instance::ClusterMap is a hash with cluster ID keys and cluster configuration values.
24
- # It is used to create a cluster.
25
+ # Instance::ClusterMap is a hash with cluster ID keys and cluster configuration values. It is used to create a
26
+ # cluster.
25
27
  #
26
28
  # @example
29
+ # require "google/cloud/bigtable"
27
30
  #
28
- # clusters = Google::Cloud::Bigtable::Instance::ClusterMap.new
31
+ # bigtable = Google::Cloud::Bigtable.new
29
32
  #
30
- # clusters.add("cluster-1", "us-east1-b", nodes: 3, storage_type: :SSD)
33
+ # job = bigtable.create_instance("my-instance") do |clusters|
34
+ # clusters.add("test-cluster", "us-east1-b", nodes: 3, storage_type: :SSD)
35
+ # end
31
36
  #
32
- # # Or
33
- # clusters.add("cluster-2", "us-east1-b")
37
+ # job.wait_until_done!
34
38
  #
35
39
  class ClusterMap < DelegateClass(::Hash)
36
40
  # @private
37
41
  #
38
- # Creates a new Instance::ClusterMap with an hash of Cluster name and
39
- # cluster grpc instances.
42
+ # Creates a new Instance::ClusterMap with an hash of Cluster name and cluster grpc instances.
40
43
  def initialize value = {}
41
44
  super value
42
45
  end
@@ -45,24 +48,61 @@ module Google
45
48
  # Adds a cluster to the cluster map.
46
49
  #
47
50
  # @param name [String] The unique identifier for the cluster.
48
- # @param location [String]
49
- # The location where this cluster's nodes and storage reside. For best
50
- # performance, clients should be located as close as possible to this
51
- # cluster. Currently only zones are supported.
52
- # @param nodes [Integer] Number of nodes for the cluster. When creating
53
- # an instance of type `:DEVELOPMENT`, `nodes` must not be set.
54
- # @param storage_type [Symbol]
55
- # Valid values are:
56
- # * `:SSD`(Flash (SSD) storage should be used),
57
- # *`:HDD`(Magnetic drive (HDD) storage should be used)
51
+ # @param location [String] The location where this cluster's nodes and storage reside. For best performance,
52
+ # clients should be located as close as possible to this cluster. Currently only zones are supported.
53
+ # @param nodes [Integer] Number of nodes for the cluster. When creating an instance of type `:DEVELOPMENT`,
54
+ # `nodes` must not be set.
55
+ # @param storage_type [Symbol] The type of storage used by this cluster to serve its parent instance's tables,
56
+ # unless explicitly overridden. Valid values are:
57
+ #
58
+ # * `:SSD` - Flash (SSD) storage should be used.
59
+ # * `:HDD` - Magnetic drive (HDD) storage should be used.
60
+ #
61
+ # If not set then default will set to `:STORAGE_TYPE_UNSPECIFIED`.
62
+ # @param kms_key [String] The full name of a Cloud KMS encryption key for a CMEK-protected cluster, in the
63
+ # format `projects/{key_project_id}/locations/{location}/keyRings/{ring_name}/cryptoKeys/{key_name}`.
64
+ #
65
+ # The requirements for this key are:
66
+ #
67
+ # 1. The Cloud Bigtable service account associated with the project that contains this cluster must be
68
+ # granted the `cloudkms.cryptoKeyEncrypterDecrypter` role on the CMEK key.
69
+ # 2. Only regional keys can be used and the region of the CMEK key must match the region of the cluster.
70
+ # 3. All clusters within an instance must use the same CMEK key.
71
+ #
72
+ # @example
73
+ # require "google/cloud/bigtable"
74
+ #
75
+ # bigtable = Google::Cloud::Bigtable.new
76
+ #
77
+ # job = bigtable.create_instance("my-instance") do |clusters|
78
+ # clusters.add("test-cluster", "us-east1-b", nodes: 3, storage_type: :SSD)
79
+ # end
80
+ #
81
+ # job.wait_until_done!
82
+ #
83
+ # @example With a Cloud KMS encryption key name for a CMEK-protected cluster:
84
+ # require "google/cloud/bigtable"
85
+ #
86
+ # bigtable = Google::Cloud::Bigtable.new
87
+ #
88
+ # kms_key_name = "projects/a/locations/b/keyRings/c/cryptoKeys/d"
89
+ # job = bigtable.create_instance("my-instance") do |clusters|
90
+ # clusters.add("test-cluster", "us-east1-b", kms_key: kms_key_name)
91
+ # end
58
92
  #
59
- # If not set then default will set to `:STORAGE_TYPE_UNSPECIFIED`
93
+ # job.wait_until_done!
60
94
  #
61
- def add name, location, nodes: nil, storage_type: nil
95
+ def add name, location, nodes: nil, storage_type: nil, kms_key: nil
96
+ if kms_key
97
+ encryption_config = Google::Cloud::Bigtable::Admin::V2::Cluster::EncryptionConfig.new(
98
+ kms_key_name: kms_key
99
+ )
100
+ end
62
101
  attrs = {
63
102
  serve_nodes: nodes,
64
103
  location: location,
65
- default_storage_type: storage_type
104
+ default_storage_type: storage_type,
105
+ encryption_config: encryption_config
66
106
  }.delete_if { |_, v| v.nil? }
67
107
 
68
108
  self[name] = Google::Cloud::Bigtable::Admin::V2::Cluster.new attrs
@@ -140,19 +140,34 @@ module Google
140
140
  end
141
141
 
142
142
  ##
143
- # Map from cluster ID to per-cluster table state.
143
+ # Returns an array of {Table::ClusterState} objects that map cluster ID
144
+ # to per-cluster table state.
145
+ #
144
146
  # If it could not be determined whether or not the table has data in a
145
147
  # particular cluster (for example, if its zone is unavailable), then
146
- # there will be an entry for the cluster with UNKNOWN `replication_status`.
148
+ # the cluster state's `replication_state` will be `UNKNOWN`.
147
149
  #
148
- # Reloads the table if necessary to retrieve the cluster states data,
149
- # since it is only available in a table with view type `REPLICATION_VIEW`
150
- # or `FULL`. Previously loaded data is retained.
150
+ # Reloads the table with the `FULL` view type to retrieve the cluster states
151
+ # data, unless the table was previously loaded with view type `ENCRYPTION_VIEW`,
152
+ # `REPLICATION_VIEW` or `FULL`.
151
153
  #
152
154
  # @return [Array<Google::Cloud::Bigtable::Table::ClusterState>]
153
155
  #
156
+ # @example Retrieve a table with cluster states.
157
+ # require "google/cloud/bigtable"
158
+ #
159
+ # bigtable = Google::Cloud::Bigtable.new
160
+ #
161
+ # table = bigtable.table("my-instance", "my-table", view: :FULL, perform_lookup: true)
162
+ #
163
+ # table.cluster_states.each do |cs|
164
+ # puts cs.cluster_name
165
+ # puts cs.replication_state
166
+ # puts cs.encryption_infos.first.encryption_type
167
+ # end
168
+ #
154
169
  def cluster_states
155
- check_view_and_load :REPLICATION_VIEW
170
+ check_view_and_load :FULL, skip_if: [:ENCRYPTION_VIEW, :REPLICATION_VIEW]
156
171
  @grpc.cluster_states.map do |name, state_grpc|
157
172
  ClusterState.from_grpc state_grpc, name
158
173
  end
@@ -674,19 +689,24 @@ module Google
674
689
 
675
690
  FIELDS_BY_VIEW = {
676
691
  SCHEMA_VIEW: ["granularity", "column_families"],
692
+ ENCRYPTION_VIEW: ["cluster_states"],
677
693
  REPLICATION_VIEW: ["cluster_states"],
678
694
  FULL: ["granularity", "column_families", "cluster_states"]
679
695
  }.freeze
680
696
 
681
697
  # @private
682
698
  #
683
- # Checks and reloads table with expected view and sets fields.
684
- # @param view [Symbol] Expected view type.
699
+ # Checks and reloads table with expected view. Performs additive updates to fields specified by the given view.
700
+ # @param view [Symbol] The view type to load. If already loaded, no load is performed.
701
+ # @param skip_if [Symbol] Additional satisfying view types. If already loaded, no load is performed.
685
702
  #
686
- def check_view_and_load view
703
+ def check_view_and_load view, skip_if: nil
687
704
  ensure_service!
688
705
 
689
- return if @loaded_views.include?(view) || @loaded_views.include?(:FULL)
706
+ skip = Set.new skip_if
707
+ skip << view
708
+ skip << :FULL
709
+ return if (@loaded_views & skip).any?
690
710
 
691
711
  grpc = service.get_table instance_id, table_id, view: view
692
712
  @loaded_views << view
@@ -694,6 +714,9 @@ module Google
694
714
  FIELDS_BY_VIEW[view].each do |field|
695
715
  case grpc[field]
696
716
  when Google::Protobuf::Map
717
+ # Special handling for column_families:
718
+ # Replace contents of existing Map since setting the new Map won't work.
719
+ # See https://github.com/protocolbuffers/protobuf/issues/4969
697
720
  @grpc[field].clear
698
721
  grpc[field].each { |k, v| @grpc[field][k] = v }
699
722
  else
@@ -15,6 +15,8 @@
15
15
  # limitations under the License.
16
16
 
17
17
 
18
+ require "google/cloud/bigtable/encryption_info"
19
+
18
20
  module Google
19
21
  module Cloud
20
22
  module Bigtable
@@ -23,6 +25,20 @@ module Google
23
25
  # Table::ClusterState is the state of a table's data in a particular cluster.
24
26
  #
25
27
  # @attr [String] cluster_name The name of the cluster.
28
+ #
29
+ # @example Retrieve a table with cluster states.
30
+ # require "google/cloud/bigtable"
31
+ #
32
+ # bigtable = Google::Cloud::Bigtable.new
33
+ #
34
+ # table = bigtable.table("my-instance", "my-table", view: :FULL, perform_lookup: true)
35
+ #
36
+ # table.cluster_states.each do |cs|
37
+ # puts cs.cluster_name
38
+ # puts cs.replication_state
39
+ # puts cs.encryption_infos.first.encryption_type
40
+ # end
41
+ #
26
42
  class ClusterState
27
43
  attr_reader :cluster_name
28
44
 
@@ -36,7 +52,7 @@ module Google
36
52
 
37
53
  ##
38
54
  # The state of replication for the table in this cluster.
39
- # Valid values are:
55
+ # Valid values include:
40
56
  # * `:INITIALIZING` - The cluster was recently created.
41
57
  # * `:PLANNED_MAINTENANCE` - The table is temporarily unable to serve.
42
58
  # * `:UNPLANNED_MAINTENANCE` - The table is temporarily unable to serve.
@@ -45,6 +61,10 @@ module Google
45
61
  # after a restore, and is being optimized for performance. When
46
62
  # optimizations are complete, the table will transition to `READY`
47
63
  # state.
64
+ # * `:STATE_NOT_KNOWN` - If replication state is not present in the object
65
+ # because the table view is not `REPLICATION_VIEW` or `FULL`.
66
+ # * `:UNKNOWN` - If it could not be determined whether or not the table
67
+ # has data in a particular cluster (for example, if its zone is unavailable.)
48
68
  #
49
69
  # @return [Symbol] The state of replication.
50
70
  #
@@ -57,7 +77,8 @@ module Google
57
77
  # over pre-existing data from other clusters before it can begin
58
78
  # receiving live replication updates and serving.
59
79
  #
60
- # @return [Boolean] `true` if the table in this cluster is initializing.
80
+ # @return [Boolean] `true` if the value of {#replication_state} is `INITIALIZING`,
81
+ # `false` otherwise.
61
82
  #
62
83
  def initializing?
63
84
  replication_state == :INITIALIZING
@@ -67,8 +88,8 @@ module Google
67
88
  # The table is temporarily unable to serve
68
89
  # requests from this cluster due to planned internal maintenance.
69
90
  #
70
- # @return [Boolean] `true` if the table in this cluster is in planned
71
- # maintenance.
91
+ # @return [Boolean] `true` if the value of {#replication_state} is `PLANNED_MAINTENANCE`,
92
+ # `false` otherwise.
72
93
  #
73
94
  def planned_maintenance?
74
95
  replication_state == :PLANNED_MAINTENANCE
@@ -78,8 +99,8 @@ module Google
78
99
  # The table is temporarily unable to serve requests from this
79
100
  # cluster due to unplanned or emergency maintenance.
80
101
  #
81
- # @return [Boolean] `true` if the table in this cluster is in unplanned
82
- # maintenance.
102
+ # @return [Boolean] `true` if the value of {#replication_state} is `UNPLANNED_MAINTENANCE`,
103
+ # `false` otherwise.
83
104
  #
84
105
  def unplanned_maintenance?
85
106
  replication_state == :UNPLANNED_MAINTENANCE
@@ -90,7 +111,8 @@ module Google
90
111
  # Depending on replication delay, reads may not immediately
91
112
  # reflect the state of the table in other clusters.
92
113
  #
93
- # @return [Boolean] `true` if the table in this cluster is ready.
114
+ # @return [Boolean] `true` if the value of {#replication_state} is `READY`,
115
+ # `false` otherwise.
94
116
  #
95
117
  def ready?
96
118
  replication_state == :READY
@@ -102,13 +124,25 @@ module Google
102
124
  # optimizations are complete, the table will transition to `READY`
103
125
  # state.
104
126
  #
105
- # @return [Boolean] `true` if the table in this cluster is being
106
- # optimized.
127
+ # @return [Boolean] `true` if the value of {#replication_state} is `READY_OPTIMIZING`,
128
+ # `false` otherwise.
107
129
  #
108
130
  def ready_optimizing?
109
131
  replication_state == :READY_OPTIMIZING
110
132
  end
111
133
 
134
+ ##
135
+ # The encryption info value objects for the table in this cluster. The encryption info
136
+ # is only present when the table view is `ENCRYPTION_VIEW` or `FULL`. See also
137
+ # {Instance::ClusterMap#add}.
138
+ #
139
+ # @return [Array<Google::Cloud::Bigtable::EncryptionInfo>] The array of encryption info
140
+ # value objects, or an empty array if none are present.
141
+ #
142
+ def encryption_infos
143
+ @grpc.encryption_info.map { |ei_grpc| Google::Cloud::Bigtable::EncryptionInfo.from_grpc ei_grpc }
144
+ end
145
+
112
146
  # @private
113
147
  # New Table::ClusterState from a Google::Cloud::Bigtable::Admin::V2::Table::ClusterState object.
114
148
  # @param grpc [Google::Cloud::Bigtable::Admin::V2::Table::ClusterState]
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Bigtable
19
- VERSION = "2.4.1".freeze
19
+ VERSION = "2.5.0".freeze
20
20
  end
21
21
  end
22
22
  end
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: 2.4.1
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-01 00:00:00.000000000 Z
11
+ date: 2021-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-cloud-bigtable-admin-v2
@@ -197,6 +197,7 @@ files:
197
197
  - lib/google/cloud/bigtable/column_range.rb
198
198
  - lib/google/cloud/bigtable/convert.rb
199
199
  - lib/google/cloud/bigtable/credentials.rb
200
+ - lib/google/cloud/bigtable/encryption_info.rb
200
201
  - lib/google/cloud/bigtable/errors.rb
201
202
  - lib/google/cloud/bigtable/gc_rule.rb
202
203
  - lib/google/cloud/bigtable/instance.rb