use of com.google.bigtable.admin.v2.AppProfileName in project java-bigtable by googleapis.
the class BaseBigtableInstanceAdminClientTest method deleteAppProfileExceptionTest.
@Test
public void deleteAppProfileExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockBigtableInstanceAdmin.addException(exception);
try {
AppProfileName name = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
client.deleteAppProfile(name);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.bigtable.admin.v2.AppProfileName in project java-bigtable by googleapis.
the class BaseBigtableInstanceAdminClientTest method getAppProfileTest.
@Test
public void getAppProfileTest() throws Exception {
AppProfile expectedResponse = AppProfile.newBuilder().setName(AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]").toString()).setEtag("etag3123477").setDescription("description-1724546052").build();
mockBigtableInstanceAdmin.addResponse(expectedResponse);
AppProfileName name = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
AppProfile actualResponse = client.getAppProfile(name);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockBigtableInstanceAdmin.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetAppProfileRequest actualRequest = ((GetAppProfileRequest) actualRequests.get(0));
Assert.assertEquals(name.toString(), actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.bigtable.admin.v2.AppProfileName in project java-bigtable by googleapis.
the class BaseBigtableInstanceAdminClientTest method getAppProfileExceptionTest.
@Test
public void getAppProfileExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockBigtableInstanceAdmin.addException(exception);
try {
AppProfileName name = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
client.getAppProfile(name);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.bigtable.admin.v2.AppProfileName 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()));
}
use of com.google.bigtable.admin.v2.AppProfileName 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);
}
Aggregations