Search in sources :

Example 1 with DeleteClusterRequest

use of com.google.cloud.dataproc.v1.DeleteClusterRequest in project java-bigtable by googleapis.

the class BaseBigtableInstanceAdminClient method deleteCluster.

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
 * Deletes a cluster from an instance.
 *
 * <p>Sample code:
 *
 * <pre>{@code
 * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
 *     BaseBigtableInstanceAdminClient.create()) {
 *   String name = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString();
 *   baseBigtableInstanceAdminClient.deleteCluster(name);
 * }
 * }</pre>
 *
 * @param name Required. The unique name of the cluster to be deleted. Values are of the form
 *     `projects/{project}/instances/{instance}/clusters/{cluster}`.
 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
 */
public final void deleteCluster(String name) {
    DeleteClusterRequest request = DeleteClusterRequest.newBuilder().setName(name).build();
    deleteCluster(request);
}
Also used : DeleteClusterRequest(com.google.bigtable.admin.v2.DeleteClusterRequest)

Example 2 with DeleteClusterRequest

use of com.google.cloud.dataproc.v1.DeleteClusterRequest in project java-bigtable by googleapis.

the class BaseBigtableInstanceAdminClientTest method deleteClusterTest2.

@Test
public void deleteClusterTest2() throws Exception {
    Empty expectedResponse = Empty.newBuilder().build();
    mockBigtableInstanceAdmin.addResponse(expectedResponse);
    String name = "name3373707";
    client.deleteCluster(name);
    List<AbstractMessage> actualRequests = mockBigtableInstanceAdmin.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    DeleteClusterRequest actualRequest = ((DeleteClusterRequest) actualRequests.get(0));
    Assert.assertEquals(name, actualRequest.getName());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : Empty(com.google.protobuf.Empty) DeleteClusterRequest(com.google.bigtable.admin.v2.DeleteClusterRequest) AbstractMessage(com.google.protobuf.AbstractMessage) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Example 3 with DeleteClusterRequest

use of com.google.cloud.dataproc.v1.DeleteClusterRequest in project java-bigtable by googleapis.

the class BaseBigtableInstanceAdminClientTest method deleteClusterTest.

@Test
public void deleteClusterTest() throws Exception {
    Empty expectedResponse = Empty.newBuilder().build();
    mockBigtableInstanceAdmin.addResponse(expectedResponse);
    ClusterName name = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
    client.deleteCluster(name);
    List<AbstractMessage> actualRequests = mockBigtableInstanceAdmin.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    DeleteClusterRequest actualRequest = ((DeleteClusterRequest) actualRequests.get(0));
    Assert.assertEquals(name.toString(), actualRequest.getName());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : Empty(com.google.protobuf.Empty) DeleteClusterRequest(com.google.bigtable.admin.v2.DeleteClusterRequest) AbstractMessage(com.google.protobuf.AbstractMessage) ClusterName(com.google.bigtable.admin.v2.ClusterName) Test(org.junit.Test)

Example 4 with DeleteClusterRequest

use of com.google.cloud.dataproc.v1.DeleteClusterRequest in project java-bigtable by googleapis.

the class BaseBigtableInstanceAdminClient method deleteCluster.

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
 * Deletes a cluster from an instance.
 *
 * <p>Sample code:
 *
 * <pre>{@code
 * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
 *     BaseBigtableInstanceAdminClient.create()) {
 *   ClusterName name = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
 *   baseBigtableInstanceAdminClient.deleteCluster(name);
 * }
 * }</pre>
 *
 * @param name Required. The unique name of the cluster to be deleted. Values are of the form
 *     `projects/{project}/instances/{instance}/clusters/{cluster}`.
 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
 */
public final void deleteCluster(ClusterName name) {
    DeleteClusterRequest request = DeleteClusterRequest.newBuilder().setName(name == null ? null : name.toString()).build();
    deleteCluster(request);
}
Also used : DeleteClusterRequest(com.google.bigtable.admin.v2.DeleteClusterRequest)

Aggregations

DeleteClusterRequest (com.google.bigtable.admin.v2.DeleteClusterRequest)4 AbstractMessage (com.google.protobuf.AbstractMessage)2 Empty (com.google.protobuf.Empty)2 Test (org.junit.Test)2 ClusterName (com.google.bigtable.admin.v2.ClusterName)1 ByteString (com.google.protobuf.ByteString)1