Search in sources :

Example 6 with DeleteInstanceRequest

use of com.google.cloud.notebooks.v1beta1.DeleteInstanceRequest 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>&#42; Billing ceases for all of the instance's reserved resources.
 *
 * <p>Soon afterward:
 *
 * <p>&#42; The instance and &#42;all of its databases&#42; 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/&lt;project&gt;/instances/&lt;instance&gt;`
 * @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);
}
Also used : DeleteInstanceRequest(com.google.spanner.admin.instance.v1.DeleteInstanceRequest)

Example 7 with DeleteInstanceRequest

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

the class BaseBigtableInstanceAdminClientTest method deleteInstanceTest.

@Test
public void deleteInstanceTest() throws Exception {
    Empty expectedResponse = Empty.newBuilder().build();
    mockBigtableInstanceAdmin.addResponse(expectedResponse);
    InstanceName name = InstanceName.of("[PROJECT]", "[INSTANCE]");
    client.deleteInstance(name);
    List<AbstractMessage> actualRequests = mockBigtableInstanceAdmin.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()));
}
Also used : InstanceName(com.google.bigtable.admin.v2.InstanceName) Empty(com.google.protobuf.Empty) AbstractMessage(com.google.protobuf.AbstractMessage) DeleteInstanceRequest(com.google.bigtable.admin.v2.DeleteInstanceRequest) Test(org.junit.Test)

Example 8 with DeleteInstanceRequest

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()) {
 *   InstanceName name = InstanceName.of("[PROJECT]", "[INSTANCE]");
 *   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(InstanceName name) {
    DeleteInstanceRequest request = DeleteInstanceRequest.newBuilder().setName(name == null ? null : name.toString()).build();
    deleteInstance(request);
}
Also used : DeleteInstanceRequest(com.google.bigtable.admin.v2.DeleteInstanceRequest)

Example 9 with DeleteInstanceRequest

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

the class ITNotebookServiceClientTest method tearDown.

@AfterClass
public static void tearDown() throws ExecutionException, InterruptedException {
    // Delete Test Environment Instance
    DeleteEnvironmentRequest deleteEnvironmentRequest = DeleteEnvironmentRequest.newBuilder().setName(ENVIRONMENT_NAME).build();
    client.deleteEnvironmentAsync(deleteEnvironmentRequest).get();
    // Delete Test Notebook Instance
    DeleteInstanceRequest deleteInstanceRequest = DeleteInstanceRequest.newBuilder().setName(INSTANCE_NAME).build();
    client.deleteInstanceAsync(deleteInstanceRequest).get();
    client.close();
}
Also used : DeleteEnvironmentRequest(com.google.cloud.notebooks.v1beta1.DeleteEnvironmentRequest) DeleteInstanceRequest(com.google.cloud.notebooks.v1beta1.DeleteInstanceRequest) AfterClass(org.junit.AfterClass)

Example 10 with DeleteInstanceRequest

use of com.google.cloud.notebooks.v1beta1.DeleteInstanceRequest 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>&#42; Billing ceases for all of the instance's reserved resources.
 *
 * <p>Soon afterward:
 *
 * <p>&#42; The instance and &#42;all of its databases&#42; 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()) {
 *   String name = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
 *   instanceAdminClient.deleteInstance(name);
 * }
 * }</pre>
 *
 * @param name Required. The name of the instance to be deleted. Values are of the form
 *     `projects/&lt;project&gt;/instances/&lt;instance&gt;`
 * @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);
}
Also used : DeleteInstanceRequest(com.google.spanner.admin.instance.v1.DeleteInstanceRequest)

Aggregations

DeleteInstanceRequest (com.google.spanner.admin.instance.v1.DeleteInstanceRequest)5 DeleteInstanceRequest (com.google.bigtable.admin.v2.DeleteInstanceRequest)4 AbstractMessage (com.google.protobuf.AbstractMessage)4 Empty (com.google.protobuf.Empty)4 Test (org.junit.Test)4 ByteString (com.google.protobuf.ByteString)2 GrpcCallContext (com.google.api.gax.grpc.GrpcCallContext)1 InstanceName (com.google.bigtable.admin.v2.InstanceName)1 DeleteInstanceRequest (com.google.cloud.compute.v1.DeleteInstanceRequest)1 InstancesClient (com.google.cloud.compute.v1.InstancesClient)1 Operation (com.google.cloud.compute.v1.Operation)1 DeleteEnvironmentRequest (com.google.cloud.notebooks.v1beta1.DeleteEnvironmentRequest)1 DeleteInstanceRequest (com.google.cloud.notebooks.v1beta1.DeleteInstanceRequest)1 InstanceName (com.google.spanner.admin.instance.v1.InstanceName)1 AfterClass (org.junit.AfterClass)1