google-cloud-bigtable 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +19 -0
- data/AUTHENTICATION.md +177 -0
- data/CHANGELOG.md +223 -0
- data/CODE_OF_CONDUCT.md +40 -0
- data/CONTRIBUTING.md +188 -0
- data/EMULATOR.md +30 -0
- data/LICENSE +201 -0
- data/LOGGING.md +32 -0
- data/OVERVIEW.md +400 -0
- data/TROUBLESHOOTING.md +31 -0
- data/lib/google-cloud-bigtable.rb +171 -0
- data/lib/google/bigtable/admin/v2/bigtable_instance_admin_pb.rb +145 -0
- data/lib/google/bigtable/admin/v2/bigtable_instance_admin_services_pb.rb +90 -0
- data/lib/google/bigtable/admin/v2/bigtable_table_admin_pb.rb +208 -0
- data/lib/google/bigtable/admin/v2/bigtable_table_admin_services_pb.rb +154 -0
- data/lib/google/bigtable/admin/v2/common_pb.rb +30 -0
- data/lib/google/bigtable/admin/v2/instance_pb.rb +74 -0
- data/lib/google/bigtable/admin/v2/table_pb.rb +127 -0
- data/lib/google/bigtable/v2/bigtable_pb.rb +113 -0
- data/lib/google/bigtable/v2/bigtable_services_pb.rb +68 -0
- data/lib/google/bigtable/v2/data_pb.rb +156 -0
- data/lib/google/cloud/bigtable.rb +184 -0
- data/lib/google/cloud/bigtable/admin.rb +202 -0
- data/lib/google/cloud/bigtable/admin/credentials.rb +27 -0
- data/lib/google/cloud/bigtable/admin/v2.rb +223 -0
- data/lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb +1451 -0
- data/lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client_config.json +139 -0
- data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb +1734 -0
- data/lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client_config.json +163 -0
- data/lib/google/cloud/bigtable/admin/v2/credentials.rb +51 -0
- data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/bigtable_instance_admin.rb +297 -0
- data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/bigtable_table_admin.rb +587 -0
- data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/instance.rb +193 -0
- data/lib/google/cloud/bigtable/admin/v2/doc/google/bigtable/admin/v2/table.rb +303 -0
- data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/iam_policy.rb +64 -0
- data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/options.rb +33 -0
- data/lib/google/cloud/bigtable/admin/v2/doc/google/iam/v1/policy.rb +151 -0
- data/lib/google/cloud/bigtable/admin/v2/doc/google/longrunning/operations.rb +51 -0
- data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/any.rb +131 -0
- data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/duration.rb +91 -0
- data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/empty.rb +29 -0
- data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/field_mask.rb +222 -0
- data/lib/google/cloud/bigtable/admin/v2/doc/google/protobuf/timestamp.rb +113 -0
- data/lib/google/cloud/bigtable/admin/v2/doc/google/rpc/status.rb +39 -0
- data/lib/google/cloud/bigtable/admin/v2/doc/google/type/expr.rb +45 -0
- data/lib/google/cloud/bigtable/app_profile.rb +439 -0
- data/lib/google/cloud/bigtable/app_profile/job.rb +99 -0
- data/lib/google/cloud/bigtable/app_profile/list.rb +165 -0
- data/lib/google/cloud/bigtable/backup.rb +324 -0
- data/lib/google/cloud/bigtable/backup/job.rb +87 -0
- data/lib/google/cloud/bigtable/backup/list.rb +167 -0
- data/lib/google/cloud/bigtable/chunk_processor.rb +241 -0
- data/lib/google/cloud/bigtable/cluster.rb +390 -0
- data/lib/google/cloud/bigtable/cluster/job.rb +88 -0
- data/lib/google/cloud/bigtable/cluster/list.rb +171 -0
- data/lib/google/cloud/bigtable/column_family.rb +73 -0
- data/lib/google/cloud/bigtable/column_family_map.rb +426 -0
- data/lib/google/cloud/bigtable/column_range.rb +194 -0
- data/lib/google/cloud/bigtable/convert.rb +83 -0
- data/lib/google/cloud/bigtable/credentials.rb +25 -0
- data/lib/google/cloud/bigtable/errors.rb +38 -0
- data/lib/google/cloud/bigtable/gc_rule.rb +334 -0
- data/lib/google/cloud/bigtable/instance.rb +935 -0
- data/lib/google/cloud/bigtable/instance/cluster_map.rb +74 -0
- data/lib/google/cloud/bigtable/instance/job.rb +98 -0
- data/lib/google/cloud/bigtable/instance/list.rb +164 -0
- data/lib/google/cloud/bigtable/longrunning_job.rb +122 -0
- data/lib/google/cloud/bigtable/mutation_entry.rb +256 -0
- data/lib/google/cloud/bigtable/mutation_operations.rb +357 -0
- data/lib/google/cloud/bigtable/policy.rb +167 -0
- data/lib/google/cloud/bigtable/project.rb +471 -0
- data/lib/google/cloud/bigtable/read_modify_write_rule.rb +134 -0
- data/lib/google/cloud/bigtable/read_operations.rb +328 -0
- data/lib/google/cloud/bigtable/routing_policy.rb +172 -0
- data/lib/google/cloud/bigtable/row.rb +136 -0
- data/lib/google/cloud/bigtable/row_filter.rb +639 -0
- data/lib/google/cloud/bigtable/row_filter/chain_filter.rb +590 -0
- data/lib/google/cloud/bigtable/row_filter/condition_filter.rb +114 -0
- data/lib/google/cloud/bigtable/row_filter/interleave_filter.rb +621 -0
- data/lib/google/cloud/bigtable/row_filter/simple_filter.rb +287 -0
- data/lib/google/cloud/bigtable/row_range.rb +179 -0
- data/lib/google/cloud/bigtable/rows_mutator.rb +113 -0
- data/lib/google/cloud/bigtable/rows_reader.rb +200 -0
- data/lib/google/cloud/bigtable/sample_row_key.rb +85 -0
- data/lib/google/cloud/bigtable/service.rb +913 -0
- data/lib/google/cloud/bigtable/status.rb +76 -0
- data/lib/google/cloud/bigtable/table.rb +686 -0
- data/lib/google/cloud/bigtable/table/cluster_state.rb +125 -0
- data/lib/google/cloud/bigtable/table/list.rb +154 -0
- data/lib/google/cloud/bigtable/table/restore_job.rb +117 -0
- data/lib/google/cloud/bigtable/v2.rb +146 -0
- data/lib/google/cloud/bigtable/v2/bigtable_client.rb +591 -0
- data/lib/google/cloud/bigtable/v2/bigtable_client_config.json +83 -0
- data/lib/google/cloud/bigtable/v2/credentials.rb +46 -0
- data/lib/google/cloud/bigtable/v2/doc/google/bigtable/v2/bigtable.rb +290 -0
- data/lib/google/cloud/bigtable/v2/doc/google/bigtable/v2/data.rb +493 -0
- data/lib/google/cloud/bigtable/v2/doc/google/protobuf/any.rb +131 -0
- data/lib/google/cloud/bigtable/v2/doc/google/protobuf/wrappers.rb +34 -0
- data/lib/google/cloud/bigtable/v2/doc/google/rpc/status.rb +39 -0
- data/lib/google/cloud/bigtable/value_range.rb +181 -0
- data/lib/google/cloud/bigtable/version.rb +22 -0
- metadata +337 -0
@@ -0,0 +1,184 @@
|
|
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
|
+
|
16
|
+
require "google-cloud-bigtable"
|
17
|
+
require "google/cloud/env"
|
18
|
+
require "google/cloud/errors"
|
19
|
+
require "google/cloud/bigtable/credentials"
|
20
|
+
require "google/cloud/bigtable/project"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
##
|
25
|
+
# Cloud Bigtable
|
26
|
+
#
|
27
|
+
# See {file:OVERVIEW.md Bigtable Overview}.
|
28
|
+
#
|
29
|
+
module Bigtable
|
30
|
+
##
|
31
|
+
# Service for managing Cloud Bigtable instances and tables and for reading from and
|
32
|
+
# writing to Bigtable tables.
|
33
|
+
#
|
34
|
+
# @param project_id [String]
|
35
|
+
# Project identifier for the Bigtable service you are connecting to.
|
36
|
+
# If not present, the default project for the credentials is used.
|
37
|
+
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel,
|
38
|
+
# GRPC::Core::ChannelCredentials, Proc]
|
39
|
+
# Provides the means for authenticating requests made by the client. This parameter can
|
40
|
+
# be one of the following types:
|
41
|
+
# `Google::Auth::Credentials` uses the properties of its represented keyfile for
|
42
|
+
# authenticating requests made by this client.
|
43
|
+
# `String` will be treated as the path to the keyfile to use to construct
|
44
|
+
# credentials for this client.
|
45
|
+
# `Hash` will be treated as the contents of a keyfile to use to construct
|
46
|
+
# credentials for this client.
|
47
|
+
# `GRPC::Core::Channel` will be used to make calls through.
|
48
|
+
# `GRPC::Core::ChannelCredentials` for the setting up the gRPC client. The channel credentials
|
49
|
+
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
50
|
+
# `Proc` will be used as an updater_proc for the gRPC channel. The proc transforms the
|
51
|
+
# metadata for requests, generally, to give OAuth credentials.
|
52
|
+
# @param [String] endpoint Override of the endpoint host name. Optional.
|
53
|
+
# If the param is nil, uses the default endpoint.
|
54
|
+
# @param [String] emulator_host Bigtable emulator host. Optional.
|
55
|
+
# If the parameter is nil, uses the value of the `emulator_host` config.
|
56
|
+
# @param scope [Array<String>]
|
57
|
+
# The OAuth 2.0 scopes controlling the set of resources and operations
|
58
|
+
# that the connection can access. See [Using OAuth 2.0 to Access Google
|
59
|
+
# APIs](https://developers.google.com/identity/protocols/OAuth2).
|
60
|
+
# The OAuth scopes for this service. This parameter is ignored if an
|
61
|
+
# updater_proc is supplied.
|
62
|
+
# @param client_config [Hash]
|
63
|
+
# A hash for call options for each method.
|
64
|
+
# See Google::Gax#construct_settings for the structure of
|
65
|
+
# this data. Falls back to the default config if not specified
|
66
|
+
# or the specified config is missing data points.
|
67
|
+
# @param timeout [Integer]
|
68
|
+
# The default timeout, in seconds, for calls made through this client. Optional.
|
69
|
+
# @return [Google::Cloud::Bigtable::Project]
|
70
|
+
#
|
71
|
+
# @example
|
72
|
+
# require "google/cloud/bigtable"
|
73
|
+
#
|
74
|
+
# client = Google::Cloud::Bigtable.new
|
75
|
+
#
|
76
|
+
def self.new project_id: nil, credentials: nil, emulator_host: nil, scope: nil, client_config: nil, endpoint: nil,
|
77
|
+
timeout: nil
|
78
|
+
project_id ||= default_project_id
|
79
|
+
scope ||= configure.scope
|
80
|
+
timeout ||= configure.timeout
|
81
|
+
client_config ||= configure.client_config
|
82
|
+
emulator_host ||= configure.emulator_host
|
83
|
+
endpoint ||= configure.endpoint
|
84
|
+
|
85
|
+
if emulator_host
|
86
|
+
return new_with_emulator project_id, emulator_host, timeout,
|
87
|
+
client_config
|
88
|
+
end
|
89
|
+
|
90
|
+
credentials = resolve_credentials credentials, scope
|
91
|
+
project_id = resolve_project_id project_id, credentials
|
92
|
+
raise ArgumentError, "project_id is missing" if project_id.empty?
|
93
|
+
|
94
|
+
service = Bigtable::Service.new(
|
95
|
+
project_id, credentials,
|
96
|
+
host: endpoint, timeout: timeout, client_config: client_config
|
97
|
+
)
|
98
|
+
Bigtable::Project.new service
|
99
|
+
end
|
100
|
+
|
101
|
+
##
|
102
|
+
# Configure the Google Cloud Bigtable library.
|
103
|
+
#
|
104
|
+
# The following Bigtable configuration parameters are supported:
|
105
|
+
#
|
106
|
+
# * `project_id` - (String) Identifier for a Bigtable project. (The
|
107
|
+
# parameter `project` is considered deprecated, but may also be used.)
|
108
|
+
# * `credentials` - (String, Hash, Google::Auth::Credentials,
|
109
|
+
# GRPC::Core::Channel, GRPC::Core::ChannelCredentials) The path to
|
110
|
+
# the keyfile as a String, the contents of the keyfile as a Hash, or a
|
111
|
+
# Google::Auth::Credentials object. (See {Bigtable::Credentials}) (The
|
112
|
+
# parameter `keyfile` is considered deprecated, but may also be used.)
|
113
|
+
# * `scope` - (String, Array<String>) The OAuth 2.0 scopes controlling
|
114
|
+
# the set of resources and operations that the connection can access.
|
115
|
+
# * `timeout` - (Integer) Default timeout to use in requests.
|
116
|
+
# * `client_config` - (Hash) A hash of values to override the default
|
117
|
+
# behavior of the API client.
|
118
|
+
# * `endpoint` - (String) Override of the endpoint host name, or `nil`
|
119
|
+
# to use the default endpoint.
|
120
|
+
#
|
121
|
+
# @return [Google::Cloud::Config] The configuration object the
|
122
|
+
# Google::Cloud::Bigtable library uses.
|
123
|
+
#
|
124
|
+
def self.configure
|
125
|
+
yield Google::Cloud.configure.bigtable if block_given?
|
126
|
+
|
127
|
+
Google::Cloud.configure.bigtable
|
128
|
+
end
|
129
|
+
|
130
|
+
# @private
|
131
|
+
# New client given an emulator host.
|
132
|
+
#
|
133
|
+
def self.new_with_emulator project_id, emulator_host, timeout,
|
134
|
+
client_config
|
135
|
+
project_id = project_id.to_s # Always cast to a string
|
136
|
+
raise ArgumentError, "project_id is missing" if project_id.empty?
|
137
|
+
|
138
|
+
Bigtable::Project.new(
|
139
|
+
Bigtable::Service.new(
|
140
|
+
project_id, :this_channel_is_insecure,
|
141
|
+
host: emulator_host, timeout: timeout,
|
142
|
+
client_config: client_config
|
143
|
+
)
|
144
|
+
)
|
145
|
+
end
|
146
|
+
|
147
|
+
# @private
|
148
|
+
# Resolve credentials
|
149
|
+
#
|
150
|
+
def self.resolve_credentials given_credentials, scope
|
151
|
+
credentials = given_credentials || default_credentials(scope: scope)
|
152
|
+
return credentials if credentials.is_a? Google::Auth::Credentials
|
153
|
+
Bigtable::Credentials.new credentials, scope: scope
|
154
|
+
end
|
155
|
+
|
156
|
+
# @private
|
157
|
+
# Resolve project.
|
158
|
+
#
|
159
|
+
def self.resolve_project_id given_project_id, credentials
|
160
|
+
project_id = given_project_id || default_project_id
|
161
|
+
project_id ||= credentials.project_id if credentials.respond_to? :project_id
|
162
|
+
project_id.to_s # Always cast to a string
|
163
|
+
end
|
164
|
+
|
165
|
+
# @private
|
166
|
+
# Default project.
|
167
|
+
#
|
168
|
+
def self.default_project_id
|
169
|
+
Google::Cloud.configure.bigtable.project_id ||
|
170
|
+
Google::Cloud.configure.project_id ||
|
171
|
+
Google::Cloud.env.project_id
|
172
|
+
end
|
173
|
+
|
174
|
+
# @private
|
175
|
+
# Default credentials.
|
176
|
+
#
|
177
|
+
def self.default_credentials scope: nil
|
178
|
+
Google::Cloud.configure.bigtable.credentials ||
|
179
|
+
Google::Cloud.configure.credentials ||
|
180
|
+
Bigtable::Credentials.default(scope: scope)
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
@@ -0,0 +1,202 @@
|
|
1
|
+
# Copyright 2020 Google LLC
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
|
16
|
+
require "google/gax"
|
17
|
+
require "pathname"
|
18
|
+
|
19
|
+
module Google
|
20
|
+
module Cloud
|
21
|
+
module Bigtable
|
22
|
+
# rubocop:disable LineLength
|
23
|
+
|
24
|
+
##
|
25
|
+
# # Ruby Client for Cloud Bigtable Admin API
|
26
|
+
#
|
27
|
+
# [Cloud Bigtable Admin API][Product Documentation]:
|
28
|
+
# Administer your Cloud Bigtable tables and instances.
|
29
|
+
# - [Product Documentation][]
|
30
|
+
#
|
31
|
+
# ## Quick Start
|
32
|
+
# In order to use this library, you first need to go through the following
|
33
|
+
# steps:
|
34
|
+
#
|
35
|
+
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
36
|
+
# 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
37
|
+
# 3. [Enable the Cloud Bigtable Admin API.](https://console.cloud.google.com/apis/library/bigtableadmin.googleapis.com)
|
38
|
+
# 4. [Setup Authentication.](https://googleapis.dev/ruby/google-cloud-bigtable/latest/file.AUTHENTICATION.html)
|
39
|
+
#
|
40
|
+
# ### Installation
|
41
|
+
# ```
|
42
|
+
# $ gem install google-cloud-bigtable
|
43
|
+
# ```
|
44
|
+
#
|
45
|
+
# ### Next Steps
|
46
|
+
# - Read the [Cloud Bigtable Admin API Product documentation][Product Documentation]
|
47
|
+
# to learn more about the product and see How-to Guides.
|
48
|
+
# - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
|
49
|
+
# to see the full list of Cloud APIs that we cover.
|
50
|
+
#
|
51
|
+
# [Product Documentation]: https://cloud.google.com/bigtable/docs/reference/admin/rpc
|
52
|
+
#
|
53
|
+
# ## Enabling Logging
|
54
|
+
#
|
55
|
+
# To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
56
|
+
# The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
|
57
|
+
# or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
|
58
|
+
# that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
59
|
+
# and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
60
|
+
#
|
61
|
+
# Configuring a Ruby stdlib logger:
|
62
|
+
#
|
63
|
+
# ```ruby
|
64
|
+
# require "logger"
|
65
|
+
#
|
66
|
+
# module MyLogger
|
67
|
+
# LOGGER = Logger.new $stderr, level: Logger::WARN
|
68
|
+
# def logger
|
69
|
+
# LOGGER
|
70
|
+
# end
|
71
|
+
# end
|
72
|
+
#
|
73
|
+
# # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
74
|
+
# module GRPC
|
75
|
+
# extend MyLogger
|
76
|
+
# end
|
77
|
+
# ```
|
78
|
+
#
|
79
|
+
module Admin
|
80
|
+
# rubocop:enable LineLength
|
81
|
+
|
82
|
+
FILE_DIR = File.realdirpath(Pathname.new(__FILE__).join("..").join("admin"))
|
83
|
+
|
84
|
+
AVAILABLE_VERSIONS = Dir["#{FILE_DIR}/*"]
|
85
|
+
.select { |file| File.directory?(file) }
|
86
|
+
.select { |dir| Google::Gax::VERSION_MATCHER.match(File.basename(dir)) }
|
87
|
+
.select { |dir| File.exist?(dir + ".rb") }
|
88
|
+
.map { |dir| File.basename(dir) }
|
89
|
+
|
90
|
+
module BigtableInstanceAdmin
|
91
|
+
##
|
92
|
+
# Service for creating, configuring, and deleting Cloud Bigtable Instances and
|
93
|
+
# Clusters. Provides access to the Instance and Cluster schemas only, not the
|
94
|
+
# tables' metadata or data stored in those tables.
|
95
|
+
#
|
96
|
+
# @param version [Symbol, String]
|
97
|
+
# The major version of the service to be used. By default :v2
|
98
|
+
# is used.
|
99
|
+
# @overload new(version:, credentials:, scopes:, client_config:, timeout:)
|
100
|
+
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
101
|
+
# Provides the means for authenticating requests made by the client. This parameter can
|
102
|
+
# be many types.
|
103
|
+
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
104
|
+
# authenticating requests made by this client.
|
105
|
+
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
106
|
+
# credentials for this client.
|
107
|
+
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
108
|
+
# credentials for this client.
|
109
|
+
# A `GRPC::Core::Channel` will be used to make calls through.
|
110
|
+
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
111
|
+
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
112
|
+
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
113
|
+
# metadata for requests, generally, to give OAuth credentials.
|
114
|
+
# @param scopes [Array<String>]
|
115
|
+
# The OAuth scopes for this service. This parameter is ignored if
|
116
|
+
# an updater_proc is supplied.
|
117
|
+
# @param client_config [Hash]
|
118
|
+
# A Hash for call options for each method. See
|
119
|
+
# Google::Gax#construct_settings for the structure of
|
120
|
+
# this data. Falls back to the default config if not specified
|
121
|
+
# or the specified config is missing data points.
|
122
|
+
# @param timeout [Numeric]
|
123
|
+
# The default timeout, in seconds, for calls made through this client.
|
124
|
+
# @param metadata [Hash]
|
125
|
+
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
126
|
+
# @param exception_transformer [Proc]
|
127
|
+
# An optional proc that intercepts any exceptions raised during an API call to inject
|
128
|
+
# custom error handling.
|
129
|
+
def self.new(*args, version: :v2, **kwargs)
|
130
|
+
unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
|
131
|
+
raise "The version: #{version} is not available. The available versions " \
|
132
|
+
"are: [#{AVAILABLE_VERSIONS.join(", ")}]"
|
133
|
+
end
|
134
|
+
|
135
|
+
require "#{FILE_DIR}/#{version.to_s.downcase}"
|
136
|
+
version_module = Google::Cloud::Bigtable::Admin
|
137
|
+
.constants
|
138
|
+
.select {|sym| sym.to_s.downcase == version.to_s.downcase}
|
139
|
+
.first
|
140
|
+
Google::Cloud::Bigtable::Admin.const_get(version_module)::BigtableInstanceAdmin.new(*args, **kwargs)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
module BigtableTableAdmin
|
145
|
+
##
|
146
|
+
# Service for creating, configuring, and deleting Cloud Bigtable tables.
|
147
|
+
#
|
148
|
+
#
|
149
|
+
# Provides access to the table schemas only, not the data stored within
|
150
|
+
# the tables.
|
151
|
+
#
|
152
|
+
# @param version [Symbol, String]
|
153
|
+
# The major version of the service to be used. By default :v2
|
154
|
+
# is used.
|
155
|
+
# @overload new(version:, credentials:, scopes:, client_config:, timeout:)
|
156
|
+
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
157
|
+
# Provides the means for authenticating requests made by the client. This parameter can
|
158
|
+
# be many types.
|
159
|
+
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
160
|
+
# authenticating requests made by this client.
|
161
|
+
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
162
|
+
# credentials for this client.
|
163
|
+
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
164
|
+
# credentials for this client.
|
165
|
+
# A `GRPC::Core::Channel` will be used to make calls through.
|
166
|
+
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
167
|
+
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
168
|
+
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
169
|
+
# metadata for requests, generally, to give OAuth credentials.
|
170
|
+
# @param scopes [Array<String>]
|
171
|
+
# The OAuth scopes for this service. This parameter is ignored if
|
172
|
+
# an updater_proc is supplied.
|
173
|
+
# @param client_config [Hash]
|
174
|
+
# A Hash for call options for each method. See
|
175
|
+
# Google::Gax#construct_settings for the structure of
|
176
|
+
# this data. Falls back to the default config if not specified
|
177
|
+
# or the specified config is missing data points.
|
178
|
+
# @param timeout [Numeric]
|
179
|
+
# The default timeout, in seconds, for calls made through this client.
|
180
|
+
# @param metadata [Hash]
|
181
|
+
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
182
|
+
# @param exception_transformer [Proc]
|
183
|
+
# An optional proc that intercepts any exceptions raised during an API call to inject
|
184
|
+
# custom error handling.
|
185
|
+
def self.new(*args, version: :v2, **kwargs)
|
186
|
+
unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
|
187
|
+
raise "The version: #{version} is not available. The available versions " \
|
188
|
+
"are: [#{AVAILABLE_VERSIONS.join(", ")}]"
|
189
|
+
end
|
190
|
+
|
191
|
+
require "#{FILE_DIR}/#{version.to_s.downcase}"
|
192
|
+
version_module = Google::Cloud::Bigtable::Admin
|
193
|
+
.constants
|
194
|
+
.select {|sym| sym.to_s.downcase == version.to_s.downcase}
|
195
|
+
.first
|
196
|
+
Google::Cloud::Bigtable::Admin.const_get(version_module)::BigtableTableAdmin.new(*args, **kwargs)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
201
|
+
end
|
202
|
+
end
|
@@ -0,0 +1,27 @@
|
|
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
|
+
|
16
|
+
require "google/cloud/bigtable/admin/v2/credentials"
|
17
|
+
|
18
|
+
module Google
|
19
|
+
module Cloud
|
20
|
+
module Bigtable
|
21
|
+
module Admin
|
22
|
+
class Credentials < Google::Cloud::Bigtable::Admin::V2::Credentials
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,223 @@
|
|
1
|
+
# Copyright 2020 Google LLC
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
|
16
|
+
require "google/cloud/bigtable/admin/v2/bigtable_instance_admin_client"
|
17
|
+
require "google/cloud/bigtable/admin/v2/bigtable_table_admin_client"
|
18
|
+
require "google/bigtable/admin/v2/bigtable_instance_admin_pb"
|
19
|
+
require "google/bigtable/admin/v2/table_pb"
|
20
|
+
require "google/bigtable/admin/v2/bigtable_table_admin_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Bigtable
|
25
|
+
module Admin
|
26
|
+
# rubocop:disable LineLength
|
27
|
+
|
28
|
+
##
|
29
|
+
# # Ruby Client for Cloud Bigtable Admin API
|
30
|
+
#
|
31
|
+
# [Cloud Bigtable Admin API][Product Documentation]:
|
32
|
+
# Administer your Cloud Bigtable tables and instances.
|
33
|
+
# - [Product Documentation][]
|
34
|
+
#
|
35
|
+
# ## Quick Start
|
36
|
+
# In order to use this library, you first need to go through the following
|
37
|
+
# steps:
|
38
|
+
#
|
39
|
+
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
40
|
+
# 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
41
|
+
# 3. [Enable the Cloud Bigtable Admin API.](https://console.cloud.google.com/apis/library/bigtableadmin.googleapis.com)
|
42
|
+
# 4. [Setup Authentication.](https://googleapis.dev/ruby/google-cloud-bigtable/latest/file.AUTHENTICATION.html)
|
43
|
+
#
|
44
|
+
# ### Installation
|
45
|
+
# ```
|
46
|
+
# $ gem install google-cloud-bigtable
|
47
|
+
# ```
|
48
|
+
#
|
49
|
+
# ### Next Steps
|
50
|
+
# - Read the [Cloud Bigtable Admin API Product documentation][Product Documentation]
|
51
|
+
# to learn more about the product and see How-to Guides.
|
52
|
+
# - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
|
53
|
+
# to see the full list of Cloud APIs that we cover.
|
54
|
+
#
|
55
|
+
# [Product Documentation]: https://cloud.google.com/bigtable/docs/reference/admin/rpc
|
56
|
+
#
|
57
|
+
# ## Enabling Logging
|
58
|
+
#
|
59
|
+
# To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
60
|
+
# The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
|
61
|
+
# or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
|
62
|
+
# that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
63
|
+
# and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
64
|
+
#
|
65
|
+
# Configuring a Ruby stdlib logger:
|
66
|
+
#
|
67
|
+
# ```ruby
|
68
|
+
# require "logger"
|
69
|
+
#
|
70
|
+
# module MyLogger
|
71
|
+
# LOGGER = Logger.new $stderr, level: Logger::WARN
|
72
|
+
# def logger
|
73
|
+
# LOGGER
|
74
|
+
# end
|
75
|
+
# end
|
76
|
+
#
|
77
|
+
# # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
78
|
+
# module GRPC
|
79
|
+
# extend MyLogger
|
80
|
+
# end
|
81
|
+
# ```
|
82
|
+
#
|
83
|
+
module V2
|
84
|
+
# rubocop:enable LineLength
|
85
|
+
|
86
|
+
module BigtableInstanceAdmin
|
87
|
+
##
|
88
|
+
# Service for creating, configuring, and deleting Cloud Bigtable Instances and
|
89
|
+
# Clusters. Provides access to the Instance and Cluster schemas only, not the
|
90
|
+
# tables' metadata or data stored in those tables.
|
91
|
+
#
|
92
|
+
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
93
|
+
# Provides the means for authenticating requests made by the client. This parameter can
|
94
|
+
# be many types.
|
95
|
+
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
96
|
+
# authenticating requests made by this client.
|
97
|
+
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
98
|
+
# credentials for this client.
|
99
|
+
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
100
|
+
# credentials for this client.
|
101
|
+
# A `GRPC::Core::Channel` will be used to make calls through.
|
102
|
+
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
103
|
+
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
104
|
+
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
105
|
+
# metadata for requests, generally, to give OAuth credentials.
|
106
|
+
# @param scopes [Array<String>]
|
107
|
+
# The OAuth scopes for this service. This parameter is ignored if
|
108
|
+
# an updater_proc is supplied.
|
109
|
+
# @param client_config [Hash]
|
110
|
+
# A Hash for call options for each method. See
|
111
|
+
# Google::Gax#construct_settings for the structure of
|
112
|
+
# this data. Falls back to the default config if not specified
|
113
|
+
# or the specified config is missing data points.
|
114
|
+
# @param timeout [Numeric]
|
115
|
+
# The default timeout, in seconds, for calls made through this client.
|
116
|
+
# @param metadata [Hash]
|
117
|
+
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
118
|
+
# @param service_address [String]
|
119
|
+
# Override for the service hostname, or `nil` to leave as the default.
|
120
|
+
# @param service_port [Integer]
|
121
|
+
# Override for the service port, or `nil` to leave as the default.
|
122
|
+
# @param exception_transformer [Proc]
|
123
|
+
# An optional proc that intercepts any exceptions raised during an API call to inject
|
124
|
+
# custom error handling.
|
125
|
+
def self.new \
|
126
|
+
credentials: nil,
|
127
|
+
scopes: nil,
|
128
|
+
client_config: nil,
|
129
|
+
timeout: nil,
|
130
|
+
metadata: nil,
|
131
|
+
service_address: nil,
|
132
|
+
service_port: nil,
|
133
|
+
exception_transformer: nil,
|
134
|
+
lib_name: nil,
|
135
|
+
lib_version: nil
|
136
|
+
kwargs = {
|
137
|
+
credentials: credentials,
|
138
|
+
scopes: scopes,
|
139
|
+
client_config: client_config,
|
140
|
+
timeout: timeout,
|
141
|
+
metadata: metadata,
|
142
|
+
exception_transformer: exception_transformer,
|
143
|
+
lib_name: lib_name,
|
144
|
+
service_address: service_address,
|
145
|
+
service_port: service_port,
|
146
|
+
lib_version: lib_version
|
147
|
+
}.select { |_, v| v != nil }
|
148
|
+
Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdminClient.new(**kwargs)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
module BigtableTableAdmin
|
153
|
+
##
|
154
|
+
# Service for creating, configuring, and deleting Cloud Bigtable tables.
|
155
|
+
#
|
156
|
+
#
|
157
|
+
# Provides access to the table schemas only, not the data stored within
|
158
|
+
# the tables.
|
159
|
+
#
|
160
|
+
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
161
|
+
# Provides the means for authenticating requests made by the client. This parameter can
|
162
|
+
# be many types.
|
163
|
+
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
164
|
+
# authenticating requests made by this client.
|
165
|
+
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
166
|
+
# credentials for this client.
|
167
|
+
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
168
|
+
# credentials for this client.
|
169
|
+
# A `GRPC::Core::Channel` will be used to make calls through.
|
170
|
+
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
171
|
+
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
172
|
+
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
173
|
+
# metadata for requests, generally, to give OAuth credentials.
|
174
|
+
# @param scopes [Array<String>]
|
175
|
+
# The OAuth scopes for this service. This parameter is ignored if
|
176
|
+
# an updater_proc is supplied.
|
177
|
+
# @param client_config [Hash]
|
178
|
+
# A Hash for call options for each method. See
|
179
|
+
# Google::Gax#construct_settings for the structure of
|
180
|
+
# this data. Falls back to the default config if not specified
|
181
|
+
# or the specified config is missing data points.
|
182
|
+
# @param timeout [Numeric]
|
183
|
+
# The default timeout, in seconds, for calls made through this client.
|
184
|
+
# @param metadata [Hash]
|
185
|
+
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
186
|
+
# @param service_address [String]
|
187
|
+
# Override for the service hostname, or `nil` to leave as the default.
|
188
|
+
# @param service_port [Integer]
|
189
|
+
# Override for the service port, or `nil` to leave as the default.
|
190
|
+
# @param exception_transformer [Proc]
|
191
|
+
# An optional proc that intercepts any exceptions raised during an API call to inject
|
192
|
+
# custom error handling.
|
193
|
+
def self.new \
|
194
|
+
credentials: nil,
|
195
|
+
scopes: nil,
|
196
|
+
client_config: nil,
|
197
|
+
timeout: nil,
|
198
|
+
metadata: nil,
|
199
|
+
service_address: nil,
|
200
|
+
service_port: nil,
|
201
|
+
exception_transformer: nil,
|
202
|
+
lib_name: nil,
|
203
|
+
lib_version: nil
|
204
|
+
kwargs = {
|
205
|
+
credentials: credentials,
|
206
|
+
scopes: scopes,
|
207
|
+
client_config: client_config,
|
208
|
+
timeout: timeout,
|
209
|
+
metadata: metadata,
|
210
|
+
exception_transformer: exception_transformer,
|
211
|
+
lib_name: lib_name,
|
212
|
+
service_address: service_address,
|
213
|
+
service_port: service_port,
|
214
|
+
lib_version: lib_version
|
215
|
+
}.select { |_, v| v != nil }
|
216
|
+
Google::Cloud::Bigtable::Admin::V2::BigtableTableAdminClient.new(**kwargs)
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
222
|
+
end
|
223
|
+
end
|