Search in sources :

Example 1 with DeleteAppProfileRequest

use of com.google.bigtable.admin.v2.DeleteAppProfileRequest in project java-bigtable by googleapis.

the class BigtableInstanceAdminClient method deleteAppProfileAsync.

/**
 * Asynchronously deletes the specified app profile with an option to force deletion.
 *
 * <p>Sample code:
 *
 * <pre>{@code
 * ApiFuture<Void> deleteFuture = client.deleteAppProfileAsync("my-instance", "my-app-profile", true);
 *
 * deleteFuture.get();
 * }</pre>
 */
@SuppressWarnings("WeakerAccess")
public ApiFuture<Void> deleteAppProfileAsync(String instanceId, String appProfileId, boolean forceDelete) {
    String name = NameUtil.formatAppProfileName(projectId, instanceId, appProfileId);
    DeleteAppProfileRequest request = DeleteAppProfileRequest.newBuilder().setName(name).setIgnoreWarnings(forceDelete).build();
    return ApiFutures.transform(stub.deleteAppProfileCallable().futureCall(request), new ApiFunction<Empty, Void>() {

        @Override
        public Void apply(Empty input) {
            return null;
        }
    }, MoreExecutors.directExecutor());
}
Also used : DeleteAppProfileRequest(com.google.bigtable.admin.v2.DeleteAppProfileRequest) Empty(com.google.protobuf.Empty)

Example 2 with DeleteAppProfileRequest

use of com.google.bigtable.admin.v2.DeleteAppProfileRequest in project java-bigtable by googleapis.

the class BaseBigtableInstanceAdminClient method deleteAppProfile.

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

Example 3 with DeleteAppProfileRequest

use of com.google.bigtable.admin.v2.DeleteAppProfileRequest in project java-bigtable by googleapis.

the class BaseBigtableInstanceAdminClientTest method deleteAppProfileTest.

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

Example 4 with DeleteAppProfileRequest

use of com.google.bigtable.admin.v2.DeleteAppProfileRequest in project java-bigtable by googleapis.

the class BaseBigtableInstanceAdminClientTest method deleteAppProfileTest2.

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

Example 5 with DeleteAppProfileRequest

use of com.google.bigtable.admin.v2.DeleteAppProfileRequest in project java-bigtable by googleapis.

the class BaseBigtableInstanceAdminClient method deleteAppProfile.

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

Aggregations

DeleteAppProfileRequest (com.google.bigtable.admin.v2.DeleteAppProfileRequest)5 Empty (com.google.protobuf.Empty)3 AbstractMessage (com.google.protobuf.AbstractMessage)2 Test (org.junit.Test)2 AppProfileName (com.google.bigtable.admin.v2.AppProfileName)1 ByteString (com.google.protobuf.ByteString)1