Search in sources :

Example 1 with DeleteDeidentifyTemplateRequest

use of com.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest in project java-dlp by googleapis.

the class DlpServiceClientTest method deleteDeidentifyTemplateTest.

@Test
public void deleteDeidentifyTemplateTest() throws Exception {
    Empty expectedResponse = Empty.newBuilder().build();
    mockDlpService.addResponse(expectedResponse);
    DeidentifyTemplateName name = DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName("[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]");
    client.deleteDeidentifyTemplate(name);
    List<AbstractMessage> actualRequests = mockDlpService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    DeleteDeidentifyTemplateRequest actualRequest = ((DeleteDeidentifyTemplateRequest) actualRequests.get(0));
    Assert.assertEquals(name.toString(), actualRequest.getName());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : Empty(com.google.protobuf.Empty) DeleteDeidentifyTemplateRequest(com.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest) AbstractMessage(com.google.protobuf.AbstractMessage) DeidentifyTemplateName(com.google.privacy.dlp.v2.DeidentifyTemplateName) Test(org.junit.Test)

Example 2 with DeleteDeidentifyTemplateRequest

use of com.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest in project java-dlp by googleapis.

the class DlpServiceClient method deleteDeidentifyTemplate.

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
 * Deletes a DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid to
 * learn more.
 *
 * <p>Sample code:
 *
 * <pre>{@code
 * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
 *   DeidentifyTemplateName name =
 *       DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName(
 *           "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]");
 *   dlpServiceClient.deleteDeidentifyTemplate(name);
 * }
 * }</pre>
 *
 * @param name Required. Resource name of the organization and deidentify template to be deleted,
 *     for example `organizations/433245324/deidentifyTemplates/432452342` or
 *     projects/project-id/deidentifyTemplates/432452342.
 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
 */
public final void deleteDeidentifyTemplate(DeidentifyTemplateName name) {
    DeleteDeidentifyTemplateRequest request = DeleteDeidentifyTemplateRequest.newBuilder().setName(name == null ? null : name.toString()).build();
    deleteDeidentifyTemplate(request);
}
Also used : DeleteDeidentifyTemplateRequest(com.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest)

Example 3 with DeleteDeidentifyTemplateRequest

use of com.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest in project java-dlp by googleapis.

the class DlpServiceClient method deleteDeidentifyTemplate.

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
 * Deletes a DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid to
 * learn more.
 *
 * <p>Sample code:
 *
 * <pre>{@code
 * try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
 *   String name =
 *       DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName(
 *               "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]")
 *           .toString();
 *   dlpServiceClient.deleteDeidentifyTemplate(name);
 * }
 * }</pre>
 *
 * @param name Required. Resource name of the organization and deidentify template to be deleted,
 *     for example `organizations/433245324/deidentifyTemplates/432452342` or
 *     projects/project-id/deidentifyTemplates/432452342.
 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
 */
public final void deleteDeidentifyTemplate(String name) {
    DeleteDeidentifyTemplateRequest request = DeleteDeidentifyTemplateRequest.newBuilder().setName(name).build();
    deleteDeidentifyTemplate(request);
}
Also used : DeleteDeidentifyTemplateRequest(com.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest)

Example 4 with DeleteDeidentifyTemplateRequest

use of com.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest in project java-dlp by googleapis.

the class DlpServiceClientTest method deleteDeidentifyTemplateTest2.

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

Aggregations

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