Class Instance (6.68.0)

public class Instance extends InstanceInfo

Represents a Cloud Spanner Instance. Instance adds a layer of service related functionality over InstanceInfo.

Inheritance

java.lang.Object > InstanceInfo > Instance

Methods

createDatabase(String databaseId, Iterable<String> statements)

public OperationFuture<Database,CreateDatabaseMetadata> createDatabase(String databaseId, Iterable<String> statements)

Creates a new database in this instance.

Parameters
Name Description
databaseId String

the id of the database which will be created. It must conform to the regular expression a-z*[a-z0-9] and be between 2 and 30 characters in length

statements Iterable<String>

DDL statements to run while creating the database, for example CREATE TABLE MyTable ( ... ). This should not include CREATE DATABASE statement.

Returns
Type Description
OperationFuture<Database,CreateDatabaseMetadata>
Exceptions
Type Description
SpannerException

delete()

public void delete()

getBackup(String backupId)

public Backup getBackup(String backupId)

Returns the backup with the given id on this instance.

Parameter
Name Description
backupId String
Returns
Type Description
Backup

getDatabase(String databaseId)

public Database getDatabase(String databaseId)
Parameter
Name Description
databaseId String
Returns
Type Description
Database

getIAMPolicy()

public Policy getIAMPolicy()

Returns the IAM Policy for this instance.

Returns
Type Description
com.google.cloud.Policy

listBackupOperations(Options.ListOption[] options)

public Page<Operation> listBackupOperations(Options.ListOption[] options)

Returns the long-running backup operations on this instance.

Parameter
Name Description
options ListOption[]
Returns
Type Description
Page<Operation>

listBackups(Options.ListOption[] options)

public Page<Backup> listBackups(Options.ListOption[] options)

Returns the backups belonging to this instance.

Parameter
Name Description
options ListOption[]
Returns
Type Description
Page<Backup>

listDatabaseOperations(Options.ListOption[] options)

public Page<Operation> listDatabaseOperations(Options.ListOption[] options)

Returns the long-running database operations on this instance.

Parameter
Name Description
options ListOption[]
Returns
Type Description
Page<Operation>

listDatabases(Options.ListOption[] options)

public Page<Database> listDatabases(Options.ListOption[] options)
Parameter
Name Description
options ListOption[]
Returns
Type Description
Page<Database>

reload()

public Instance reload()
Returns
Type Description
Instance

setIAMPolicy(Policy policy)

public Policy setIAMPolicy(Policy policy)

Updates the IAM policy for this instance and returns the resulting policy. It is highly recommended to first get the current policy and base the updated policy on the returned policy. See Policy.Builder#setEtag(String) for information on the recommended read-modify-write cycle.

Parameter
Name Description
policy com.google.cloud.Policy
Returns
Type Description
com.google.cloud.Policy

testIAMPermissions(Iterable<String> permissions)

public Iterable<String> testIAMPermissions(Iterable<String> permissions)

Tests for the given permissions on this instance for the caller.

Parameter
Name Description
permissions Iterable<String>

the permissions to test for. Permissions with wildcards (such as '', 'spanner.', 'spanner.instances.*') are not allowed.

Returns
Type Description
Iterable<String>

the subset of the tested permissions that the caller is allowed.

toBuilder()

public Instance.Builder toBuilder()
Returns
Type Description
Instance.Builder
Overrides

update(InstanceInfo.InstanceField[] fieldsToUpdate)

public OperationFuture<Instance,UpdateInstanceMetadata> update(InstanceInfo.InstanceField[] fieldsToUpdate)
Parameter
Name Description
fieldsToUpdate InstanceField[]
Returns
Type Description
OperationFuture<Instance,UpdateInstanceMetadata>