use of com.google.spanner.admin.instance.v1.UpdateInstanceRequest in project java-redis by googleapis.
the class ITSystemTest method testUpdateInstance.
@Test
public void testUpdateInstance() throws ExecutionException, InterruptedException {
int memorySizeGb = 4;
FieldMask updateMask = FieldMask.newBuilder().addAllPaths(Arrays.asList("memory_size_gb")).build();
Instance instance = Instance.newBuilder().setName(INSTANCE_NAME.toString()).setMemorySizeGb(memorySizeGb).build();
UpdateInstanceRequest updateInstanceRequest = UpdateInstanceRequest.newBuilder().setInstance(instance).setUpdateMask(updateMask).build();
Instance actualInstance = client.updateInstanceAsync(updateInstanceRequest).get();
assertEquals(memorySizeGb, actualInstance.getMemorySizeGb());
}
use of com.google.spanner.admin.instance.v1.UpdateInstanceRequest in project java-redis by googleapis.
the class ITSystemTest method testUpdateInstance.
@Test
public void testUpdateInstance() throws ExecutionException, InterruptedException {
int memorySizeGb = 4;
FieldMask updateMask = FieldMask.newBuilder().addAllPaths(Arrays.asList("memory_size_gb")).build();
Instance instance = Instance.newBuilder().setName(INSTANCE_NAME.toString()).setMemorySizeGb(memorySizeGb).build();
UpdateInstanceRequest updateInstanceRequest = UpdateInstanceRequest.newBuilder().setInstance(instance).setUpdateMask(updateMask).build();
Instance actualInstance = client.updateInstanceAsync(updateInstanceRequest).get();
assertEquals(memorySizeGb, actualInstance.getMemorySizeGb());
}
use of com.google.spanner.admin.instance.v1.UpdateInstanceRequest in project java-spanner by googleapis.
the class InstanceAdminClientTest method updateInstanceTest.
@Test
public void updateInstanceTest() throws Exception {
Instance expectedResponse = Instance.newBuilder().setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString()).setConfig(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString()).setDisplayName("displayName1714148973").setNodeCount(1539922066).setProcessingUnits(-329117885).putAllLabels(new HashMap<String, String>()).addAllEndpointUris(new ArrayList<String>()).build();
Operation resultOperation = Operation.newBuilder().setName("updateInstanceTest").setDone(true).setResponse(Any.pack(expectedResponse)).build();
mockInstanceAdmin.addResponse(resultOperation);
Instance instance = Instance.newBuilder().build();
FieldMask fieldMask = FieldMask.newBuilder().build();
Instance actualResponse = client.updateInstanceAsync(instance, fieldMask).get();
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockInstanceAdmin.getRequests();
Assert.assertEquals(1, actualRequests.size());
UpdateInstanceRequest actualRequest = ((UpdateInstanceRequest) actualRequests.get(0));
Assert.assertEquals(instance, actualRequest.getInstance());
Assert.assertEquals(fieldMask, actualRequest.getFieldMask());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.spanner.admin.instance.v1.UpdateInstanceRequest in project java-spanner by googleapis.
the class GapicSpannerRpc method updateInstance.
@Override
public OperationFuture<Instance, UpdateInstanceMetadata> updateInstance(Instance instance, FieldMask fieldMask) throws SpannerException {
UpdateInstanceRequest request = UpdateInstanceRequest.newBuilder().setInstance(instance).setFieldMask(fieldMask).build();
GrpcCallContext context = newCallContext(null, instance.getName(), request, InstanceAdminGrpc.getUpdateInstanceMethod());
return instanceAdminStub.updateInstanceOperationCallable().futureCall(request, context);
}
Aggregations