@InternalApi public class GapicSpannerRpc extends Object implements SpannerRpc
SpannerRpc.Option, SpannerRpc.Paginated<T>, SpannerRpc.ResultStreamConsumer, SpannerRpc.StreamingCall
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_USER_AGENT |
Constructor and Description |
---|
GapicSpannerRpc(SpannerOptions options) |
Modifier and Type | Method and Description |
---|---|
com.google.api.core.ApiFuture<Empty> |
asyncDeleteSession(String sessionName,
Map<SpannerRpc.Option,?> options) |
List<Session> |
batchCreateSessions(String databaseName,
int sessionCount,
Map<String,String> labels,
Map<SpannerRpc.Option,?> options) |
Transaction |
beginTransaction(BeginTransactionRequest request,
Map<SpannerRpc.Option,?> options) |
com.google.api.core.ApiFuture<Transaction> |
beginTransactionAsync(BeginTransactionRequest request,
Map<SpannerRpc.Option,?> options) |
void |
cancelOperation(String name)
Cancels the specified long-running operation.
|
CommitResponse |
commit(CommitRequest commitRequest,
Map<SpannerRpc.Option,?> options) |
com.google.api.core.ApiFuture<CommitResponse> |
commitAsync(CommitRequest request,
Map<SpannerRpc.Option,?> options) |
OperationFuture<Backup,CopyBackupMetadata> |
copyBackup(BackupId sourceBackupId,
Backup destinationBackup)
Creates a copy backup from the source backup specified.
|
static GapicSpannerRpc |
create(SpannerOptions options) |
OperationFuture<Backup,CreateBackupMetadata> |
createBackup(Backup backupInfo)
Creates a new backup from the source database specified in the
Backup instance. |
OperationFuture<Database,CreateDatabaseMetadata> |
createDatabase(String instanceName,
String createDatabaseStatement,
Iterable<String> additionalStatements,
Database databaseInfo) |
OperationFuture<Instance,CreateInstanceMetadata> |
createInstance(String parent,
String instanceId,
Instance instance) |
Session |
createSession(String databaseName,
Map<String,String> labels,
Map<SpannerRpc.Option,?> options) |
void |
deleteBackup(String backupName)
Deletes a pending or completed backup.
|
void |
deleteInstance(String instanceName) |
void |
deleteSession(String sessionName,
Map<SpannerRpc.Option,?> options) |
void |
dropDatabase(String databaseName) |
ExecuteBatchDmlResponse |
executeBatchDml(ExecuteBatchDmlRequest request,
Map<SpannerRpc.Option,?> options) |
com.google.api.core.ApiFuture<ExecuteBatchDmlResponse> |
executeBatchDmlAsync(ExecuteBatchDmlRequest request,
Map<SpannerRpc.Option,?> options) |
ResultSet |
executePartitionedDml(ExecuteSqlRequest request,
Map<SpannerRpc.Option,?> options) |
ResultSet |
executeQuery(ExecuteSqlRequest request,
Map<SpannerRpc.Option,?> options) |
SpannerRpc.StreamingCall |
executeQuery(ExecuteSqlRequest request,
SpannerRpc.ResultStreamConsumer consumer,
Map<SpannerRpc.Option,?> options) |
com.google.api.core.ApiFuture<ResultSet> |
executeQueryAsync(ExecuteSqlRequest request,
Map<SpannerRpc.Option,?> options) |
ServerStream<PartialResultSet> |
executeStreamingPartitionedDml(ExecuteSqlRequest request,
Map<SpannerRpc.Option,?> options,
org.threeten.bp.Duration timeout) |
Backup |
getBackup(String backupName)
Gets the backup with the specified name.
|
Database |
getDatabase(String databaseName) |
com.google.iam.v1.Policy |
getDatabaseAdminIAMPolicy(String resource)
Gets the IAM policy for the given resource using the
DatabaseAdminStub . |
List<String> |
getDatabaseDdl(String databaseName) |
Instance |
getInstance(String instanceName) |
com.google.iam.v1.Policy |
getInstanceAdminIAMPolicy(String resource)
Gets the IAM policy for the given resource using the
InstanceAdminStub . |
InstanceConfig |
getInstanceConfig(String instanceConfigName) |
Operation |
getOperation(String name)
Retrieves a long running operation.
|
RetrySettings |
getPartitionedDmlRetrySettings() |
boolean |
isClosed() |
SpannerRpc.Paginated<Operation> |
listBackupOperations(String instanceName,
int pageSize,
String filter,
String pageToken)
List all long-running backup operations on the given instance.
|
SpannerRpc.Paginated<Backup> |
listBackups(String instanceName,
int pageSize,
String filter,
String pageToken)
Lists the backups in the specified instance.
|
SpannerRpc.Paginated<Operation> |
listDatabaseOperations(String instanceName,
int pageSize,
String filter,
String pageToken) |
SpannerRpc.Paginated<Database> |
listDatabases(String instanceName,
int pageSize,
String pageToken) |
SpannerRpc.Paginated<InstanceConfig> |
listInstanceConfigs(int pageSize,
String pageToken) |
SpannerRpc.Paginated<Instance> |
listInstances(int pageSize,
String pageToken,
String filter) |
PartitionResponse |
partitionQuery(PartitionQueryRequest request,
Map<SpannerRpc.Option,?> options) |
PartitionResponse |
partitionRead(PartitionReadRequest request,
Map<SpannerRpc.Option,?> options) |
SpannerRpc.StreamingCall |
read(ReadRequest request,
SpannerRpc.ResultStreamConsumer consumer,
Map<SpannerRpc.Option,?> options) |
OperationFuture<Database,RestoreDatabaseMetadata> |
restoreDatabase(Restore restore)
Restore a backup into the given database.
|
void |
rollback(RollbackRequest request,
Map<SpannerRpc.Option,?> options) |
com.google.api.core.ApiFuture<Empty> |
rollbackAsync(RollbackRequest request,
Map<SpannerRpc.Option,?> options) |
com.google.iam.v1.Policy |
setDatabaseAdminIAMPolicy(String resource,
com.google.iam.v1.Policy policy)
Updates the IAM policy for the given resource using the
DatabaseAdminStub . |
com.google.iam.v1.Policy |
setInstanceAdminIAMPolicy(String resource,
com.google.iam.v1.Policy policy)
Updates the IAM policy for the given resource using the
InstanceAdminStub . |
void |
shutdown() |
void |
shutdownNow() |
com.google.iam.v1.TestIamPermissionsResponse |
testDatabaseAdminIAMPermissions(String resource,
Iterable<String> permissions)
Tests the IAM permissions for the given resource using the
DatabaseAdminStub . |
com.google.iam.v1.TestIamPermissionsResponse |
testInstanceAdminIAMPermissions(String resource,
Iterable<String> permissions)
Tests the IAM permissions for the given resource using the
InstanceAdminStub . |
Backup |
updateBackup(Backup backup,
FieldMask updateMask)
Updates the specified backup.
|
OperationFuture<Empty,UpdateDatabaseDdlMetadata> |
updateDatabaseDdl(String databaseName,
Iterable<String> updateDatabaseStatements,
String updateId)
If the update database ddl operation returns an ALREADY_EXISTS error, meaning the operation id
used is already in flight, this method will simply resume the original operation.
|
OperationFuture<Instance,UpdateInstanceMetadata> |
updateInstance(Instance instance,
FieldMask fieldMask) |
public static final String DEFAULT_USER_AGENT
public GapicSpannerRpc(SpannerOptions options)
public static GapicSpannerRpc create(SpannerOptions options)
public SpannerRpc.Paginated<InstanceConfig> listInstanceConfigs(int pageSize, @Nullable String pageToken) throws SpannerException
listInstanceConfigs
in interface SpannerRpc
SpannerException
public InstanceConfig getInstanceConfig(String instanceConfigName) throws SpannerException
getInstanceConfig
in interface SpannerRpc
SpannerException
public SpannerRpc.Paginated<Instance> listInstances(int pageSize, @Nullable String pageToken, @Nullable String filter) throws SpannerException
listInstances
in interface SpannerRpc
SpannerException
public OperationFuture<Instance,CreateInstanceMetadata> createInstance(String parent, String instanceId, Instance instance) throws SpannerException
createInstance
in interface SpannerRpc
SpannerException
public OperationFuture<Instance,UpdateInstanceMetadata> updateInstance(Instance instance, FieldMask fieldMask) throws SpannerException
updateInstance
in interface SpannerRpc
SpannerException
public Instance getInstance(String instanceName) throws SpannerException
getInstance
in interface SpannerRpc
SpannerException
public void deleteInstance(String instanceName) throws SpannerException
deleteInstance
in interface SpannerRpc
SpannerException
public SpannerRpc.Paginated<Operation> listBackupOperations(String instanceName, int pageSize, @Nullable String filter, @Nullable String pageToken)
SpannerRpc
listBackupOperations
in interface SpannerRpc
public SpannerRpc.Paginated<Operation> listDatabaseOperations(String instanceName, int pageSize, @Nullable String filter, @Nullable String pageToken)
listDatabaseOperations
in interface SpannerRpc
public SpannerRpc.Paginated<Backup> listBackups(String instanceName, int pageSize, @Nullable String filter, @Nullable String pageToken) throws SpannerException
SpannerRpc
listBackups
in interface SpannerRpc
SpannerException
public SpannerRpc.Paginated<Database> listDatabases(String instanceName, int pageSize, @Nullable String pageToken) throws SpannerException
listDatabases
in interface SpannerRpc
SpannerException
public OperationFuture<Database,CreateDatabaseMetadata> createDatabase(String instanceName, String createDatabaseStatement, Iterable<String> additionalStatements, Database databaseInfo) throws SpannerException
createDatabase
in interface SpannerRpc
SpannerException
public OperationFuture<Empty,UpdateDatabaseDdlMetadata> updateDatabaseDdl(String databaseName, Iterable<String> updateDatabaseStatements, @Nullable String updateId) throws SpannerException
This mechanism is necessary, because the update database ddl can be retried. If a retryable failure occurs, the backend has already started processing the update database ddl operation with the given id and the library issues a retry, an ALREADY_EXISTS error will be returned. If we were to bubble this error up, it would be confusing for the caller, who used originally called the method with a new operation id.
updateDatabaseDdl
in interface SpannerRpc
SpannerException
public void dropDatabase(String databaseName) throws SpannerException
dropDatabase
in interface SpannerRpc
SpannerException
public Database getDatabase(String databaseName) throws SpannerException
getDatabase
in interface SpannerRpc
SpannerException
public List<String> getDatabaseDdl(String databaseName) throws SpannerException
getDatabaseDdl
in interface SpannerRpc
SpannerException
public OperationFuture<Backup,CreateBackupMetadata> createBackup(Backup backupInfo) throws SpannerException
SpannerRpc
Backup
instance.createBackup
in interface SpannerRpc
backupInfo
- the backup to create. The instance, database and expireTime fields of the
backup must be filled.SpannerException
public OperationFuture<Backup,CopyBackupMetadata> copyBackup(BackupId sourceBackupId, Backup destinationBackup) throws SpannerException
SpannerRpc
copyBackup
in interface SpannerRpc
destinationBackup
- the backup to create. The instance, database, and expireTime fields of
the backup must be filled. It may also optionally have an encryption config set. If no
encryption config has been set, the new backup will use the same encryption config as the
source backup.SpannerException
public OperationFuture<Database,RestoreDatabaseMetadata> restoreDatabase(Restore restore)
SpannerRpc
restoreDatabase
in interface SpannerRpc
restore
- a Restore
instance with the backup source and destination databasepublic Backup updateBackup(Backup backup, FieldMask updateMask)
SpannerRpc
updateBackup
in interface SpannerRpc
public void deleteBackup(String backupName)
SpannerRpc
deleteBackup
in interface SpannerRpc
backupName
- Required. The fully qualified name of the backup to delete.public Backup getBackup(String backupName) throws SpannerException
SpannerRpc
getBackup
in interface SpannerRpc
SpannerException
public Operation getOperation(String name) throws SpannerException
SpannerRpc
getOperation
in interface SpannerRpc
SpannerException
public void cancelOperation(String name) throws SpannerException
SpannerRpc
cancelOperation
in interface SpannerRpc
SpannerException
public List<Session> batchCreateSessions(String databaseName, int sessionCount, @Nullable Map<String,String> labels, @Nullable Map<SpannerRpc.Option,?> options) throws SpannerException
batchCreateSessions
in interface SpannerRpc
SpannerException
public Session createSession(String databaseName, @Nullable Map<String,String> labels, @Nullable Map<SpannerRpc.Option,?> options) throws SpannerException
createSession
in interface SpannerRpc
SpannerException
public void deleteSession(String sessionName, @Nullable Map<SpannerRpc.Option,?> options) throws SpannerException
deleteSession
in interface SpannerRpc
SpannerException
public com.google.api.core.ApiFuture<Empty> asyncDeleteSession(String sessionName, @Nullable Map<SpannerRpc.Option,?> options)
asyncDeleteSession
in interface SpannerRpc
public SpannerRpc.StreamingCall read(ReadRequest request, SpannerRpc.ResultStreamConsumer consumer, @Nullable Map<SpannerRpc.Option,?> options)
read
in interface SpannerRpc
public ResultSet executeQuery(ExecuteSqlRequest request, @Nullable Map<SpannerRpc.Option,?> options)
executeQuery
in interface SpannerRpc
public com.google.api.core.ApiFuture<ResultSet> executeQueryAsync(ExecuteSqlRequest request, @Nullable Map<SpannerRpc.Option,?> options)
executeQueryAsync
in interface SpannerRpc
public ResultSet executePartitionedDml(ExecuteSqlRequest request, @Nullable Map<SpannerRpc.Option,?> options)
executePartitionedDml
in interface SpannerRpc
public RetrySettings getPartitionedDmlRetrySettings()
getPartitionedDmlRetrySettings
in interface SpannerRpc
public ServerStream<PartialResultSet> executeStreamingPartitionedDml(ExecuteSqlRequest request, Map<SpannerRpc.Option,?> options, org.threeten.bp.Duration timeout)
executeStreamingPartitionedDml
in interface SpannerRpc
public SpannerRpc.StreamingCall executeQuery(ExecuteSqlRequest request, SpannerRpc.ResultStreamConsumer consumer, @Nullable Map<SpannerRpc.Option,?> options)
executeQuery
in interface SpannerRpc
public ExecuteBatchDmlResponse executeBatchDml(ExecuteBatchDmlRequest request, @Nullable Map<SpannerRpc.Option,?> options)
executeBatchDml
in interface SpannerRpc
public com.google.api.core.ApiFuture<ExecuteBatchDmlResponse> executeBatchDmlAsync(ExecuteBatchDmlRequest request, @Nullable Map<SpannerRpc.Option,?> options)
executeBatchDmlAsync
in interface SpannerRpc
public com.google.api.core.ApiFuture<Transaction> beginTransactionAsync(BeginTransactionRequest request, @Nullable Map<SpannerRpc.Option,?> options)
beginTransactionAsync
in interface SpannerRpc
public Transaction beginTransaction(BeginTransactionRequest request, @Nullable Map<SpannerRpc.Option,?> options) throws SpannerException
beginTransaction
in interface SpannerRpc
SpannerException
public com.google.api.core.ApiFuture<CommitResponse> commitAsync(CommitRequest request, @Nullable Map<SpannerRpc.Option,?> options)
commitAsync
in interface SpannerRpc
public CommitResponse commit(CommitRequest commitRequest, @Nullable Map<SpannerRpc.Option,?> options) throws SpannerException
commit
in interface SpannerRpc
SpannerException
public com.google.api.core.ApiFuture<Empty> rollbackAsync(RollbackRequest request, @Nullable Map<SpannerRpc.Option,?> options)
rollbackAsync
in interface SpannerRpc
public void rollback(RollbackRequest request, @Nullable Map<SpannerRpc.Option,?> options) throws SpannerException
rollback
in interface SpannerRpc
SpannerException
public PartitionResponse partitionQuery(PartitionQueryRequest request, @Nullable Map<SpannerRpc.Option,?> options) throws SpannerException
partitionQuery
in interface SpannerRpc
SpannerException
public PartitionResponse partitionRead(PartitionReadRequest request, @Nullable Map<SpannerRpc.Option,?> options) throws SpannerException
partitionRead
in interface SpannerRpc
SpannerException
public com.google.iam.v1.Policy getDatabaseAdminIAMPolicy(String resource)
SpannerRpc
DatabaseAdminStub
.getDatabaseAdminIAMPolicy
in interface SpannerRpc
public com.google.iam.v1.Policy setDatabaseAdminIAMPolicy(String resource, com.google.iam.v1.Policy policy)
SpannerRpc
DatabaseAdminStub
. It is highly
recommended to first get the current policy and base the updated policy on the returned policy.
See Policy.Builder#setEtag(com.google.protobuf.ByteString)
for information on the
recommended read-modify-write cycle.setDatabaseAdminIAMPolicy
in interface SpannerRpc
public com.google.iam.v1.TestIamPermissionsResponse testDatabaseAdminIAMPermissions(String resource, Iterable<String> permissions)
SpannerRpc
DatabaseAdminStub
.testDatabaseAdminIAMPermissions
in interface SpannerRpc
public com.google.iam.v1.Policy getInstanceAdminIAMPolicy(String resource)
SpannerRpc
InstanceAdminStub
.getInstanceAdminIAMPolicy
in interface SpannerRpc
public com.google.iam.v1.Policy setInstanceAdminIAMPolicy(String resource, com.google.iam.v1.Policy policy)
SpannerRpc
InstanceAdminStub
. It is highly
recommended to first get the current policy and base the updated policy on the returned policy.
See Policy.Builder#setEtag(com.google.protobuf.ByteString)
for information on the
recommended read-modify-write cycle.setInstanceAdminIAMPolicy
in interface SpannerRpc
public com.google.iam.v1.TestIamPermissionsResponse testInstanceAdminIAMPermissions(String resource, Iterable<String> permissions)
SpannerRpc
InstanceAdminStub
.testInstanceAdminIAMPermissions
in interface SpannerRpc
public void shutdown()
shutdown
in interface SpannerRpc
public void shutdownNow()
public boolean isClosed()
isClosed
in interface SpannerRpc
Copyright © 2022 Google LLC. All rights reserved.