use of com.google.spanner.admin.instance.v1.Instance in project java-spanner by googleapis.
the class InstanceAdminClient method deleteInstance.
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes an instance.
*
* <p>Immediately upon completion of the request:
*
* <p>* Billing ceases for all of the instance's reserved resources.
*
* <p>Soon afterward:
*
* <p>* The instance and *all of its databases* immediately and irrevocably disappear
* from the API. All data in the databases is permanently deleted.
*
* <p>Sample code:
*
* <pre>{@code
* try (InstanceAdminClient instanceAdminClient = InstanceAdminClient.create()) {
* InstanceName name = InstanceName.of("[PROJECT]", "[INSTANCE]");
* instanceAdminClient.deleteInstance(name);
* }
* }</pre>
*
* @param name Required. The name of the instance to be deleted. Values are of the form
* `projects/<project>/instances/<instance>`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteInstance(InstanceName name) {
DeleteInstanceRequest request = DeleteInstanceRequest.newBuilder().setName(name == null ? null : name.toString()).build();
deleteInstance(request);
}
use of com.google.spanner.admin.instance.v1.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();
}
use of com.google.spanner.admin.instance.v1.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());
}
use of com.google.spanner.admin.instance.v1.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));
}
use of com.google.spanner.admin.instance.v1.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");
}
Aggregations