Data Loss Prevention V2 Client - Class DlpServiceClient (1.8.6)

Reference documentation and code samples for the Data Loss Prevention V2 Client class DlpServiceClient.

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:

$dlpServiceClient = new DlpServiceClient();
try {
    $formattedName = $dlpServiceClient->jobTriggerName('[PROJECT]', '[JOB_TRIGGER]');
    $response = $dlpServiceClient->activateJobTrigger($formattedName);
} finally {
    $dlpServiceClient->close();
}

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 parseName method to extract the individual identifiers contained within formatted names that are returned by the API.

Methods

deidentifyTemplateName

Formats a string containing the fully-qualified path to represent a deidentify_template resource.

Parameters
NameDescription
organization string
deidentifyTemplate string
Returns
TypeDescription
stringThe formatted deidentify_template resource.

dlpJobName

Formats a string containing the fully-qualified path to represent a dlp_job resource.

Parameters
NameDescription
project string
dlpJob string
Returns
TypeDescription
stringThe formatted dlp_job resource.

inspectTemplateName

Formats a string containing the fully-qualified path to represent a inspect_template resource.

Parameters
NameDescription
organization string
inspectTemplate string
Returns
TypeDescription
stringThe formatted inspect_template resource.

jobTriggerName

Formats a string containing the fully-qualified path to represent a job_trigger resource.

Parameters
NameDescription
project string
jobTrigger string
Returns
TypeDescription
stringThe formatted job_trigger resource.

locationName

Formats a string containing the fully-qualified path to represent a location resource.

Parameters
NameDescription
project string
location string
Returns
TypeDescription
stringThe formatted location resource.

organizationName

Formats a string containing the fully-qualified path to represent a organization resource.

Parameter
NameDescription
organization string
Returns
TypeDescription
stringThe formatted organization resource.

organizationDeidentifyTemplateName

Formats a string containing the fully-qualified path to represent a organization_deidentify_template resource.

Parameters
NameDescription
organization string
deidentifyTemplate string
Returns
TypeDescription
stringThe formatted organization_deidentify_template resource.

organizationInspectTemplateName

Formats a string containing the fully-qualified path to represent a organization_inspect_template resource.

Parameters
NameDescription
organization string
inspectTemplate string
Returns
TypeDescription
stringThe formatted organization_inspect_template resource.

organizationLocationName

Formats a string containing the fully-qualified path to represent a organization_location resource.

Parameters
NameDescription
organization string
location string
Returns
TypeDescription
stringThe formatted organization_location resource.

organizationLocationDeidentifyTemplateName

Formats a string containing the fully-qualified path to represent a organization_location_deidentify_template resource.

Parameters
NameDescription
organization string
location string
deidentifyTemplate string
Returns
TypeDescription
stringThe formatted organization_location_deidentify_template resource.

organizationLocationInspectTemplateName

Formats a string containing the fully-qualified path to represent a organization_location_inspect_template resource.

Parameters
NameDescription
organization string
location string
inspectTemplate string
Returns
TypeDescription
stringThe formatted organization_location_inspect_template resource.

organizationLocationStoredInfoTypeName

Formats a string containing the fully-qualified path to represent a organization_location_stored_info_type resource.

Parameters
NameDescription
organization string
location string
storedInfoType string
Returns
TypeDescription
stringThe formatted organization_location_stored_info_type resource.

organizationStoredInfoTypeName

Formats a string containing the fully-qualified path to represent a organization_stored_info_type resource.

Parameters
NameDescription
organization string
storedInfoType string
Returns
TypeDescription
stringThe formatted organization_stored_info_type resource.

projectName

Formats a string containing the fully-qualified path to represent a project resource.

Parameter
NameDescription
project string
Returns
TypeDescription
stringThe formatted project resource.

projectDeidentifyTemplateName

Formats a string containing the fully-qualified path to represent a project_deidentify_template resource.

Parameters
NameDescription
project string
deidentifyTemplate string
Returns
TypeDescription
stringThe formatted project_deidentify_template resource.

projectDlpJobName

Formats a string containing the fully-qualified path to represent a project_dlp_job resource.

Parameters
NameDescription
project string
dlpJob string
Returns
TypeDescription
stringThe formatted project_dlp_job resource.

projectInspectTemplateName

Formats a string containing the fully-qualified path to represent a project_inspect_template resource.

Parameters
NameDescription
project string
inspectTemplate string
Returns
TypeDescription
stringThe formatted project_inspect_template resource.

projectJobTriggerName

Formats a string containing the fully-qualified path to represent a project_job_trigger resource.

Parameters
NameDescription
project string
jobTrigger string
Returns
TypeDescription
stringThe formatted project_job_trigger resource.

projectLocationDeidentifyTemplateName

Formats a string containing the fully-qualified path to represent a project_location_deidentify_template resource.

Parameters
NameDescription
project string
location string
deidentifyTemplate string
Returns
TypeDescription
stringThe formatted project_location_deidentify_template resource.

projectLocationDlpJobName

Formats a string containing the fully-qualified path to represent a project_location_dlp_job resource.

Parameters
NameDescription
project string
location string
dlpJob string
Returns
TypeDescription
stringThe formatted project_location_dlp_job resource.

projectLocationInspectTemplateName

Formats a string containing the fully-qualified path to represent a project_location_inspect_template resource.

Parameters
NameDescription
project string
location string
inspectTemplate string
Returns
TypeDescription
stringThe formatted project_location_inspect_template resource.

projectLocationJobTriggerName

Formats a string containing the fully-qualified path to represent a project_location_job_trigger resource.

Parameters
NameDescription
project string
location string
jobTrigger string
Returns
TypeDescription
stringThe formatted project_location_job_trigger resource.

projectLocationStoredInfoTypeName

Formats a string containing the fully-qualified path to represent a project_location_stored_info_type resource.

Parameters
NameDescription
project string
location string
storedInfoType string
Returns
TypeDescription
stringThe formatted project_location_stored_info_type resource.

projectStoredInfoTypeName

Formats a string containing the fully-qualified path to represent a project_stored_info_type resource.

Parameters
NameDescription
project string
storedInfoType string
Returns
TypeDescription
stringThe formatted project_stored_info_type resource.

storedInfoTypeName

Formats a string containing the fully-qualified path to represent a stored_info_type resource.

Parameters
NameDescription
organization string
storedInfoType string
Returns
TypeDescription
stringThe formatted stored_info_type resource.

parseName

Parses a formatted name string and returns an associative array of the components in the name.

The following name formats are supported: Template: Pattern

  • deidentifyTemplate: organizations/{organization}/deidentifyTemplates/{deidentify_template}
  • dlpJob: projects/{project}/dlpJobs/{dlp_job}
  • inspectTemplate: organizations/{organization}/inspectTemplates/{inspect_template}
  • jobTrigger: projects/{project}/jobTriggers/{job_trigger}
  • location: projects/{project}/locations/{location}
  • organization: organizations/{organization}
  • organizationDeidentifyTemplate: organizations/{organization}/deidentifyTemplates/{deidentify_template}
  • organizationInspectTemplate: organizations/{organization}/inspectTemplates/{inspect_template}
  • organizationLocation: organizations/{organization}/locations/{location}
  • organizationLocationDeidentifyTemplate: organizations/{organization}/locations/{location}/deidentifyTemplates/{deidentify_template}
  • organizationLocationInspectTemplate: organizations/{organization}/locations/{location}/inspectTemplates/{inspect_template}
  • organizationLocationStoredInfoType: organizations/{organization}/locations/{location}/storedInfoTypes/{stored_info_type}
  • organizationStoredInfoType: organizations/{organization}/storedInfoTypes/{stored_info_type}
  • project: projects/{project}
  • projectDeidentifyTemplate: projects/{project}/deidentifyTemplates/{deidentify_template}
  • projectDlpJob: projects/{project}/dlpJobs/{dlp_job}
  • projectInspectTemplate: projects/{project}/inspectTemplates/{inspect_template}
  • projectJobTrigger: projects/{project}/jobTriggers/{job_trigger}
  • projectLocationDeidentifyTemplate: projects/{project}/locations/{location}/deidentifyTemplates/{deidentify_template}
  • projectLocationDlpJob: projects/{project}/locations/{location}/dlpJobs/{dlp_job}
  • projectLocationInspectTemplate: projects/{project}/locations/{location}/inspectTemplates/{inspect_template}
  • projectLocationJobTrigger: projects/{project}/locations/{location}/jobTriggers/{job_trigger}
  • projectLocationStoredInfoType: projects/{project}/locations/{location}/storedInfoTypes/{stored_info_type}
  • projectStoredInfoType: projects/{project}/storedInfoTypes/{stored_info_type}
  • storedInfoType: organizations/{organization}/storedInfoTypes/{stored_info_type}

The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.

Parameters
NameDescription
formattedName string

The formatted name string

template string

Optional name of template to match

Returns
TypeDescription
arrayAn associative array from name component IDs to component values.

__construct

Constructor.

Parameters
NameDescription
options array

Optional. Options for configuring the service API wrapper.

↳ apiEndpoint string

The address of the API remote host. May optionally include the port, formatted as "

↳ credentials string|array|FetchAuthTokenInterface|CredentialsWrapper

The credentials to be used by the client to authorize API calls. This option accepts either a path to a credentials file, or a decoded credentials file as a PHP array. Advanced usage: In addition, this option can also accept a pre-constructed Google\Auth\FetchAuthTokenInterface object or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored.

↳ credentialsConfig array

Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() .

↳ disableRetries bool

Determines whether or not retries defined by the client configuration should be disabled. Defaults to false.

↳ clientConfig string|array

Client method configuration, including retry settings. This option can be either a path to a JSON file, or a PHP array containing the decoded JSON data. By default this settings points to the default client config file, which is provided in the resources folder.

↳ transport string|TransportInterface

The transport used for executing network requests. May be either the string rest or grpc. Defaults to grpc if gRPC support is detected on the system. Advanced usage: Additionally, it is possible to pass in an already instantiated Google\ApiCore\Transport\TransportInterface object. Note that when this object is provided, any settings in $transportConfig, and any $apiEndpoint setting, will be ignored.

↳ transportConfig array

Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = [ 'grpc' => [...], 'rest' => [...], ]; See the Google\ApiCore\Transport\GrpcTransport::build() and Google\ApiCore\Transport\RestTransport::build() methods for the supported options.

↳ clientCertSource callable

A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS.

activateJobTrigger

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

Parameters
NameDescription
name string

Required. Resource name of the trigger to activate, for example projects/dlp-test-project/jobTriggers/53234423.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Dlp\V2\DlpJob
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Dlp\V2\DlpJob;
use Google\Cloud\Dlp\V2\DlpServiceClient;

/**
 * @param string $formattedName Resource name of the trigger to activate, for example
 *                              `projects/dlp-test-project/jobTriggers/53234423`. Please see
 *                              {@see DlpServiceClient::jobTriggerName()} for help formatting this field.
 */
function activate_job_trigger_sample(string $formattedName): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var DlpJob $response */
        $response = $dlpServiceClient->activateJobTrigger($formattedName);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = DlpServiceClient::jobTriggerName('[PROJECT]', '[JOB_TRIGGER]');

    activate_job_trigger_sample($formattedName);
}

cancelDlpJob

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.

Parameters
NameDescription
name string

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

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\ApiCore\ApiException;
use Google\Cloud\Dlp\V2\DlpServiceClient;

/**
 * @param string $formattedName The name of the DlpJob resource to be cancelled. Please see
 *                              {@see DlpServiceClient::dlpJobName()} for help formatting this field.
 */
function cancel_dlp_job_sample(string $formattedName): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Call the API and handle any network failures.
    try {
        $dlpServiceClient->cancelDlpJob($formattedName);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = DlpServiceClient::dlpJobName('[PROJECT]', '[DLP_JOB]');

    cancel_dlp_job_sample($formattedName);
}

createDeidentifyTemplate

Creates a DeidentifyTemplate for reusing frequently used configuration for de-identifying content, images, and storage.

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

Parameters
NameDescription
parent string

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:
    projects/PROJECT_ID/locations/LOCATION_ID
  • Projects scope, no location specified (defaults to global):
    projects/PROJECT_ID
  • Organizations scope, location specified:
    organizations/ORG_ID/locations/LOCATION_ID
  • Organizations scope, no location specified (defaults to global):
    organizations/ORG_ID

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

deidentifyTemplate Google\Cloud\Dlp\V2\DeidentifyTemplate

Required. The DeidentifyTemplate to create.

optionalArgs array

Optional.

↳ templateId string

The template id can contain uppercase and lowercase letters, numbers, and hyphens; that is, it must match the regular expression: [a-zA-Z\d-_]+. The maximum length is 100 characters. Can be empty to allow the system to generate one.

↳ locationId string

Deprecated. This field has no effect.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Dlp\V2\DeidentifyTemplate
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Dlp\V2\DeidentifyTemplate;
use Google\Cloud\Dlp\V2\DlpServiceClient;

/**
 * @param string $formattedParent 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](https://cloud.google.com/dlp/docs/specifying-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
 *                                Please see {@see DlpServiceClient::organizationLocationName()} for help formatting this field.
 */
function create_deidentify_template_sample(string $formattedParent): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $deidentifyTemplate = new DeidentifyTemplate();

    // Call the API and handle any network failures.
    try {
        /** @var DeidentifyTemplate $response */
        $response = $dlpServiceClient->createDeidentifyTemplate($formattedParent, $deidentifyTemplate);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = DlpServiceClient::organizationLocationName('[ORGANIZATION]', '[LOCATION]');

    create_deidentify_template_sample($formattedParent);
}

createDlpJob

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.

Parameters
NameDescription
parent string

Required. Parent resource name.

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

  • Projects scope, location specified:
    projects/PROJECT_ID/locations/LOCATION_ID
  • Projects scope, no location specified (defaults to global):
    projects/PROJECT_ID

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

optionalArgs array

Optional.

↳ inspectJob InspectJobConfig

The configuration details for an inspect job. Only one of $inspectJob and $riskJob may be provided. An inspection job scans a storage repository for InfoTypes.

↳ riskJob RiskAnalysisJobConfig

The configuration details for a risk analysis job. Only one of $inspectJob and $riskJob may be provided. A risk analysis job calculates re-identification risk metrics for a BigQuery table.

↳ jobId string

The job id can contain uppercase and lowercase letters, numbers, and hyphens; that is, it must match the regular expression: [a-zA-Z\d-_]+. The maximum length is 100 characters. Can be empty to allow the system to generate one.

↳ locationId string

Deprecated. This field has no effect.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Dlp\V2\DlpJob
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Dlp\V2\DlpJob;
use Google\Cloud\Dlp\V2\DlpServiceClient;

/**
 * @param string $formattedParent Parent resource name.
 *
 *                                The format of this value varies depending on whether you have [specified a
 *                                processing
 *                                location](https://cloud.google.com/dlp/docs/specifying-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
 *                                Please see {@see DlpServiceClient::projectName()} for help formatting this field.
 */
function create_dlp_job_sample(string $formattedParent): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var DlpJob $response */
        $response = $dlpServiceClient->createDlpJob($formattedParent);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = DlpServiceClient::projectName('[PROJECT]');

    create_dlp_job_sample($formattedParent);
}

createInspectTemplate

Creates an InspectTemplate for reusing frequently used configuration for inspecting content, images, and storage.

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

Parameters
NameDescription
parent string

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:
    projects/PROJECT_ID/locations/LOCATION_ID
  • Projects scope, no location specified (defaults to global):
    projects/PROJECT_ID
  • Organizations scope, location specified:
    organizations/ORG_ID/locations/LOCATION_ID
  • Organizations scope, no location specified (defaults to global):
    organizations/ORG_ID

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

inspectTemplate Google\Cloud\Dlp\V2\InspectTemplate

Required. The InspectTemplate to create.

optionalArgs array

Optional.

↳ templateId string

The template id can contain uppercase and lowercase letters, numbers, and hyphens; that is, it must match the regular expression: [a-zA-Z\d-_]+. The maximum length is 100 characters. Can be empty to allow the system to generate one.

↳ locationId string

Deprecated. This field has no effect.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Dlp\V2\InspectTemplate
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Dlp\V2\DlpServiceClient;
use Google\Cloud\Dlp\V2\InspectTemplate;

/**
 * @param string $formattedParent 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](https://cloud.google.com/dlp/docs/specifying-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
 *                                Please see {@see DlpServiceClient::organizationLocationName()} for help formatting this field.
 */
function create_inspect_template_sample(string $formattedParent): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $inspectTemplate = new InspectTemplate();

    // Call the API and handle any network failures.
    try {
        /** @var InspectTemplate $response */
        $response = $dlpServiceClient->createInspectTemplate($formattedParent, $inspectTemplate);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = DlpServiceClient::organizationLocationName('[ORGANIZATION]', '[LOCATION]');

    create_inspect_template_sample($formattedParent);
}

createJobTrigger

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.

Parameters
NameDescription
parent string

Required. Parent resource name.

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

  • Projects scope, location specified:
    projects/PROJECT_ID/locations/LOCATION_ID
  • Projects scope, no location specified (defaults to global):
    projects/PROJECT_ID

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

jobTrigger Google\Cloud\Dlp\V2\JobTrigger

Required. The JobTrigger to create.

optionalArgs array

Optional.

↳ triggerId string

The trigger id can contain uppercase and lowercase letters, numbers, and hyphens; that is, it must match the regular expression: [a-zA-Z\d-_]+. The maximum length is 100 characters. Can be empty to allow the system to generate one.

↳ locationId string

Deprecated. This field has no effect.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Dlp\V2\JobTrigger
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Dlp\V2\DlpServiceClient;
use Google\Cloud\Dlp\V2\JobTrigger;
use Google\Cloud\Dlp\V2\JobTrigger\Status;

/**
 * @param string $formattedParent  Parent resource name.
 *
 *                                 The format of this value varies depending on whether you have [specified a
 *                                 processing
 *                                 location](https://cloud.google.com/dlp/docs/specifying-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
 *                                 Please see {@see DlpServiceClient::projectName()} for help formatting this field.
 * @param int    $jobTriggerStatus A status for this trigger.
 */
function create_job_trigger_sample(string $formattedParent, int $jobTriggerStatus): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $jobTrigger = (new JobTrigger())
        ->setStatus($jobTriggerStatus);

    // Call the API and handle any network failures.
    try {
        /** @var JobTrigger $response */
        $response = $dlpServiceClient->createJobTrigger($formattedParent, $jobTrigger);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = DlpServiceClient::projectName('[PROJECT]');
    $jobTriggerStatus = Status::STATUS_UNSPECIFIED;

    create_job_trigger_sample($formattedParent, $jobTriggerStatus);
}

createStoredInfoType

Creates a pre-built stored infoType to be used for inspection.

See https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more.

Parameters
NameDescription
parent string

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:
    projects/PROJECT_ID/locations/LOCATION_ID
  • Projects scope, no location specified (defaults to global):
    projects/PROJECT_ID
  • Organizations scope, location specified:
    organizations/ORG_ID/locations/LOCATION_ID
  • Organizations scope, no location specified (defaults to global):
    organizations/ORG_ID

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

config Google\Cloud\Dlp\V2\StoredInfoTypeConfig

Required. Configuration of the storedInfoType to create.

optionalArgs array

Optional.

↳ storedInfoTypeId string

The storedInfoType ID can contain uppercase and lowercase letters, numbers, and hyphens; that is, it must match the regular expression: [a-zA-Z\d-_]+. The maximum length is 100 characters. Can be empty to allow the system to generate one.

↳ locationId string

Deprecated. This field has no effect.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Dlp\V2\StoredInfoType
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Dlp\V2\DlpServiceClient;
use Google\Cloud\Dlp\V2\StoredInfoType;
use Google\Cloud\Dlp\V2\StoredInfoTypeConfig;

/**
 * @param string $formattedParent 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](https://cloud.google.com/dlp/docs/specifying-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
 *                                Please see {@see DlpServiceClient::organizationLocationName()} for help formatting this field.
 */
function create_stored_info_type_sample(string $formattedParent): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $config = new StoredInfoTypeConfig();

    // Call the API and handle any network failures.
    try {
        /** @var StoredInfoType $response */
        $response = $dlpServiceClient->createStoredInfoType($formattedParent, $config);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = DlpServiceClient::organizationLocationName('[ORGANIZATION]', '[LOCATION]');

    create_stored_info_type_sample($formattedParent);
}

deidentifyContent

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.

Parameters
NameDescription
optionalArgs array

Optional.

↳ parent string

The parent resource name. Please note, unless you have authenticated using an API key this option will be required. The format of this value varies depending on whether you have specified a processing location: + Projects scope, location specified:
projects/PROJECT_ID/locations/LOCATION_ID + Projects scope, no location specified (defaults to global):
projects/PROJECT_ID 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

↳ deidentifyConfig DeidentifyConfig

Configuration for the de-identification of the content item. Items specified here will override the template referenced by the deidentify_template_name argument.

↳ inspectConfig InspectConfig

Configuration for the inspector. Items specified here will override the template referenced by the inspect_template_name argument.

↳ item ContentItem

The item to de-identify. Will be treated as text. This value must be of type Table if your deidentify_config is a RecordTransformations object.

↳ inspectTemplateName string

Template to use. Any configuration directly specified in inspect_config will override those set in the template. Singular fields that are set in this request will replace their corresponding fields in the template. Repeated fields are appended. Singular sub-messages and groups are recursively merged.

↳ deidentifyTemplateName string

Template to use. Any configuration directly specified in deidentify_config will override those set in the template. Singular fields that are set in this request will replace their corresponding fields in the template. Repeated fields are appended. Singular sub-messages and groups are recursively merged.

↳ locationId string

Deprecated. This field has no effect.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Dlp\V2\DeidentifyContentResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Dlp\V2\DeidentifyContentResponse;
use Google\Cloud\Dlp\V2\DlpServiceClient;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function deidentify_content_sample(): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var DeidentifyContentResponse $response */
        $response = $dlpServiceClient->deidentifyContent();
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

deleteDeidentifyTemplate

Deletes a DeidentifyTemplate.

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

Parameters
NameDescription
name string

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

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\ApiCore\ApiException;
use Google\Cloud\Dlp\V2\DlpServiceClient;

/**
 * @param string $formattedName Resource name of the organization and deidentify template to be deleted,
 *                              for example `organizations/433245324/deidentifyTemplates/432452342` or
 *                              projects/project-id/deidentifyTemplates/432452342. Please see
 *                              {@see DlpServiceClient::deidentifyTemplateName()} for help formatting this field.
 */
function delete_deidentify_template_sample(string $formattedName): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Call the API and handle any network failures.
    try {
        $dlpServiceClient->deleteDeidentifyTemplate($formattedName);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = DlpServiceClient::deidentifyTemplateName(
        '[ORGANIZATION]',
        '[DEIDENTIFY_TEMPLATE]'
    );

    delete_deidentify_template_sample($formattedName);
}

deleteDlpJob

Deletes a long-running DlpJob. This method indicates that the client is no longer interested in the DlpJob result. The job will be canceled if possible.

See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.

Parameters
NameDescription
name string

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

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\ApiCore\ApiException;
use Google\Cloud\Dlp\V2\DlpServiceClient;

/**
 * @param string $formattedName The name of the DlpJob resource to be deleted. Please see
 *                              {@see DlpServiceClient::dlpJobName()} for help formatting this field.
 */
function delete_dlp_job_sample(string $formattedName): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Call the API and handle any network failures.
    try {
        $dlpServiceClient->deleteDlpJob($formattedName);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = DlpServiceClient::dlpJobName('[PROJECT]', '[DLP_JOB]');

    delete_dlp_job_sample($formattedName);
}

deleteInspectTemplate

Deletes an InspectTemplate.

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

Parameters
NameDescription
name string

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

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\ApiCore\ApiException;
use Google\Cloud\Dlp\V2\DlpServiceClient;

/**
 * @param string $formattedName Resource name of the organization and inspectTemplate to be deleted, for
 *                              example `organizations/433245324/inspectTemplates/432452342` or
 *                              projects/project-id/inspectTemplates/432452342. Please see
 *                              {@see DlpServiceClient::inspectTemplateName()} for help formatting this field.
 */
function delete_inspect_template_sample(string $formattedName): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Call the API and handle any network failures.
    try {
        $dlpServiceClient->deleteInspectTemplate($formattedName);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = DlpServiceClient::inspectTemplateName('[ORGANIZATION]', '[INSPECT_TEMPLATE]');

    delete_inspect_template_sample($formattedName);
}

deleteJobTrigger

Deletes a job trigger.

See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.

Parameters
NameDescription
name string

Required. Resource name of the project and the triggeredJob, for example projects/dlp-test-project/jobTriggers/53234423.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\ApiCore\ApiException;
use Google\Cloud\Dlp\V2\DlpServiceClient;

/**
 * @param string $formattedName Resource name of the project and the triggeredJob, for example
 *                              `projects/dlp-test-project/jobTriggers/53234423`. Please see
 *                              {@see DlpServiceClient::jobTriggerName()} for help formatting this field.
 */
function delete_job_trigger_sample(string $formattedName): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Call the API and handle any network failures.
    try {
        $dlpServiceClient->deleteJobTrigger($formattedName);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = DlpServiceClient::jobTriggerName('[PROJECT]', '[JOB_TRIGGER]');

    delete_job_trigger_sample($formattedName);
}

deleteStoredInfoType

Deletes a stored infoType.

See https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more.

Parameters
NameDescription
name string

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

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\ApiCore\ApiException;
use Google\Cloud\Dlp\V2\DlpServiceClient;

/**
 * @param string $formattedName Resource name of the organization and storedInfoType to be deleted, for
 *                              example `organizations/433245324/storedInfoTypes/432452342` or
 *                              projects/project-id/storedInfoTypes/432452342. Please see
 *                              {@see DlpServiceClient::storedInfoTypeName()} for help formatting this field.
 */
function delete_stored_info_type_sample(string $formattedName): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Call the API and handle any network failures.
    try {
        $dlpServiceClient->deleteStoredInfoType($formattedName);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = DlpServiceClient::storedInfoTypeName('[ORGANIZATION]', '[STORED_INFO_TYPE]');

    delete_stored_info_type_sample($formattedName);
}

finishDlpJob

Finish a running hybrid DlpJob. Triggers the finalization steps and running of any enabled actions that have not yet run.

Parameters
NameDescription
name string

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

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Example
use Google\ApiCore\ApiException;
use Google\Cloud\Dlp\V2\DlpServiceClient;

/**
 * @param string $formattedName The name of the DlpJob resource to be cancelled. Please see
 *                              {@see DlpServiceClient::dlpJobName()} for help formatting this field.
 */
function finish_dlp_job_sample(string $formattedName): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Call the API and handle any network failures.
    try {
        $dlpServiceClient->finishDlpJob($formattedName);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = DlpServiceClient::dlpJobName('[PROJECT]', '[DLP_JOB]');

    finish_dlp_job_sample($formattedName);
}

getDeidentifyTemplate

Gets a DeidentifyTemplate.

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

Parameters
NameDescription
name string

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

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Dlp\V2\DeidentifyTemplate
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Dlp\V2\DeidentifyTemplate;
use Google\Cloud\Dlp\V2\DlpServiceClient;

/**
 * @param string $formattedName Resource name of the organization and deidentify template to be read, for
 *                              example `organizations/433245324/deidentifyTemplates/432452342` or
 *                              projects/project-id/deidentifyTemplates/432452342. Please see
 *                              {@see DlpServiceClient::deidentifyTemplateName()} for help formatting this field.
 */
function get_deidentify_template_sample(string $formattedName): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var DeidentifyTemplate $response */
        $response = $dlpServiceClient->getDeidentifyTemplate($formattedName);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = DlpServiceClient::deidentifyTemplateName(
        '[ORGANIZATION]',
        '[DEIDENTIFY_TEMPLATE]'
    );

    get_deidentify_template_sample($formattedName);
}

getDlpJob

Gets the latest state of a long-running DlpJob.

See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.

Parameters
NameDescription
name string

Required. The name of the DlpJob resource.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Dlp\V2\DlpJob
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Dlp\V2\DlpJob;
use Google\Cloud\Dlp\V2\DlpServiceClient;

/**
 * @param string $formattedName The name of the DlpJob resource. Please see
 *                              {@see DlpServiceClient::dlpJobName()} for help formatting this field.
 */
function get_dlp_job_sample(string $formattedName): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var DlpJob $response */
        $response = $dlpServiceClient->getDlpJob($formattedName);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = DlpServiceClient::dlpJobName('[PROJECT]', '[DLP_JOB]');

    get_dlp_job_sample($formattedName);
}

getInspectTemplate

Gets an InspectTemplate.

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

Parameters
NameDescription
name string

Required. Resource name of the organization and inspectTemplate to be read, for example organizations/433245324/inspectTemplates/432452342 or projects/project-id/inspectTemplates/432452342.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Dlp\V2\InspectTemplate
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Dlp\V2\DlpServiceClient;
use Google\Cloud\Dlp\V2\InspectTemplate;

/**
 * @param string $formattedName Resource name of the organization and inspectTemplate to be read, for
 *                              example `organizations/433245324/inspectTemplates/432452342` or
 *                              projects/project-id/inspectTemplates/432452342. Please see
 *                              {@see DlpServiceClient::inspectTemplateName()} for help formatting this field.
 */
function get_inspect_template_sample(string $formattedName): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var InspectTemplate $response */
        $response = $dlpServiceClient->getInspectTemplate($formattedName);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = DlpServiceClient::inspectTemplateName('[ORGANIZATION]', '[INSPECT_TEMPLATE]');

    get_inspect_template_sample($formattedName);
}

getJobTrigger

Gets a job trigger.

See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.

Parameters
NameDescription
name string

Required. Resource name of the project and the triggeredJob, for example projects/dlp-test-project/jobTriggers/53234423.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Dlp\V2\JobTrigger
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Dlp\V2\DlpServiceClient;
use Google\Cloud\Dlp\V2\JobTrigger;

/**
 * @param string $formattedName Resource name of the project and the triggeredJob, for example
 *                              `projects/dlp-test-project/jobTriggers/53234423`. Please see
 *                              {@see DlpServiceClient::jobTriggerName()} for help formatting this field.
 */
function get_job_trigger_sample(string $formattedName): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var JobTrigger $response */
        $response = $dlpServiceClient->getJobTrigger($formattedName);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = DlpServiceClient::jobTriggerName('[PROJECT]', '[JOB_TRIGGER]');

    get_job_trigger_sample($formattedName);
}

getStoredInfoType

Gets a stored infoType.

See https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more.

Parameters
NameDescription
name string

Required. Resource name of the organization and storedInfoType to be read, for example organizations/433245324/storedInfoTypes/432452342 or projects/project-id/storedInfoTypes/432452342.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Dlp\V2\StoredInfoType
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Dlp\V2\DlpServiceClient;
use Google\Cloud\Dlp\V2\StoredInfoType;

/**
 * @param string $formattedName Resource name of the organization and storedInfoType to be read, for
 *                              example `organizations/433245324/storedInfoTypes/432452342` or
 *                              projects/project-id/storedInfoTypes/432452342. Please see
 *                              {@see DlpServiceClient::storedInfoTypeName()} for help formatting this field.
 */
function get_stored_info_type_sample(string $formattedName): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var StoredInfoType $response */
        $response = $dlpServiceClient->getStoredInfoType($formattedName);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = DlpServiceClient::storedInfoTypeName('[ORGANIZATION]', '[STORED_INFO_TYPE]');

    get_stored_info_type_sample($formattedName);
}

hybridInspectDlpJob

Inspect hybrid content and store findings to a job.

To review the findings, inspect the job. Inspection will occur asynchronously.

Parameters
NameDescription
name string

Required. Resource name of the job to execute a hybrid inspect on, for example projects/dlp-test-project/dlpJob/53234423.

optionalArgs array

Optional.

↳ hybridItem HybridContentItem

The item to inspect.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Dlp\V2\HybridInspectResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Dlp\V2\DlpServiceClient;
use Google\Cloud\Dlp\V2\HybridInspectResponse;

/**
 * @param string $formattedName Resource name of the job to execute a hybrid inspect on, for example
 *                              `projects/dlp-test-project/dlpJob/53234423`. Please see
 *                              {@see DlpServiceClient::dlpJobName()} for help formatting this field.
 */
function hybrid_inspect_dlp_job_sample(string $formattedName): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var HybridInspectResponse $response */
        $response = $dlpServiceClient->hybridInspectDlpJob($formattedName);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = DlpServiceClient::dlpJobName('[PROJECT]', '[DLP_JOB]');

    hybrid_inspect_dlp_job_sample($formattedName);
}

hybridInspectJobTrigger

Inspect hybrid content and store findings to a trigger. The inspection will be processed asynchronously. To review the findings monitor the jobs within the trigger.

Parameters
NameDescription
name string

Required. Resource name of the trigger to execute a hybrid inspect on, for example projects/dlp-test-project/jobTriggers/53234423.

optionalArgs array

Optional.

↳ hybridItem HybridContentItem

The item to inspect.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Dlp\V2\HybridInspectResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Dlp\V2\DlpServiceClient;
use Google\Cloud\Dlp\V2\HybridInspectResponse;

/**
 * @param string $formattedName Resource name of the trigger to execute a hybrid inspect on, for example
 *                              `projects/dlp-test-project/jobTriggers/53234423`. Please see
 *                              {@see DlpServiceClient::jobTriggerName()} for help formatting this field.
 */
function hybrid_inspect_job_trigger_sample(string $formattedName): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var HybridInspectResponse $response */
        $response = $dlpServiceClient->hybridInspectJobTrigger($formattedName);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = DlpServiceClient::jobTriggerName('[PROJECT]', '[JOB_TRIGGER]');

    hybrid_inspect_job_trigger_sample($formattedName);
}

inspectContent

Finds potentially sensitive info in content.

This method has limits on input size, processing time, and output size.

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.

For how to guides, see https://cloud.google.com/dlp/docs/inspecting-images and https://cloud.google.com/dlp/docs/inspecting-text,

Parameters
NameDescription
optionalArgs array

Optional.

↳ parent string

The parent resource name. Please note, unless you have authenticated using an API key this option will be required. The format of this value varies depending on whether you have specified a processing location: + Projects scope, location specified:
projects/PROJECT_ID/locations/LOCATION_ID + Projects scope, no location specified (defaults to global):
projects/PROJECT_ID 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

↳ inspectConfig InspectConfig

Configuration for the inspector. What specified here will override the template referenced by the inspect_template_name argument.

↳ item ContentItem

The item to inspect.

↳ inspectTemplateName string

Template to use. Any configuration directly specified in inspect_config will override those set in the template. Singular fields that are set in this request will replace their corresponding fields in the template. Repeated fields are appended. Singular sub-messages and groups are recursively merged.

↳ locationId string

Deprecated. This field has no effect.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Dlp\V2\InspectContentResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Dlp\V2\DlpServiceClient;
use Google\Cloud\Dlp\V2\InspectContentResponse;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function inspect_content_sample(): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var InspectContentResponse $response */
        $response = $dlpServiceClient->inspectContent();
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

listDeidentifyTemplates

Lists DeidentifyTemplates.

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

Parameters
NameDescription
parent string

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:
    projects/PROJECT_ID/locations/LOCATION_ID
  • Projects scope, no location specified (defaults to global):
    projects/PROJECT_ID
  • Organizations scope, location specified:
    organizations/ORG_ID/locations/LOCATION_ID
  • Organizations scope, no location specified (defaults to global):
    organizations/ORG_ID

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

optionalArgs array

Optional.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ orderBy string

Comma separated list of fields to order by, followed by asc or desc postfix. This list is case-insensitive, default sorting order is ascending, redundant space characters are insignificant. Example: name asc,update_time, create_time desc Supported fields are: - create_time: corresponds to the time the template was created. - update_time: corresponds to the time the template was last updated. - name: corresponds to the template's name. - display_name: corresponds to the template's display name.

↳ locationId string

Deprecated. This field has no effect.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Dlp\V2\DeidentifyTemplate;
use Google\Cloud\Dlp\V2\DlpServiceClient;

/**
 * @param string $formattedParent 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](https://cloud.google.com/dlp/docs/specifying-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
 *                                Please see {@see DlpServiceClient::organizationLocationName()} for help formatting this field.
 */
function list_deidentify_templates_sample(string $formattedParent): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $dlpServiceClient->listDeidentifyTemplates($formattedParent);

        /** @var DeidentifyTemplate $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = DlpServiceClient::organizationLocationName('[ORGANIZATION]', '[LOCATION]');

    list_deidentify_templates_sample($formattedParent);
}

listDlpJobs

Lists DlpJobs that match the specified filter in the request.

See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.

Parameters
NameDescription
parent string

Required. Parent resource name.

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

  • Projects scope, location specified:
    projects/PROJECT_ID/locations/LOCATION_ID
  • Projects scope, no location specified (defaults to global):
    projects/PROJECT_ID

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

optionalArgs array

Optional.

↳ filter string

Allows filtering. Supported syntax: * Filter expressions are made up of one or more restrictions. * Restrictions can be combined by AND or OR logical operators. A sequence of restrictions implicitly uses AND. * A restriction has the form of {field} {operator} {value}. * Supported fields/values for inspect jobs: - state - PENDING|RUNNING|CANCELED|FINISHED|FAILED - inspected_storage - DATASTORE|CLOUD_STORAGE|BIGQUERY - trigger_name - The name of the trigger that created the job. - 'end_time- Corresponds to the time the job finished. - 'start_time - Corresponds to the time the job finished. * Supported fields for risk analysis jobs: - state - RUNNING|CANCELED|FINISHED|FAILED - 'end_time- Corresponds to the time the job finished. - 'start_time - Corresponds to the time the job finished. * The operator must be = or !=. Examples: * inspected_storage = cloud_storage AND state = done * inspected_storage = cloud_storage OR inspected_storage = bigquery * inspected_storage = cloud_storage AND (state = done OR state = canceled) * end_time > "2017-12-12T00:00:00+00:00" The length of this field should be no more than 500 characters.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ type int

The type of job. Defaults to DlpJobType.INSPECT For allowed values, use constants defined on Google\Cloud\Dlp\V2\DlpJobType

↳ orderBy string

Comma separated list of fields to order by, followed by asc or desc postfix. This list is case-insensitive, default sorting order is ascending, redundant space characters are insignificant. Example: name asc, end_time asc, create_time desc Supported fields are: - create_time: corresponds to the time the job was created. - end_time: corresponds to the time the job ended. - name: corresponds to the job's name. - state: corresponds to state

↳ locationId string

Deprecated. This field has no effect.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Dlp\V2\DlpJob;
use Google\Cloud\Dlp\V2\DlpServiceClient;

/**
 * @param string $formattedParent Parent resource name.
 *
 *                                The format of this value varies depending on whether you have [specified a
 *                                processing
 *                                location](https://cloud.google.com/dlp/docs/specifying-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
 *                                Please see {@see DlpServiceClient::projectName()} for help formatting this field.
 */
function list_dlp_jobs_sample(string $formattedParent): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $dlpServiceClient->listDlpJobs($formattedParent);

        /** @var DlpJob $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = DlpServiceClient::projectName('[PROJECT]');

    list_dlp_jobs_sample($formattedParent);
}

listInfoTypes

Returns a list of the sensitive information types that DLP API supports. See https://cloud.google.com/dlp/docs/infotypes-reference to learn more.

Parameters
NameDescription
optionalArgs array

Optional.

↳ parent string

The parent resource name. Please note, unless you have authenticated using an API key this option will be required. The format of this value is as follows: locations/LOCATION_ID

↳ languageCode string

BCP-47 language code for localized infoType friendly names. If omitted, or if localized strings are not available, en-US strings will be returned.

↳ filter string

filter to only return infoTypes supported by certain parts of the API. Defaults to supported_by=INSPECT.

↳ locationId string

Deprecated. This field has no effect.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Dlp\V2\ListInfoTypesResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Dlp\V2\DlpServiceClient;
use Google\Cloud\Dlp\V2\ListInfoTypesResponse;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function list_info_types_sample(): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var ListInfoTypesResponse $response */
        $response = $dlpServiceClient->listInfoTypes();
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

listInspectTemplates

Lists InspectTemplates.

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

Parameters
NameDescription
parent string

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:
    projects/PROJECT_ID/locations/LOCATION_ID
  • Projects scope, no location specified (defaults to global):
    projects/PROJECT_ID
  • Organizations scope, location specified:
    organizations/ORG_ID/locations/LOCATION_ID
  • Organizations scope, no location specified (defaults to global):
    organizations/ORG_ID

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

optionalArgs array

Optional.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ orderBy string

Comma separated list of fields to order by, followed by asc or desc postfix. This list is case-insensitive, default sorting order is ascending, redundant space characters are insignificant. Example: name asc,update_time, create_time desc Supported fields are: - create_time: corresponds to the time the template was created. - update_time: corresponds to the time the template was last updated. - name: corresponds to the template's name. - display_name: corresponds to the template's display name.

↳ locationId string

Deprecated. This field has no effect.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Dlp\V2\DlpServiceClient;
use Google\Cloud\Dlp\V2\InspectTemplate;

/**
 * @param string $formattedParent 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](https://cloud.google.com/dlp/docs/specifying-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
 *                                Please see {@see DlpServiceClient::organizationLocationName()} for help formatting this field.
 */
function list_inspect_templates_sample(string $formattedParent): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $dlpServiceClient->listInspectTemplates($formattedParent);

        /** @var InspectTemplate $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = DlpServiceClient::organizationLocationName('[ORGANIZATION]', '[LOCATION]');

    list_inspect_templates_sample($formattedParent);
}

listJobTriggers

Lists job triggers.

See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.

Parameters
NameDescription
parent string

Required. Parent resource name.

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

  • Projects scope, location specified:
    projects/PROJECT_ID/locations/LOCATION_ID
  • Projects scope, no location specified (defaults to global):
    projects/PROJECT_ID

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

optionalArgs array

Optional.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ orderBy string

Comma separated list of triggeredJob fields to order by, followed by asc or desc postfix. This list is case-insensitive, default sorting order is ascending, redundant space characters are insignificant. Example: name asc,update_time, create_time desc Supported fields are: - create_time: corresponds to the time the JobTrigger was created. - update_time: corresponds to the time the JobTrigger was last updated. - last_run_time: corresponds to the last time the JobTrigger ran. - name: corresponds to the JobTrigger's name. - display_name: corresponds to the JobTrigger's display name. - status: corresponds to JobTrigger's status.

↳ filter string

Allows filtering. Supported syntax: * Filter expressions are made up of one or more restrictions. * Restrictions can be combined by AND or OR logical operators. A sequence of restrictions implicitly uses AND. * A restriction has the form of {field} {operator} {value}. * Supported fields/values for inspect triggers: - status - HEALTHY|PAUSED|CANCELLED - inspected_storage - DATASTORE|CLOUD_STORAGE|BIGQUERY - 'last_run_time- RFC 3339 formatted timestamp, surrounded by quotation marks. Nanoseconds are ignored. - 'error_count' - Number of errors that have occurred while running. * The operator must be=or!=` for status and inspected_storage. Examples: * inspected_storage = cloud_storage AND status = HEALTHY * inspected_storage = cloud_storage OR inspected_storage = bigquery * inspected_storage = cloud_storage AND (state = PAUSED OR state = HEALTHY) * last_run_time > "2017-12-12T00:00:00+00:00" The length of this field should be no more than 500 characters.

↳ type int

The type of jobs. Will use DlpJobType.INSPECT if not set. For allowed values, use constants defined on Google\Cloud\Dlp\V2\DlpJobType

↳ locationId string

Deprecated. This field has no effect.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Dlp\V2\DlpServiceClient;
use Google\Cloud\Dlp\V2\JobTrigger;

/**
 * @param string $formattedParent Parent resource name.
 *
 *                                The format of this value varies depending on whether you have [specified a
 *                                processing
 *                                location](https://cloud.google.com/dlp/docs/specifying-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
 *                                Please see {@see DlpServiceClient::projectName()} for help formatting this field.
 */
function list_job_triggers_sample(string $formattedParent): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $dlpServiceClient->listJobTriggers($formattedParent);

        /** @var JobTrigger $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = DlpServiceClient::projectName('[PROJECT]');

    list_job_triggers_sample($formattedParent);
}

listStoredInfoTypes

Lists stored infoTypes.

See https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more.

Parameters
NameDescription
parent string

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:
    projects/PROJECT_ID/locations/LOCATION_ID
  • Projects scope, no location specified (defaults to global):
    projects/PROJECT_ID

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

optionalArgs array

Optional.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ orderBy string

Comma separated list of fields to order by, followed by asc or desc postfix. This list is case-insensitive, default sorting order is ascending, redundant space characters are insignificant. Example: name asc, display_name, create_time desc Supported fields are: - create_time: corresponds to the time the most recent version of the resource was created. - state: corresponds to the state of the resource. - name: corresponds to resource name. - display_name: corresponds to info type's display name.

↳ locationId string

Deprecated. This field has no effect.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Dlp\V2\DlpServiceClient;
use Google\Cloud\Dlp\V2\StoredInfoType;

/**
 * @param string $formattedParent 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](https://cloud.google.com/dlp/docs/specifying-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
 *                                Please see {@see DlpServiceClient::organizationLocationName()} for help formatting this field.
 */
function list_stored_info_types_sample(string $formattedParent): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $dlpServiceClient->listStoredInfoTypes($formattedParent);

        /** @var StoredInfoType $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = DlpServiceClient::organizationLocationName('[ORGANIZATION]', '[LOCATION]');

    list_stored_info_types_sample($formattedParent);
}

redactImage

Redacts potentially sensitive info from an image.

This method has limits on input size, processing time, and output size. See https://cloud.google.com/dlp/docs/redacting-sensitive-data-images 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.

Parameters
NameDescription
optionalArgs array

Optional.

↳ parent string

The parent resource name. Please note, unless you have authenticated using an API key this option will be required. The format of this value varies depending on whether you have specified a processing location: + Projects scope, location specified:
projects/PROJECT_ID/locations/LOCATION_ID + Projects scope, no location specified (defaults to global):
projects/PROJECT_ID 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

↳ locationId string

Deprecated. This field has no effect.

↳ inspectConfig InspectConfig

Configuration for the inspector.

↳ imageRedactionConfigs ImageRedactionConfig[]

The configuration for specifying what content to redact from images.

↳ includeFindings bool

Whether the response should include findings along with the redacted image.

↳ byteItem ByteContentItem

The content must be PNG, JPEG, SVG or BMP.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Dlp\V2\RedactImageResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Dlp\V2\DlpServiceClient;
use Google\Cloud\Dlp\V2\RedactImageResponse;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function redact_image_sample(): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var RedactImageResponse $response */
        $response = $dlpServiceClient->redactImage();
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

reidentifyContent

Re-identifies content that has been de-identified.

See https://cloud.google.com/dlp/docs/pseudonymization#re-identification_in_free_text_code_example to learn more.

Parameters
NameDescription
parent string

Required. Parent resource name.

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

  • Projects scope, location specified:
    projects/PROJECT_ID/locations/LOCATION_ID
  • Projects scope, no location specified (defaults to global):
    projects/PROJECT_ID

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

optionalArgs array

Optional.

↳ reidentifyConfig DeidentifyConfig

Configuration for the re-identification of the content item. This field shares the same proto message type that is used for de-identification, however its usage here is for the reversal of the previous de-identification. Re-identification is performed by examining the transformations used to de-identify the items and executing the reverse. This requires that only reversible transformations be provided here. The reversible transformations are: - CryptoDeterministicConfig - CryptoReplaceFfxFpeConfig

↳ inspectConfig InspectConfig

Configuration for the inspector.

↳ item ContentItem

The item to re-identify. Will be treated as text.

↳ inspectTemplateName string

Template to use. Any configuration directly specified in inspect_config will override those set in the template. Singular fields that are set in this request will replace their corresponding fields in the template. Repeated fields are appended. Singular sub-messages and groups are recursively merged.

↳ reidentifyTemplateName string

Template to use. References an instance of DeidentifyTemplate. Any configuration directly specified in reidentify_config or inspect_config will override those set in the template. The DeidentifyTemplate used must include only reversible transformations. Singular fields that are set in this request will replace their corresponding fields in the template. Repeated fields are appended. Singular sub-messages and groups are recursively merged.

↳ locationId string

Deprecated. This field has no effect.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Dlp\V2\ReidentifyContentResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Dlp\V2\DlpServiceClient;
use Google\Cloud\Dlp\V2\ReidentifyContentResponse;

/**
 * @param string $formattedParent Parent resource name.
 *
 *                                The format of this value varies depending on whether you have [specified a
 *                                processing
 *                                location](https://cloud.google.com/dlp/docs/specifying-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
 *                                Please see {@see DlpServiceClient::projectName()} for help formatting this field.
 */
function reidentify_content_sample(string $formattedParent): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var ReidentifyContentResponse $response */
        $response = $dlpServiceClient->reidentifyContent($formattedParent);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = DlpServiceClient::projectName('[PROJECT]');

    reidentify_content_sample($formattedParent);
}

updateDeidentifyTemplate

Updates the DeidentifyTemplate.

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

Parameters
NameDescription
name string

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

optionalArgs array

Optional.

↳ deidentifyTemplate DeidentifyTemplate

New DeidentifyTemplate value.

↳ updateMask FieldMask

Mask to control which fields get updated.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Dlp\V2\DeidentifyTemplate
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Dlp\V2\DeidentifyTemplate;
use Google\Cloud\Dlp\V2\DlpServiceClient;

/**
 * @param string $formattedName Resource name of organization and deidentify template to be updated, for
 *                              example `organizations/433245324/deidentifyTemplates/432452342` or
 *                              projects/project-id/deidentifyTemplates/432452342. Please see
 *                              {@see DlpServiceClient::deidentifyTemplateName()} for help formatting this field.
 */
function update_deidentify_template_sample(string $formattedName): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var DeidentifyTemplate $response */
        $response = $dlpServiceClient->updateDeidentifyTemplate($formattedName);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = DlpServiceClient::deidentifyTemplateName(
        '[ORGANIZATION]',
        '[DEIDENTIFY_TEMPLATE]'
    );

    update_deidentify_template_sample($formattedName);
}

updateInspectTemplate

Updates the InspectTemplate.

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

Parameters
NameDescription
name string

Required. Resource name of organization and inspectTemplate to be updated, for example organizations/433245324/inspectTemplates/432452342 or projects/project-id/inspectTemplates/432452342.

optionalArgs array

Optional.

↳ inspectTemplate InspectTemplate

New InspectTemplate value.

↳ updateMask FieldMask

Mask to control which fields get updated.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Dlp\V2\InspectTemplate
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Dlp\V2\DlpServiceClient;
use Google\Cloud\Dlp\V2\InspectTemplate;

/**
 * @param string $formattedName Resource name of organization and inspectTemplate to be updated, for
 *                              example `organizations/433245324/inspectTemplates/432452342` or
 *                              projects/project-id/inspectTemplates/432452342. Please see
 *                              {@see DlpServiceClient::inspectTemplateName()} for help formatting this field.
 */
function update_inspect_template_sample(string $formattedName): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var InspectTemplate $response */
        $response = $dlpServiceClient->updateInspectTemplate($formattedName);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = DlpServiceClient::inspectTemplateName('[ORGANIZATION]', '[INSPECT_TEMPLATE]');

    update_inspect_template_sample($formattedName);
}

updateJobTrigger

Updates a job trigger.

See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.

Parameters
NameDescription
name string

Required. Resource name of the project and the triggeredJob, for example projects/dlp-test-project/jobTriggers/53234423.

optionalArgs array

Optional.

↳ jobTrigger JobTrigger

New JobTrigger value.

↳ updateMask FieldMask

Mask to control which fields get updated.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Dlp\V2\JobTrigger
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Dlp\V2\DlpServiceClient;
use Google\Cloud\Dlp\V2\JobTrigger;

/**
 * @param string $formattedName Resource name of the project and the triggeredJob, for example
 *                              `projects/dlp-test-project/jobTriggers/53234423`. Please see
 *                              {@see DlpServiceClient::jobTriggerName()} for help formatting this field.
 */
function update_job_trigger_sample(string $formattedName): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var JobTrigger $response */
        $response = $dlpServiceClient->updateJobTrigger($formattedName);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = DlpServiceClient::jobTriggerName('[PROJECT]', '[JOB_TRIGGER]');

    update_job_trigger_sample($formattedName);
}

updateStoredInfoType

Updates the stored infoType by creating a new version. The existing version will continue to be used until the new version is ready.

See https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more.

Parameters
NameDescription
name string

Required. Resource name of organization and storedInfoType to be updated, for example organizations/433245324/storedInfoTypes/432452342 or projects/project-id/storedInfoTypes/432452342.

optionalArgs array

Optional.

↳ config StoredInfoTypeConfig

Updated configuration for the storedInfoType. If not provided, a new version of the storedInfoType will be created with the existing configuration.

↳ updateMask FieldMask

Mask to control which fields get updated.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Dlp\V2\StoredInfoType
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Dlp\V2\DlpServiceClient;
use Google\Cloud\Dlp\V2\StoredInfoType;

/**
 * @param string $formattedName Resource name of organization and storedInfoType to be updated, for
 *                              example `organizations/433245324/storedInfoTypes/432452342` or
 *                              projects/project-id/storedInfoTypes/432452342. Please see
 *                              {@see DlpServiceClient::storedInfoTypeName()} for help formatting this field.
 */
function update_stored_info_type_sample(string $formattedName): void
{
    // Create a client.
    $dlpServiceClient = new DlpServiceClient();

    // Call the API and handle any network failures.
    try {
        /** @var StoredInfoType $response */
        $response = $dlpServiceClient->updateStoredInfoType($formattedName);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = DlpServiceClient::storedInfoTypeName('[ORGANIZATION]', '[STORED_INFO_TYPE]');

    update_stored_info_type_sample($formattedName);
}

Constants

SERVICE_NAME

Value: 'google.privacy.dlp.v2.DlpService'

The name of the service.

SERVICE_ADDRESS

Value: 'dlp.googleapis.com'

The default address of the service.

DEFAULT_SERVICE_PORT

Value: 443

The default port of the service.

CODEGEN_NAME

Value: 'gapic'

The name of the code generator, to be included in the agent header.