Package com.google.cloud.spanner
Class Instance
- java.lang.Object
-
- com.google.cloud.spanner.InstanceInfo
-
- com.google.cloud.spanner.Instance
-
public class Instance extends InstanceInfo
Represents a Cloud Spanner Instance.Instance
adds a layer of service related functionality overInstanceInfo
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Instance.Builder
Builder ofInstance
.-
Nested classes/interfaces inherited from class com.google.cloud.spanner.InstanceInfo
InstanceInfo.InstanceField, InstanceInfo.State
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.api.gax.longrunning.OperationFuture<Database,CreateDatabaseMetadata>
createDatabase(String databaseId, Iterable<String> statements)
Creates a new database in this instance.void
delete()
Backup
getBackup(String backupId)
Returns the backup with the given id on this instance.Database
getDatabase(String databaseId)
com.google.cloud.Policy
getIAMPolicy()
Returns the IAMPolicy
for this instance.com.google.api.gax.paging.Page<com.google.longrunning.Operation>
listBackupOperations(Options.ListOption... options)
Returns the long-running backup operations on this instance.com.google.api.gax.paging.Page<Backup>
listBackups(Options.ListOption... options)
Returns the backups belonging to this instance.com.google.api.gax.paging.Page<com.google.longrunning.Operation>
listDatabaseOperations(Options.ListOption... options)
Returns the long-running database operations on this instance.com.google.api.gax.paging.Page<Database>
listDatabases(Options.ListOption... options)
Instance
reload()
com.google.cloud.Policy
setIAMPolicy(com.google.cloud.Policy policy)
Updates the IAM policy for this instance and returns the resulting policy.Iterable<String>
testIAMPermissions(Iterable<String> permissions)
Tests for the given permissions on this instance for the caller.Instance.Builder
toBuilder()
com.google.api.gax.longrunning.OperationFuture<Instance,UpdateInstanceMetadata>
update(InstanceInfo.InstanceField... fieldsToUpdate)
-
Methods inherited from class com.google.cloud.spanner.InstanceInfo
equals, getCreateTime, getDisplayName, getId, getInstanceConfigId, getLabels, getNodeCount, getProcessingUnits, getState, getUpdateTime, hashCode, newBuilder, toString
-
-
-
-
Method Detail
-
reload
public Instance reload()
-
delete
public void delete()
-
update
public com.google.api.gax.longrunning.OperationFuture<Instance,UpdateInstanceMetadata> update(InstanceInfo.InstanceField... fieldsToUpdate)
-
listDatabases
public com.google.api.gax.paging.Page<Database> listDatabases(Options.ListOption... options)
-
createDatabase
public com.google.api.gax.longrunning.OperationFuture<Database,CreateDatabaseMetadata> createDatabase(String databaseId, Iterable<String> statements) throws SpannerException
Creates a new database in this instance.- Parameters:
databaseId
- the id of the database which will be created. It must conform to the regular expression [a-z][a-z0-9_\-]*[a-z0-9] and be between 2 and 30 characters in lengthstatements
- DDL statements to run while creating the database, for exampleCREATE TABLE MyTable ( ... )
. This should not includeCREATE DATABASE
statement.- Throws:
SpannerException
-
listBackups
public com.google.api.gax.paging.Page<Backup> listBackups(Options.ListOption... options)
Returns the backups belonging to this instance.
-
getBackup
public Backup getBackup(String backupId)
Returns the backup with the given id on this instance.
-
listDatabaseOperations
public com.google.api.gax.paging.Page<com.google.longrunning.Operation> listDatabaseOperations(Options.ListOption... options)
Returns the long-running database operations on this instance.
-
listBackupOperations
public com.google.api.gax.paging.Page<com.google.longrunning.Operation> listBackupOperations(Options.ListOption... options)
Returns the long-running backup operations on this instance.
-
getIAMPolicy
public com.google.cloud.Policy getIAMPolicy()
Returns the IAMPolicy
for this instance.
-
setIAMPolicy
public com.google.cloud.Policy setIAMPolicy(com.google.cloud.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. SeePolicy.Builder.setEtag(String)
for information on the recommended read-modify-write cycle.
-
testIAMPermissions
public Iterable<String> testIAMPermissions(Iterable<String> permissions)
Tests for the given permissions on this instance for the caller.- Parameters:
permissions
- the permissions to test for. Permissions with wildcards (such as '*', 'spanner.*', 'spanner.instances.*') are not allowed.- Returns:
- the subset of the tested permissions that the caller is allowed.
-
toBuilder
public Instance.Builder toBuilder()
- Overrides:
toBuilder
in classInstanceInfo
-
-