public class Database extends DatabaseInfo
Database
adds a layer of service related
functionality over DatabaseInfo
.Modifier and Type | Class and Description |
---|---|
static class |
Database.Builder |
DatabaseInfo.State
Constructor and Description |
---|
Database(DatabaseId id,
DatabaseInfo.State state,
DatabaseAdminClient dbClient) |
Modifier and Type | Method and Description |
---|---|
OperationFuture<Backup,CreateBackupMetadata> |
backup(Backup backup)
Backs up this database to the location specified by the
Backup . |
void |
drop()
Drops this database.
|
boolean |
exists()
Returns
true if a database with the id of this Database exists on Cloud
Spanner. |
Iterable<String> |
getDdl()
Returns the schema of a Cloud Spanner database as a list of formatted DDL statements.
|
com.google.cloud.Policy |
getIAMPolicy()
Returns the IAM
Policy for this database. |
Page<Operation> |
listDatabaseOperations()
Returns the long-running operations for this database.
|
Database |
reload()
Fetches the database's current information.
|
com.google.cloud.Policy |
setIAMPolicy(com.google.cloud.Policy policy)
Updates the IAM policy for this database and returns the resulting policy.
|
Iterable<String> |
testIAMPermissions(Iterable<String> permissions)
Tests for the given permissions on this database for the caller.
|
OperationFuture<Void,UpdateDatabaseDdlMetadata> |
updateDdl(Iterable<String> statements,
String operationId)
Enqueues the given DDL statements to be applied, in order but not necessarily all at once, to
the database schema at some point (or points) in the future.
|
equals, getCreateTime, getDefaultLeader, getDialect, getEarliestVersionTime, getEncryptionConfig, getId, getProto, getRestoreInfo, getState, getVersionRetentionPeriod, hashCode, toString
public Database(DatabaseId id, DatabaseInfo.State state, DatabaseAdminClient dbClient)
public Database reload() throws SpannerException
SpannerException
public OperationFuture<Void,UpdateDatabaseDdlMetadata> updateDdl(Iterable<String> statements, String operationId) throws SpannerException
operationId
- Operation id assigned to this operation. If null, system will autogenerate
one. This must be unique within a database abd must be a valid identifier
[a-zA-Z][a-zA-Z0-9_]*.SpannerException
public void drop() throws SpannerException
SpannerException
public boolean exists()
true
if a database with the id of this Database
exists on Cloud
Spanner.public OperationFuture<Backup,CreateBackupMetadata> backup(Backup backup)
public Iterable<String> getDdl() throws SpannerException
SpannerException
public Page<Operation> listDatabaseOperations()
public com.google.cloud.Policy getIAMPolicy()
Policy
for this database.public com.google.cloud.Policy setIAMPolicy(com.google.cloud.Policy policy)
Policy.Builder#setEtag(String)
for information on the recommended read-modify-write
cycle.public Iterable<String> testIAMPermissions(Iterable<String> permissions)
permissions
- the permissions to test for. Permissions with wildcards (such as '*',
'spanner.*', 'spanner.instances.*') are not allowed.Copyright © 2022 Google LLC. All rights reserved.