# Cloud Spanner API - Module Google::Cloud::Spanner::Admin::Database (v2.36.0)

2.36.0 (latest) 2.35.0 2.34.0 2.33.0 2.32.0 2.31.0 2.30.0 2.29.0 2.28.0 2.27.0 2.26.0 2.25.0 2.24.0 2.23.0 2.22.0 2.21.0 2.20.0 2.19.1 2.18.1 2.17.0 2.16.1 2.15.0 2.14.0 2.13.0 2.12.1 2.11.0 Reference documentation and code samples for the Cloud Spanner API module Google::Cloud::Spanner::Admin::Database.

## Methods

### .configure

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

Configure the Google Cloud Spanner Database 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 databases.

```ruby
require "google/cloud/spanner/admin/database"

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

### .database_admin

    def self.database_admin(project_id: nil, credentials: nil, universe_domain: nil, scope: nil, timeout: nil, endpoint: nil, project: nil, keyfile: nil, emulator_host: nil, lib_name: nil, lib_version: nil) -> Admin::Database::V1::DatabaseAdmin::Client

Create a new client object for a DatabaseAdmin.


This returns an instance of
[Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client](https://googleapis.dev/ruby/google-cloud-spanner-admin-database-v1/latest/Google/Cloud/Spanner/Admin/Database/V1/DatabaseAdmin/Client.html)
for version V1 of the API.

#### About DatabaseAdmin

Google Cloud Spanner Database Admin Service

The Cloud Spanner Database Admin API can be used to create, drop, and
list databases. It also enables updating the schema of pre-existing
databases. It can be also used to create, delete and list backups for a
database and to restore from an existing backup.

<br />

For more information on connecting to Google Cloud see the
[Authentication Guide](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-spanner/latest/AUTHENTICATION "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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-spanner/latest/Google-Cloud-Spanner-Credentials "Google::Cloud::Spanner::Credentials (class)")) 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](https://developers.google.com/identity/protocols/OAuth2).

  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::Database::V1::DatabaseAdmin::Client) --- A client object of version V1.
**Raises**

- (ArgumentError)

## Constants

### Credentials

**value:**V1::DatabaseAdmin::Credentials