InstanceConfig

InstanceConfig

The InstanceConfig class represents a possible configuration for a Cloud Spanner instance.

Create an InstanceConfig object to interact with a Cloud Spanner instance config.

Constructor

new InstanceConfig(spanner, name)

Parameters:
Name Type Description
spanner Spanner

Spanner instance.

name string

Name of the instance config.

Example
```
const {Spanner} = require('@google-cloud/spanner');
const spanner = new Spanner();
const instance = spanner.instanceConfig('my-instance-config');
```

Methods

create(config, callbackopt) → {Promise.<CreateInstanceConfigResponse>}

Create an instance config.

Wrapper around v1.InstanceAdminClient#createInstanceConfig.

Parameters:
Name Type Attributes Description
config CreateInstanceConfigRequest

Configuration object.

callback CreateInstanceConfigCallback <optional>

Callback function.

Returns:
Type Description
Promise.<CreateInstanceConfigResponse>
See:
Example
```
const {Spanner} = require('@google-cloud/spanner');
const spanner = new Spanner();

const instanceConfig =
    spanner.instanceConfig('custom-my-instance-config');

instanceConfig.create(function(err, instance, operation, apiResponse) {
  if (err) {
    // Error handling omitted.
  }

  operation
    .on('error', function(err) {})
    .on('complete', function() {
      // Instance config created successfully.
    });
});

//-
// If the callback is omitted, we'll return a Promise.
//-
instanceConfig.create()
  .then(function(data) {
    const operation = data[0];
    const apiResponse = data[1];

    return operation.promise();
  })
  .then(function() {
    // Instance config created successfully.
  });
```