Constructor
new InstanceConfig(spanner, name)
Parameters:
Name | Type | Description |
---|---|---|
spanner |
Spanner |
Spanner instance. |
name |
string |
Name of the 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:
-
- v1.InstanceAdminClient#createInstanceConfig
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.
});
```