Search in sources :

Example 26 with Instance

use of com.google.cloud.notebooks.v1beta1.Instance in project java-notebooks by googleapis.

the class ITNotebookServiceClientTest method testSetInstanceMachineType.

@Test
public void testSetInstanceMachineType() throws ExecutionException, InterruptedException {
    this.stopInstance();
    SetInstanceMachineTypeRequest request = SetInstanceMachineTypeRequest.newBuilder().setName(INSTANCE_NAME).setMachineType(MACHINE_TYPE_B).build();
    Instance response = client.setInstanceMachineTypeAsync(request).get();
    assertTrue(response.getMachineType().endsWith(MACHINE_TYPE_B));
    this.startInstance();
}
Also used : Instance(com.google.cloud.notebooks.v1beta1.Instance) SetInstanceMachineTypeRequest(com.google.cloud.notebooks.v1beta1.SetInstanceMachineTypeRequest) Test(org.junit.Test)

Example 27 with Instance

use of com.google.cloud.notebooks.v1beta1.Instance in project java-notebooks by googleapis.

the class ITNotebookServiceClientTest method testSetInstanceAccelarator.

@Test
public void testSetInstanceAccelarator() throws ExecutionException, InterruptedException {
    this.stopInstance();
    SetInstanceAcceleratorRequest request = SetInstanceAcceleratorRequest.newBuilder().setName(INSTANCE_NAME).setType(Instance.AcceleratorType.NVIDIA_TESLA_P4).setCoreCount(1L).build();
    Instance response = client.setInstanceAcceleratorAsync(request).get();
    this.startInstance();
    assertEquals(response.getAcceleratorConfig().getType().name(), Instance.AcceleratorType.NVIDIA_TESLA_P4.name());
}
Also used : Instance(com.google.cloud.notebooks.v1beta1.Instance) SetInstanceAcceleratorRequest(com.google.cloud.notebooks.v1beta1.SetInstanceAcceleratorRequest) Test(org.junit.Test)

Example 28 with Instance

use of com.google.cloud.notebooks.v1beta1.Instance in project java-notebooks by googleapis.

the class ITNotebookServiceClientTest method testResetInstance.

@Test
public void testResetInstance() throws ExecutionException, InterruptedException {
    ResetInstanceRequest request = ResetInstanceRequest.newBuilder().setName(INSTANCE_NAME).build();
    Instance response = client.resetInstanceAsync(request).get();
    assertTrue(response.getMachineType().endsWith(MACHINE_TYPE_B));
}
Also used : ResetInstanceRequest(com.google.cloud.notebooks.v1beta1.ResetInstanceRequest) Instance(com.google.cloud.notebooks.v1beta1.Instance) Test(org.junit.Test)

Example 29 with Instance

use of com.google.cloud.notebooks.v1beta1.Instance in project java-notebooks by googleapis.

the class ITNotebookServiceClientTest method testSetInstanceLabels.

@Test
public void testSetInstanceLabels() throws ExecutionException, InterruptedException {
    SetInstanceLabelsRequest setInstanceLabelsRequest = SetInstanceLabelsRequest.newBuilder().setName(INSTANCE_NAME).putLabels("a", "100").build();
    Instance response = client.setInstanceLabelsAsync(setInstanceLabelsRequest).get();
    assertEquals(response.getLabelsMap().get("a"), "100");
}
Also used : Instance(com.google.cloud.notebooks.v1beta1.Instance) SetInstanceLabelsRequest(com.google.cloud.notebooks.v1beta1.SetInstanceLabelsRequest) Test(org.junit.Test)

Example 30 with Instance

use of com.google.cloud.notebooks.v1beta1.Instance in project java-notebooks by googleapis.

the class ITNotebookServiceClientTest method startInstance.

private String startInstance() throws ExecutionException, InterruptedException {
    StartInstanceRequest request = StartInstanceRequest.newBuilder().setName(INSTANCE_NAME).build();
    Instance response = client.startInstanceAsync(request).get();
    return response.getState().name();
}
Also used : Instance(com.google.cloud.notebooks.v1beta1.Instance) StartInstanceRequest(com.google.cloud.notebooks.v1beta1.StartInstanceRequest)

Aggregations

Test (org.junit.Test)33 ByteString (com.google.protobuf.ByteString)17 AbstractMessage (com.google.protobuf.AbstractMessage)14 Instance (com.google.cloud.compute.v1.Instance)11 InstancesClient (com.google.cloud.compute.v1.InstancesClient)11 Instance (com.google.spanner.admin.instance.v1.Instance)11 Instance (com.google.bigtable.admin.v2.Instance)10 Instance (com.google.cloud.notebooks.v1beta1.Instance)9 InvalidArgumentException (com.google.api.gax.rpc.InvalidArgumentException)7 Operation (com.google.cloud.compute.v1.Operation)7 StatusRuntimeException (io.grpc.StatusRuntimeException)7 InsertInstanceRequest (com.google.cloud.compute.v1.InsertInstanceRequest)6 Operation (com.google.longrunning.Operation)6 FieldMask (com.google.protobuf.FieldMask)6 ArrayList (java.util.ArrayList)6 AttachedDisk (com.google.cloud.compute.v1.AttachedDisk)5 NetworkInterface (com.google.cloud.compute.v1.NetworkInterface)5 Instance (com.google.cloud.redis.v1.Instance)5 HashMap (java.util.HashMap)5 ExecutionException (java.util.concurrent.ExecutionException)5