use of com.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest in project java-dlp by googleapis.
the class DlpServiceClient method deleteStoredInfoType.
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a stored infoType. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to
* learn more.
*
* <p>Sample code:
*
* <pre>{@code
* try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
* StoredInfoTypeName name =
* StoredInfoTypeName.ofOrganizationStoredInfoTypeName(
* "[ORGANIZATION]", "[STORED_INFO_TYPE]");
* dlpServiceClient.deleteStoredInfoType(name);
* }
* }</pre>
*
* @param name Required. Resource name of the organization and storedInfoType to be deleted, for
* example `organizations/433245324/storedInfoTypes/432452342` or
* projects/project-id/storedInfoTypes/432452342.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteStoredInfoType(StoredInfoTypeName name) {
DeleteStoredInfoTypeRequest request = DeleteStoredInfoTypeRequest.newBuilder().setName(name == null ? null : name.toString()).build();
deleteStoredInfoType(request);
}
use of com.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest in project java-dlp by googleapis.
the class DlpServiceClient method deleteStoredInfoType.
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a stored infoType. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to
* learn more.
*
* <p>Sample code:
*
* <pre>{@code
* try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
* String name =
* StoredInfoTypeName.ofOrganizationStoredInfoTypeName(
* "[ORGANIZATION]", "[STORED_INFO_TYPE]")
* .toString();
* dlpServiceClient.deleteStoredInfoType(name);
* }
* }</pre>
*
* @param name Required. Resource name of the organization and storedInfoType to be deleted, for
* example `organizations/433245324/storedInfoTypes/432452342` or
* projects/project-id/storedInfoTypes/432452342.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteStoredInfoType(String name) {
DeleteStoredInfoTypeRequest request = DeleteStoredInfoTypeRequest.newBuilder().setName(name).build();
deleteStoredInfoType(request);
}
use of com.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest in project java-dlp by googleapis.
the class DlpServiceClientTest method deleteStoredInfoTypeTest2.
@Test
public void deleteStoredInfoTypeTest2() throws Exception {
Empty expectedResponse = Empty.newBuilder().build();
mockDlpService.addResponse(expectedResponse);
String name = "name3373707";
client.deleteStoredInfoType(name);
List<AbstractMessage> actualRequests = mockDlpService.getRequests();
Assert.assertEquals(1, actualRequests.size());
DeleteStoredInfoTypeRequest actualRequest = ((DeleteStoredInfoTypeRequest) actualRequests.get(0));
Assert.assertEquals(name, actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest in project java-dlp by googleapis.
the class DlpServiceClientTest method deleteStoredInfoTypeTest.
@Test
public void deleteStoredInfoTypeTest() throws Exception {
Empty expectedResponse = Empty.newBuilder().build();
mockDlpService.addResponse(expectedResponse);
StoredInfoTypeName name = StoredInfoTypeName.ofOrganizationStoredInfoTypeName("[ORGANIZATION]", "[STORED_INFO_TYPE]");
client.deleteStoredInfoType(name);
List<AbstractMessage> actualRequests = mockDlpService.getRequests();
Assert.assertEquals(1, actualRequests.size());
DeleteStoredInfoTypeRequest actualRequest = ((DeleteStoredInfoTypeRequest) actualRequests.get(0));
Assert.assertEquals(name.toString(), actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations