use of com.google.spanner.admin.instance.v1.Instance in project java-notebooks by googleapis.
the class ITNotebookServiceClientTest method testGetInstance.
@Test
public void testGetInstance() {
GetInstanceRequest request = GetInstanceRequest.newBuilder().setName(INSTANCE_NAME).build();
Instance actualNotebookInstance = client.getInstance(request);
assertEquals(expectedNotebookInstance.getContainerImage(), actualNotebookInstance.getContainerImage());
assertEquals(expectedNotebookInstance.getName(), actualNotebookInstance.getName());
assertEquals(expectedNotebookInstance.getNetwork(), actualNotebookInstance.getNetwork());
assertEquals(expectedNotebookInstance.getSubnet(), actualNotebookInstance.getSubnet());
}
use of com.google.spanner.admin.instance.v1.Instance in project java-notebooks by googleapis.
the class ITNotebookServiceClientTest method stopInstance.
private String stopInstance() throws ExecutionException, InterruptedException {
StopInstanceRequest request = StopInstanceRequest.newBuilder().setName(INSTANCE_NAME).build();
Instance response = client.stopInstanceAsync(request).get();
return response.getState().name();
}
use of com.google.spanner.admin.instance.v1.Instance in project java-notebooks by googleapis.
the class ITNotebookServiceClientTest method testListInstances.
@Test
public void testListInstances() {
ListInstancesRequest request = ListInstancesRequest.newBuilder().setParent(PARENT).build();
for (Instance element : client.listInstances(request).iterateAll()) {
if (element.getName().equals(NOTEBOOK_INSTANCE_ID)) {
assertEquals(expectedNotebookInstance.getContainerImage(), element.getContainerImage());
assertEquals(expectedNotebookInstance.getName(), element.getName());
assertEquals(expectedNotebookInstance.getMachineType(), element.getMachineType());
assertEquals(expectedNotebookInstance.getNetwork(), element.getNetwork());
assertEquals(expectedNotebookInstance.getSubnet(), element.getSubnet());
}
}
}
use of com.google.spanner.admin.instance.v1.Instance in project java-spanner by googleapis.
the class GapicSpannerRpc method createInstance.
@Override
public OperationFuture<Instance, CreateInstanceMetadata> createInstance(String parent, String instanceId, Instance instance) throws SpannerException {
CreateInstanceRequest request = CreateInstanceRequest.newBuilder().setParent(parent).setInstanceId(instanceId).setInstance(instance).build();
GrpcCallContext context = newCallContext(null, parent, request, InstanceAdminGrpc.getCreateInstanceMethod());
return instanceAdminStub.createInstanceOperationCallable().futureCall(request, context);
}
use of com.google.spanner.admin.instance.v1.Instance 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