use of com.google.cloud.redis.v1beta1.InstanceName in project gapic-generator-java by googleapis.
the class SyncGetInstanceAuthStringInstancename method syncGetInstanceAuthStringInstancename.
public static void syncGetInstanceAuthStringInstancename() throws Exception {
// It may require modifications to work in your environment.
try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
InstanceAuthString response = cloudRedisClient.getInstanceAuthString(name);
}
}
use of com.google.cloud.redis.v1beta1.InstanceName in project gapic-generator-java by googleapis.
the class SyncUpgradeInstanceInstancenameString method syncUpgradeInstanceInstancenameString.
public static void syncUpgradeInstanceInstancenameString() throws Exception {
// It may require modifications to work in your environment.
try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
String redisVersion = "redisVersion-1972584739";
Instance response = cloudRedisClient.upgradeInstanceAsync(name, redisVersion).get();
}
}
use of com.google.cloud.redis.v1beta1.InstanceName in project gapic-generator-java by googleapis.
the class SyncRescheduleMaintenanceInstancenameReschedulemaintenancerequestrescheduletypeTimestamp method syncRescheduleMaintenanceInstancenameReschedulemaintenancerequestrescheduletypeTimestamp.
public static void syncRescheduleMaintenanceInstancenameReschedulemaintenancerequestrescheduletypeTimestamp() throws Exception {
// It may require modifications to work in your environment.
try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
RescheduleMaintenanceRequest.RescheduleType rescheduleType = RescheduleMaintenanceRequest.RescheduleType.forNumber(0);
Timestamp scheduleTime = Timestamp.newBuilder().build();
Instance response = cloudRedisClient.rescheduleMaintenanceAsync(name, rescheduleType, scheduleTime).get();
}
}
use of com.google.cloud.redis.v1beta1.InstanceName in project java-bigtable by googleapis.
the class BaseBigtableTableAdminClientTest method createTableExceptionTest.
@Test
public void createTableExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockBigtableTableAdmin.addException(exception);
try {
InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
String tableId = "tableId-1552905847";
Table table = Table.newBuilder().build();
client.createTable(parent, tableId, table);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.cloud.redis.v1beta1.InstanceName in project java-bigtable by googleapis.
the class BaseBigtableTableAdminClientTest method createTableFromSnapshotExceptionTest.
@Test
public void createTableFromSnapshotExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockBigtableTableAdmin.addException(exception);
try {
InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
String tableId = "tableId-1552905847";
SnapshotName sourceSnapshot = SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]");
client.createTableFromSnapshotAsync(parent, tableId, sourceSnapshot).get();
Assert.fail("No exception raised");
} catch (ExecutionException e) {
Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass());
InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause());
Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode());
}
}
Aggregations