@Generated(value="by gapic-generator") @BetaApi public class DlpServiceClient extends Object implements com.google.api.gax.core.BackgroundResource
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:
try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
String name = "EMAIL_ADDRESS";
InfoType infoTypesElement = InfoType.newBuilder()
.setName(name)
.build();
List<InfoType> infoTypes = Arrays.asList(infoTypesElement);
InspectConfig inspectConfig = InspectConfig.newBuilder()
.addAllInfoTypes(infoTypes)
.build();
String type = "text/plain";
String value = "My email is example @example.com.";
ContentItem itemsElement = ContentItem.newBuilder()
.setType(type)
.setValue(value)
.build();
List<ContentItem> items = Arrays.asList(itemsElement);
InspectContentResponse response = dlpServiceClient.inspectContent(inspectConfig, items);
}
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:
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:
DlpServiceSettings dlpServiceSettings =
DlpServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
DlpServiceClient dlpServiceClient =
DlpServiceClient.create(dlpServiceSettings);
To customize the endpoint:
DlpServiceSettings dlpServiceSettings =
DlpServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
DlpServiceClient dlpServiceClient =
DlpServiceClient.create(dlpServiceSettings);
| Modifier | Constructor and Description |
|---|---|
protected |
DlpServiceClient(DlpServiceSettings settings)
Constructs an instance of DlpServiceClient, using the given settings.
|
protected |
DlpServiceClient(DlpServiceStub stub) |
| Modifier and Type | Method and Description |
|---|---|
com.google.api.gax.longrunning.OperationFuture<com.google.privacy.dlp.v2beta1.RiskAnalysisOperationResult,com.google.privacy.dlp.v2beta1.RiskAnalysisOperationMetadata> |
analyzeDataSourceRiskAsync(com.google.privacy.dlp.v2beta1.AnalyzeDataSourceRiskRequest request)
Schedules a job to compute risk analysis metrics over content in a Google Cloud Platform
repository.
|
com.google.api.gax.longrunning.OperationFuture<com.google.privacy.dlp.v2beta1.RiskAnalysisOperationResult,com.google.privacy.dlp.v2beta1.RiskAnalysisOperationMetadata> |
analyzeDataSourceRiskAsync(com.google.privacy.dlp.v2beta1.PrivacyMetric privacyMetric,
com.google.privacy.dlp.v2beta1.BigQueryTable sourceTable)
Schedules a job to compute risk analysis metrics over content in a Google Cloud Platform
repository.
|
com.google.api.gax.rpc.UnaryCallable<com.google.privacy.dlp.v2beta1.AnalyzeDataSourceRiskRequest,com.google.longrunning.Operation> |
analyzeDataSourceRiskCallable()
Schedules a job to compute risk analysis metrics over content in a Google Cloud Platform
repository.
|
com.google.api.gax.rpc.OperationCallable<com.google.privacy.dlp.v2beta1.AnalyzeDataSourceRiskRequest,com.google.privacy.dlp.v2beta1.RiskAnalysisOperationResult,com.google.privacy.dlp.v2beta1.RiskAnalysisOperationMetadata> |
analyzeDataSourceRiskOperationCallable()
Schedules a job to compute risk analysis metrics over content in a Google Cloud Platform
repository.
|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static DlpServiceClient |
create()
Constructs an instance of DlpServiceClient with default settings.
|
static DlpServiceClient |
create(DlpServiceSettings settings)
Constructs an instance of DlpServiceClient, using the given settings.
|
static DlpServiceClient |
create(DlpServiceStub stub)
Constructs an instance of DlpServiceClient, using the given stub for making calls.
|
com.google.api.gax.longrunning.OperationFuture<com.google.privacy.dlp.v2beta1.InspectOperationResult,com.google.privacy.dlp.v2beta1.InspectOperationMetadata> |
createInspectOperationAsync(com.google.privacy.dlp.v2beta1.CreateInspectOperationRequest request)
Schedules a job scanning content in a Google Cloud Platform data repository.
|
com.google.api.gax.longrunning.OperationFuture<com.google.privacy.dlp.v2beta1.InspectOperationResult,com.google.privacy.dlp.v2beta1.InspectOperationMetadata> |
createInspectOperationAsync(com.google.privacy.dlp.v2beta1.InspectConfig inspectConfig,
com.google.privacy.dlp.v2beta1.StorageConfig storageConfig,
com.google.privacy.dlp.v2beta1.OutputStorageConfig outputConfig)
Schedules a job scanning content in a Google Cloud Platform data repository.
|
com.google.api.gax.rpc.UnaryCallable<com.google.privacy.dlp.v2beta1.CreateInspectOperationRequest,com.google.longrunning.Operation> |
createInspectOperationCallable()
Schedules a job scanning content in a Google Cloud Platform data repository.
|
com.google.api.gax.rpc.OperationCallable<com.google.privacy.dlp.v2beta1.CreateInspectOperationRequest,com.google.privacy.dlp.v2beta1.InspectOperationResult,com.google.privacy.dlp.v2beta1.InspectOperationMetadata> |
createInspectOperationOperationCallable()
Schedules a job scanning content in a Google Cloud Platform data repository.
|
com.google.privacy.dlp.v2beta1.DeidentifyContentResponse |
deidentifyContent(com.google.privacy.dlp.v2beta1.DeidentifyConfig deidentifyConfig,
com.google.privacy.dlp.v2beta1.InspectConfig inspectConfig,
List<com.google.privacy.dlp.v2beta1.ContentItem> items)
De-identifies potentially sensitive info from a list of strings.
|
com.google.privacy.dlp.v2beta1.DeidentifyContentResponse |
deidentifyContent(com.google.privacy.dlp.v2beta1.DeidentifyContentRequest request)
De-identifies potentially sensitive info from a list of strings.
|
com.google.api.gax.rpc.UnaryCallable<com.google.privacy.dlp.v2beta1.DeidentifyContentRequest,com.google.privacy.dlp.v2beta1.DeidentifyContentResponse> |
deidentifyContentCallable()
De-identifies potentially sensitive info from a list of strings.
|
com.google.longrunning.OperationsClient |
getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
DlpServiceSettings |
getSettings() |
DlpServiceStub |
getStub() |
com.google.privacy.dlp.v2beta1.InspectContentResponse |
inspectContent(com.google.privacy.dlp.v2beta1.InspectConfig inspectConfig,
List<com.google.privacy.dlp.v2beta1.ContentItem> items)
Finds potentially sensitive info in a list of strings.
|
com.google.privacy.dlp.v2beta1.InspectContentResponse |
inspectContent(com.google.privacy.dlp.v2beta1.InspectContentRequest request)
Finds potentially sensitive info in a list of strings.
|
com.google.api.gax.rpc.UnaryCallable<com.google.privacy.dlp.v2beta1.InspectContentRequest,com.google.privacy.dlp.v2beta1.InspectContentResponse> |
inspectContentCallable()
Finds potentially sensitive info in a list of strings.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
com.google.privacy.dlp.v2beta1.ListInfoTypesResponse |
listInfoTypes(com.google.privacy.dlp.v2beta1.ListInfoTypesRequest request)
Returns sensitive information types for given category.
|
com.google.privacy.dlp.v2beta1.ListInfoTypesResponse |
listInfoTypes(String category,
String languageCode)
Returns sensitive information types for given category.
|
com.google.api.gax.rpc.UnaryCallable<com.google.privacy.dlp.v2beta1.ListInfoTypesRequest,com.google.privacy.dlp.v2beta1.ListInfoTypesResponse> |
listInfoTypesCallable()
Returns sensitive information types for given category.
|
com.google.privacy.dlp.v2beta1.ListInspectFindingsResponse |
listInspectFindings(com.google.privacy.dlp.v2beta1.ListInspectFindingsRequest request)
Returns list of results for given inspect operation result set id.
|
com.google.privacy.dlp.v2beta1.ListInspectFindingsResponse |
listInspectFindings(com.google.privacy.dlp.v2beta1.ResultName name)
Returns list of results for given inspect operation result set id.
|
com.google.privacy.dlp.v2beta1.ListInspectFindingsResponse |
listInspectFindings(String name)
Returns list of results for given inspect operation result set id.
|
com.google.api.gax.rpc.UnaryCallable<com.google.privacy.dlp.v2beta1.ListInspectFindingsRequest,com.google.privacy.dlp.v2beta1.ListInspectFindingsResponse> |
listInspectFindingsCallable()
Returns list of results for given inspect operation result set id.
|
com.google.privacy.dlp.v2beta1.ListRootCategoriesResponse |
listRootCategories(String languageCode)
Returns the list of root categories of sensitive information.
|
com.google.api.gax.rpc.UnaryCallable<com.google.privacy.dlp.v2beta1.ListRootCategoriesRequest,com.google.privacy.dlp.v2beta1.ListRootCategoriesResponse> |
listRootCategoriesCallable()
Returns the list of root categories of sensitive information.
|
com.google.privacy.dlp.v2beta1.RedactContentResponse |
redactContent(com.google.privacy.dlp.v2beta1.RedactContentRequest request)
Redacts potentially sensitive info from a list of strings.
|
com.google.api.gax.rpc.UnaryCallable<com.google.privacy.dlp.v2beta1.RedactContentRequest,com.google.privacy.dlp.v2beta1.RedactContentResponse> |
redactContentCallable()
Redacts potentially sensitive info from a list of strings.
|
void |
shutdown() |
void |
shutdownNow() |
protected DlpServiceClient(DlpServiceSettings settings) throws IOException
IOException@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected DlpServiceClient(DlpServiceStub stub)
public static final DlpServiceClient create() throws IOException
IOExceptionpublic static final DlpServiceClient create(DlpServiceSettings settings) throws IOException
IOException@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final DlpServiceClient create(DlpServiceStub stub)
public final DlpServiceSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public DlpServiceStub getStub()
public final com.google.longrunning.OperationsClient getOperationsClient()
public final com.google.privacy.dlp.v2beta1.InspectContentResponse inspectContent(com.google.privacy.dlp.v2beta1.InspectConfig inspectConfig,
List<com.google.privacy.dlp.v2beta1.ContentItem> items)
Sample code:
try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
String name = "EMAIL_ADDRESS";
InfoType infoTypesElement = InfoType.newBuilder()
.setName(name)
.build();
List<InfoType> infoTypes = Arrays.asList(infoTypesElement);
InspectConfig inspectConfig = InspectConfig.newBuilder()
.addAllInfoTypes(infoTypes)
.build();
String type = "text/plain";
String value = "My email is example @example.com.";
ContentItem itemsElement = ContentItem.newBuilder()
.setType(type)
.setValue(value)
.build();
List<ContentItem> items = Arrays.asList(itemsElement);
InspectContentResponse response = dlpServiceClient.inspectContent(inspectConfig, items);
}
inspectConfig - Configuration for the inspector.items - The list of items to inspect. Items in a single request are considered "related"
unless inspect_config.independent_inputs is true. Up to 100 are allowed per request.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.privacy.dlp.v2beta1.InspectContentResponse inspectContent(com.google.privacy.dlp.v2beta1.InspectContentRequest request)
Sample code:
try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
String name = "EMAIL_ADDRESS";
InfoType infoTypesElement = InfoType.newBuilder()
.setName(name)
.build();
List<InfoType> infoTypes = Arrays.asList(infoTypesElement);
InspectConfig inspectConfig = InspectConfig.newBuilder()
.addAllInfoTypes(infoTypes)
.build();
String type = "text/plain";
String value = "My email is example @example.com.";
ContentItem itemsElement = ContentItem.newBuilder()
.setType(type)
.setValue(value)
.build();
List<ContentItem> items = Arrays.asList(itemsElement);
InspectContentRequest request = InspectContentRequest.newBuilder()
.setInspectConfig(inspectConfig)
.addAllItems(items)
.build();
InspectContentResponse response = dlpServiceClient.inspectContent(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.privacy.dlp.v2beta1.InspectContentRequest,com.google.privacy.dlp.v2beta1.InspectContentResponse> inspectContentCallable()
Sample code:
try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
String name = "EMAIL_ADDRESS";
InfoType infoTypesElement = InfoType.newBuilder()
.setName(name)
.build();
List<InfoType> infoTypes = Arrays.asList(infoTypesElement);
InspectConfig inspectConfig = InspectConfig.newBuilder()
.addAllInfoTypes(infoTypes)
.build();
String type = "text/plain";
String value = "My email is example @example.com.";
ContentItem itemsElement = ContentItem.newBuilder()
.setType(type)
.setValue(value)
.build();
List<ContentItem> items = Arrays.asList(itemsElement);
InspectContentRequest request = InspectContentRequest.newBuilder()
.setInspectConfig(inspectConfig)
.addAllItems(items)
.build();
ApiFuture<InspectContentResponse> future = dlpServiceClient.inspectContentCallable().futureCall(request);
// Do something
InspectContentResponse response = future.get();
}
public final com.google.privacy.dlp.v2beta1.RedactContentResponse redactContent(com.google.privacy.dlp.v2beta1.RedactContentRequest request)
Sample code:
try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
String name = "EMAIL_ADDRESS";
InfoType infoTypesElement = InfoType.newBuilder()
.setName(name)
.build();
List<InfoType> infoTypes = Arrays.asList(infoTypesElement);
InspectConfig inspectConfig = InspectConfig.newBuilder()
.addAllInfoTypes(infoTypes)
.build();
String type = "text/plain";
String value = "My email is example @example.com.";
ContentItem itemsElement = ContentItem.newBuilder()
.setType(type)
.setValue(value)
.build();
List<ContentItem> items = Arrays.asList(itemsElement);
String name2 = "EMAIL_ADDRESS";
InfoType infoType = InfoType.newBuilder()
.setName(name2)
.build();
String replaceWith = "REDACTED";
RedactContentRequest.ReplaceConfig replaceConfigsElement = RedactContentRequest.ReplaceConfig.newBuilder()
.setInfoType(infoType)
.setReplaceWith(replaceWith)
.build();
List<RedactContentRequest.ReplaceConfig> replaceConfigs = Arrays.asList(replaceConfigsElement);
RedactContentRequest request = RedactContentRequest.newBuilder()
.setInspectConfig(inspectConfig)
.addAllItems(items)
.addAllReplaceConfigs(replaceConfigs)
.build();
RedactContentResponse response = dlpServiceClient.redactContent(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.privacy.dlp.v2beta1.RedactContentRequest,com.google.privacy.dlp.v2beta1.RedactContentResponse> redactContentCallable()
Sample code:
try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
String name = "EMAIL_ADDRESS";
InfoType infoTypesElement = InfoType.newBuilder()
.setName(name)
.build();
List<InfoType> infoTypes = Arrays.asList(infoTypesElement);
InspectConfig inspectConfig = InspectConfig.newBuilder()
.addAllInfoTypes(infoTypes)
.build();
String type = "text/plain";
String value = "My email is example @example.com.";
ContentItem itemsElement = ContentItem.newBuilder()
.setType(type)
.setValue(value)
.build();
List<ContentItem> items = Arrays.asList(itemsElement);
String name2 = "EMAIL_ADDRESS";
InfoType infoType = InfoType.newBuilder()
.setName(name2)
.build();
String replaceWith = "REDACTED";
RedactContentRequest.ReplaceConfig replaceConfigsElement = RedactContentRequest.ReplaceConfig.newBuilder()
.setInfoType(infoType)
.setReplaceWith(replaceWith)
.build();
List<RedactContentRequest.ReplaceConfig> replaceConfigs = Arrays.asList(replaceConfigsElement);
RedactContentRequest request = RedactContentRequest.newBuilder()
.setInspectConfig(inspectConfig)
.addAllItems(items)
.addAllReplaceConfigs(replaceConfigs)
.build();
ApiFuture<RedactContentResponse> future = dlpServiceClient.redactContentCallable().futureCall(request);
// Do something
RedactContentResponse response = future.get();
}
public final com.google.privacy.dlp.v2beta1.DeidentifyContentResponse deidentifyContent(com.google.privacy.dlp.v2beta1.DeidentifyConfig deidentifyConfig,
com.google.privacy.dlp.v2beta1.InspectConfig inspectConfig,
List<com.google.privacy.dlp.v2beta1.ContentItem> items)
Sample code:
try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
DeidentifyConfig deidentifyConfig = DeidentifyConfig.newBuilder().build();
InspectConfig inspectConfig = InspectConfig.newBuilder().build();
List<ContentItem> items = new ArrayList<>();
DeidentifyContentResponse response = dlpServiceClient.deidentifyContent(deidentifyConfig, inspectConfig, items);
}
deidentifyConfig - Configuration for the de-identification of the list of content items.inspectConfig - Configuration for the inspector.items - The list of items to inspect. Up to 100 are allowed per request. All items will be
treated as text/*.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.privacy.dlp.v2beta1.DeidentifyContentResponse deidentifyContent(com.google.privacy.dlp.v2beta1.DeidentifyContentRequest request)
Sample code:
try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
DeidentifyConfig deidentifyConfig = DeidentifyConfig.newBuilder().build();
InspectConfig inspectConfig = InspectConfig.newBuilder().build();
List<ContentItem> items = new ArrayList<>();
DeidentifyContentRequest request = DeidentifyContentRequest.newBuilder()
.setDeidentifyConfig(deidentifyConfig)
.setInspectConfig(inspectConfig)
.addAllItems(items)
.build();
DeidentifyContentResponse response = dlpServiceClient.deidentifyContent(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.privacy.dlp.v2beta1.DeidentifyContentRequest,com.google.privacy.dlp.v2beta1.DeidentifyContentResponse> deidentifyContentCallable()
Sample code:
try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
DeidentifyConfig deidentifyConfig = DeidentifyConfig.newBuilder().build();
InspectConfig inspectConfig = InspectConfig.newBuilder().build();
List<ContentItem> items = new ArrayList<>();
DeidentifyContentRequest request = DeidentifyContentRequest.newBuilder()
.setDeidentifyConfig(deidentifyConfig)
.setInspectConfig(inspectConfig)
.addAllItems(items)
.build();
ApiFuture<DeidentifyContentResponse> future = dlpServiceClient.deidentifyContentCallable().futureCall(request);
// Do something
DeidentifyContentResponse response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<com.google.privacy.dlp.v2beta1.RiskAnalysisOperationResult,com.google.privacy.dlp.v2beta1.RiskAnalysisOperationMetadata> analyzeDataSourceRiskAsync(com.google.privacy.dlp.v2beta1.PrivacyMetric privacyMetric,
com.google.privacy.dlp.v2beta1.BigQueryTable sourceTable)
Sample code:
try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
PrivacyMetric privacyMetric = PrivacyMetric.newBuilder().build();
BigQueryTable sourceTable = BigQueryTable.newBuilder().build();
RiskAnalysisOperationResult response = dlpServiceClient.analyzeDataSourceRiskAsync(privacyMetric, sourceTable).get();
}
privacyMetric - Privacy metric to compute.sourceTable - Input dataset to compute metrics over.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.privacy.dlp.v2beta1.RiskAnalysisOperationResult,com.google.privacy.dlp.v2beta1.RiskAnalysisOperationMetadata> analyzeDataSourceRiskAsync(com.google.privacy.dlp.v2beta1.AnalyzeDataSourceRiskRequest request)
Sample code:
try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
PrivacyMetric privacyMetric = PrivacyMetric.newBuilder().build();
BigQueryTable sourceTable = BigQueryTable.newBuilder().build();
AnalyzeDataSourceRiskRequest request = AnalyzeDataSourceRiskRequest.newBuilder()
.setPrivacyMetric(privacyMetric)
.setSourceTable(sourceTable)
.build();
RiskAnalysisOperationResult response = dlpServiceClient.analyzeDataSourceRiskAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<com.google.privacy.dlp.v2beta1.AnalyzeDataSourceRiskRequest,com.google.privacy.dlp.v2beta1.RiskAnalysisOperationResult,com.google.privacy.dlp.v2beta1.RiskAnalysisOperationMetadata> analyzeDataSourceRiskOperationCallable()
Sample code:
try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
PrivacyMetric privacyMetric = PrivacyMetric.newBuilder().build();
BigQueryTable sourceTable = BigQueryTable.newBuilder().build();
AnalyzeDataSourceRiskRequest request = AnalyzeDataSourceRiskRequest.newBuilder()
.setPrivacyMetric(privacyMetric)
.setSourceTable(sourceTable)
.build();
OperationFuture<Operation> future = dlpServiceClient.analyzeDataSourceRiskOperationCallable().futureCall(request);
// Do something
RiskAnalysisOperationResult response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<com.google.privacy.dlp.v2beta1.AnalyzeDataSourceRiskRequest,com.google.longrunning.Operation> analyzeDataSourceRiskCallable()
Sample code:
try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
PrivacyMetric privacyMetric = PrivacyMetric.newBuilder().build();
BigQueryTable sourceTable = BigQueryTable.newBuilder().build();
AnalyzeDataSourceRiskRequest request = AnalyzeDataSourceRiskRequest.newBuilder()
.setPrivacyMetric(privacyMetric)
.setSourceTable(sourceTable)
.build();
ApiFuture<Operation> future = dlpServiceClient.analyzeDataSourceRiskCallable().futureCall(request);
// Do something
Operation response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<com.google.privacy.dlp.v2beta1.InspectOperationResult,com.google.privacy.dlp.v2beta1.InspectOperationMetadata> createInspectOperationAsync(com.google.privacy.dlp.v2beta1.InspectConfig inspectConfig,
com.google.privacy.dlp.v2beta1.StorageConfig storageConfig,
com.google.privacy.dlp.v2beta1.OutputStorageConfig outputConfig)
Sample code:
try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
String name = "EMAIL_ADDRESS";
InfoType infoTypesElement = InfoType.newBuilder()
.setName(name)
.build();
List<InfoType> infoTypes = Arrays.asList(infoTypesElement);
InspectConfig inspectConfig = InspectConfig.newBuilder()
.addAllInfoTypes(infoTypes)
.build();
String url = "gs://example_bucket/example_file.png";
CloudStorageOptions.FileSet fileSet = CloudStorageOptions.FileSet.newBuilder()
.setUrl(url)
.build();
CloudStorageOptions cloudStorageOptions = CloudStorageOptions.newBuilder()
.setFileSet(fileSet)
.build();
StorageConfig storageConfig = StorageConfig.newBuilder()
.setCloudStorageOptions(cloudStorageOptions)
.build();
OutputStorageConfig outputConfig = OutputStorageConfig.newBuilder().build();
InspectOperationResult response = dlpServiceClient.createInspectOperationAsync(inspectConfig, storageConfig, outputConfig).get();
}
inspectConfig - Configuration for the inspector.storageConfig - Specification of the data set to process.outputConfig - Optional location to store findings.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.privacy.dlp.v2beta1.InspectOperationResult,com.google.privacy.dlp.v2beta1.InspectOperationMetadata> createInspectOperationAsync(com.google.privacy.dlp.v2beta1.CreateInspectOperationRequest request)
Sample code:
try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
String name = "EMAIL_ADDRESS";
InfoType infoTypesElement = InfoType.newBuilder()
.setName(name)
.build();
List<InfoType> infoTypes = Arrays.asList(infoTypesElement);
InspectConfig inspectConfig = InspectConfig.newBuilder()
.addAllInfoTypes(infoTypes)
.build();
String url = "gs://example_bucket/example_file.png";
CloudStorageOptions.FileSet fileSet = CloudStorageOptions.FileSet.newBuilder()
.setUrl(url)
.build();
CloudStorageOptions cloudStorageOptions = CloudStorageOptions.newBuilder()
.setFileSet(fileSet)
.build();
StorageConfig storageConfig = StorageConfig.newBuilder()
.setCloudStorageOptions(cloudStorageOptions)
.build();
OutputStorageConfig outputConfig = OutputStorageConfig.newBuilder().build();
CreateInspectOperationRequest request = CreateInspectOperationRequest.newBuilder()
.setInspectConfig(inspectConfig)
.setStorageConfig(storageConfig)
.setOutputConfig(outputConfig)
.build();
InspectOperationResult response = dlpServiceClient.createInspectOperationAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<com.google.privacy.dlp.v2beta1.CreateInspectOperationRequest,com.google.privacy.dlp.v2beta1.InspectOperationResult,com.google.privacy.dlp.v2beta1.InspectOperationMetadata> createInspectOperationOperationCallable()
Sample code:
try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
String name = "EMAIL_ADDRESS";
InfoType infoTypesElement = InfoType.newBuilder()
.setName(name)
.build();
List<InfoType> infoTypes = Arrays.asList(infoTypesElement);
InspectConfig inspectConfig = InspectConfig.newBuilder()
.addAllInfoTypes(infoTypes)
.build();
String url = "gs://example_bucket/example_file.png";
CloudStorageOptions.FileSet fileSet = CloudStorageOptions.FileSet.newBuilder()
.setUrl(url)
.build();
CloudStorageOptions cloudStorageOptions = CloudStorageOptions.newBuilder()
.setFileSet(fileSet)
.build();
StorageConfig storageConfig = StorageConfig.newBuilder()
.setCloudStorageOptions(cloudStorageOptions)
.build();
OutputStorageConfig outputConfig = OutputStorageConfig.newBuilder().build();
CreateInspectOperationRequest request = CreateInspectOperationRequest.newBuilder()
.setInspectConfig(inspectConfig)
.setStorageConfig(storageConfig)
.setOutputConfig(outputConfig)
.build();
OperationFuture<Operation> future = dlpServiceClient.createInspectOperationOperationCallable().futureCall(request);
// Do something
InspectOperationResult response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<com.google.privacy.dlp.v2beta1.CreateInspectOperationRequest,com.google.longrunning.Operation> createInspectOperationCallable()
Sample code:
try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
String name = "EMAIL_ADDRESS";
InfoType infoTypesElement = InfoType.newBuilder()
.setName(name)
.build();
List<InfoType> infoTypes = Arrays.asList(infoTypesElement);
InspectConfig inspectConfig = InspectConfig.newBuilder()
.addAllInfoTypes(infoTypes)
.build();
String url = "gs://example_bucket/example_file.png";
CloudStorageOptions.FileSet fileSet = CloudStorageOptions.FileSet.newBuilder()
.setUrl(url)
.build();
CloudStorageOptions cloudStorageOptions = CloudStorageOptions.newBuilder()
.setFileSet(fileSet)
.build();
StorageConfig storageConfig = StorageConfig.newBuilder()
.setCloudStorageOptions(cloudStorageOptions)
.build();
OutputStorageConfig outputConfig = OutputStorageConfig.newBuilder().build();
CreateInspectOperationRequest request = CreateInspectOperationRequest.newBuilder()
.setInspectConfig(inspectConfig)
.setStorageConfig(storageConfig)
.setOutputConfig(outputConfig)
.build();
ApiFuture<Operation> future = dlpServiceClient.createInspectOperationCallable().futureCall(request);
// Do something
Operation response = future.get();
}
public final com.google.privacy.dlp.v2beta1.ListInspectFindingsResponse listInspectFindings(com.google.privacy.dlp.v2beta1.ResultName name)
Sample code:
try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
ResultName name = ResultName.of("[RESULT]");
ListInspectFindingsResponse response = dlpServiceClient.listInspectFindings(name);
}
name - Identifier of the results set returned as metadata of the longrunning operation
created by a call to InspectDataSource. Should be in the format of `inspect/results/{id}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.privacy.dlp.v2beta1.ListInspectFindingsResponse listInspectFindings(String name)
Sample code:
try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
ResultName name = ResultName.of("[RESULT]");
ListInspectFindingsResponse response = dlpServiceClient.listInspectFindings(name.toString());
}
name - Identifier of the results set returned as metadata of the longrunning operation
created by a call to InspectDataSource. Should be in the format of `inspect/results/{id}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.privacy.dlp.v2beta1.ListInspectFindingsResponse listInspectFindings(com.google.privacy.dlp.v2beta1.ListInspectFindingsRequest request)
Sample code:
try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
ResultName name = ResultName.of("[RESULT]");
ListInspectFindingsRequest request = ListInspectFindingsRequest.newBuilder()
.setName(name.toString())
.build();
ListInspectFindingsResponse response = dlpServiceClient.listInspectFindings(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.privacy.dlp.v2beta1.ListInspectFindingsRequest,com.google.privacy.dlp.v2beta1.ListInspectFindingsResponse> listInspectFindingsCallable()
Sample code:
try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
ResultName name = ResultName.of("[RESULT]");
ListInspectFindingsRequest request = ListInspectFindingsRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<ListInspectFindingsResponse> future = dlpServiceClient.listInspectFindingsCallable().futureCall(request);
// Do something
ListInspectFindingsResponse response = future.get();
}
public final com.google.privacy.dlp.v2beta1.ListInfoTypesResponse listInfoTypes(String category, String languageCode)
Sample code:
try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
String category = "PII";
String languageCode = "en";
ListInfoTypesResponse response = dlpServiceClient.listInfoTypes(category, languageCode);
}
category - Category name as returned by ListRootCategories.languageCode - Optional BCP-47 language code for localized info type friendly names. If
omitted, or if localized strings are not available, en-US strings will be returned.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.privacy.dlp.v2beta1.ListInfoTypesResponse listInfoTypes(com.google.privacy.dlp.v2beta1.ListInfoTypesRequest request)
Sample code:
try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
String category = "PII";
String languageCode = "en";
ListInfoTypesRequest request = ListInfoTypesRequest.newBuilder()
.setCategory(category)
.setLanguageCode(languageCode)
.build();
ListInfoTypesResponse response = dlpServiceClient.listInfoTypes(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.privacy.dlp.v2beta1.ListInfoTypesRequest,com.google.privacy.dlp.v2beta1.ListInfoTypesResponse> listInfoTypesCallable()
Sample code:
try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
String category = "PII";
String languageCode = "en";
ListInfoTypesRequest request = ListInfoTypesRequest.newBuilder()
.setCategory(category)
.setLanguageCode(languageCode)
.build();
ApiFuture<ListInfoTypesResponse> future = dlpServiceClient.listInfoTypesCallable().futureCall(request);
// Do something
ListInfoTypesResponse response = future.get();
}
public final com.google.privacy.dlp.v2beta1.ListRootCategoriesResponse listRootCategories(String languageCode)
Sample code:
try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
String languageCode = "en";
ListRootCategoriesResponse response = dlpServiceClient.listRootCategories(languageCode);
}
languageCode - Optional language code for localized friendly category names. If omitted or
if localized strings are not available, en-US strings will be returned.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.privacy.dlp.v2beta1.ListRootCategoriesRequest,com.google.privacy.dlp.v2beta1.ListRootCategoriesResponse> listRootCategoriesCallable()
Sample code:
try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
String languageCode = "en";
ListRootCategoriesRequest request = ListRootCategoriesRequest.newBuilder()
.setLanguageCode(languageCode)
.build();
ApiFuture<ListRootCategoriesResponse> future = dlpServiceClient.listRootCategoriesCallable().futureCall(request);
// Do something
ListRootCategoriesResponse response = future.get();
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2018 Google LLC. All rights reserved.