Cloud Spanner API - Class Google::Cloud::Spanner::Credentials (v2.20.0)

Reference documentation and code samples for the Cloud Spanner API class Google::Cloud::Spanner::Credentials.

Credentials

Represents the authentication and authorization used to connect to the Spanner API.

Inherits

  • Google::Cloud::Spanner::V1::Spanner::Credentials

Example

require "google/cloud/spanner"

keyfile = "/path/to/keyfile.json"
creds = Google::Cloud::Spanner::Credentials.new keyfile

spanner = Google::Cloud::Spanner.new(
  project_id: "my-project",
  credentials: creds
)

spanner.project_id #=> "my-project"