Class DlpServiceClient (3.3.2)

public class DlpServiceClient implements BackgroundResource

Service Description: The Cloud Data Loss Prevention (DLP) API is a service that allows clients to detect the presence of Personally Identifiable Information (PII) and other privacy-sensitive data in user-supplied, unstructured data streams, like text blocks or images. The service also includes methods for sensitive data redaction and scheduling of data scans on Google Cloud Platform based data sets.

To learn more about concepts and find how-to guides see https://cloud.google.com/dlp/docs/.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   InspectContentRequest request =
       InspectContentRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setInspectConfig(InspectConfig.newBuilder().build())
           .setItem(ContentItem.newBuilder().build())
           .setInspectTemplateName("inspectTemplateName1828857433")
           .setLocationId("locationId1541836720")
           .build();
   InspectContentResponse response = dlpServiceClient.inspectContent(request);
 }
 

Note: close() needs to be called on the DlpServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of DlpServiceSettings to create(). For example:

To customize credentials:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 DlpServiceSettings dlpServiceSettings =
     DlpServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 DlpServiceClient dlpServiceClient = DlpServiceClient.create(dlpServiceSettings);
 

To customize the endpoint:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 DlpServiceSettings dlpServiceSettings =
     DlpServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 DlpServiceClient dlpServiceClient = DlpServiceClient.create(dlpServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > DlpServiceClient

Implements

BackgroundResource

Static Methods

create()

public static final DlpServiceClient create()

Constructs an instance of DlpServiceClient with default settings.

Returns
TypeDescription
DlpServiceClient
Exceptions
TypeDescription
IOException

create(DlpServiceSettings settings)

public static final DlpServiceClient create(DlpServiceSettings settings)

Constructs an instance of DlpServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
NameDescription
settingsDlpServiceSettings
Returns
TypeDescription
DlpServiceClient
Exceptions
TypeDescription
IOException

create(DlpServiceStub stub)

public static final DlpServiceClient create(DlpServiceStub stub)

Constructs an instance of DlpServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(DlpServiceSettings).

Parameter
NameDescription
stubDlpServiceStub
Returns
TypeDescription
DlpServiceClient

Constructors

DlpServiceClient(DlpServiceSettings settings)

protected DlpServiceClient(DlpServiceSettings settings)

Constructs an instance of DlpServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.

Parameter
NameDescription
settingsDlpServiceSettings

DlpServiceClient(DlpServiceStub stub)

protected DlpServiceClient(DlpServiceStub stub)
Parameter
NameDescription
stubDlpServiceStub

Methods

activateJobTrigger(ActivateJobTriggerRequest request)

public final DlpJob activateJobTrigger(ActivateJobTriggerRequest request)

Activate a job trigger. Causes the immediate execute of a trigger instead of waiting on the trigger event to occur.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   ActivateJobTriggerRequest request =
       ActivateJobTriggerRequest.newBuilder()
           .setName(
               JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]").toString())
           .build();
   DlpJob response = dlpServiceClient.activateJobTrigger(request);
 }
 
Parameter
NameDescription
requestActivateJobTriggerRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
DlpJob

activateJobTriggerCallable()

public final UnaryCallable<ActivateJobTriggerRequest,DlpJob> activateJobTriggerCallable()

Activate a job trigger. Causes the immediate execute of a trigger instead of waiting on the trigger event to occur.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   ActivateJobTriggerRequest request =
       ActivateJobTriggerRequest.newBuilder()
           .setName(
               JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]").toString())
           .build();
   ApiFuture<DlpJob> future = dlpServiceClient.activateJobTriggerCallable().futureCall(request);
   // Do something.
   DlpJob response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<ActivateJobTriggerRequest,DlpJob>

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
InterruptedException

cancelDlpJob(CancelDlpJobRequest request)

public final void cancelDlpJob(CancelDlpJobRequest request)

Starts asynchronous cancellation on a long-running DlpJob. The server makes a best effort to cancel the DlpJob, but success is not guaranteed. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   CancelDlpJobRequest request =
       CancelDlpJobRequest.newBuilder()
           .setName(DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]").toString())
           .build();
   dlpServiceClient.cancelDlpJob(request);
 }
 
Parameter
NameDescription
requestCancelDlpJobRequest

The request object containing all of the parameters for the API call.

cancelDlpJobCallable()

public final UnaryCallable<CancelDlpJobRequest,Empty> cancelDlpJobCallable()

Starts asynchronous cancellation on a long-running DlpJob. The server makes a best effort to cancel the DlpJob, but success is not guaranteed. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   CancelDlpJobRequest request =
       CancelDlpJobRequest.newBuilder()
           .setName(DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]").toString())
           .build();
   ApiFuture<Empty> future = dlpServiceClient.cancelDlpJobCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CancelDlpJobRequest,Empty>

close()

public final void close()

createDeidentifyTemplate(CreateDeidentifyTemplateRequest request)

public final DeidentifyTemplate createDeidentifyTemplate(CreateDeidentifyTemplateRequest request)

Creates a DeidentifyTemplate for re-using frequently used configuration for de-identifying content, images, and storage. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   CreateDeidentifyTemplateRequest request =
       CreateDeidentifyTemplateRequest.newBuilder()
           .setParent(OrganizationName.of("[ORGANIZATION]").toString())
           .setDeidentifyTemplate(DeidentifyTemplate.newBuilder().build())
           .setTemplateId("templateId1304010549")
           .setLocationId("locationId1541836720")
           .build();
   DeidentifyTemplate response = dlpServiceClient.createDeidentifyTemplate(request);
 }
 
Parameter
NameDescription
requestCreateDeidentifyTemplateRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
DeidentifyTemplate

createDeidentifyTemplate(LocationName parent, DeidentifyTemplate deidentifyTemplate)

public final DeidentifyTemplate createDeidentifyTemplate(LocationName parent, DeidentifyTemplate deidentifyTemplate)

Creates a DeidentifyTemplate for re-using frequently used configuration for de-identifying content, images, and storage. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build();
   DeidentifyTemplate response =
       dlpServiceClient.createDeidentifyTemplate(parent, deidentifyTemplate);
 }
 
Parameters
NameDescription
parentLocationName

Required. Parent resource name.

The format of this value varies depending on the scope of the request (project or organization) and whether you have specified a processing location:

+ Projects scope, location specified:<br/> projects/<var>PROJECT_ID</var>/locations/<var>LOCATION_ID</var>

  • Projects scope, no location specified (defaults to global):<br/> projects/<var>PROJECT_ID</var> + Organizations scope, location specified:<br/> organizations/<var>ORG_ID</var>/locations/<var>LOCATION_ID</var>
  • Organizations scope, no location specified (defaults to global):<br/> organizations/<var>ORG_ID</var>

    The following example parent string specifies a parent project with the identifier example-project, and specifies the europe-west3 location for processing data:

    parent=projects/example-project/locations/europe-west3

deidentifyTemplateDeidentifyTemplate

Required. The DeidentifyTemplate to create.

Returns
TypeDescription
DeidentifyTemplate

createDeidentifyTemplate(OrganizationLocationName parent, DeidentifyTemplate deidentifyTemplate)

public final DeidentifyTemplate createDeidentifyTemplate(OrganizationLocationName parent, DeidentifyTemplate deidentifyTemplate)

Creates a DeidentifyTemplate for re-using frequently used configuration for de-identifying content, images, and storage. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
   DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build();
   DeidentifyTemplate response =
       dlpServiceClient.createDeidentifyTemplate(parent, deidentifyTemplate);
 }
 
Parameters
NameDescription
parentOrganizationLocationName

Required. Parent resource name.

The format of this value varies depending on the scope of the request (project or organization) and whether you have specified a processing location:

+ Projects scope, location specified:<br/> projects/<var>PROJECT_ID</var>/locations/<var>LOCATION_ID</var>

  • Projects scope, no location specified (defaults to global):<br/> projects/<var>PROJECT_ID</var> + Organizations scope, location specified:<br/> organizations/<var>ORG_ID</var>/locations/<var>LOCATION_ID</var>
  • Organizations scope, no location specified (defaults to global):<br/> organizations/<var>ORG_ID</var>

    The following example parent string specifies a parent project with the identifier example-project, and specifies the europe-west3 location for processing data:

    parent=projects/example-project/locations/europe-west3

deidentifyTemplateDeidentifyTemplate

Required. The DeidentifyTemplate to create.

Returns
TypeDescription
DeidentifyTemplate

createDeidentifyTemplate(OrganizationName parent, DeidentifyTemplate deidentifyTemplate)

public final DeidentifyTemplate createDeidentifyTemplate(OrganizationName parent, DeidentifyTemplate deidentifyTemplate)

Creates a DeidentifyTemplate for re-using frequently used configuration for de-identifying content, images, and storage. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
   DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build();
   DeidentifyTemplate response =
       dlpServiceClient.createDeidentifyTemplate(parent, deidentifyTemplate);
 }
 
Parameters
NameDescription
parentOrganizationName

Required. Parent resource name.

The format of this value varies depending on the scope of the request (project or organization) and whether you have specified a processing location:

+ Projects scope, location specified:<br/> projects/<var>PROJECT_ID</var>/locations/<var>LOCATION_ID</var>

  • Projects scope, no location specified (defaults to global):<br/> projects/<var>PROJECT_ID</var> + Organizations scope, location specified:<br/> organizations/<var>ORG_ID</var>/locations/<var>LOCATION_ID</var>
  • Organizations scope, no location specified (defaults to global):<br/> organizations/<var>ORG_ID</var>

    The following example parent string specifies a parent project with the identifier example-project, and specifies the europe-west3 location for processing data:

    parent=projects/example-project/locations/europe-west3

deidentifyTemplateDeidentifyTemplate

Required. The DeidentifyTemplate to create.

Returns
TypeDescription
DeidentifyTemplate

createDeidentifyTemplate(ProjectName parent, DeidentifyTemplate deidentifyTemplate)

public final DeidentifyTemplate createDeidentifyTemplate(ProjectName parent, DeidentifyTemplate deidentifyTemplate)

Creates a DeidentifyTemplate for re-using frequently used configuration for de-identifying content, images, and storage. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   ProjectName parent = ProjectName.of("[PROJECT]");
   DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build();
   DeidentifyTemplate response =
       dlpServiceClient.createDeidentifyTemplate(parent, deidentifyTemplate);
 }
 
Parameters
NameDescription
parentProjectName

Required. Parent resource name.

The format of this value varies depending on the scope of the request (project or organization) and whether you have specified a processing location:

+ Projects scope, location specified:<br/> projects/<var>PROJECT_ID</var>/locations/<var>LOCATION_ID</var>

  • Projects scope, no location specified (defaults to global):<br/> projects/<var>PROJECT_ID</var> + Organizations scope, location specified:<br/> organizations/<var>ORG_ID</var>/locations/<var>LOCATION_ID</var>
  • Organizations scope, no location specified (defaults to global):<br/> organizations/<var>ORG_ID</var>

    The following example parent string specifies a parent project with the identifier example-project, and specifies the europe-west3 location for processing data:

    parent=projects/example-project/locations/europe-west3

deidentifyTemplateDeidentifyTemplate

Required. The DeidentifyTemplate to create.

Returns
TypeDescription
DeidentifyTemplate

createDeidentifyTemplate(String parent, DeidentifyTemplate deidentifyTemplate)

public final DeidentifyTemplate createDeidentifyTemplate(String parent, DeidentifyTemplate deidentifyTemplate)

Creates a DeidentifyTemplate for re-using frequently used configuration for de-identifying content, images, and storage. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   String parent = OrganizationName.of("[ORGANIZATION]").toString();
   DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build();
   DeidentifyTemplate response =
       dlpServiceClient.createDeidentifyTemplate(parent, deidentifyTemplate);
 }
 
Parameters
NameDescription
parentString

Required. Parent resource name.

The format of this value varies depending on the scope of the request (project or organization) and whether you have specified a processing location:

+ Projects scope, location specified:<br/> projects/<var>PROJECT_ID</var>/locations/<var>LOCATION_ID</var>

  • Projects scope, no location specified (defaults to global):<br/> projects/<var>PROJECT_ID</var> + Organizations scope, location specified:<br/> organizations/<var>ORG_ID</var>/locations/<var>LOCATION_ID</var>
  • Organizations scope, no location specified (defaults to global):<br/> organizations/<var>ORG_ID</var>

    The following example parent string specifies a parent project with the identifier example-project, and specifies the europe-west3 location for processing data:

    parent=projects/example-project/locations/europe-west3

deidentifyTemplateDeidentifyTemplate

Required. The DeidentifyTemplate to create.

Returns
TypeDescription
DeidentifyTemplate

createDeidentifyTemplateCallable()

public final UnaryCallable<CreateDeidentifyTemplateRequest,DeidentifyTemplate> createDeidentifyTemplateCallable()

Creates a DeidentifyTemplate for re-using frequently used configuration for de-identifying content, images, and storage. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   CreateDeidentifyTemplateRequest request =
       CreateDeidentifyTemplateRequest.newBuilder()
           .setParent(OrganizationName.of("[ORGANIZATION]").toString())
           .setDeidentifyTemplate(DeidentifyTemplate.newBuilder().build())
           .setTemplateId("templateId1304010549")
           .setLocationId("locationId1541836720")
           .build();
   ApiFuture<DeidentifyTemplate> future =
       dlpServiceClient.createDeidentifyTemplateCallable().futureCall(request);
   // Do something.
   DeidentifyTemplate response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreateDeidentifyTemplateRequest,DeidentifyTemplate>

createDlpJob(CreateDlpJobRequest request)

public final DlpJob createDlpJob(CreateDlpJobRequest request)

Creates a new job to inspect storage or calculate risk metrics. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.

When no InfoTypes or CustomInfoTypes are specified in inspect jobs, the system will automatically choose what detectors to run. By default this may be all types, but may change over time as detectors are updated.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   CreateDlpJobRequest request =
       CreateDlpJobRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setJobId("jobId101296568")
           .setLocationId("locationId1541836720")
           .build();
   DlpJob response = dlpServiceClient.createDlpJob(request);
 }
 
Parameter
NameDescription
requestCreateDlpJobRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
DlpJob

createDlpJob(LocationName parent, InspectJobConfig inspectJob)

public final DlpJob createDlpJob(LocationName parent, InspectJobConfig inspectJob)

Creates a new job to inspect storage or calculate risk metrics. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.

When no InfoTypes or CustomInfoTypes are specified in inspect jobs, the system will automatically choose what detectors to run. By default this may be all types, but may change over time as detectors are updated.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   InspectJobConfig inspectJob = InspectJobConfig.newBuilder().build();
   DlpJob response = dlpServiceClient.createDlpJob(parent, inspectJob);
 }
 
Parameters
NameDescription
parentLocationName

Required. Parent resource name.

The format of this value varies depending on whether you have specified a processing location:

+ Projects scope, location specified:<br/> projects/<var>PROJECT_ID</var>/locations/<var>LOCATION_ID</var>

  • Projects scope, no location specified (defaults to global):<br/> projects/<var>PROJECT_ID</var>

    The following example parent string specifies a parent project with the identifier example-project, and specifies the europe-west3 location for processing data:

    parent=projects/example-project/locations/europe-west3

inspectJobInspectJobConfig

An inspection job scans a storage repository for InfoTypes.

Returns
TypeDescription
DlpJob

createDlpJob(LocationName parent, RiskAnalysisJobConfig riskJob)

public final DlpJob createDlpJob(LocationName parent, RiskAnalysisJobConfig riskJob)

Creates a new job to inspect storage or calculate risk metrics. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.

When no InfoTypes or CustomInfoTypes are specified in inspect jobs, the system will automatically choose what detectors to run. By default this may be all types, but may change over time as detectors are updated.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   RiskAnalysisJobConfig riskJob = RiskAnalysisJobConfig.newBuilder().build();
   DlpJob response = dlpServiceClient.createDlpJob(parent, riskJob);
 }
 
Parameters
NameDescription
parentLocationName

Required. Parent resource name.

The format of this value varies depending on whether you have specified a processing location:

+ Projects scope, location specified:<br/> projects/<var>PROJECT_ID</var>/locations/<var>LOCATION_ID</var>

  • Projects scope, no location specified (defaults to global):<br/> projects/<var>PROJECT_ID</var>

    The following example parent string specifies a parent project with the identifier example-project, and specifies the europe-west3 location for processing data:

    parent=projects/example-project/locations/europe-west3

riskJobRiskAnalysisJobConfig

A risk analysis job calculates re-identification risk metrics for a BigQuery table.

Returns
TypeDescription
DlpJob

createDlpJob(ProjectName parent, InspectJobConfig inspectJob)

public final DlpJob createDlpJob(ProjectName parent, InspectJobConfig inspectJob)

Creates a new job to inspect storage or calculate risk metrics. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.

When no InfoTypes or CustomInfoTypes are specified in inspect jobs, the system will automatically choose what detectors to run. By default this may be all types, but may change over time as detectors are updated.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   ProjectName parent = ProjectName.of("[PROJECT]");
   InspectJobConfig inspectJob = InspectJobConfig.newBuilder().build();
   DlpJob response = dlpServiceClient.createDlpJob(parent, inspectJob);
 }
 
Parameters
NameDescription
parentProjectName

Required. Parent resource name.

The format of this value varies depending on whether you have specified a processing location:

+ Projects scope, location specified:<br/> projects/<var>PROJECT_ID</var>/locations/<var>LOCATION_ID</var>

  • Projects scope, no location specified (defaults to global):<br/> projects/<var>PROJECT_ID</var>

    The following example parent string specifies a parent project with the identifier example-project, and specifies the europe-west3 location for processing data:

    parent=projects/example-project/locations/europe-west3

inspectJobInspectJobConfig

An inspection job scans a storage repository for InfoTypes.

Returns
TypeDescription
DlpJob

createDlpJob(ProjectName parent, RiskAnalysisJobConfig riskJob)

public final DlpJob createDlpJob(ProjectName parent, RiskAnalysisJobConfig riskJob)

Creates a new job to inspect storage or calculate risk metrics. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.

When no InfoTypes or CustomInfoTypes are specified in inspect jobs, the system will automatically choose what detectors to run. By default this may be all types, but may change over time as detectors are updated.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   ProjectName parent = ProjectName.of("[PROJECT]");
   RiskAnalysisJobConfig riskJob = RiskAnalysisJobConfig.newBuilder().build();
   DlpJob response = dlpServiceClient.createDlpJob(parent, riskJob);
 }
 
Parameters
NameDescription
parentProjectName

Required. Parent resource name.

The format of this value varies depending on whether you have specified a processing location:

+ Projects scope, location specified:<br/> projects/<var>PROJECT_ID</var>/locations/<var>LOCATION_ID</var>

  • Projects scope, no location specified (defaults to global):<br/> projects/<var>PROJECT_ID</var>

    The following example parent string specifies a parent project with the identifier example-project, and specifies the europe-west3 location for processing data:

    parent=projects/example-project/locations/europe-west3

riskJobRiskAnalysisJobConfig

A risk analysis job calculates re-identification risk metrics for a BigQuery table.

Returns
TypeDescription
DlpJob

createDlpJob(String parent, InspectJobConfig inspectJob)

public final DlpJob createDlpJob(String parent, InspectJobConfig inspectJob)

Creates a new job to inspect storage or calculate risk metrics. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.

When no InfoTypes or CustomInfoTypes are specified in inspect jobs, the system will automatically choose what detectors to run. By default this may be all types, but may change over time as detectors are updated.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   String parent = ProjectName.of("[PROJECT]").toString();
   InspectJobConfig inspectJob = InspectJobConfig.newBuilder().build();
   DlpJob response = dlpServiceClient.createDlpJob(parent, inspectJob);
 }
 
Parameters
NameDescription
parentString

Required. Parent resource name.

The format of this value varies depending on whether you have specified a processing location:

+ Projects scope, location specified:<br/> projects/<var>PROJECT_ID</var>/locations/<var>LOCATION_ID</var>

  • Projects scope, no location specified (defaults to global):<br/> projects/<var>PROJECT_ID</var>

    The following example parent string specifies a parent project with the identifier example-project, and specifies the europe-west3 location for processing data:

    parent=projects/example-project/locations/europe-west3

inspectJobInspectJobConfig

An inspection job scans a storage repository for InfoTypes.

Returns
TypeDescription
DlpJob

createDlpJob(String parent, RiskAnalysisJobConfig riskJob)

public final DlpJob createDlpJob(String parent, RiskAnalysisJobConfig riskJob)

Creates a new job to inspect storage or calculate risk metrics. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.

When no InfoTypes or CustomInfoTypes are specified in inspect jobs, the system will automatically choose what detectors to run. By default this may be all types, but may change over time as detectors are updated.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   String parent = ProjectName.of("[PROJECT]").toString();
   RiskAnalysisJobConfig riskJob = RiskAnalysisJobConfig.newBuilder().build();
   DlpJob response = dlpServiceClient.createDlpJob(parent, riskJob);
 }
 
Parameters
NameDescription
parentString

Required. Parent resource name.

The format of this value varies depending on whether you have specified a processing location:

+ Projects scope, location specified:<br/> projects/<var>PROJECT_ID</var>/locations/<var>LOCATION_ID</var>

  • Projects scope, no location specified (defaults to global):<br/> projects/<var>PROJECT_ID</var>

    The following example parent string specifies a parent project with the identifier example-project, and specifies the europe-west3 location for processing data:

    parent=projects/example-project/locations/europe-west3

riskJobRiskAnalysisJobConfig

A risk analysis job calculates re-identification risk metrics for a BigQuery table.

Returns
TypeDescription
DlpJob

createDlpJobCallable()

public final UnaryCallable<CreateDlpJobRequest,DlpJob> createDlpJobCallable()

Creates a new job to inspect storage or calculate risk metrics. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.

When no InfoTypes or CustomInfoTypes are specified in inspect jobs, the system will automatically choose what detectors to run. By default this may be all types, but may change over time as detectors are updated.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   CreateDlpJobRequest request =
       CreateDlpJobRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setJobId("jobId101296568")
           .setLocationId("locationId1541836720")
           .build();
   ApiFuture<DlpJob> future = dlpServiceClient.createDlpJobCallable().futureCall(request);
   // Do something.
   DlpJob response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreateDlpJobRequest,DlpJob>

createInspectTemplate(CreateInspectTemplateRequest request)

public final InspectTemplate createInspectTemplate(CreateInspectTemplateRequest request)

Creates an InspectTemplate for re-using frequently used configuration for inspecting content, images, and storage. See https://cloud.google.com/dlp/docs/creating-templates to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   CreateInspectTemplateRequest request =
       CreateInspectTemplateRequest.newBuilder()
           .setParent(OrganizationName.of("[ORGANIZATION]").toString())
           .setInspectTemplate(InspectTemplate.newBuilder().build())
           .setTemplateId("templateId1304010549")
           .setLocationId("locationId1541836720")
           .build();
   InspectTemplate response = dlpServiceClient.createInspectTemplate(request);
 }
 
Parameter
NameDescription
requestCreateInspectTemplateRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
InspectTemplate

createInspectTemplate(LocationName parent, InspectTemplate inspectTemplate)

public final InspectTemplate createInspectTemplate(LocationName parent, InspectTemplate inspectTemplate)

Creates an InspectTemplate for re-using frequently used configuration for inspecting content, images, and storage. See https://cloud.google.com/dlp/docs/creating-templates to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   InspectTemplate inspectTemplate = InspectTemplate.newBuilder().build();
   InspectTemplate response = dlpServiceClient.createInspectTemplate(parent, inspectTemplate);
 }
 
Parameters
NameDescription
parentLocationName

Required. Parent resource name.

The format of this value varies depending on the scope of the request (project or organization) and whether you have specified a processing location:

+ Projects scope, location specified:<br/> projects/<var>PROJECT_ID</var>/locations/<var>LOCATION_ID</var>

  • Projects scope, no location specified (defaults to global):<br/> projects/<var>PROJECT_ID</var> + Organizations scope, location specified:<br/> organizations/<var>ORG_ID</var>/locations/<var>LOCATION_ID</var>
  • Organizations scope, no location specified (defaults to global):<br/> organizations/<var>ORG_ID</var>

    The following example parent string specifies a parent project with the identifier example-project, and specifies the europe-west3 location for processing data:

    parent=projects/example-project/locations/europe-west3

inspectTemplateInspectTemplate

Required. The InspectTemplate to create.

Returns
TypeDescription
InspectTemplate

createInspectTemplate(OrganizationLocationName parent, InspectTemplate inspectTemplate)

public final InspectTemplate createInspectTemplate(OrganizationLocationName parent, InspectTemplate inspectTemplate)

Creates an InspectTemplate for re-using frequently used configuration for inspecting content, images, and storage. See https://cloud.google.com/dlp/docs/creating-templates to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
   InspectTemplate inspectTemplate = InspectTemplate.newBuilder().build();
   InspectTemplate response = dlpServiceClient.createInspectTemplate(parent, inspectTemplate);
 }
 
Parameters
NameDescription
parentOrganizationLocationName

Required. Parent resource name.

The format of this value varies depending on the scope of the request (project or organization) and whether you have specified a processing location:

+ Projects scope, location specified:<br/> projects/<var>PROJECT_ID</var>/locations/<var>LOCATION_ID</var>

  • Projects scope, no location specified (defaults to global):<br/> projects/<var>PROJECT_ID</var> + Organizations scope, location specified:<br/> organizations/<var>ORG_ID</var>/locations/<var>LOCATION_ID</var>
  • Organizations scope, no location specified (defaults to global):<br/> organizations/<var>ORG_ID</var>

    The following example parent string specifies a parent project with the identifier example-project, and specifies the europe-west3 location for processing data:

    parent=projects/example-project/locations/europe-west3

inspectTemplateInspectTemplate

Required. The InspectTemplate to create.

Returns
TypeDescription
InspectTemplate

createInspectTemplate(OrganizationName parent, InspectTemplate inspectTemplate)

public final InspectTemplate createInspectTemplate(OrganizationName parent, InspectTemplate inspectTemplate)

Creates an InspectTemplate for re-using frequently used configuration for inspecting content, images, and storage. See https://cloud.google.com/dlp/docs/creating-templates to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
   InspectTemplate inspectTemplate = InspectTemplate.newBuilder().build();
   InspectTemplate response = dlpServiceClient.createInspectTemplate(parent, inspectTemplate);
 }
 
Parameters
NameDescription
parentOrganizationName

Required. Parent resource name.

The format of this value varies depending on the scope of the request (project or organization) and whether you have specified a processing location:

+ Projects scope, location specified:<br/> projects/<var>PROJECT_ID</var>/locations/<var>LOCATION_ID</var>

  • Projects scope, no location specified (defaults to global):<br/> projects/<var>PROJECT_ID</var> + Organizations scope, location specified:<br/> organizations/<var>ORG_ID</var>/locations/<var>LOCATION_ID</var>
  • Organizations scope, no location specified (defaults to global):<br/> organizations/<var>ORG_ID</var>

    The following example parent string specifies a parent project with the identifier example-project, and specifies the europe-west3 location for processing data:

    parent=projects/example-project/locations/europe-west3

inspectTemplateInspectTemplate

Required. The InspectTemplate to create.

Returns
TypeDescription
InspectTemplate

createInspectTemplate(ProjectName parent, InspectTemplate inspectTemplate)

public final InspectTemplate createInspectTemplate(ProjectName parent, InspectTemplate inspectTemplate)

Creates an InspectTemplate for re-using frequently used configuration for inspecting content, images, and storage. See https://cloud.google.com/dlp/docs/creating-templates to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   ProjectName parent = ProjectName.of("[PROJECT]");
   InspectTemplate inspectTemplate = InspectTemplate.newBuilder().build();
   InspectTemplate response = dlpServiceClient.createInspectTemplate(parent, inspectTemplate);
 }
 
Parameters
NameDescription
parentProjectName

Required. Parent resource name.

The format of this value varies depending on the scope of the request (project or organization) and whether you have specified a processing location:

+ Projects scope, location specified:<br/> projects/<var>PROJECT_ID</var>/locations/<var>LOCATION_ID</var>

  • Projects scope, no location specified (defaults to global):<br/> projects/<var>PROJECT_ID</var> + Organizations scope, location specified:<br/> organizations/<var>ORG_ID</var>/locations/<var>LOCATION_ID</var>
  • Organizations scope, no location specified (defaults to global):<br/> organizations/<var>ORG_ID</var>

    The following example parent string specifies a parent project with the identifier example-project, and specifies the europe-west3 location for processing data:

    parent=projects/example-project/locations/europe-west3

inspectTemplateInspectTemplate

Required. The InspectTemplate to create.

Returns
TypeDescription
InspectTemplate

createInspectTemplate(String parent, InspectTemplate inspectTemplate)

public final InspectTemplate createInspectTemplate(String parent, InspectTemplate inspectTemplate)

Creates an InspectTemplate for re-using frequently used configuration for inspecting content, images, and storage. See https://cloud.google.com/dlp/docs/creating-templates to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   String parent = OrganizationName.of("[ORGANIZATION]").toString();
   InspectTemplate inspectTemplate = InspectTemplate.newBuilder().build();
   InspectTemplate response = dlpServiceClient.createInspectTemplate(parent, inspectTemplate);
 }
 
Parameters
NameDescription
parentString

Required. Parent resource name.

The format of this value varies depending on the scope of the request (project or organization) and whether you have specified a processing location:

+ Projects scope, location specified:<br/> projects/<var>PROJECT_ID</var>/locations/<var>LOCATION_ID</var>

  • Projects scope, no location specified (defaults to global):<br/> projects/<var>PROJECT_ID</var> + Organizations scope, location specified:<br/> organizations/<var>ORG_ID</var>/locations/<var>LOCATION_ID</var>
  • Organizations scope, no location specified (defaults to global):<br/> organizations/<var>ORG_ID</var>

    The following example parent string specifies a parent project with the identifier example-project, and specifies the europe-west3 location for processing data:

    parent=projects/example-project/locations/europe-west3

inspectTemplateInspectTemplate

Required. The InspectTemplate to create.

Returns
TypeDescription
InspectTemplate

createInspectTemplateCallable()

public final UnaryCallable<CreateInspectTemplateRequest,InspectTemplate> createInspectTemplateCallable()

Creates an InspectTemplate for re-using frequently used configuration for inspecting content, images, and storage. See https://cloud.google.com/dlp/docs/creating-templates to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   CreateInspectTemplateRequest request =
       CreateInspectTemplateRequest.newBuilder()
           .setParent(OrganizationName.of("[ORGANIZATION]").toString())
           .setInspectTemplate(InspectTemplate.newBuilder().build())
           .setTemplateId("templateId1304010549")
           .setLocationId("locationId1541836720")
           .build();
   ApiFuture<InspectTemplate> future =
       dlpServiceClient.createInspectTemplateCallable().futureCall(request);
   // Do something.
   InspectTemplate response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreateInspectTemplateRequest,InspectTemplate>

createJobTrigger(CreateJobTriggerRequest request)

public final JobTrigger createJobTrigger(CreateJobTriggerRequest request)

Creates a job trigger to run DLP actions such as scanning storage for sensitive information on a set schedule. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   CreateJobTriggerRequest request =
       CreateJobTriggerRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setJobTrigger(JobTrigger.newBuilder().build())
           .setTriggerId("triggerId-648752909")
           .setLocationId("locationId1541836720")
           .build();
   JobTrigger response = dlpServiceClient.createJobTrigger(request);
 }
 
Parameter
NameDescription
requestCreateJobTriggerRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
JobTrigger

createJobTrigger(LocationName parent, JobTrigger jobTrigger)

public final JobTrigger createJobTrigger(LocationName parent, JobTrigger jobTrigger)

Creates a job trigger to run DLP actions such as scanning storage for sensitive information on a set schedule. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   JobTrigger jobTrigger = JobTrigger.newBuilder().build();
   JobTrigger response = dlpServiceClient.createJobTrigger(parent, jobTrigger);
 }
 
Parameters
NameDescription
parentLocationName

Required. Parent resource name.

The format of this value varies depending on whether you have specified a processing location:

+ Projects scope, location specified:<br/> projects/<var>PROJECT_ID</var>/locations/<var>LOCATION_ID</var>

  • Projects scope, no location specified (defaults to global):<br/> projects/<var>PROJECT_ID</var>

    The following example parent string specifies a parent project with the identifier example-project, and specifies the europe-west3 location for processing data:

    parent=projects/example-project/locations/europe-west3

jobTriggerJobTrigger

Required. The JobTrigger to create.

Returns
TypeDescription
JobTrigger

createJobTrigger(ProjectName parent, JobTrigger jobTrigger)

public final JobTrigger createJobTrigger(ProjectName parent, JobTrigger jobTrigger)

Creates a job trigger to run DLP actions such as scanning storage for sensitive information on a set schedule. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   ProjectName parent = ProjectName.of("[PROJECT]");
   JobTrigger jobTrigger = JobTrigger.newBuilder().build();
   JobTrigger response = dlpServiceClient.createJobTrigger(parent, jobTrigger);
 }
 
Parameters
NameDescription
parentProjectName

Required. Parent resource name.

The format of this value varies depending on whether you have specified a processing location:

+ Projects scope, location specified:<br/> projects/<var>PROJECT_ID</var>/locations/<var>LOCATION_ID</var>

  • Projects scope, no location specified (defaults to global):<br/> projects/<var>PROJECT_ID</var>

    The following example parent string specifies a parent project with the identifier example-project, and specifies the europe-west3 location for processing data:

    parent=projects/example-project/locations/europe-west3

jobTriggerJobTrigger

Required. The JobTrigger to create.

Returns
TypeDescription
JobTrigger

createJobTrigger(String parent, JobTrigger jobTrigger)

public final JobTrigger createJobTrigger(String parent, JobTrigger jobTrigger)

Creates a job trigger to run DLP actions such as scanning storage for sensitive information on a set schedule. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   String parent = ProjectName.of("[PROJECT]").toString();
   JobTrigger jobTrigger = JobTrigger.newBuilder().build();
   JobTrigger response = dlpServiceClient.createJobTrigger(parent, jobTrigger);
 }
 
Parameters
NameDescription
parentString

Required. Parent resource name.

The format of this value varies depending on whether you have specified a processing location:

+ Projects scope, location specified:<br/> projects/<var>PROJECT_ID</var>/locations/<var>LOCATION_ID</var>

  • Projects scope, no location specified (defaults to global):<br/> projects/<var>PROJECT_ID</var>

    The following example parent string specifies a parent project with the identifier example-project, and specifies the europe-west3 location for processing data:

    parent=projects/example-project/locations/europe-west3

jobTriggerJobTrigger

Required. The JobTrigger to create.

Returns
TypeDescription
JobTrigger

createJobTriggerCallable()

public final UnaryCallable<CreateJobTriggerRequest,JobTrigger> createJobTriggerCallable()

Creates a job trigger to run DLP actions such as scanning storage for sensitive information on a set schedule. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   CreateJobTriggerRequest request =
       CreateJobTriggerRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setJobTrigger(JobTrigger.newBuilder().build())
           .setTriggerId("triggerId-648752909")
           .setLocationId("locationId1541836720")
           .build();
   ApiFuture<JobTrigger> future =
       dlpServiceClient.createJobTriggerCallable().futureCall(request);
   // Do something.
   JobTrigger response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreateJobTriggerRequest,JobTrigger>

createStoredInfoType(CreateStoredInfoTypeRequest request)

public final StoredInfoType createStoredInfoType(CreateStoredInfoTypeRequest request)

Creates a pre-built stored infoType to be used for inspection. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   CreateStoredInfoTypeRequest request =
       CreateStoredInfoTypeRequest.newBuilder()
           .setParent(OrganizationName.of("[ORGANIZATION]").toString())
           .setConfig(StoredInfoTypeConfig.newBuilder().build())
           .setStoredInfoTypeId("storedInfoTypeId-1409591226")
           .setLocationId("locationId1541836720")
           .build();
   StoredInfoType response = dlpServiceClient.createStoredInfoType(request);
 }
 
Parameter
NameDescription
requestCreateStoredInfoTypeRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
StoredInfoType

createStoredInfoType(LocationName parent, StoredInfoTypeConfig config)

public final StoredInfoType createStoredInfoType(LocationName parent, StoredInfoTypeConfig config)

Creates a pre-built stored infoType to be used for inspection. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build();
   StoredInfoType response = dlpServiceClient.createStoredInfoType(parent, config);
 }
 
Parameters
NameDescription
parentLocationName

Required. Parent resource name.

The format of this value varies depending on the scope of the request (project or organization) and whether you have specified a processing location:

+ Projects scope, location specified:<br/> projects/<var>PROJECT_ID</var>/locations/<var>LOCATION_ID</var>

  • Projects scope, no location specified (defaults to global):<br/> projects/<var>PROJECT_ID</var> + Organizations scope, location specified:<br/> organizations/<var>ORG_ID</var>/locations/<var>LOCATION_ID</var>
  • Organizations scope, no location specified (defaults to global):<br/> organizations/<var>ORG_ID</var>

    The following example parent string specifies a parent project with the identifier example-project, and specifies the europe-west3 location for processing data:

    parent=projects/example-project/locations/europe-west3

configStoredInfoTypeConfig

Required. Configuration of the storedInfoType to create.

Returns
TypeDescription
StoredInfoType

createStoredInfoType(OrganizationLocationName parent, StoredInfoTypeConfig config)

public final StoredInfoType createStoredInfoType(OrganizationLocationName parent, StoredInfoTypeConfig config)

Creates a pre-built stored infoType to be used for inspection. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
   StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build();
   StoredInfoType response = dlpServiceClient.createStoredInfoType(parent, config);
 }
 
Parameters
NameDescription
parentOrganizationLocationName

Required. Parent resource name.

The format of this value varies depending on the scope of the request (project or organization) and whether you have specified a processing location:

+ Projects scope, location specified:<br/> projects/<var>PROJECT_ID</var>/locations/<var>LOCATION_ID</var>

  • Projects scope, no location specified (defaults to global):<br/> projects/<var>PROJECT_ID</var> + Organizations scope, location specified:<br/> organizations/<var>ORG_ID</var>/locations/<var>LOCATION_ID</var>
  • Organizations scope, no location specified (defaults to global):<br/> organizations/<var>ORG_ID</var>

    The following example parent string specifies a parent project with the identifier example-project, and specifies the europe-west3 location for processing data:

    parent=projects/example-project/locations/europe-west3

configStoredInfoTypeConfig

Required. Configuration of the storedInfoType to create.

Returns
TypeDescription
StoredInfoType

createStoredInfoType(OrganizationName parent, StoredInfoTypeConfig config)

public final StoredInfoType createStoredInfoType(OrganizationName parent, StoredInfoTypeConfig config)

Creates a pre-built stored infoType to be used for inspection. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
   StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build();
   StoredInfoType response = dlpServiceClient.createStoredInfoType(parent, config);
 }
 
Parameters
NameDescription
parentOrganizationName

Required. Parent resource name.

The format of this value varies depending on the scope of the request (project or organization) and whether you have specified a processing location:

+ Projects scope, location specified:<br/> projects/<var>PROJECT_ID</var>/locations/<var>LOCATION_ID</var>

  • Projects scope, no location specified (defaults to global):<br/> projects/<var>PROJECT_ID</var> + Organizations scope, location specified:<br/> organizations/<var>ORG_ID</var>/locations/<var>LOCATION_ID</var>
  • Organizations scope, no location specified (defaults to global):<br/> organizations/<var>ORG_ID</var>

    The following example parent string specifies a parent project with the identifier example-project, and specifies the europe-west3 location for processing data:

    parent=projects/example-project/locations/europe-west3

configStoredInfoTypeConfig

Required. Configuration of the storedInfoType to create.

Returns
TypeDescription
StoredInfoType

createStoredInfoType(ProjectName parent, StoredInfoTypeConfig config)

public final StoredInfoType createStoredInfoType(ProjectName parent, StoredInfoTypeConfig config)

Creates a pre-built stored infoType to be used for inspection. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   ProjectName parent = ProjectName.of("[PROJECT]");
   StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build();
   StoredInfoType response = dlpServiceClient.createStoredInfoType(parent, config);
 }
 
Parameters
NameDescription
parentProjectName

Required. Parent resource name.

The format of this value varies depending on the scope of the request (project or organization) and whether you have specified a processing location:

+ Projects scope, location specified:<br/> projects/<var>PROJECT_ID</var>/locations/<var>LOCATION_ID</var>

  • Projects scope, no location specified (defaults to global):<br/> projects/<var>PROJECT_ID</var> + Organizations scope, location specified:<br/> organizations/<var>ORG_ID</var>/locations/<var>LOCATION_ID</var>
  • Organizations scope, no location specified (defaults to global):<br/> organizations/<var>ORG_ID</var>

    The following example parent string specifies a parent project with the identifier example-project, and specifies the europe-west3 location for processing data:

    parent=projects/example-project/locations/europe-west3

configStoredInfoTypeConfig

Required. Configuration of the storedInfoType to create.

Returns
TypeDescription
StoredInfoType

createStoredInfoType(String parent, StoredInfoTypeConfig config)

public final StoredInfoType createStoredInfoType(String parent, StoredInfoTypeConfig config)

Creates a pre-built stored infoType to be used for inspection. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   String parent = OrganizationName.of("[ORGANIZATION]").toString();
   StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build();
   StoredInfoType response = dlpServiceClient.createStoredInfoType(parent, config);
 }
 
Parameters
NameDescription
parentString

Required. Parent resource name.

The format of this value varies depending on the scope of the request (project or organization) and whether you have specified a processing location:

+ Projects scope, location specified:<br/> projects/<var>PROJECT_ID</var>/locations/<var>LOCATION_ID</var>

  • Projects scope, no location specified (defaults to global):<br/> projects/<var>PROJECT_ID</var> + Organizations scope, location specified:<br/> organizations/<var>ORG_ID</var>/locations/<var>LOCATION_ID</var>
  • Organizations scope, no location specified (defaults to global):<br/> organizations/<var>ORG_ID</var>

    The following example parent string specifies a parent project with the identifier example-project, and specifies the europe-west3 location for processing data:

    parent=projects/example-project/locations/europe-west3

configStoredInfoTypeConfig

Required. Configuration of the storedInfoType to create.

Returns
TypeDescription
StoredInfoType

createStoredInfoTypeCallable()

public final UnaryCallable<CreateStoredInfoTypeRequest,StoredInfoType> createStoredInfoTypeCallable()

Creates a pre-built stored infoType to be used for inspection. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   CreateStoredInfoTypeRequest request =
       CreateStoredInfoTypeRequest.newBuilder()
           .setParent(OrganizationName.of("[ORGANIZATION]").toString())
           .setConfig(StoredInfoTypeConfig.newBuilder().build())
           .setStoredInfoTypeId("storedInfoTypeId-1409591226")
           .setLocationId("locationId1541836720")
           .build();
   ApiFuture<StoredInfoType> future =
       dlpServiceClient.createStoredInfoTypeCallable().futureCall(request);
   // Do something.
   StoredInfoType response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreateStoredInfoTypeRequest,StoredInfoType>

deidentifyContent(DeidentifyContentRequest request)

public final DeidentifyContentResponse deidentifyContent(DeidentifyContentRequest request)

De-identifies potentially sensitive info from a ContentItem. This method has limits on input size and output size. See https://cloud.google.com/dlp/docs/deidentify-sensitive-data to learn more.

When no InfoTypes or CustomInfoTypes are specified in this request, the system will automatically choose what detectors to run. By default this may be all types, but may change over time as detectors are updated.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   DeidentifyContentRequest request =
       DeidentifyContentRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setDeidentifyConfig(DeidentifyConfig.newBuilder().build())
           .setInspectConfig(InspectConfig.newBuilder().build())
           .setItem(ContentItem.newBuilder().build())
           .setInspectTemplateName("inspectTemplateName1828857433")
           .setDeidentifyTemplateName("deidentifyTemplateName-1374666414")
           .setLocationId("locationId1541836720")
           .build();
   DeidentifyContentResponse response = dlpServiceClient.deidentifyContent(request);
 }
 
Parameter
NameDescription
requestDeidentifyContentRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
DeidentifyContentResponse

deidentifyContentCallable()

public final UnaryCallable<DeidentifyContentRequest,DeidentifyContentResponse> deidentifyContentCallable()

De-identifies potentially sensitive info from a ContentItem. This method has limits on input size and output size. See https://cloud.google.com/dlp/docs/deidentify-sensitive-data to learn more.

When no InfoTypes or CustomInfoTypes are specified in this request, the system will automatically choose what detectors to run. By default this may be all types, but may change over time as detectors are updated.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   DeidentifyContentRequest request =
       DeidentifyContentRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setDeidentifyConfig(DeidentifyConfig.newBuilder().build())
           .setInspectConfig(InspectConfig.newBuilder().build())
           .setItem(ContentItem.newBuilder().build())
           .setInspectTemplateName("inspectTemplateName1828857433")
           .setDeidentifyTemplateName("deidentifyTemplateName-1374666414")
           .setLocationId("locationId1541836720")
           .build();
   ApiFuture<DeidentifyContentResponse> future =
       dlpServiceClient.deidentifyContentCallable().futureCall(request);
   // Do something.
   DeidentifyContentResponse response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeidentifyContentRequest,DeidentifyContentResponse>

deleteDeidentifyTemplate(DeidentifyTemplateName name)

public final void deleteDeidentifyTemplate(DeidentifyTemplateName name)

Deletes a DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   DeidentifyTemplateName name =
       DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName(
           "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]");
   dlpServiceClient.deleteDeidentifyTemplate(name);
 }
 
Parameter
NameDescription
nameDeidentifyTemplateName

Required. Resource name of the organization and deidentify template to be deleted, for example organizations/433245324/deidentifyTemplates/432452342 or projects/project-id/deidentifyTemplates/432452342.

deleteDeidentifyTemplate(DeleteDeidentifyTemplateRequest request)

public final void deleteDeidentifyTemplate(DeleteDeidentifyTemplateRequest request)

Deletes a DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   DeleteDeidentifyTemplateRequest request =
       DeleteDeidentifyTemplateRequest.newBuilder()
           .setName(
               DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName(
                       "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]")
                   .toString())
           .build();
   dlpServiceClient.deleteDeidentifyTemplate(request);
 }
 
Parameter
NameDescription
requestDeleteDeidentifyTemplateRequest

The request object containing all of the parameters for the API call.

deleteDeidentifyTemplate(String name)

public final void deleteDeidentifyTemplate(String name)

Deletes a DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   String name =
       DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName(
               "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]")
           .toString();
   dlpServiceClient.deleteDeidentifyTemplate(name);
 }
 
Parameter
NameDescription
nameString

Required. Resource name of the organization and deidentify template to be deleted, for example organizations/433245324/deidentifyTemplates/432452342 or projects/project-id/deidentifyTemplates/432452342.

deleteDeidentifyTemplateCallable()

public final UnaryCallable<DeleteDeidentifyTemplateRequest,Empty> deleteDeidentifyTemplateCallable()

Deletes a DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   DeleteDeidentifyTemplateRequest request =
       DeleteDeidentifyTemplateRequest.newBuilder()
           .setName(
               DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName(
                       "[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]")
                   .toString())
           .build();
   ApiFuture<Empty> future =
       dlpServiceClient.deleteDeidentifyTemplateCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteDeidentifyTemplateRequest,Empty>

deleteDlpJob(DeleteDlpJobRequest request)

public final void deleteDlpJob(DeleteDlpJobRequest request)

Deletes a long-running DlpJob. This method indicates that the client is no longer interested in the DlpJob result. The job will be cancelled if possible. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   DeleteDlpJobRequest request =
       DeleteDlpJobRequest.newBuilder()
           .setName(DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]").toString())
           .build();
   dlpServiceClient.deleteDlpJob(request);
 }
 
Parameter
NameDescription
requestDeleteDlpJobRequest

The request object containing all of the parameters for the API call.

deleteDlpJob(DlpJobName name)

public final void deleteDlpJob(DlpJobName name)

Deletes a long-running DlpJob. This method indicates that the client is no longer interested in the DlpJob result. The job will be cancelled if possible. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   DlpJobName name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]");
   dlpServiceClient.deleteDlpJob(name);
 }
 
Parameter
NameDescription
nameDlpJobName

Required. The name of the DlpJob resource to be deleted.

deleteDlpJob(String name)

public final void deleteDlpJob(String name)

Deletes a long-running DlpJob. This method indicates that the client is no longer interested in the DlpJob result. The job will be cancelled if possible. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   String name = DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]").toString();
   dlpServiceClient.deleteDlpJob(name);
 }
 
Parameter
NameDescription
nameString

Required. The name of the DlpJob resource to be deleted.

deleteDlpJobCallable()

public final UnaryCallable<DeleteDlpJobRequest,Empty> deleteDlpJobCallable()

Deletes a long-running DlpJob. This method indicates that the client is no longer interested in the DlpJob result. The job will be cancelled if possible. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
   DeleteDlpJobRequest request =
       DeleteDlpJobRequest.newBuilder()
           .setName(DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]").toString())
           .build();
   ApiFuture<Empty> future = dlpServiceClient.deleteDlpJobCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteDlpJobRequest,Empty>

deleteInspectTemplate(DeleteInspectTemplateRequest request)

public final void deleteInspectTemplate(DeleteInspectTemplateRequest request)

Deletes an InspectTemplate. See https://cloud.google.com/dlp/docs/creating-templates to learn more.

Sample code: