Class Instance (6.58.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
NameDescription
databaseIdString

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

statementsIterable<String>

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

Returns
TypeDescription
OperationFuture<Database,CreateDatabaseMetadata>
Exceptions
TypeDescription
SpannerException

delete()

public void delete()

getBackup(String backupId)

public Backup getBackup(String backupId)

Returns the backup with the given id on this instance.

Parameter
NameDescription
backupIdString
Returns
TypeDescription
Backup

getDatabase(String databaseId)

public Database getDatabase(String databaseId)
Parameter
NameDescription
databaseIdString
Returns
TypeDescription
Database

getIAMPolicy()

public Policy getIAMPolicy()

Returns the IAM Policy for this instance.

Returns
TypeDescription
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
NameDescription
optionsListOption[]
Returns
TypeDescription
Page<Operation>

listBackups(Options.ListOption[] options)

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

Returns the backups belonging to this instance.

Parameter
NameDescription
optionsListOption[]
Returns
TypeDescription
Page<Backup>

listDatabaseOperations(Options.ListOption[] options)

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

Returns the long-running database operations on this instance.

Parameter
NameDescription
optionsListOption[]
Returns
TypeDescription
Page<Operation>

listDatabases(Options.ListOption[] options)

public Page<Database> listDatabases(Options.ListOption[] options)
Parameter
NameDescription
optionsListOption[]
Returns
TypeDescription
Page<Database>

reload()

public Instance reload()
Returns
TypeDescription
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
NameDescription
policycom.google.cloud.Policy
Returns
TypeDescription
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
NameDescription
permissionsIterable<String>

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

Returns
TypeDescription
Iterable<String>

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

toBuilder()

public Instance.Builder toBuilder()
Returns
TypeDescription
Instance.Builder
Overrides

update(InstanceInfo.InstanceField[] fieldsToUpdate)

public OperationFuture<Instance,UpdateInstanceMetadata> update(InstanceInfo.InstanceField[] fieldsToUpdate)
Parameter
NameDescription
fieldsToUpdateInstanceField[]
Returns
TypeDescription
OperationFuture<Instance,UpdateInstanceMetadata>