public class Database extends DatabaseInfo
Database
adds a layer of service related
functionality over DatabaseInfo
.DatabaseInfo.State
Constructor and Description |
---|
Database(DatabaseId id,
DatabaseInfo.State state,
DatabaseAdminClient dbClient) |
Modifier and Type | Method and Description |
---|---|
void |
drop()
Drops this database.
|
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. |
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.
|
com.google.api.gax.longrunning.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.
|
public Database(DatabaseId id, DatabaseInfo.State state, DatabaseAdminClient dbClient)
public Database reload() throws SpannerException
SpannerException
public com.google.api.gax.longrunning.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 Iterable<String> getDdl() throws SpannerException
SpannerException
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 © 2019 Google LLC. All rights reserved.