Cloud Spanner API - Module Google::Cloud::Spanner::Admin::Instance (v2.23.0)

Reference documentation and code samples for the Cloud Spanner API module Google::Cloud::Spanner::Admin::Instance.

Methods

.configure

def self.configure() -> ::Google::Cloud::Config

Configure the Google Cloud Spanner Instance Admin library. This configuration can be applied globally to all clients.

The following configuration parameters are supported:

  • credentials (type: String, Hash, Google::Auth::Credentials) - The path to the keyfile as a String, the contents of the keyfile as a Hash, or a Google::Auth::Credentials object.
  • lib_name (type: String) - The library name as recorded in instrumentation and logging.
  • lib_version (type: String) - The library version as recorded in instrumentation and logging.
  • interceptors (type: Array<GRPC::ClientInterceptor>) - An array of interceptors that are run before calls are executed.
  • timeout (type: Numeric) - Default timeout in seconds.
  • emulator_host - (String) Host name of the emulator. Defaults to ENV["SPANNER_EMULATOR_HOST"].
  • metadata (type: Hash{Symbol=>String}) - Additional gRPC headers to be sent with the call.
  • retry_policy (type: Hash) - The retry policy. The value is a hash with the following keys:
    • :initial_delay (type: Numeric) - The initial delay in seconds.
    • :max_delay (type: Numeric) - The max delay in seconds.
    • :multiplier (type: Numeric) - The incremental backoff multiplier.
    • :retry_codes (type: Array<String>) - The error codes that should trigger a retry.
Yields
  • (@configure)
Returns
  • (::Google::Cloud::Config) — The default configuration used by this library
Example

Modify the global config, setting the timeout to 10 seconds for all admin instances.

require "google/cloud/spanner/admin/instance"

::Google::Cloud::Spanner::Admin::Instance.configure do |config|
  config.timeout = 10.0
end

.instance_admin

def self.instance_admin(project_id: nil, credentials: nil, scope: nil, timeout: nil, endpoint: nil, project: nil, keyfile: nil, emulator_host: nil, lib_name: nil, lib_version: nil) -> Admin::Instance::V1::InstanceAdmin::Client

Create a new client object for a InstanceAdmin.

This returns an instance of Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Client for version V1 of the API.

About InstanceAdmin

Google Cloud Spanner Instance Admin Service

The Cloud Spanner Instance Admin API can be used to create, delete, modify and list instances. Instances are dedicated Cloud Spanner serving and storage resources to be used by Cloud Spanner databases.

For more information on connecting to Google Cloud see the Authentication Guide.

Parameters
  • project_id (String) (defaults to: nil) — Project identifier for the Spanner service you are connecting to. If not present, the default project for the credentials is used.
  • credentials (String, Hash, Google::Auth::Credentials) (defaults to: nil) — The path to the keyfile as a String, the contents of the keyfile as a Hash, or a Google::Auth::Credentials object. (See Credentials) If emulator_host is present, this becomes optional and the value is internally overriden with :this_channel_is_insecure.
  • scope (String, Array<String>) (defaults to: nil)

    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 default scopes are:

    • https://www.googleapis.com/auth/spanner
    • https://www.googleapis.com/auth/spanner.data
  • timeout (Integer) (defaults to: nil) — Default timeout to use in requests. Optional.
  • endpoint (String) (defaults to: nil) — Override of the endpoint host name. Optional. If the param is nil, uses emulator_host or the default endpoint.
  • project (String) (defaults to: nil) — Alias for the project_id argument. Deprecated.
  • keyfile (String) (defaults to: nil) — Alias for the credentials argument. Deprecated.
  • emulator_host (String) (defaults to: nil) — Spanner emulator host. Optional. If the param is nil, uses the value of the emulator_host config.
  • lib_name (String) (defaults to: nil) — Library name. This will be added as a prefix to the API call tracking header x-goog-api-client with provided lib version for telemetry. Optional. For example prefix looks like spanner-activerecord/0.0.1 gccl/1.13.1. Here, spanner-activerecord/0.0.1 is provided custom library name and version and gccl/1.13.1 represents the Cloud Spanner Ruby library with version.
  • lib_version (String) (defaults to: nil) — Library version. This will be added as a prefix to the API call tracking header x-goog-api-client with provided lib name for telemetry. Optional. For example prefix look like spanner-activerecord/0.0.1 gccl/1.13.1. Here, spanner-activerecord/0.0.1 is provided custom library name and version and gccl/1.13.1 represents the Cloud Spanner Ruby library with version.
Returns
  • (Admin::Instance::V1::InstanceAdmin::Client) — A client object of version V1.
Raises
  • (ArgumentError)

Constants

Credentials

value: V1::InstanceAdmin::Credentials