use of com.google.cloud.notebooks.v1beta1.DeleteInstanceRequest in project java-docs-samples by GoogleCloudPlatform.
the class DeleteInstance method deleteInstance.
// Delete the instance specified by `instanceName`
// if it's present in the given project and zone.
public static void deleteInstance(String project, String zone, String instanceName) throws IOException, InterruptedException, ExecutionException {
// clean up any remaining background resources.
try (InstancesClient instancesClient = InstancesClient.create()) {
System.out.printf("Deleting instance: %s ", instanceName);
// Describe which instance is to be deleted.
DeleteInstanceRequest deleteInstanceRequest = DeleteInstanceRequest.newBuilder().setProject(project).setZone(zone).setInstance(instanceName).build();
OperationFuture<Operation, Operation> operation = instancesClient.deleteAsync(deleteInstanceRequest);
// Wait for the operation to complete.
Operation response = operation.get();
if (response.hasError()) {
System.out.println("Instance deletion failed ! ! " + response);
return;
}
System.out.println("Operation Status: " + response.getStatus());
}
}
use of com.google.cloud.notebooks.v1beta1.DeleteInstanceRequest in project java-bigtable by googleapis.
the class BaseBigtableInstanceAdminClient method deleteInstance.
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Delete an instance from a project.
*
* <p>Sample code:
*
* <pre>{@code
* try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
* BaseBigtableInstanceAdminClient.create()) {
* String name = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
* baseBigtableInstanceAdminClient.deleteInstance(name);
* }
* }</pre>
*
* @param name Required. The unique 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(String name) {
DeleteInstanceRequest request = DeleteInstanceRequest.newBuilder().setName(name).build();
deleteInstance(request);
}
use of com.google.cloud.notebooks.v1beta1.DeleteInstanceRequest in project java-bigtable by googleapis.
the class BaseBigtableInstanceAdminClientTest method deleteInstanceTest2.
@Test
public void deleteInstanceTest2() throws Exception {
Empty expectedResponse = Empty.newBuilder().build();
mockBigtableInstanceAdmin.addResponse(expectedResponse);
String name = "name3373707";
client.deleteInstance(name);
List<AbstractMessage> actualRequests = mockBigtableInstanceAdmin.getRequests();
Assert.assertEquals(1, actualRequests.size());
DeleteInstanceRequest actualRequest = ((DeleteInstanceRequest) actualRequests.get(0));
Assert.assertEquals(name, actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.notebooks.v1beta1.DeleteInstanceRequest in project java-spanner by googleapis.
the class InstanceAdminClientTest method deleteInstanceTest.
@Test
public void deleteInstanceTest() throws Exception {
Empty expectedResponse = Empty.newBuilder().build();
mockInstanceAdmin.addResponse(expectedResponse);
InstanceName name = InstanceName.of("[PROJECT]", "[INSTANCE]");
client.deleteInstance(name);
List<AbstractMessage> actualRequests = mockInstanceAdmin.getRequests();
Assert.assertEquals(1, actualRequests.size());
DeleteInstanceRequest actualRequest = ((DeleteInstanceRequest) actualRequests.get(0));
Assert.assertEquals(name.toString(), actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.notebooks.v1beta1.DeleteInstanceRequest in project java-spanner by googleapis.
the class GapicSpannerRpc method deleteInstance.
@Override
public void deleteInstance(String instanceName) throws SpannerException {
DeleteInstanceRequest request = DeleteInstanceRequest.newBuilder().setName(instanceName).build();
GrpcCallContext context = newCallContext(null, instanceName, request, InstanceAdminGrpc.getDeleteInstanceMethod());
get(instanceAdminStub.deleteInstanceCallable().futureCall(request, context));
}
Aggregations