Module: Google::Cloud::Bigtable

Defined in:
lib/google/cloud/bigtable.rb,
lib/google/cloud/bigtable/v2.rb,
lib/google/cloud/bigtable/row.rb,
lib/google/cloud/bigtable/admin.rb,
lib/google/cloud/bigtable/table.rb,
lib/google/cloud/bigtable/errors.rb,
lib/google/cloud/bigtable/policy.rb,
lib/google/cloud/bigtable/cluster.rb,
lib/google/cloud/bigtable/convert.rb,
lib/google/cloud/bigtable/gc_rule.rb,
lib/google/cloud/bigtable/project.rb,
lib/google/cloud/bigtable/service.rb,
lib/google/cloud/bigtable/version.rb,
lib/google/cloud/bigtable/admin/v2.rb,
lib/google/cloud/bigtable/instance.rb,
lib/google/cloud/bigtable/row_range.rb,
lib/google/cloud/bigtable/row_filter.rb,
lib/google/cloud/bigtable/table/list.rb,
lib/google/cloud/bigtable/app_profile.rb,
lib/google/cloud/bigtable/cluster/job.rb,
lib/google/cloud/bigtable/credentials.rb,
lib/google/cloud/bigtable/rows_reader.rb,
lib/google/cloud/bigtable/value_range.rb,
lib/google/cloud/bigtable/cluster/list.rb,
lib/google/cloud/bigtable/column_range.rb,
lib/google/cloud/bigtable/instance/job.rb,
lib/google/cloud/bigtable/rows_mutator.rb,
lib/google/cloud/bigtable/column_family.rb,
lib/google/cloud/bigtable/instance/list.rb,
lib/google/cloud/bigtable/mutation_entry.rb,
lib/google/cloud/bigtable/sample_row_key.rb,
lib/google/cloud/bigtable/v2/credentials.rb,
lib/google/cloud/bigtable/app_profile/job.rb,
lib/google/cloud/bigtable/chunk_processor.rb,
lib/google/cloud/bigtable/longrunning_job.rb,
lib/google/cloud/bigtable/read_operations.rb,
lib/google/cloud/bigtable/app_profile/list.rb,
lib/google/cloud/bigtable/admin/credentials.rb,
lib/google/cloud/bigtable/v2/bigtable_client.rb,
lib/google/cloud/bigtable/mutation_operations.rb,
lib/google/cloud/bigtable/table/cluster_state.rb,
lib/google/cloud/bigtable/admin/v2/credentials.rb,
lib/google/cloud/bigtable/instance/cluster_map.rb,
lib/google/cloud/bigtable/read_modify_write_rule.rb,
lib/google/cloud/bigtable/row_filter/chain_filter.rb,
lib/google/cloud/bigtable/table/column_family_map.rb,
lib/google/cloud/bigtable/row_filter/simple_filter.rb,
lib/google/cloud/bigtable/row_filter/condition_filter.rb,
lib/google/cloud/bigtable/row_filter/interleave_filter.rb,
lib/google/cloud/bigtable/admin/v2/bigtable_table_admin_client.rb,
lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin_client.rb

Overview

Cloud Bigtable

Ruby Client for Cloud Bigtable API (Alpha)

Cloud Bigtable API: API for reading and writing the contents of Bigtables associated with a cloud project.

Quick Start

In order to use this library, you first need to go through the following steps:

  1. Select or create a Cloud Platform project.
  2. Enable billing for your project.
  3. Enable the Cloud Bigtable API.
  4. Setup Authentication.

Next Steps

Enabling Logging

To enable logging for this library, set the logger for the underlying gRPC library. The logger that you set may be a Ruby stdlib Logger as shown below, or a Google::Cloud::Logging::Logger that will write logs to Stackdriver Logging. See grpc/logconfig.rb and the gRPC spec_helper.rb for additional information.

Configuring a Ruby stdlib logger:

require "logger"

module MyLogger
  LOGGER = Logger.new $stderr, level: Logger::WARN
  def logger
    LOGGER
  end
end

# Define a gRPC module-level logger method before grpc/logconfig.rb loads.
module GRPC
  extend MyLogger
end

Defined Under Namespace

Modules: Admin, MutationOperations, ReadOperations, RowFilter, V2 Classes: AppProfile, Cluster, ColumnFamily, ColumnRange, Credentials, GcRule, Instance, InvalidRowStateError, LongrunningJob, MutationEntry, Policy, Project, ReadModifyWriteRule, Row, RowFilterError, RowRange, SampleRowKey, Table, ValueRange

Constant Summary collapse

VERSION =
"0.1.0".freeze

Class Method Summary collapse

Class Method Details

.configure {|Google::Cloud.configure.bigtable| ... } ⇒ Google::Cloud::Config

Configure the Google Cloud Bigtable library.

The following Bigtable configuration parameters are supported:

  • project_id - (String) Identifier for a Bigtable project. (The parameter project is considered deprecated, but may also be used.)
  • credentials - (String, Hash, Google::Auth::Credentials, GRPC::Core::Channel, GRPC::Core::ChannelCredentials) The path to the keyfile as a String, the contents of the keyfile as a Hash, or a Google::Auth::Credentials object. (See Credentials) (The parameter keyfile is considered deprecated, but may also be used.)
  • scope - (String, Array) The OAuth 2.0 scopes controlling the set of resources and operations that the connection can access.
  • timeout - (Integer) Default timeout to use in requests.
  • client_config - (Hash) A hash of values to override the default behavior of the API client.

Yields:

Returns:

  • (Google::Cloud::Config)

    The configuration object the Google::Cloud::Bigtable library uses.



172
173
174
175
176
# File 'lib/google/cloud/bigtable.rb', line 172

def self.configure
  yield Google::Cloud.configure.bigtable if block_given?

  Google::Cloud.configure.bigtable
end

.new(project_id: nil, credentials: nil, scope: nil, client_config: nil, timeout: nil) ⇒ Google::Cloud::Bigtable::Project

Service for managing Bigtable instance, tables and reading from and writing to existing Bigtable tables.

Examples:

require "google/cloud/bigtable"

client = Google::Cloud::Bigtable.new

Parameters:

  • project_id (String)

    Project identifier for the Bigtable service you are connecting to. If not present, the default project for the credentials is used.

  • credentials (Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc)

    Provides the means for authenticating requests made by the client. This parameter can be many types. A Google::Auth::Credentials uses a the properties of its represented keyfile for authenticating requests made by this client. A String will be treated as the path to the keyfile to be used for the construction of credentials for this client. A Hash will be treated as the contents of a keyfile to be used for the construction of credentials for this client. A GRPC::Core::Channel will be used to make calls through. A GRPC::Core::ChannelCredentials for the setting up the RPC client. The channel credentials should already be composed with a GRPC::Core::CallCredentials object. A Proc will be used as an updater_proc for the Grpc channel. The proc transforms the metadata for requests, generally, to give OAuth credentials.

  • scope (Array<String>)

    The OAuth 2.0 scopes controlling the set of resources and operations that the connection can access. See Using OAuth 2.0 to Access Google APIs. The OAuth scopes for this service. This parameter is ignored if an updater_proc is supplied.

  • client_config (Hash)

    A Hash for call options for each method. See Google::Gax#construct_settings for the structure of this data. Falls back to the default config if not specified or the specified config is missing data points.

  • timeout (Integer)

    The default timeout, in seconds, for calls made through this client. Optional.

Returns:

Raises:

  • (InvalidArgumentError)


124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/google/cloud/bigtable.rb', line 124

def self.new \
    project_id: nil,
    credentials: nil,
    scope: nil,
    client_config: nil,
    timeout: nil
  project_id = (project_id || default_project_id).to_s

  raise InvalidArgumentError, "project_id is required" unless project_id

  scope ||= configure.scope
  timeout ||= configure.timeout
  client_config ||= configure.client_config
  credentials ||= default_credentials(scope: scope)

  unless credentials.is_a? Google::Auth::Credentials
    credentials = Bigtable::Credentials.new credentials, scope: scope
  end

  service = Bigtable::Service.new(
    project_id,
    credentials,
    timeout: timeout,
    client_config: client_config
  )
  Bigtable::Project.new(service)
end