google-cloud-bigtable 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +10 -0
  3. data/LICENSE +201 -0
  4. data/README.md +65 -0
  5. data/lib/google/bigtable/admin/v2/bigtable_instance_admin_pb.rb +139 -0
  6. data/lib/google/bigtable/admin/v2/bigtable_instance_admin_services_pb.rb +85 -0
  7. data/lib/google/bigtable/admin/v2/bigtable_table_admin_pb.rb +137 -0
  8. data/lib/google/bigtable/admin/v2/bigtable_table_admin_services_pb.rb +117 -0
  9. data/lib/google/bigtable/admin/v2/common_pb.rb +24 -0
  10. data/lib/google/bigtable/admin/v2/instance_pb.rb +72 -0
  11. data/lib/google/bigtable/admin/v2/table_pb.rb +88 -0
  12. data/lib/google/bigtable/v2/bigtable_pb.rb +109 -0
  13. data/lib/google/bigtable/v2/bigtable_services_pb.rb +67 -0
  14. data/lib/google/bigtable/v2/data_pb.rb +155 -0
  15. data/lib/google/cloud/bigtable/admin/credentials.rb +26 -0
  16. data/lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb +1417 -0
  17. data/lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client_config.json +123 -0
  18. data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb +1079 -0
  19. data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client_config.json +109 -0
  20. data/lib/google/cloud/bigtable/admin/v2/credentials.rb +50 -0
  21. data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/bigtable_instance_admin.rb +279 -0
  22. data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/bigtable_table_admin.rb +353 -0
  23. data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/instance.rb +194 -0
  24. data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/table.rb +209 -0
  25. data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/iam_policy.rb +62 -0
  26. data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/policy.rb +127 -0
  27. data/lib/google/cloud/bigtable/admin/v2/doc/google/longrunning/operations.rb +92 -0
  28. data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/any.rb +124 -0
  29. data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/duration.rb +90 -0
  30. data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/empty.rb +28 -0
  31. data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/field_mask.rb +223 -0
  32. data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/timestamp.rb +106 -0
  33. data/lib/google/cloud/bigtable/admin/v2/doc/google/rpc/status.rb +83 -0
  34. data/lib/google/cloud/bigtable/admin/v2.rb +200 -0
  35. data/lib/google/cloud/bigtable/admin.rb +196 -0
  36. data/lib/google/cloud/bigtable/app_profile/job.rb +102 -0
  37. data/lib/google/cloud/bigtable/app_profile/list.rb +159 -0
  38. data/lib/google/cloud/bigtable/app_profile.rb +373 -0
  39. data/lib/google/cloud/bigtable/chunk_processor.rb +253 -0
  40. data/lib/google/cloud/bigtable/cluster/job.rb +92 -0
  41. data/lib/google/cloud/bigtable/cluster/list.rb +169 -0
  42. data/lib/google/cloud/bigtable/cluster.rb +264 -0
  43. data/lib/google/cloud/bigtable/column_family.rb +280 -0
  44. data/lib/google/cloud/bigtable/column_range.rb +186 -0
  45. data/lib/google/cloud/bigtable/convert.rb +75 -0
  46. data/lib/google/cloud/bigtable/credentials.rb +24 -0
  47. data/lib/google/cloud/bigtable/errors.rb +35 -0
  48. data/lib/google/cloud/bigtable/gc_rule.rb +215 -0
  49. data/lib/google/cloud/bigtable/instance/cluster_map.rb +70 -0
  50. data/lib/google/cloud/bigtable/instance/job.rb +97 -0
  51. data/lib/google/cloud/bigtable/instance/list.rb +159 -0
  52. data/lib/google/cloud/bigtable/instance.rb +921 -0
  53. data/lib/google/cloud/bigtable/longrunning_job.rb +105 -0
  54. data/lib/google/cloud/bigtable/mutation_entry.rb +244 -0
  55. data/lib/google/cloud/bigtable/mutation_operations.rb +338 -0
  56. data/lib/google/cloud/bigtable/policy.rb +163 -0
  57. data/lib/google/cloud/bigtable/project.rb +580 -0
  58. data/lib/google/cloud/bigtable/read_modify_write_rule.rb +129 -0
  59. data/lib/google/cloud/bigtable/read_operations.rb +345 -0
  60. data/lib/google/cloud/bigtable/row.rb +125 -0
  61. data/lib/google/cloud/bigtable/row_filter/chain_filter.rb +539 -0
  62. data/lib/google/cloud/bigtable/row_filter/condition_filter.rb +108 -0
  63. data/lib/google/cloud/bigtable/row_filter/interleave_filter.rb +570 -0
  64. data/lib/google/cloud/bigtable/row_filter/simple_filter.rb +273 -0
  65. data/lib/google/cloud/bigtable/row_filter.rb +593 -0
  66. data/lib/google/cloud/bigtable/row_range.rb +174 -0
  67. data/lib/google/cloud/bigtable/rows_mutator.rb +120 -0
  68. data/lib/google/cloud/bigtable/rows_reader.rb +196 -0
  69. data/lib/google/cloud/bigtable/sample_row_key.rb +82 -0
  70. data/lib/google/cloud/bigtable/service.rb +817 -0
  71. data/lib/google/cloud/bigtable/table/cluster_state.rb +93 -0
  72. data/lib/google/cloud/bigtable/table/column_family_map.rb +68 -0
  73. data/lib/google/cloud/bigtable/table/list.rb +147 -0
  74. data/lib/google/cloud/bigtable/table.rb +676 -0
  75. data/lib/google/cloud/bigtable/v2/bigtable_client.rb +579 -0
  76. data/lib/google/cloud/bigtable/v2/bigtable_client_config.json +65 -0
  77. data/lib/google/cloud/bigtable/v2/credentials.rb +45 -0
  78. data/lib/google/cloud/bigtable/v2/doc/google/bigtable/v2/bigtable.rb +286 -0
  79. data/lib/google/cloud/bigtable/v2/doc/google/bigtable/v2/data.rb +492 -0
  80. data/lib/google/cloud/bigtable/v2/doc/google/protobuf/any.rb +124 -0
  81. data/lib/google/cloud/bigtable/v2/doc/google/protobuf/wrappers.rb +89 -0
  82. data/lib/google/cloud/bigtable/v2/doc/google/rpc/status.rb +83 -0
  83. data/lib/google/cloud/bigtable/v2.rb +132 -0
  84. data/lib/google/cloud/bigtable/value_range.rb +175 -0
  85. data/lib/google/cloud/bigtable/version.rb +22 -0
  86. data/lib/google/cloud/bigtable.rb +223 -0
  87. data/lib/google-cloud-bigtable.rb +167 -0
  88. metadata +283 -0
@@ -0,0 +1,67 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: google/bigtable/v2/bigtable.proto for package 'google.bigtable.v2'
3
+ # Original file comments:
4
+ # Copyright 2018 Google Inc.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'grpc'
20
+ require 'google/bigtable/v2/bigtable_pb'
21
+
22
+ module Google
23
+ module Bigtable
24
+ module V2
25
+ module Bigtable
26
+ # Service for reading from and writing to existing Bigtable tables.
27
+ class Service
28
+
29
+ include GRPC::GenericService
30
+
31
+ self.marshal_class_method = :encode
32
+ self.unmarshal_class_method = :decode
33
+ self.service_name = 'google.bigtable.v2.Bigtable'
34
+
35
+ # Streams back the contents of all requested rows in key order, optionally
36
+ # applying the same Reader filter to each. Depending on their size,
37
+ # rows and cells may be broken up across multiple responses, but
38
+ # atomicity of each row will still be preserved. See the
39
+ # ReadRowsResponse documentation for details.
40
+ rpc :ReadRows, ReadRowsRequest, stream(ReadRowsResponse)
41
+ # Returns a sample of row keys in the table. The returned row keys will
42
+ # delimit contiguous sections of the table of approximately equal size,
43
+ # which can be used to break up the data for distributed tasks like
44
+ # mapreduces.
45
+ rpc :SampleRowKeys, SampleRowKeysRequest, stream(SampleRowKeysResponse)
46
+ # Mutates a row atomically. Cells already present in the row are left
47
+ # unchanged unless explicitly changed by `mutation`.
48
+ rpc :MutateRow, MutateRowRequest, MutateRowResponse
49
+ # Mutates multiple rows in a batch. Each individual row is mutated
50
+ # atomically as in MutateRow, but the entire batch is not executed
51
+ # atomically.
52
+ rpc :MutateRows, MutateRowsRequest, stream(MutateRowsResponse)
53
+ # Mutates a row atomically based on the output of a predicate Reader filter.
54
+ rpc :CheckAndMutateRow, CheckAndMutateRowRequest, CheckAndMutateRowResponse
55
+ # Modifies a row atomically on the server. The method reads the latest
56
+ # existing timestamp and value from the specified columns and writes a new
57
+ # entry based on pre-defined read/modify/write rules. The new value for the
58
+ # timestamp is the greater of the existing timestamp or the current server
59
+ # time. The method returns the new contents of all modified cells.
60
+ rpc :ReadModifyWriteRow, ReadModifyWriteRowRequest, ReadModifyWriteRowResponse
61
+ end
62
+
63
+ Stub = Service.rpc_stub_class
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,155 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: google/bigtable/v2/data.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ Google::Protobuf::DescriptorPool.generated_pool.build do
7
+ add_message "google.bigtable.v2.Row" do
8
+ optional :key, :bytes, 1
9
+ repeated :families, :message, 2, "google.bigtable.v2.Family"
10
+ end
11
+ add_message "google.bigtable.v2.Family" do
12
+ optional :name, :string, 1
13
+ repeated :columns, :message, 2, "google.bigtable.v2.Column"
14
+ end
15
+ add_message "google.bigtable.v2.Column" do
16
+ optional :qualifier, :bytes, 1
17
+ repeated :cells, :message, 2, "google.bigtable.v2.Cell"
18
+ end
19
+ add_message "google.bigtable.v2.Cell" do
20
+ optional :timestamp_micros, :int64, 1
21
+ optional :value, :bytes, 2
22
+ repeated :labels, :string, 3
23
+ end
24
+ add_message "google.bigtable.v2.RowRange" do
25
+ oneof :start_key do
26
+ optional :start_key_closed, :bytes, 1
27
+ optional :start_key_open, :bytes, 2
28
+ end
29
+ oneof :end_key do
30
+ optional :end_key_open, :bytes, 3
31
+ optional :end_key_closed, :bytes, 4
32
+ end
33
+ end
34
+ add_message "google.bigtable.v2.RowSet" do
35
+ repeated :row_keys, :bytes, 1
36
+ repeated :row_ranges, :message, 2, "google.bigtable.v2.RowRange"
37
+ end
38
+ add_message "google.bigtable.v2.ColumnRange" do
39
+ optional :family_name, :string, 1
40
+ oneof :start_qualifier do
41
+ optional :start_qualifier_closed, :bytes, 2
42
+ optional :start_qualifier_open, :bytes, 3
43
+ end
44
+ oneof :end_qualifier do
45
+ optional :end_qualifier_closed, :bytes, 4
46
+ optional :end_qualifier_open, :bytes, 5
47
+ end
48
+ end
49
+ add_message "google.bigtable.v2.TimestampRange" do
50
+ optional :start_timestamp_micros, :int64, 1
51
+ optional :end_timestamp_micros, :int64, 2
52
+ end
53
+ add_message "google.bigtable.v2.ValueRange" do
54
+ oneof :start_value do
55
+ optional :start_value_closed, :bytes, 1
56
+ optional :start_value_open, :bytes, 2
57
+ end
58
+ oneof :end_value do
59
+ optional :end_value_closed, :bytes, 3
60
+ optional :end_value_open, :bytes, 4
61
+ end
62
+ end
63
+ add_message "google.bigtable.v2.RowFilter" do
64
+ oneof :filter do
65
+ optional :chain, :message, 1, "google.bigtable.v2.RowFilter.Chain"
66
+ optional :interleave, :message, 2, "google.bigtable.v2.RowFilter.Interleave"
67
+ optional :condition, :message, 3, "google.bigtable.v2.RowFilter.Condition"
68
+ optional :sink, :bool, 16
69
+ optional :pass_all_filter, :bool, 17
70
+ optional :block_all_filter, :bool, 18
71
+ optional :row_key_regex_filter, :bytes, 4
72
+ optional :row_sample_filter, :double, 14
73
+ optional :family_name_regex_filter, :string, 5
74
+ optional :column_qualifier_regex_filter, :bytes, 6
75
+ optional :column_range_filter, :message, 7, "google.bigtable.v2.ColumnRange"
76
+ optional :timestamp_range_filter, :message, 8, "google.bigtable.v2.TimestampRange"
77
+ optional :value_regex_filter, :bytes, 9
78
+ optional :value_range_filter, :message, 15, "google.bigtable.v2.ValueRange"
79
+ optional :cells_per_row_offset_filter, :int32, 10
80
+ optional :cells_per_row_limit_filter, :int32, 11
81
+ optional :cells_per_column_limit_filter, :int32, 12
82
+ optional :strip_value_transformer, :bool, 13
83
+ optional :apply_label_transformer, :string, 19
84
+ end
85
+ end
86
+ add_message "google.bigtable.v2.RowFilter.Chain" do
87
+ repeated :filters, :message, 1, "google.bigtable.v2.RowFilter"
88
+ end
89
+ add_message "google.bigtable.v2.RowFilter.Interleave" do
90
+ repeated :filters, :message, 1, "google.bigtable.v2.RowFilter"
91
+ end
92
+ add_message "google.bigtable.v2.RowFilter.Condition" do
93
+ optional :predicate_filter, :message, 1, "google.bigtable.v2.RowFilter"
94
+ optional :true_filter, :message, 2, "google.bigtable.v2.RowFilter"
95
+ optional :false_filter, :message, 3, "google.bigtable.v2.RowFilter"
96
+ end
97
+ add_message "google.bigtable.v2.Mutation" do
98
+ oneof :mutation do
99
+ optional :set_cell, :message, 1, "google.bigtable.v2.Mutation.SetCell"
100
+ optional :delete_from_column, :message, 2, "google.bigtable.v2.Mutation.DeleteFromColumn"
101
+ optional :delete_from_family, :message, 3, "google.bigtable.v2.Mutation.DeleteFromFamily"
102
+ optional :delete_from_row, :message, 4, "google.bigtable.v2.Mutation.DeleteFromRow"
103
+ end
104
+ end
105
+ add_message "google.bigtable.v2.Mutation.SetCell" do
106
+ optional :family_name, :string, 1
107
+ optional :column_qualifier, :bytes, 2
108
+ optional :timestamp_micros, :int64, 3
109
+ optional :value, :bytes, 4
110
+ end
111
+ add_message "google.bigtable.v2.Mutation.DeleteFromColumn" do
112
+ optional :family_name, :string, 1
113
+ optional :column_qualifier, :bytes, 2
114
+ optional :time_range, :message, 3, "google.bigtable.v2.TimestampRange"
115
+ end
116
+ add_message "google.bigtable.v2.Mutation.DeleteFromFamily" do
117
+ optional :family_name, :string, 1
118
+ end
119
+ add_message "google.bigtable.v2.Mutation.DeleteFromRow" do
120
+ end
121
+ add_message "google.bigtable.v2.ReadModifyWriteRule" do
122
+ optional :family_name, :string, 1
123
+ optional :column_qualifier, :bytes, 2
124
+ oneof :rule do
125
+ optional :append_value, :bytes, 3
126
+ optional :increment_amount, :int64, 4
127
+ end
128
+ end
129
+ end
130
+
131
+ module Google
132
+ module Bigtable
133
+ module V2
134
+ Row = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.bigtable.v2.Row").msgclass
135
+ Family = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.bigtable.v2.Family").msgclass
136
+ Column = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.bigtable.v2.Column").msgclass
137
+ Cell = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.bigtable.v2.Cell").msgclass
138
+ RowRange = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.bigtable.v2.RowRange").msgclass
139
+ RowSet = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.bigtable.v2.RowSet").msgclass
140
+ ColumnRange = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.bigtable.v2.ColumnRange").msgclass
141
+ TimestampRange = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.bigtable.v2.TimestampRange").msgclass
142
+ ValueRange = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.bigtable.v2.ValueRange").msgclass
143
+ RowFilter = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.bigtable.v2.RowFilter").msgclass
144
+ RowFilter::Chain = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.bigtable.v2.RowFilter.Chain").msgclass
145
+ RowFilter::Interleave = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.bigtable.v2.RowFilter.Interleave").msgclass
146
+ RowFilter::Condition = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.bigtable.v2.RowFilter.Condition").msgclass
147
+ Mutation = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.bigtable.v2.Mutation").msgclass
148
+ Mutation::SetCell = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.bigtable.v2.Mutation.SetCell").msgclass
149
+ Mutation::DeleteFromColumn = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.bigtable.v2.Mutation.DeleteFromColumn").msgclass
150
+ Mutation::DeleteFromFamily = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.bigtable.v2.Mutation.DeleteFromFamily").msgclass
151
+ Mutation::DeleteFromRow = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.bigtable.v2.Mutation.DeleteFromRow").msgclass
152
+ ReadModifyWriteRule = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.bigtable.v2.ReadModifyWriteRule").msgclass
153
+ end
154
+ end
155
+ end
@@ -0,0 +1,26 @@
1
+ # Copyright 2018 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require "google/cloud/bigtable/admin/v2/credentials"
16
+
17
+ module Google
18
+ module Cloud
19
+ module Bigtable
20
+ module Admin
21
+ class Credentials < Google::Cloud::Bigtable::Admin::V2::Credentials
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,1417 @@
1
+ # Copyright 2018 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ # EDITING INSTRUCTIONS
16
+ # This file was generated from the file
17
+ # https://github.com/googleapis/googleapis/blob/master/google/bigtable/admin/v2/bigtable_instance_admin.proto,
18
+ # and updates to that file get reflected here through a refresh process.
19
+ # For the short term, the refresh process will only be runnable by Google
20
+ # engineers.
21
+
22
+ require "json"
23
+ require "pathname"
24
+
25
+ require "google/gax"
26
+ require "google/gax/operation"
27
+ require "google/longrunning/operations_client"
28
+
29
+ require "google/bigtable/admin/v2/bigtable_instance_admin_pb"
30
+ require "google/cloud/bigtable/admin/v2/credentials"
31
+
32
+ module Google
33
+ module Cloud
34
+ module Bigtable
35
+ module Admin
36
+ module V2
37
+ # Service for creating, configuring, and deleting Cloud Bigtable Instances and
38
+ # Clusters. Provides access to the Instance and Cluster schemas only, not the
39
+ # tables' metadata or data stored in those tables.
40
+ #
41
+ # @!attribute [r] bigtable_instance_admin_stub
42
+ # @return [Google::Bigtable::Admin::V2::BigtableInstanceAdmin::Stub]
43
+ class BigtableInstanceAdminClient
44
+ attr_reader :bigtable_instance_admin_stub
45
+
46
+ # The default address of the service.
47
+ SERVICE_ADDRESS = "bigtableadmin.googleapis.com".freeze
48
+
49
+ # The default port of the service.
50
+ DEFAULT_SERVICE_PORT = 443
51
+
52
+ # The default set of gRPC interceptors.
53
+ GRPC_INTERCEPTORS = []
54
+
55
+ DEFAULT_TIMEOUT = 30
56
+
57
+ PAGE_DESCRIPTORS = {
58
+ "list_app_profiles" => Google::Gax::PageDescriptor.new(
59
+ "page_token",
60
+ "next_page_token",
61
+ "app_profiles")
62
+ }.freeze
63
+
64
+ private_constant :PAGE_DESCRIPTORS
65
+
66
+ # The scopes needed to make gRPC calls to all of the methods defined in
67
+ # this service.
68
+ ALL_SCOPES = [
69
+ "https://www.googleapis.com/auth/bigtable.admin",
70
+ "https://www.googleapis.com/auth/bigtable.admin.cluster",
71
+ "https://www.googleapis.com/auth/bigtable.admin.instance",
72
+ "https://www.googleapis.com/auth/bigtable.admin.table",
73
+ "https://www.googleapis.com/auth/cloud-bigtable.admin",
74
+ "https://www.googleapis.com/auth/cloud-bigtable.admin.cluster",
75
+ "https://www.googleapis.com/auth/cloud-bigtable.admin.table",
76
+ "https://www.googleapis.com/auth/cloud-platform",
77
+ "https://www.googleapis.com/auth/cloud-platform.read-only"
78
+ ].freeze
79
+
80
+ class OperationsClient < Google::Longrunning::OperationsClient
81
+ self::SERVICE_ADDRESS = BigtableInstanceAdminClient::SERVICE_ADDRESS
82
+ self::GRPC_INTERCEPTORS = BigtableInstanceAdminClient::GRPC_INTERCEPTORS
83
+ end
84
+
85
+ PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
86
+ "projects/{project}"
87
+ )
88
+
89
+ private_constant :PROJECT_PATH_TEMPLATE
90
+
91
+ INSTANCE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
92
+ "projects/{project}/instances/{instance}"
93
+ )
94
+
95
+ private_constant :INSTANCE_PATH_TEMPLATE
96
+
97
+ APP_PROFILE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
98
+ "projects/{project}/instances/{instance}/appProfiles/{app_profile}"
99
+ )
100
+
101
+ private_constant :APP_PROFILE_PATH_TEMPLATE
102
+
103
+ CLUSTER_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
104
+ "projects/{project}/instances/{instance}/clusters/{cluster}"
105
+ )
106
+
107
+ private_constant :CLUSTER_PATH_TEMPLATE
108
+
109
+ LOCATION_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
110
+ "projects/{project}/locations/{location}"
111
+ )
112
+
113
+ private_constant :LOCATION_PATH_TEMPLATE
114
+
115
+ # Returns a fully-qualified project resource name string.
116
+ # @param project [String]
117
+ # @return [String]
118
+ def self.project_path project
119
+ PROJECT_PATH_TEMPLATE.render(
120
+ :"project" => project
121
+ )
122
+ end
123
+
124
+ # Returns a fully-qualified instance resource name string.
125
+ # @param project [String]
126
+ # @param instance [String]
127
+ # @return [String]
128
+ def self.instance_path project, instance
129
+ INSTANCE_PATH_TEMPLATE.render(
130
+ :"project" => project,
131
+ :"instance" => instance
132
+ )
133
+ end
134
+
135
+ # Returns a fully-qualified app_profile resource name string.
136
+ # @param project [String]
137
+ # @param instance [String]
138
+ # @param app_profile [String]
139
+ # @return [String]
140
+ def self.app_profile_path project, instance, app_profile
141
+ APP_PROFILE_PATH_TEMPLATE.render(
142
+ :"project" => project,
143
+ :"instance" => instance,
144
+ :"app_profile" => app_profile
145
+ )
146
+ end
147
+
148
+ # Returns a fully-qualified cluster resource name string.
149
+ # @param project [String]
150
+ # @param instance [String]
151
+ # @param cluster [String]
152
+ # @return [String]
153
+ def self.cluster_path project, instance, cluster
154
+ CLUSTER_PATH_TEMPLATE.render(
155
+ :"project" => project,
156
+ :"instance" => instance,
157
+ :"cluster" => cluster
158
+ )
159
+ end
160
+
161
+ # Returns a fully-qualified location resource name string.
162
+ # @param project [String]
163
+ # @param location [String]
164
+ # @return [String]
165
+ def self.location_path project, location
166
+ LOCATION_PATH_TEMPLATE.render(
167
+ :"project" => project,
168
+ :"location" => location
169
+ )
170
+ end
171
+
172
+ # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
173
+ # Provides the means for authenticating requests made by the client. This parameter can
174
+ # be many types.
175
+ # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
176
+ # authenticating requests made by this client.
177
+ # A `String` will be treated as the path to the keyfile to be used for the construction of
178
+ # credentials for this client.
179
+ # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
180
+ # credentials for this client.
181
+ # A `GRPC::Core::Channel` will be used to make calls through.
182
+ # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
183
+ # should already be composed with a `GRPC::Core::CallCredentials` object.
184
+ # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
185
+ # metadata for requests, generally, to give OAuth credentials.
186
+ # @param scopes [Array<String>]
187
+ # The OAuth scopes for this service. This parameter is ignored if
188
+ # an updater_proc is supplied.
189
+ # @param client_config [Hash]
190
+ # A Hash for call options for each method. See
191
+ # Google::Gax#construct_settings for the structure of
192
+ # this data. Falls back to the default config if not specified
193
+ # or the specified config is missing data points.
194
+ # @param timeout [Numeric]
195
+ # The default timeout, in seconds, for calls made through this client.
196
+ # @param metadata [Hash]
197
+ # Default metadata to be sent with each request. This can be overridden on a per call basis.
198
+ # @param exception_transformer [Proc]
199
+ # An optional proc that intercepts any exceptions raised during an API call to inject
200
+ # custom error handling.
201
+ def initialize \
202
+ credentials: nil,
203
+ scopes: ALL_SCOPES,
204
+ client_config: {},
205
+ timeout: DEFAULT_TIMEOUT,
206
+ metadata: nil,
207
+ exception_transformer: nil,
208
+ lib_name: nil,
209
+ lib_version: ""
210
+ # These require statements are intentionally placed here to initialize
211
+ # the gRPC module only when it's required.
212
+ # See https://github.com/googleapis/toolkit/issues/446
213
+ require "google/gax/grpc"
214
+ require "google/bigtable/admin/v2/bigtable_instance_admin_services_pb"
215
+
216
+ credentials ||= Google::Cloud::Bigtable::Admin::V2::Credentials.default
217
+
218
+ @operations_client = OperationsClient.new(
219
+ credentials: credentials,
220
+ scopes: scopes,
221
+ client_config: client_config,
222
+ timeout: timeout,
223
+ lib_name: lib_name,
224
+ lib_version: lib_version,
225
+ )
226
+
227
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
228
+ updater_proc = Google::Cloud::Bigtable::Admin::V2::Credentials.new(credentials).updater_proc
229
+ end
230
+ if credentials.is_a?(GRPC::Core::Channel)
231
+ channel = credentials
232
+ end
233
+ if credentials.is_a?(GRPC::Core::ChannelCredentials)
234
+ chan_creds = credentials
235
+ end
236
+ if credentials.is_a?(Proc)
237
+ updater_proc = credentials
238
+ end
239
+ if credentials.is_a?(Google::Auth::Credentials)
240
+ updater_proc = credentials.updater_proc
241
+ end
242
+
243
+ package_version = Gem.loaded_specs['google-cloud-bigtable'].version.version
244
+
245
+ google_api_client = "gl-ruby/#{RUBY_VERSION}"
246
+ google_api_client << " #{lib_name}/#{lib_version}" if lib_name
247
+ google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
248
+ google_api_client << " grpc/#{GRPC::VERSION}"
249
+ google_api_client.freeze
250
+
251
+ headers = { :"x-goog-api-client" => google_api_client }
252
+ headers.merge!(metadata) unless metadata.nil?
253
+ client_config_file = Pathname.new(__dir__).join(
254
+ "bigtable_instance_admin_client_config.json"
255
+ )
256
+ defaults = client_config_file.open do |f|
257
+ Google::Gax.construct_settings(
258
+ "google.bigtable.admin.v2.BigtableInstanceAdmin",
259
+ JSON.parse(f.read),
260
+ client_config,
261
+ Google::Gax::Grpc::STATUS_CODE_NAMES,
262
+ timeout,
263
+ page_descriptors: PAGE_DESCRIPTORS,
264
+ errors: Google::Gax::Grpc::API_ERRORS,
265
+ metadata: headers
266
+ )
267
+ end
268
+
269
+ # Allow overriding the service path/port in subclasses.
270
+ service_path = self.class::SERVICE_ADDRESS
271
+ port = self.class::DEFAULT_SERVICE_PORT
272
+ interceptors = self.class::GRPC_INTERCEPTORS
273
+ @bigtable_instance_admin_stub = Google::Gax::Grpc.create_stub(
274
+ service_path,
275
+ port,
276
+ chan_creds: chan_creds,
277
+ channel: channel,
278
+ updater_proc: updater_proc,
279
+ scopes: scopes,
280
+ interceptors: interceptors,
281
+ &Google::Bigtable::Admin::V2::BigtableInstanceAdmin::Stub.method(:new)
282
+ )
283
+
284
+ @create_instance = Google::Gax.create_api_call(
285
+ @bigtable_instance_admin_stub.method(:create_instance),
286
+ defaults["create_instance"],
287
+ exception_transformer: exception_transformer,
288
+ params_extractor: proc do |request|
289
+ {'parent' => request.parent}
290
+ end
291
+ )
292
+ @get_instance = Google::Gax.create_api_call(
293
+ @bigtable_instance_admin_stub.method(:get_instance),
294
+ defaults["get_instance"],
295
+ exception_transformer: exception_transformer,
296
+ params_extractor: proc do |request|
297
+ {'name' => request.name}
298
+ end
299
+ )
300
+ @list_instances = Google::Gax.create_api_call(
301
+ @bigtable_instance_admin_stub.method(:list_instances),
302
+ defaults["list_instances"],
303
+ exception_transformer: exception_transformer,
304
+ params_extractor: proc do |request|
305
+ {'parent' => request.parent}
306
+ end
307
+ )
308
+ @update_instance = Google::Gax.create_api_call(
309
+ @bigtable_instance_admin_stub.method(:update_instance),
310
+ defaults["update_instance"],
311
+ exception_transformer: exception_transformer,
312
+ params_extractor: proc do |request|
313
+ {'name' => request.name}
314
+ end
315
+ )
316
+ @partial_update_instance = Google::Gax.create_api_call(
317
+ @bigtable_instance_admin_stub.method(:partial_update_instance),
318
+ defaults["partial_update_instance"],
319
+ exception_transformer: exception_transformer,
320
+ params_extractor: proc do |request|
321
+ {'instance.name' => request.instance.name}
322
+ end
323
+ )
324
+ @delete_instance = Google::Gax.create_api_call(
325
+ @bigtable_instance_admin_stub.method(:delete_instance),
326
+ defaults["delete_instance"],
327
+ exception_transformer: exception_transformer,
328
+ params_extractor: proc do |request|
329
+ {'name' => request.name}
330
+ end
331
+ )
332
+ @create_cluster = Google::Gax.create_api_call(
333
+ @bigtable_instance_admin_stub.method(:create_cluster),
334
+ defaults["create_cluster"],
335
+ exception_transformer: exception_transformer,
336
+ params_extractor: proc do |request|
337
+ {'parent' => request.parent}
338
+ end
339
+ )
340
+ @get_cluster = Google::Gax.create_api_call(
341
+ @bigtable_instance_admin_stub.method(:get_cluster),
342
+ defaults["get_cluster"],
343
+ exception_transformer: exception_transformer,
344
+ params_extractor: proc do |request|
345
+ {'name' => request.name}
346
+ end
347
+ )
348
+ @list_clusters = Google::Gax.create_api_call(
349
+ @bigtable_instance_admin_stub.method(:list_clusters),
350
+ defaults["list_clusters"],
351
+ exception_transformer: exception_transformer,
352
+ params_extractor: proc do |request|
353
+ {'parent' => request.parent}
354
+ end
355
+ )
356
+ @update_cluster = Google::Gax.create_api_call(
357
+ @bigtable_instance_admin_stub.method(:update_cluster),
358
+ defaults["update_cluster"],
359
+ exception_transformer: exception_transformer,
360
+ params_extractor: proc do |request|
361
+ {'name' => request.name}
362
+ end
363
+ )
364
+ @delete_cluster = Google::Gax.create_api_call(
365
+ @bigtable_instance_admin_stub.method(:delete_cluster),
366
+ defaults["delete_cluster"],
367
+ exception_transformer: exception_transformer,
368
+ params_extractor: proc do |request|
369
+ {'name' => request.name}
370
+ end
371
+ )
372
+ @create_app_profile = Google::Gax.create_api_call(
373
+ @bigtable_instance_admin_stub.method(:create_app_profile),
374
+ defaults["create_app_profile"],
375
+ exception_transformer: exception_transformer,
376
+ params_extractor: proc do |request|
377
+ {'parent' => request.parent}
378
+ end
379
+ )
380
+ @get_app_profile = Google::Gax.create_api_call(
381
+ @bigtable_instance_admin_stub.method(:get_app_profile),
382
+ defaults["get_app_profile"],
383
+ exception_transformer: exception_transformer,
384
+ params_extractor: proc do |request|
385
+ {'name' => request.name}
386
+ end
387
+ )
388
+ @list_app_profiles = Google::Gax.create_api_call(
389
+ @bigtable_instance_admin_stub.method(:list_app_profiles),
390
+ defaults["list_app_profiles"],
391
+ exception_transformer: exception_transformer,
392
+ params_extractor: proc do |request|
393
+ {'parent' => request.parent}
394
+ end
395
+ )
396
+ @update_app_profile = Google::Gax.create_api_call(
397
+ @bigtable_instance_admin_stub.method(:update_app_profile),
398
+ defaults["update_app_profile"],
399
+ exception_transformer: exception_transformer,
400
+ params_extractor: proc do |request|
401
+ {'app_profile.name' => request.app_profile.name}
402
+ end
403
+ )
404
+ @delete_app_profile = Google::Gax.create_api_call(
405
+ @bigtable_instance_admin_stub.method(:delete_app_profile),
406
+ defaults["delete_app_profile"],
407
+ exception_transformer: exception_transformer,
408
+ params_extractor: proc do |request|
409
+ {'name' => request.name}
410
+ end
411
+ )
412
+ @get_iam_policy = Google::Gax.create_api_call(
413
+ @bigtable_instance_admin_stub.method(:get_iam_policy),
414
+ defaults["get_iam_policy"],
415
+ exception_transformer: exception_transformer,
416
+ params_extractor: proc do |request|
417
+ {'resource' => request.resource}
418
+ end
419
+ )
420
+ @set_iam_policy = Google::Gax.create_api_call(
421
+ @bigtable_instance_admin_stub.method(:set_iam_policy),
422
+ defaults["set_iam_policy"],
423
+ exception_transformer: exception_transformer,
424
+ params_extractor: proc do |request|
425
+ {'resource' => request.resource}
426
+ end
427
+ )
428
+ @test_iam_permissions = Google::Gax.create_api_call(
429
+ @bigtable_instance_admin_stub.method(:test_iam_permissions),
430
+ defaults["test_iam_permissions"],
431
+ exception_transformer: exception_transformer,
432
+ params_extractor: proc do |request|
433
+ {'resource' => request.resource}
434
+ end
435
+ )
436
+ end
437
+
438
+ # Service calls
439
+
440
+ # Create an instance within a project.
441
+ #
442
+ # @param parent [String]
443
+ # The unique name of the project in which to create the new instance.
444
+ # Values are of the form +projects/<project>+.
445
+ # @param instance_id [String]
446
+ # The ID to be used when referring to the new instance within its project,
447
+ # e.g., just +myinstance+ rather than
448
+ # +projects/myproject/instances/myinstance+.
449
+ # @param instance [Google::Bigtable::Admin::V2::Instance | Hash]
450
+ # The instance to create.
451
+ # Fields marked +OutputOnly+ must be left blank.
452
+ # A hash of the same form as `Google::Bigtable::Admin::V2::Instance`
453
+ # can also be provided.
454
+ # @param clusters [Hash{String => Google::Bigtable::Admin::V2::Cluster | Hash}]
455
+ # The clusters to be created within the instance, mapped by desired
456
+ # cluster ID, e.g., just +mycluster+ rather than
457
+ # +projects/myproject/instances/myinstance/clusters/mycluster+.
458
+ # Fields marked +OutputOnly+ must be left blank.
459
+ # Currently exactly one cluster must be specified.
460
+ # A hash of the same form as `Google::Bigtable::Admin::V2::Cluster`
461
+ # can also be provided.
462
+ # @param options [Google::Gax::CallOptions]
463
+ # Overrides the default settings for this call, e.g, timeout,
464
+ # retries, etc.
465
+ # @return [Google::Gax::Operation]
466
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
467
+ # @example
468
+ # require "google/cloud/bigtable/admin"
469
+ #
470
+ # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
471
+ # formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.project_path("[PROJECT]")
472
+ #
473
+ # # TODO: Initialize +instance_id+:
474
+ # instance_id = ''
475
+ #
476
+ # # TODO: Initialize +instance+:
477
+ # instance = {}
478
+ #
479
+ # # TODO: Initialize +clusters+:
480
+ # clusters = {}
481
+ #
482
+ # # Register a callback during the method call.
483
+ # operation = bigtable_instance_admin_client.create_instance(formatted_parent, instance_id, instance, clusters) do |op|
484
+ # raise op.results.message if op.error?
485
+ # op_results = op.results
486
+ # # Process the results.
487
+ #
488
+ # metadata = op.metadata
489
+ # # Process the metadata.
490
+ # end
491
+ #
492
+ # # Or use the return value to register a callback.
493
+ # operation.on_done do |op|
494
+ # raise op.results.message if op.error?
495
+ # op_results = op.results
496
+ # # Process the results.
497
+ #
498
+ # metadata = op.metadata
499
+ # # Process the metadata.
500
+ # end
501
+ #
502
+ # # Manually reload the operation.
503
+ # operation.reload!
504
+ #
505
+ # # Or block until the operation completes, triggering callbacks on
506
+ # # completion.
507
+ # operation.wait_until_done!
508
+
509
+ def create_instance \
510
+ parent,
511
+ instance_id,
512
+ instance,
513
+ clusters,
514
+ options: nil
515
+ req = {
516
+ parent: parent,
517
+ instance_id: instance_id,
518
+ instance: instance,
519
+ clusters: clusters
520
+ }.delete_if { |_, v| v.nil? }
521
+ req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::CreateInstanceRequest)
522
+ operation = Google::Gax::Operation.new(
523
+ @create_instance.call(req, options),
524
+ @operations_client,
525
+ Google::Bigtable::Admin::V2::Instance,
526
+ Google::Bigtable::Admin::V2::CreateInstanceMetadata,
527
+ call_options: options
528
+ )
529
+ operation.on_done { |operation| yield(operation) } if block_given?
530
+ operation
531
+ end
532
+
533
+ # Gets information about an instance.
534
+ #
535
+ # @param name [String]
536
+ # The unique name of the requested instance. Values are of the form
537
+ # +projects/<project>/instances/<instance>+.
538
+ # @param options [Google::Gax::CallOptions]
539
+ # Overrides the default settings for this call, e.g, timeout,
540
+ # retries, etc.
541
+ # @yield [result, operation] Access the result along with the RPC operation
542
+ # @yieldparam result [Google::Bigtable::Admin::V2::Instance]
543
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
544
+ # @return [Google::Bigtable::Admin::V2::Instance]
545
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
546
+ # @example
547
+ # require "google/cloud/bigtable/admin"
548
+ #
549
+ # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
550
+ # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
551
+ # response = bigtable_instance_admin_client.get_instance(formatted_name)
552
+
553
+ def get_instance \
554
+ name,
555
+ options: nil,
556
+ &block
557
+ req = {
558
+ name: name
559
+ }.delete_if { |_, v| v.nil? }
560
+ req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::GetInstanceRequest)
561
+ @get_instance.call(req, options, &block)
562
+ end
563
+
564
+ # Lists information about instances in a project.
565
+ #
566
+ # @param parent [String]
567
+ # The unique name of the project for which a list of instances is requested.
568
+ # Values are of the form +projects/<project>+.
569
+ # @param page_token [String]
570
+ # The value of +next_page_token+ returned by a previous call.
571
+ # @param options [Google::Gax::CallOptions]
572
+ # Overrides the default settings for this call, e.g, timeout,
573
+ # retries, etc.
574
+ # @yield [result, operation] Access the result along with the RPC operation
575
+ # @yieldparam result [Google::Bigtable::Admin::V2::ListInstancesResponse]
576
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
577
+ # @return [Google::Bigtable::Admin::V2::ListInstancesResponse]
578
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
579
+ # @example
580
+ # require "google/cloud/bigtable/admin"
581
+ #
582
+ # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
583
+ # formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.project_path("[PROJECT]")
584
+ # response = bigtable_instance_admin_client.list_instances(formatted_parent)
585
+
586
+ def list_instances \
587
+ parent,
588
+ page_token: nil,
589
+ options: nil,
590
+ &block
591
+ req = {
592
+ parent: parent,
593
+ page_token: page_token
594
+ }.delete_if { |_, v| v.nil? }
595
+ req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::ListInstancesRequest)
596
+ @list_instances.call(req, options, &block)
597
+ end
598
+
599
+ # Updates an instance within a project.
600
+ #
601
+ # @param name [String]
602
+ # (+OutputOnly+)
603
+ # The unique name of the instance. Values are of the form
604
+ # +projects/<project>/instances/[a-z][a-z0-9\\-]+[a-z0-9]+.
605
+ # @param display_name [String]
606
+ # The descriptive name for this instance as it appears in UIs.
607
+ # Can be changed at any time, but should be kept globally unique
608
+ # to avoid confusion.
609
+ # @param type [Google::Bigtable::Admin::V2::Instance::Type]
610
+ # The type of the instance. Defaults to +PRODUCTION+.
611
+ # @param labels [Hash{String => String}]
612
+ # Labels are a flexible and lightweight mechanism for organizing cloud
613
+ # resources into groups that reflect a customer's organizational needs and
614
+ # deployment strategies. They can be used to filter resources and aggregate
615
+ # metrics.
616
+ #
617
+ # * Label keys must be between 1 and 63 characters long and must conform to
618
+ # the regular expression: +[\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}+.
619
+ # * Label values must be between 0 and 63 characters long and must conform to
620
+ # the regular expression: +[\p{Ll}\p{Lo}\p{N}_-]{0,63}+.
621
+ # * No more than 64 labels can be associated with a given resource.
622
+ # * Keys and values must both be under 128 bytes.
623
+ # @param state [Google::Bigtable::Admin::V2::Instance::State]
624
+ # (+OutputOnly+)
625
+ # The current state of the instance.
626
+ # @param options [Google::Gax::CallOptions]
627
+ # Overrides the default settings for this call, e.g, timeout,
628
+ # retries, etc.
629
+ # @yield [result, operation] Access the result along with the RPC operation
630
+ # @yieldparam result [Google::Bigtable::Admin::V2::Instance]
631
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
632
+ # @return [Google::Bigtable::Admin::V2::Instance]
633
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
634
+ # @example
635
+ # require "google/cloud/bigtable/admin"
636
+ #
637
+ # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
638
+ # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
639
+ #
640
+ # # TODO: Initialize +display_name+:
641
+ # display_name = ''
642
+ #
643
+ # # TODO: Initialize +type+:
644
+ # type = :TYPE_UNSPECIFIED
645
+ #
646
+ # # TODO: Initialize +labels+:
647
+ # labels = {}
648
+ # response = bigtable_instance_admin_client.update_instance(formatted_name, display_name, type, labels)
649
+
650
+ def update_instance \
651
+ name,
652
+ display_name,
653
+ type,
654
+ labels,
655
+ state: nil,
656
+ options: nil,
657
+ &block
658
+ req = {
659
+ name: name,
660
+ display_name: display_name,
661
+ type: type,
662
+ labels: labels,
663
+ state: state
664
+ }.delete_if { |_, v| v.nil? }
665
+ req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::Instance)
666
+ @update_instance.call(req, options, &block)
667
+ end
668
+
669
+ # Partially updates an instance within a project.
670
+ #
671
+ # @param instance [Google::Bigtable::Admin::V2::Instance | Hash]
672
+ # The Instance which will (partially) replace the current value.
673
+ # A hash of the same form as `Google::Bigtable::Admin::V2::Instance`
674
+ # can also be provided.
675
+ # @param update_mask [Google::Protobuf::FieldMask | Hash]
676
+ # The subset of Instance fields which should be replaced.
677
+ # Must be explicitly set.
678
+ # A hash of the same form as `Google::Protobuf::FieldMask`
679
+ # can also be provided.
680
+ # @param options [Google::Gax::CallOptions]
681
+ # Overrides the default settings for this call, e.g, timeout,
682
+ # retries, etc.
683
+ # @return [Google::Gax::Operation]
684
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
685
+ # @example
686
+ # require "google/cloud/bigtable/admin"
687
+ #
688
+ # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
689
+ #
690
+ # # TODO: Initialize +instance+:
691
+ # instance = {}
692
+ #
693
+ # # TODO: Initialize +update_mask+:
694
+ # update_mask = {}
695
+ #
696
+ # # Register a callback during the method call.
697
+ # operation = bigtable_instance_admin_client.partial_update_instance(instance, update_mask) do |op|
698
+ # raise op.results.message if op.error?
699
+ # op_results = op.results
700
+ # # Process the results.
701
+ #
702
+ # metadata = op.metadata
703
+ # # Process the metadata.
704
+ # end
705
+ #
706
+ # # Or use the return value to register a callback.
707
+ # operation.on_done do |op|
708
+ # raise op.results.message if op.error?
709
+ # op_results = op.results
710
+ # # Process the results.
711
+ #
712
+ # metadata = op.metadata
713
+ # # Process the metadata.
714
+ # end
715
+ #
716
+ # # Manually reload the operation.
717
+ # operation.reload!
718
+ #
719
+ # # Or block until the operation completes, triggering callbacks on
720
+ # # completion.
721
+ # operation.wait_until_done!
722
+
723
+ def partial_update_instance \
724
+ instance,
725
+ update_mask,
726
+ options: nil
727
+ req = {
728
+ instance: instance,
729
+ update_mask: update_mask
730
+ }.delete_if { |_, v| v.nil? }
731
+ req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::PartialUpdateInstanceRequest)
732
+ operation = Google::Gax::Operation.new(
733
+ @partial_update_instance.call(req, options),
734
+ @operations_client,
735
+ Google::Bigtable::Admin::V2::Instance,
736
+ Google::Bigtable::Admin::V2::UpdateInstanceMetadata,
737
+ call_options: options
738
+ )
739
+ operation.on_done { |operation| yield(operation) } if block_given?
740
+ operation
741
+ end
742
+
743
+ # Delete an instance from a project.
744
+ #
745
+ # @param name [String]
746
+ # The unique name of the instance to be deleted.
747
+ # Values are of the form +projects/<project>/instances/<instance>+.
748
+ # @param options [Google::Gax::CallOptions]
749
+ # Overrides the default settings for this call, e.g, timeout,
750
+ # retries, etc.
751
+ # @yield [result, operation] Access the result along with the RPC operation
752
+ # @yieldparam result []
753
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
754
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
755
+ # @example
756
+ # require "google/cloud/bigtable/admin"
757
+ #
758
+ # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
759
+ # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
760
+ # bigtable_instance_admin_client.delete_instance(formatted_name)
761
+
762
+ def delete_instance \
763
+ name,
764
+ options: nil,
765
+ &block
766
+ req = {
767
+ name: name
768
+ }.delete_if { |_, v| v.nil? }
769
+ req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::DeleteInstanceRequest)
770
+ @delete_instance.call(req, options, &block)
771
+ nil
772
+ end
773
+
774
+ # Creates a cluster within an instance.
775
+ #
776
+ # @param parent [String]
777
+ # The unique name of the instance in which to create the new cluster.
778
+ # Values are of the form
779
+ # +projects/<project>/instances/<instance>+.
780
+ # @param cluster_id [String]
781
+ # The ID to be used when referring to the new cluster within its instance,
782
+ # e.g., just +mycluster+ rather than
783
+ # +projects/myproject/instances/myinstance/clusters/mycluster+.
784
+ # @param cluster [Google::Bigtable::Admin::V2::Cluster | Hash]
785
+ # The cluster to be created.
786
+ # Fields marked +OutputOnly+ must be left blank.
787
+ # A hash of the same form as `Google::Bigtable::Admin::V2::Cluster`
788
+ # can also be provided.
789
+ # @param options [Google::Gax::CallOptions]
790
+ # Overrides the default settings for this call, e.g, timeout,
791
+ # retries, etc.
792
+ # @return [Google::Gax::Operation]
793
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
794
+ # @example
795
+ # require "google/cloud/bigtable/admin"
796
+ #
797
+ # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
798
+ # formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
799
+ #
800
+ # # TODO: Initialize +cluster_id+:
801
+ # cluster_id = ''
802
+ #
803
+ # # TODO: Initialize +cluster+:
804
+ # cluster = {}
805
+ #
806
+ # # Register a callback during the method call.
807
+ # operation = bigtable_instance_admin_client.create_cluster(formatted_parent, cluster_id, cluster) do |op|
808
+ # raise op.results.message if op.error?
809
+ # op_results = op.results
810
+ # # Process the results.
811
+ #
812
+ # metadata = op.metadata
813
+ # # Process the metadata.
814
+ # end
815
+ #
816
+ # # Or use the return value to register a callback.
817
+ # operation.on_done do |op|
818
+ # raise op.results.message if op.error?
819
+ # op_results = op.results
820
+ # # Process the results.
821
+ #
822
+ # metadata = op.metadata
823
+ # # Process the metadata.
824
+ # end
825
+ #
826
+ # # Manually reload the operation.
827
+ # operation.reload!
828
+ #
829
+ # # Or block until the operation completes, triggering callbacks on
830
+ # # completion.
831
+ # operation.wait_until_done!
832
+
833
+ def create_cluster \
834
+ parent,
835
+ cluster_id,
836
+ cluster,
837
+ options: nil
838
+ req = {
839
+ parent: parent,
840
+ cluster_id: cluster_id,
841
+ cluster: cluster
842
+ }.delete_if { |_, v| v.nil? }
843
+ req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::CreateClusterRequest)
844
+ operation = Google::Gax::Operation.new(
845
+ @create_cluster.call(req, options),
846
+ @operations_client,
847
+ Google::Bigtable::Admin::V2::Cluster,
848
+ Google::Bigtable::Admin::V2::CreateClusterMetadata,
849
+ call_options: options
850
+ )
851
+ operation.on_done { |operation| yield(operation) } if block_given?
852
+ operation
853
+ end
854
+
855
+ # Gets information about a cluster.
856
+ #
857
+ # @param name [String]
858
+ # The unique name of the requested cluster. Values are of the form
859
+ # +projects/<project>/instances/<instance>/clusters/<cluster>+.
860
+ # @param options [Google::Gax::CallOptions]
861
+ # Overrides the default settings for this call, e.g, timeout,
862
+ # retries, etc.
863
+ # @yield [result, operation] Access the result along with the RPC operation
864
+ # @yieldparam result [Google::Bigtable::Admin::V2::Cluster]
865
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
866
+ # @return [Google::Bigtable::Admin::V2::Cluster]
867
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
868
+ # @example
869
+ # require "google/cloud/bigtable/admin"
870
+ #
871
+ # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
872
+ # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.cluster_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]")
873
+ # response = bigtable_instance_admin_client.get_cluster(formatted_name)
874
+
875
+ def get_cluster \
876
+ name,
877
+ options: nil,
878
+ &block
879
+ req = {
880
+ name: name
881
+ }.delete_if { |_, v| v.nil? }
882
+ req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::GetClusterRequest)
883
+ @get_cluster.call(req, options, &block)
884
+ end
885
+
886
+ # Lists information about clusters in an instance.
887
+ #
888
+ # @param parent [String]
889
+ # The unique name of the instance for which a list of clusters is requested.
890
+ # Values are of the form +projects/<project>/instances/<instance>+.
891
+ # Use +<instance> = '-'+ to list Clusters for all Instances in a project,
892
+ # e.g., +projects/myproject/instances/-+.
893
+ # @param page_token [String]
894
+ # The value of +next_page_token+ returned by a previous call.
895
+ # @param options [Google::Gax::CallOptions]
896
+ # Overrides the default settings for this call, e.g, timeout,
897
+ # retries, etc.
898
+ # @yield [result, operation] Access the result along with the RPC operation
899
+ # @yieldparam result [Google::Bigtable::Admin::V2::ListClustersResponse]
900
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
901
+ # @return [Google::Bigtable::Admin::V2::ListClustersResponse]
902
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
903
+ # @example
904
+ # require "google/cloud/bigtable/admin"
905
+ #
906
+ # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
907
+ # formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
908
+ # response = bigtable_instance_admin_client.list_clusters(formatted_parent)
909
+
910
+ def list_clusters \
911
+ parent,
912
+ page_token: nil,
913
+ options: nil,
914
+ &block
915
+ req = {
916
+ parent: parent,
917
+ page_token: page_token
918
+ }.delete_if { |_, v| v.nil? }
919
+ req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::ListClustersRequest)
920
+ @list_clusters.call(req, options, &block)
921
+ end
922
+
923
+ # Updates a cluster within an instance.
924
+ #
925
+ # @param name [String]
926
+ # (+OutputOnly+)
927
+ # The unique name of the cluster. Values are of the form
928
+ # +projects/<project>/instances/<instance>/clusters/[a-z][-a-z0-9]*+.
929
+ # @param serve_nodes [Integer]
930
+ # The number of nodes allocated to this cluster. More nodes enable higher
931
+ # throughput and more consistent performance.
932
+ # @param location [String]
933
+ # (+CreationOnly+)
934
+ # The location where this cluster's nodes and storage reside. For best
935
+ # performance, clients should be located as close as possible to this
936
+ # cluster. Currently only zones are supported, so values should be of the
937
+ # form +projects/<project>/locations/<zone>+.
938
+ # @param state [Google::Bigtable::Admin::V2::Cluster::State]
939
+ # (+OutputOnly+)
940
+ # The current state of the cluster.
941
+ # @param default_storage_type [Google::Bigtable::Admin::V2::StorageType]
942
+ # (+CreationOnly+)
943
+ # The type of storage used by this cluster to serve its
944
+ # parent instance's tables, unless explicitly overridden.
945
+ # @param options [Google::Gax::CallOptions]
946
+ # Overrides the default settings for this call, e.g, timeout,
947
+ # retries, etc.
948
+ # @return [Google::Gax::Operation]
949
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
950
+ # @example
951
+ # require "google/cloud/bigtable/admin"
952
+ #
953
+ # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
954
+ # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.cluster_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]")
955
+ #
956
+ # # TODO: Initialize +serve_nodes+:
957
+ # serve_nodes = 0
958
+ #
959
+ # # Register a callback during the method call.
960
+ # operation = bigtable_instance_admin_client.update_cluster(formatted_name, serve_nodes) do |op|
961
+ # raise op.results.message if op.error?
962
+ # op_results = op.results
963
+ # # Process the results.
964
+ #
965
+ # metadata = op.metadata
966
+ # # Process the metadata.
967
+ # end
968
+ #
969
+ # # Or use the return value to register a callback.
970
+ # operation.on_done do |op|
971
+ # raise op.results.message if op.error?
972
+ # op_results = op.results
973
+ # # Process the results.
974
+ #
975
+ # metadata = op.metadata
976
+ # # Process the metadata.
977
+ # end
978
+ #
979
+ # # Manually reload the operation.
980
+ # operation.reload!
981
+ #
982
+ # # Or block until the operation completes, triggering callbacks on
983
+ # # completion.
984
+ # operation.wait_until_done!
985
+
986
+ def update_cluster \
987
+ name,
988
+ serve_nodes,
989
+ location: nil,
990
+ state: nil,
991
+ default_storage_type: nil,
992
+ options: nil
993
+ req = {
994
+ name: name,
995
+ serve_nodes: serve_nodes,
996
+ location: location,
997
+ state: state,
998
+ default_storage_type: default_storage_type
999
+ }.delete_if { |_, v| v.nil? }
1000
+ req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::Cluster)
1001
+ operation = Google::Gax::Operation.new(
1002
+ @update_cluster.call(req, options),
1003
+ @operations_client,
1004
+ Google::Bigtable::Admin::V2::Cluster,
1005
+ Google::Bigtable::Admin::V2::UpdateClusterMetadata,
1006
+ call_options: options
1007
+ )
1008
+ operation.on_done { |operation| yield(operation) } if block_given?
1009
+ operation
1010
+ end
1011
+
1012
+ # Deletes a cluster from an instance.
1013
+ #
1014
+ # @param name [String]
1015
+ # The unique name of the cluster to be deleted. Values are of the form
1016
+ # +projects/<project>/instances/<instance>/clusters/<cluster>+.
1017
+ # @param options [Google::Gax::CallOptions]
1018
+ # Overrides the default settings for this call, e.g, timeout,
1019
+ # retries, etc.
1020
+ # @yield [result, operation] Access the result along with the RPC operation
1021
+ # @yieldparam result []
1022
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
1023
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1024
+ # @example
1025
+ # require "google/cloud/bigtable/admin"
1026
+ #
1027
+ # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
1028
+ # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.cluster_path("[PROJECT]", "[INSTANCE]", "[CLUSTER]")
1029
+ # bigtable_instance_admin_client.delete_cluster(formatted_name)
1030
+
1031
+ def delete_cluster \
1032
+ name,
1033
+ options: nil,
1034
+ &block
1035
+ req = {
1036
+ name: name
1037
+ }.delete_if { |_, v| v.nil? }
1038
+ req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::DeleteClusterRequest)
1039
+ @delete_cluster.call(req, options, &block)
1040
+ nil
1041
+ end
1042
+
1043
+ # Creates an app profile within an instance.
1044
+ #
1045
+ # @param parent [String]
1046
+ # The unique name of the instance in which to create the new app profile.
1047
+ # Values are of the form
1048
+ # +projects/<project>/instances/<instance>+.
1049
+ # @param app_profile_id [String]
1050
+ # The ID to be used when referring to the new app profile within its
1051
+ # instance, e.g., just +myprofile+ rather than
1052
+ # +projects/myproject/instances/myinstance/appProfiles/myprofile+.
1053
+ # @param app_profile [Google::Bigtable::Admin::V2::AppProfile | Hash]
1054
+ # The app profile to be created.
1055
+ # Fields marked +OutputOnly+ will be ignored.
1056
+ # A hash of the same form as `Google::Bigtable::Admin::V2::AppProfile`
1057
+ # can also be provided.
1058
+ # @param ignore_warnings [true, false]
1059
+ # If true, ignore safety checks when creating the app profile.
1060
+ # @param options [Google::Gax::CallOptions]
1061
+ # Overrides the default settings for this call, e.g, timeout,
1062
+ # retries, etc.
1063
+ # @yield [result, operation] Access the result along with the RPC operation
1064
+ # @yieldparam result [Google::Bigtable::Admin::V2::AppProfile]
1065
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
1066
+ # @return [Google::Bigtable::Admin::V2::AppProfile]
1067
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1068
+ # @example
1069
+ # require "google/cloud/bigtable/admin"
1070
+ #
1071
+ # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
1072
+ # formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
1073
+ #
1074
+ # # TODO: Initialize +app_profile_id+:
1075
+ # app_profile_id = ''
1076
+ #
1077
+ # # TODO: Initialize +app_profile+:
1078
+ # app_profile = {}
1079
+ # response = bigtable_instance_admin_client.create_app_profile(formatted_parent, app_profile_id, app_profile)
1080
+
1081
+ def create_app_profile \
1082
+ parent,
1083
+ app_profile_id,
1084
+ app_profile,
1085
+ ignore_warnings: nil,
1086
+ options: nil,
1087
+ &block
1088
+ req = {
1089
+ parent: parent,
1090
+ app_profile_id: app_profile_id,
1091
+ app_profile: app_profile,
1092
+ ignore_warnings: ignore_warnings
1093
+ }.delete_if { |_, v| v.nil? }
1094
+ req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::CreateAppProfileRequest)
1095
+ @create_app_profile.call(req, options, &block)
1096
+ end
1097
+
1098
+ # Gets information about an app profile.
1099
+ #
1100
+ # @param name [String]
1101
+ # The unique name of the requested app profile. Values are of the form
1102
+ # +projects/<project>/instances/<instance>/appProfiles/<app_profile>+.
1103
+ # @param options [Google::Gax::CallOptions]
1104
+ # Overrides the default settings for this call, e.g, timeout,
1105
+ # retries, etc.
1106
+ # @yield [result, operation] Access the result along with the RPC operation
1107
+ # @yieldparam result [Google::Bigtable::Admin::V2::AppProfile]
1108
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
1109
+ # @return [Google::Bigtable::Admin::V2::AppProfile]
1110
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1111
+ # @example
1112
+ # require "google/cloud/bigtable/admin"
1113
+ #
1114
+ # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
1115
+ # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.app_profile_path("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]")
1116
+ # response = bigtable_instance_admin_client.get_app_profile(formatted_name)
1117
+
1118
+ def get_app_profile \
1119
+ name,
1120
+ options: nil,
1121
+ &block
1122
+ req = {
1123
+ name: name
1124
+ }.delete_if { |_, v| v.nil? }
1125
+ req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::GetAppProfileRequest)
1126
+ @get_app_profile.call(req, options, &block)
1127
+ end
1128
+
1129
+ # Lists information about app profiles in an instance.
1130
+ #
1131
+ # @param parent [String]
1132
+ # The unique name of the instance for which a list of app profiles is
1133
+ # requested. Values are of the form
1134
+ # +projects/<project>/instances/<instance>+.
1135
+ # @param options [Google::Gax::CallOptions]
1136
+ # Overrides the default settings for this call, e.g, timeout,
1137
+ # retries, etc.
1138
+ # @yield [result, operation] Access the result along with the RPC operation
1139
+ # @yieldparam result [Google::Gax::PagedEnumerable<Google::Bigtable::Admin::V2::AppProfile>]
1140
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
1141
+ # @return [Google::Gax::PagedEnumerable<Google::Bigtable::Admin::V2::AppProfile>]
1142
+ # An enumerable of Google::Bigtable::Admin::V2::AppProfile instances.
1143
+ # See Google::Gax::PagedEnumerable documentation for other
1144
+ # operations such as per-page iteration or access to the response
1145
+ # object.
1146
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1147
+ # @example
1148
+ # require "google/cloud/bigtable/admin"
1149
+ #
1150
+ # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
1151
+ # formatted_parent = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
1152
+ #
1153
+ # # Iterate over all results.
1154
+ # bigtable_instance_admin_client.list_app_profiles(formatted_parent).each do |element|
1155
+ # # Process element.
1156
+ # end
1157
+ #
1158
+ # # Or iterate over results one page at a time.
1159
+ # bigtable_instance_admin_client.list_app_profiles(formatted_parent).each_page do |page|
1160
+ # # Process each page at a time.
1161
+ # page.each do |element|
1162
+ # # Process element.
1163
+ # end
1164
+ # end
1165
+
1166
+ def list_app_profiles \
1167
+ parent,
1168
+ options: nil,
1169
+ &block
1170
+ req = {
1171
+ parent: parent
1172
+ }.delete_if { |_, v| v.nil? }
1173
+ req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::ListAppProfilesRequest)
1174
+ @list_app_profiles.call(req, options, &block)
1175
+ end
1176
+
1177
+ # Updates an app profile within an instance.
1178
+ #
1179
+ # @param app_profile [Google::Bigtable::Admin::V2::AppProfile | Hash]
1180
+ # The app profile which will (partially) replace the current value.
1181
+ # A hash of the same form as `Google::Bigtable::Admin::V2::AppProfile`
1182
+ # can also be provided.
1183
+ # @param update_mask [Google::Protobuf::FieldMask | Hash]
1184
+ # The subset of app profile fields which should be replaced.
1185
+ # If unset, all fields will be replaced.
1186
+ # A hash of the same form as `Google::Protobuf::FieldMask`
1187
+ # can also be provided.
1188
+ # @param ignore_warnings [true, false]
1189
+ # If true, ignore safety checks when updating the app profile.
1190
+ # @param options [Google::Gax::CallOptions]
1191
+ # Overrides the default settings for this call, e.g, timeout,
1192
+ # retries, etc.
1193
+ # @return [Google::Gax::Operation]
1194
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1195
+ # @example
1196
+ # require "google/cloud/bigtable/admin"
1197
+ #
1198
+ # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
1199
+ #
1200
+ # # TODO: Initialize +app_profile+:
1201
+ # app_profile = {}
1202
+ #
1203
+ # # TODO: Initialize +update_mask+:
1204
+ # update_mask = {}
1205
+ #
1206
+ # # Register a callback during the method call.
1207
+ # operation = bigtable_instance_admin_client.update_app_profile(app_profile, update_mask) do |op|
1208
+ # raise op.results.message if op.error?
1209
+ # op_results = op.results
1210
+ # # Process the results.
1211
+ #
1212
+ # metadata = op.metadata
1213
+ # # Process the metadata.
1214
+ # end
1215
+ #
1216
+ # # Or use the return value to register a callback.
1217
+ # operation.on_done do |op|
1218
+ # raise op.results.message if op.error?
1219
+ # op_results = op.results
1220
+ # # Process the results.
1221
+ #
1222
+ # metadata = op.metadata
1223
+ # # Process the metadata.
1224
+ # end
1225
+ #
1226
+ # # Manually reload the operation.
1227
+ # operation.reload!
1228
+ #
1229
+ # # Or block until the operation completes, triggering callbacks on
1230
+ # # completion.
1231
+ # operation.wait_until_done!
1232
+
1233
+ def update_app_profile \
1234
+ app_profile,
1235
+ update_mask,
1236
+ ignore_warnings: nil,
1237
+ options: nil
1238
+ req = {
1239
+ app_profile: app_profile,
1240
+ update_mask: update_mask,
1241
+ ignore_warnings: ignore_warnings
1242
+ }.delete_if { |_, v| v.nil? }
1243
+ req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::UpdateAppProfileRequest)
1244
+ operation = Google::Gax::Operation.new(
1245
+ @update_app_profile.call(req, options),
1246
+ @operations_client,
1247
+ Google::Bigtable::Admin::V2::AppProfile,
1248
+ Google::Bigtable::Admin::V2::UpdateAppProfileMetadata,
1249
+ call_options: options
1250
+ )
1251
+ operation.on_done { |operation| yield(operation) } if block_given?
1252
+ operation
1253
+ end
1254
+
1255
+ # Deletes an app profile from an instance.
1256
+ #
1257
+ # @param name [String]
1258
+ # The unique name of the app profile to be deleted. Values are of the form
1259
+ # +projects/<project>/instances/<instance>/appProfiles/<app_profile>+.
1260
+ # @param ignore_warnings [true, false]
1261
+ # If true, ignore safety checks when deleting the app profile.
1262
+ # @param options [Google::Gax::CallOptions]
1263
+ # Overrides the default settings for this call, e.g, timeout,
1264
+ # retries, etc.
1265
+ # @yield [result, operation] Access the result along with the RPC operation
1266
+ # @yieldparam result []
1267
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
1268
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1269
+ # @example
1270
+ # require "google/cloud/bigtable/admin"
1271
+ #
1272
+ # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
1273
+ # formatted_name = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.app_profile_path("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]")
1274
+ #
1275
+ # # TODO: Initialize +ignore_warnings+:
1276
+ # ignore_warnings = false
1277
+ # bigtable_instance_admin_client.delete_app_profile(formatted_name, ignore_warnings)
1278
+
1279
+ def delete_app_profile \
1280
+ name,
1281
+ ignore_warnings,
1282
+ options: nil,
1283
+ &block
1284
+ req = {
1285
+ name: name,
1286
+ ignore_warnings: ignore_warnings
1287
+ }.delete_if { |_, v| v.nil? }
1288
+ req = Google::Gax::to_proto(req, Google::Bigtable::Admin::V2::DeleteAppProfileRequest)
1289
+ @delete_app_profile.call(req, options, &block)
1290
+ nil
1291
+ end
1292
+
1293
+ # Gets the access control policy for an instance resource. Returns an empty
1294
+ # policy if an instance exists but does not have a policy set.
1295
+ #
1296
+ # @param resource [String]
1297
+ # REQUIRED: The resource for which the policy is being requested.
1298
+ # +resource+ is usually specified as a path. For example, a Project
1299
+ # resource is specified as +projects/{project}+.
1300
+ # @param options [Google::Gax::CallOptions]
1301
+ # Overrides the default settings for this call, e.g, timeout,
1302
+ # retries, etc.
1303
+ # @yield [result, operation] Access the result along with the RPC operation
1304
+ # @yieldparam result [Google::Iam::V1::Policy]
1305
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
1306
+ # @return [Google::Iam::V1::Policy]
1307
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1308
+ # @example
1309
+ # require "google/cloud/bigtable/admin"
1310
+ #
1311
+ # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
1312
+ # formatted_resource = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
1313
+ # response = bigtable_instance_admin_client.get_iam_policy(formatted_resource)
1314
+
1315
+ def get_iam_policy \
1316
+ resource,
1317
+ options: nil,
1318
+ &block
1319
+ req = {
1320
+ resource: resource
1321
+ }.delete_if { |_, v| v.nil? }
1322
+ req = Google::Gax::to_proto(req, Google::Iam::V1::GetIamPolicyRequest)
1323
+ @get_iam_policy.call(req, options, &block)
1324
+ end
1325
+
1326
+ # Sets the access control policy on an instance resource. Replaces any
1327
+ # existing policy.
1328
+ #
1329
+ # @param resource [String]
1330
+ # REQUIRED: The resource for which the policy is being specified.
1331
+ # +resource+ is usually specified as a path. For example, a Project
1332
+ # resource is specified as +projects/{project}+.
1333
+ # @param policy [Google::Iam::V1::Policy | Hash]
1334
+ # REQUIRED: The complete policy to be applied to the +resource+. The size of
1335
+ # the policy is limited to a few 10s of KB. An empty policy is a
1336
+ # valid policy but certain Cloud Platform services (such as Projects)
1337
+ # might reject them.
1338
+ # A hash of the same form as `Google::Iam::V1::Policy`
1339
+ # can also be provided.
1340
+ # @param options [Google::Gax::CallOptions]
1341
+ # Overrides the default settings for this call, e.g, timeout,
1342
+ # retries, etc.
1343
+ # @yield [result, operation] Access the result along with the RPC operation
1344
+ # @yieldparam result [Google::Iam::V1::Policy]
1345
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
1346
+ # @return [Google::Iam::V1::Policy]
1347
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1348
+ # @example
1349
+ # require "google/cloud/bigtable/admin"
1350
+ #
1351
+ # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
1352
+ # formatted_resource = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
1353
+ #
1354
+ # # TODO: Initialize +policy+:
1355
+ # policy = {}
1356
+ # response = bigtable_instance_admin_client.set_iam_policy(formatted_resource, policy)
1357
+
1358
+ def set_iam_policy \
1359
+ resource,
1360
+ policy,
1361
+ options: nil,
1362
+ &block
1363
+ req = {
1364
+ resource: resource,
1365
+ policy: policy
1366
+ }.delete_if { |_, v| v.nil? }
1367
+ req = Google::Gax::to_proto(req, Google::Iam::V1::SetIamPolicyRequest)
1368
+ @set_iam_policy.call(req, options, &block)
1369
+ end
1370
+
1371
+ # Returns permissions that the caller has on the specified instance resource.
1372
+ #
1373
+ # @param resource [String]
1374
+ # REQUIRED: The resource for which the policy detail is being requested.
1375
+ # +resource+ is usually specified as a path. For example, a Project
1376
+ # resource is specified as +projects/{project}+.
1377
+ # @param permissions [Array<String>]
1378
+ # The set of permissions to check for the +resource+. Permissions with
1379
+ # wildcards (such as '*' or 'storage.*') are not allowed. For more
1380
+ # information see
1381
+ # [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
1382
+ # @param options [Google::Gax::CallOptions]
1383
+ # Overrides the default settings for this call, e.g, timeout,
1384
+ # retries, etc.
1385
+ # @yield [result, operation] Access the result along with the RPC operation
1386
+ # @yieldparam result [Google::Iam::V1::TestIamPermissionsResponse]
1387
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
1388
+ # @return [Google::Iam::V1::TestIamPermissionsResponse]
1389
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
1390
+ # @example
1391
+ # require "google/cloud/bigtable/admin"
1392
+ #
1393
+ # bigtable_instance_admin_client = Google::Cloud::Bigtable::Admin::BigtableInstanceAdmin.new(version: :v2)
1394
+ # formatted_resource = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.instance_path("[PROJECT]", "[INSTANCE]")
1395
+ #
1396
+ # # TODO: Initialize +permissions+:
1397
+ # permissions = []
1398
+ # response = bigtable_instance_admin_client.test_iam_permissions(formatted_resource, permissions)
1399
+
1400
+ def test_iam_permissions \
1401
+ resource,
1402
+ permissions,
1403
+ options: nil,
1404
+ &block
1405
+ req = {
1406
+ resource: resource,
1407
+ permissions: permissions
1408
+ }.delete_if { |_, v| v.nil? }
1409
+ req = Google::Gax::to_proto(req, Google::Iam::V1::TestIamPermissionsRequest)
1410
+ @test_iam_permissions.call(req, options, &block)
1411
+ end
1412
+ end
1413
+ end
1414
+ end
1415
+ end
1416
+ end
1417
+ end