Search in sources :

Example 1 with DeleteStoredInfoTypeRequest

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);
}
Also used : DeleteStoredInfoTypeRequest(com.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest)

Example 2 with DeleteStoredInfoTypeRequest

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);
}
Also used : DeleteStoredInfoTypeRequest(com.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest)

Example 3 with DeleteStoredInfoTypeRequest

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()));
}
Also used : Empty(com.google.protobuf.Empty) AbstractMessage(com.google.protobuf.AbstractMessage) DeleteStoredInfoTypeRequest(com.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Example 4 with DeleteStoredInfoTypeRequest

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()));
}
Also used : Empty(com.google.protobuf.Empty) AbstractMessage(com.google.protobuf.AbstractMessage) DeleteStoredInfoTypeRequest(com.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest) StoredInfoTypeName(com.google.privacy.dlp.v2.StoredInfoTypeName) Test(org.junit.Test)

Aggregations

DeleteStoredInfoTypeRequest (com.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest)4 AbstractMessage (com.google.protobuf.AbstractMessage)2 Empty (com.google.protobuf.Empty)2 Test (org.junit.Test)2 StoredInfoTypeName (com.google.privacy.dlp.v2.StoredInfoTypeName)1 ByteString (com.google.protobuf.ByteString)1