Search in sources :

Example 6 with DeleteClusterRequest

use of com.google.container.v1beta1.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 7 with DeleteClusterRequest

use of com.google.container.v1beta1.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

AbstractMessage (com.google.protobuf.AbstractMessage)5 Test (org.junit.Test)5 DeleteClusterRequest (com.google.bigtable.admin.v2.DeleteClusterRequest)4 ArrayList (java.util.ArrayList)3 DeleteClusterRequest (com.google.container.v1.DeleteClusterRequest)2 Operation (com.google.container.v1.Operation)2 StatusCondition (com.google.container.v1.StatusCondition)2 Empty (com.google.protobuf.Empty)2 ClusterName (com.google.bigtable.admin.v2.ClusterName)1 DeleteClusterRequest (com.google.container.v1beta1.DeleteClusterRequest)1 Operation (com.google.container.v1beta1.Operation)1 StatusCondition (com.google.container.v1beta1.StatusCondition)1 ByteString (com.google.protobuf.ByteString)1