use of com.google.spanner.admin.database.v1.InstanceName in project java-spanner by googleapis.
the class InstanceAdminClientTest method getInstanceExceptionTest.
@Test
public void getInstanceExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockInstanceAdmin.addException(exception);
try {
InstanceName name = InstanceName.of("[PROJECT]", "[INSTANCE]");
client.getInstance(name);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.spanner.admin.database.v1.InstanceName in project gapic-generator-java by googleapis.
the class SyncFailoverInstanceInstancenameFailoverinstancerequestdataprotectionmode method syncFailoverInstanceInstancenameFailoverinstancerequestdataprotectionmode.
public static void syncFailoverInstanceInstancenameFailoverinstancerequestdataprotectionmode() throws Exception {
// It may require modifications to work in your environment.
try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
FailoverInstanceRequest.DataProtectionMode dataProtectionMode = FailoverInstanceRequest.DataProtectionMode.forNumber(0);
Instance response = cloudRedisClient.failoverInstanceAsync(name, dataProtectionMode).get();
}
}
Aggregations