From 4445cd5603454063d09339e1952744ece718e55c Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Fri, 31 Jul 2020 03:56:13 -0700 Subject: [PATCH] Integrate Python GAPIC Microgenerator in googleapis. This PR uses using documentai as an example. Depends on https://github.com/googleapis/gapic-generator-python/pull/402 PiperOrigin-RevId: 309824146 Source-Author: Google APIs Source-Date: Mon May 4 15:06:44 2020 -0700 Source-Repo: googleapis/googleapis Source-Sha: e0f9d9e1f9de890db765be46f45ca8490723e3eb Source-Link: https://github.com/googleapis/googleapis/commit/e0f9d9e1f9de890db765be46f45ca8490723e3eb --- Dlp/metadata/V2/Dlp.php | 13 +- Dlp/metadata/V2/Storage.php | 9 +- Dlp/src/V2/Finding.php | 36 +- Dlp/src/V2/Gapic/DlpServiceGapicClient.php | 653 ++++++++++++++++++--- Dlp/src/V2/HybridFindingDetails.php | 36 +- Dlp/src/V2/HybridOptions.php | 44 +- Dlp/src/V2/InfoType.php | 8 +- Dlp/synth.metadata | 19 +- Dlp/tests/Unit/V2/DlpServiceClientTest.php | 181 +++--- 9 files changed, 736 insertions(+), 263 deletions(-) diff --git a/Dlp/metadata/V2/Dlp.php b/Dlp/metadata/V2/Dlp.php index 7bbff390f3d2..8cfbaa83e7b8 100644 --- a/Dlp/metadata/V2/Dlp.php +++ b/Dlp/metadata/V2/Dlp.php @@ -28,7 +28,7 @@ public static function initOnce() { \GPBMetadata\Google\Type\Dayofweek::initOnce(); \GPBMetadata\Google\Type\Timeofday::initOnce(); $pool->internalAddGeneratedFile(hex2bin( - "0ac3ce020a1f676f6f676c652f707269766163792f646c702f76322f646c" . + "0adcce020a1f676f6f676c652f707269766163792f646c702f76322f646c" . "702e70726f746f1215676f6f676c652e707269766163792e646c702e7632" . "1a17676f6f676c652f6170692f636c69656e742e70726f746f1a1f676f6f" . "676c652f6170692f6669656c645f6265686176696f722e70726f746f1a19" . @@ -1447,15 +1447,16 @@ public static function initOnce() { "732f2a2f646c704a6f62732f2a7d3a66696e6973683a012a1a46ca411264" . "6c702e676f6f676c65617069732e636f6dd2412e68747470733a2f2f7777" . "772e676f6f676c65617069732e636f6d2f617574682f636c6f75642d706c" . - "6174666f726d42ec010a19636f6d2e676f6f676c652e707269766163792e" . + "6174666f726d4285020a19636f6d2e676f6f676c652e707269766163792e" . "646c702e76324208446c7050726f746f50015a38676f6f676c652e676f6c" . "616e672e6f72672f67656e70726f746f2f676f6f676c65617069732f7072" . "69766163792f646c702f76323b646c70aa0213476f6f676c652e436c6f75" . "642e446c702e5632ca0213476f6f676c655c436c6f75645c446c705c5632" . - "ea415c0a27646c702e676f6f676c65617069732e636f6d2f4f7267616e69" . - "7a6174696f6e4c6f636174696f6e12316f7267616e697a6174696f6e732f" . - "7b6f7267616e697a6174696f6e7d2f6c6f636174696f6e732f7b6c6f6361" . - "74696f6e7d620670726f746f33" + "ea0216476f6f676c653a3a436c6f75643a3a446c703a3a5632ea415c0a27" . + "646c702e676f6f676c65617069732e636f6d2f4f7267616e697a6174696f" . + "6e4c6f636174696f6e12316f7267616e697a6174696f6e732f7b6f726761" . + "6e697a6174696f6e7d2f6c6f636174696f6e732f7b6c6f636174696f6e7d" . + "620670726f746f33" ), true); static::$is_initialized = true; diff --git a/Dlp/metadata/V2/Storage.php b/Dlp/metadata/V2/Storage.php index d500a99247be..be8a54d56012 100644 --- a/Dlp/metadata/V2/Storage.php +++ b/Dlp/metadata/V2/Storage.php @@ -17,7 +17,7 @@ public static function initOnce() { \GPBMetadata\Google\Api\Resource::initOnce(); \GPBMetadata\Google\Protobuf\Timestamp::initOnce(); $pool->internalAddGeneratedFile(hex2bin( - "0ab4270a23676f6f676c652f707269766163792f646c702f76322f73746f" . + "0acd270a23676f6f676c652f707269766163792f646c702f76322f73746f" . "726167652e70726f746f1215676f6f676c652e707269766163792e646c70" . "2e76321a1f676f6f676c652f70726f746f6275662f74696d657374616d70" . "2e70726f746f22180a08496e666f54797065120c0a046e616d6518012001" . @@ -180,12 +180,13 @@ public static function initOnce() { "052a5a0a0846696c655479706512190a1546494c455f545950455f554e53" . "50454349464945441000120f0a0b42494e4152595f46494c451001120d0a" . "09544558545f46494c45100212090a05494d414745100312080a04415652" . - "4f1007428f010a19636f6d2e676f6f676c652e707269766163792e646c70" . + "4f100742a8010a19636f6d2e676f6f676c652e707269766163792e646c70" . "2e7632420a446c7053746f7261676550015a38676f6f676c652e676f6c61" . "6e672e6f72672f67656e70726f746f2f676f6f676c65617069732f707269" . "766163792f646c702f76323b646c70aa0213476f6f676c652e436c6f7564" . - "2e446c702e5632ca0213476f6f676c655c436c6f75645c446c705c563262" . - "0670726f746f33" + "2e446c702e5632ca0213476f6f676c655c436c6f75645c446c705c5632ea" . + "0216476f6f676c653a3a436c6f75643a3a446c703a3a5632620670726f74" . + "6f33" ), true); static::$is_initialized = true; diff --git a/Dlp/src/V2/Finding.php b/Dlp/src/V2/Finding.php index 6f599cc73557..f520d74e90cf 100644 --- a/Dlp/src/V2/Finding.php +++ b/Dlp/src/V2/Finding.php @@ -85,12 +85,13 @@ class Finding extends \Google\Protobuf\Internal\Message /** * The labels associated with this `InspectFinding`. * Label keys must be between 1 and 63 characters long and must conform - * to the following regular expression: \[a-z\](\[-a-z0-9\]*\[a-z0-9\])?. + * to the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. * Label values must be between 0 and 63 characters long and must conform - * to the regular expression (\[a-z\](\[-a-z0-9\]*\[a-z0-9\])?)?. + * to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. * No more than 10 labels can be associated with a given finding. - * Example: "environment" : "production" - * Example: "pipeline" : "etl" + * Examples: + * * `"environment" : "production"` + * * `"pipeline" : "etl"` * * Generated from protobuf field map labels = 10; */ @@ -152,12 +153,13 @@ class Finding extends \Google\Protobuf\Internal\Message * @type array|\Google\Protobuf\Internal\MapField $labels * The labels associated with this `InspectFinding`. * Label keys must be between 1 and 63 characters long and must conform - * to the following regular expression: \[a-z\](\[-a-z0-9\]*\[a-z0-9\])?. + * to the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. * Label values must be between 0 and 63 characters long and must conform - * to the regular expression (\[a-z\](\[-a-z0-9\]*\[a-z0-9\])?)?. + * to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. * No more than 10 labels can be associated with a given finding. - * Example: "environment" : "production" - * Example: "pipeline" : "etl" + * Examples: + * * `"environment" : "production"` + * * `"pipeline" : "etl"` * @type \Google\Protobuf\Timestamp $job_create_time * Time the job started that produced this finding. * @type string $job_name @@ -436,12 +438,13 @@ public function setTriggerName($var) /** * The labels associated with this `InspectFinding`. * Label keys must be between 1 and 63 characters long and must conform - * to the following regular expression: \[a-z\](\[-a-z0-9\]*\[a-z0-9\])?. + * to the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. * Label values must be between 0 and 63 characters long and must conform - * to the regular expression (\[a-z\](\[-a-z0-9\]*\[a-z0-9\])?)?. + * to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. * No more than 10 labels can be associated with a given finding. - * Example: "environment" : "production" - * Example: "pipeline" : "etl" + * Examples: + * * `"environment" : "production"` + * * `"pipeline" : "etl"` * * Generated from protobuf field map labels = 10; * @return \Google\Protobuf\Internal\MapField @@ -454,12 +457,13 @@ public function getLabels() /** * The labels associated with this `InspectFinding`. * Label keys must be between 1 and 63 characters long and must conform - * to the following regular expression: \[a-z\](\[-a-z0-9\]*\[a-z0-9\])?. + * to the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. * Label values must be between 0 and 63 characters long and must conform - * to the regular expression (\[a-z\](\[-a-z0-9\]*\[a-z0-9\])?)?. + * to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. * No more than 10 labels can be associated with a given finding. - * Example: "environment" : "production" - * Example: "pipeline" : "etl" + * Examples: + * * `"environment" : "production"` + * * `"pipeline" : "etl"` * * Generated from protobuf field map labels = 10; * @param array|\Google\Protobuf\Internal\MapField $var diff --git a/Dlp/src/V2/Gapic/DlpServiceGapicClient.php b/Dlp/src/V2/Gapic/DlpServiceGapicClient.php index eb76fe4c3e92..dc05d2577408 100644 --- a/Dlp/src/V2/Gapic/DlpServiceGapicClient.php +++ b/Dlp/src/V2/Gapic/DlpServiceGapicClient.php @@ -114,8 +114,7 @@ * ``` * $dlpServiceClient = new DlpServiceClient(); * try { - * $formattedParent = $dlpServiceClient->projectName('[PROJECT]'); - * $response = $dlpServiceClient->inspectContent($formattedParent); + * $response = $dlpServiceClient->inspectContent(); * } finally { * $dlpServiceClient->close(); * } @@ -158,16 +157,31 @@ class DlpServiceGapicClient public static $serviceScopes = [ 'https://www.googleapis.com/auth/cloud-platform', ]; + private static $deidentifyTemplateNameTemplate; private static $dlpJobNameTemplate; + private static $inspectTemplateNameTemplate; + private static $jobTriggerNameTemplate; + private static $locationNameTemplate; private static $organizationNameTemplate; private static $organizationDeidentifyTemplateNameTemplate; private static $organizationInspectTemplateNameTemplate; + private static $organizationLocationNameTemplate; + private static $organizationLocationDeidentifyTemplateNameTemplate; + private static $organizationLocationInspectTemplateNameTemplate; + private static $organizationLocationStoredInfoTypeNameTemplate; private static $organizationStoredInfoTypeNameTemplate; private static $projectNameTemplate; private static $projectDeidentifyTemplateNameTemplate; + private static $projectDlpJobNameTemplate; private static $projectInspectTemplateNameTemplate; private static $projectJobTriggerNameTemplate; + private static $projectLocationDeidentifyTemplateNameTemplate; + private static $projectLocationDlpJobNameTemplate; + private static $projectLocationInspectTemplateNameTemplate; + private static $projectLocationJobTriggerNameTemplate; + private static $projectLocationStoredInfoTypeNameTemplate; private static $projectStoredInfoTypeNameTemplate; + private static $storedInfoTypeNameTemplate; private static $pathTemplateMap; private static function getClientDefaults() @@ -189,6 +203,15 @@ private static function getClientDefaults() ]; } + private static function getDeidentifyTemplateNameTemplate() + { + if (null == self::$deidentifyTemplateNameTemplate) { + self::$deidentifyTemplateNameTemplate = new PathTemplate('organizations/{organization}/deidentifyTemplates/{deidentify_template}'); + } + + return self::$deidentifyTemplateNameTemplate; + } + private static function getDlpJobNameTemplate() { if (null == self::$dlpJobNameTemplate) { @@ -198,6 +221,33 @@ private static function getDlpJobNameTemplate() return self::$dlpJobNameTemplate; } + private static function getInspectTemplateNameTemplate() + { + if (null == self::$inspectTemplateNameTemplate) { + self::$inspectTemplateNameTemplate = new PathTemplate('organizations/{organization}/inspectTemplates/{inspect_template}'); + } + + return self::$inspectTemplateNameTemplate; + } + + private static function getJobTriggerNameTemplate() + { + if (null == self::$jobTriggerNameTemplate) { + self::$jobTriggerNameTemplate = new PathTemplate('projects/{project}/jobTriggers/{job_trigger}'); + } + + return self::$jobTriggerNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (null == self::$locationNameTemplate) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + private static function getOrganizationNameTemplate() { if (null == self::$organizationNameTemplate) { @@ -225,6 +275,42 @@ private static function getOrganizationInspectTemplateNameTemplate() return self::$organizationInspectTemplateNameTemplate; } + private static function getOrganizationLocationNameTemplate() + { + if (null == self::$organizationLocationNameTemplate) { + self::$organizationLocationNameTemplate = new PathTemplate('organizations/{organization}/locations/{location}'); + } + + return self::$organizationLocationNameTemplate; + } + + private static function getOrganizationLocationDeidentifyTemplateNameTemplate() + { + if (null == self::$organizationLocationDeidentifyTemplateNameTemplate) { + self::$organizationLocationDeidentifyTemplateNameTemplate = new PathTemplate('organizations/{organization}/locations/{location}/deidentifyTemplates/{deidentify_template}'); + } + + return self::$organizationLocationDeidentifyTemplateNameTemplate; + } + + private static function getOrganizationLocationInspectTemplateNameTemplate() + { + if (null == self::$organizationLocationInspectTemplateNameTemplate) { + self::$organizationLocationInspectTemplateNameTemplate = new PathTemplate('organizations/{organization}/locations/{location}/inspectTemplates/{inspect_template}'); + } + + return self::$organizationLocationInspectTemplateNameTemplate; + } + + private static function getOrganizationLocationStoredInfoTypeNameTemplate() + { + if (null == self::$organizationLocationStoredInfoTypeNameTemplate) { + self::$organizationLocationStoredInfoTypeNameTemplate = new PathTemplate('organizations/{organization}/locations/{location}/storedInfoTypes/{stored_info_type}'); + } + + return self::$organizationLocationStoredInfoTypeNameTemplate; + } + private static function getOrganizationStoredInfoTypeNameTemplate() { if (null == self::$organizationStoredInfoTypeNameTemplate) { @@ -252,6 +338,15 @@ private static function getProjectDeidentifyTemplateNameTemplate() return self::$projectDeidentifyTemplateNameTemplate; } + private static function getProjectDlpJobNameTemplate() + { + if (null == self::$projectDlpJobNameTemplate) { + self::$projectDlpJobNameTemplate = new PathTemplate('projects/{project}/dlpJobs/{dlp_job}'); + } + + return self::$projectDlpJobNameTemplate; + } + private static function getProjectInspectTemplateNameTemplate() { if (null == self::$projectInspectTemplateNameTemplate) { @@ -270,6 +365,51 @@ private static function getProjectJobTriggerNameTemplate() return self::$projectJobTriggerNameTemplate; } + private static function getProjectLocationDeidentifyTemplateNameTemplate() + { + if (null == self::$projectLocationDeidentifyTemplateNameTemplate) { + self::$projectLocationDeidentifyTemplateNameTemplate = new PathTemplate('projects/{project}/locations/{location}/deidentifyTemplates/{deidentify_template}'); + } + + return self::$projectLocationDeidentifyTemplateNameTemplate; + } + + private static function getProjectLocationDlpJobNameTemplate() + { + if (null == self::$projectLocationDlpJobNameTemplate) { + self::$projectLocationDlpJobNameTemplate = new PathTemplate('projects/{project}/locations/{location}/dlpJobs/{dlp_job}'); + } + + return self::$projectLocationDlpJobNameTemplate; + } + + private static function getProjectLocationInspectTemplateNameTemplate() + { + if (null == self::$projectLocationInspectTemplateNameTemplate) { + self::$projectLocationInspectTemplateNameTemplate = new PathTemplate('projects/{project}/locations/{location}/inspectTemplates/{inspect_template}'); + } + + return self::$projectLocationInspectTemplateNameTemplate; + } + + private static function getProjectLocationJobTriggerNameTemplate() + { + if (null == self::$projectLocationJobTriggerNameTemplate) { + self::$projectLocationJobTriggerNameTemplate = new PathTemplate('projects/{project}/locations/{location}/jobTriggers/{job_trigger}'); + } + + return self::$projectLocationJobTriggerNameTemplate; + } + + private static function getProjectLocationStoredInfoTypeNameTemplate() + { + if (null == self::$projectLocationStoredInfoTypeNameTemplate) { + self::$projectLocationStoredInfoTypeNameTemplate = new PathTemplate('projects/{project}/locations/{location}/storedInfoTypes/{stored_info_type}'); + } + + return self::$projectLocationStoredInfoTypeNameTemplate; + } + private static function getProjectStoredInfoTypeNameTemplate() { if (null == self::$projectStoredInfoTypeNameTemplate) { @@ -279,26 +419,68 @@ private static function getProjectStoredInfoTypeNameTemplate() return self::$projectStoredInfoTypeNameTemplate; } + private static function getStoredInfoTypeNameTemplate() + { + if (null == self::$storedInfoTypeNameTemplate) { + self::$storedInfoTypeNameTemplate = new PathTemplate('organizations/{organization}/storedInfoTypes/{stored_info_type}'); + } + + return self::$storedInfoTypeNameTemplate; + } + private static function getPathTemplateMap() { if (null == self::$pathTemplateMap) { self::$pathTemplateMap = [ + 'deidentifyTemplate' => self::getDeidentifyTemplateNameTemplate(), 'dlpJob' => self::getDlpJobNameTemplate(), + 'inspectTemplate' => self::getInspectTemplateNameTemplate(), + 'jobTrigger' => self::getJobTriggerNameTemplate(), + 'location' => self::getLocationNameTemplate(), 'organization' => self::getOrganizationNameTemplate(), 'organizationDeidentifyTemplate' => self::getOrganizationDeidentifyTemplateNameTemplate(), 'organizationInspectTemplate' => self::getOrganizationInspectTemplateNameTemplate(), + 'organizationLocation' => self::getOrganizationLocationNameTemplate(), + 'organizationLocationDeidentifyTemplate' => self::getOrganizationLocationDeidentifyTemplateNameTemplate(), + 'organizationLocationInspectTemplate' => self::getOrganizationLocationInspectTemplateNameTemplate(), + 'organizationLocationStoredInfoType' => self::getOrganizationLocationStoredInfoTypeNameTemplate(), 'organizationStoredInfoType' => self::getOrganizationStoredInfoTypeNameTemplate(), 'project' => self::getProjectNameTemplate(), 'projectDeidentifyTemplate' => self::getProjectDeidentifyTemplateNameTemplate(), + 'projectDlpJob' => self::getProjectDlpJobNameTemplate(), 'projectInspectTemplate' => self::getProjectInspectTemplateNameTemplate(), 'projectJobTrigger' => self::getProjectJobTriggerNameTemplate(), + 'projectLocationDeidentifyTemplate' => self::getProjectLocationDeidentifyTemplateNameTemplate(), + 'projectLocationDlpJob' => self::getProjectLocationDlpJobNameTemplate(), + 'projectLocationInspectTemplate' => self::getProjectLocationInspectTemplateNameTemplate(), + 'projectLocationJobTrigger' => self::getProjectLocationJobTriggerNameTemplate(), + 'projectLocationStoredInfoType' => self::getProjectLocationStoredInfoTypeNameTemplate(), 'projectStoredInfoType' => self::getProjectStoredInfoTypeNameTemplate(), + 'storedInfoType' => self::getStoredInfoTypeNameTemplate(), ]; } return self::$pathTemplateMap; } + /** + * Formats a string containing the fully-qualified path to represent + * a deidentify_template resource. + * + * @param string $organization + * @param string $deidentifyTemplate + * + * @return string The formatted deidentify_template resource. + * @experimental + */ + public static function deidentifyTemplateName($organization, $deidentifyTemplate) + { + return self::getDeidentifyTemplateNameTemplate()->render([ + 'organization' => $organization, + 'deidentify_template' => $deidentifyTemplate, + ]); + } + /** * Formats a string containing the fully-qualified path to represent * a dlp_job resource. @@ -317,6 +499,60 @@ public static function dlpJobName($project, $dlpJob) ]); } + /** + * Formats a string containing the fully-qualified path to represent + * a inspect_template resource. + * + * @param string $organization + * @param string $inspectTemplate + * + * @return string The formatted inspect_template resource. + * @experimental + */ + public static function inspectTemplateName($organization, $inspectTemplate) + { + return self::getInspectTemplateNameTemplate()->render([ + 'organization' => $organization, + 'inspect_template' => $inspectTemplate, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent + * a job_trigger resource. + * + * @param string $project + * @param string $jobTrigger + * + * @return string The formatted job_trigger resource. + * @experimental + */ + public static function jobTriggerName($project, $jobTrigger) + { + return self::getJobTriggerNameTemplate()->render([ + 'project' => $project, + 'job_trigger' => $jobTrigger, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent + * a location resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + * @experimental + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + /** * Formats a string containing the fully-qualified path to represent * a organization resource. @@ -369,6 +605,84 @@ public static function organizationInspectTemplateName($organization, $inspectTe ]); } + /** + * Formats a string containing the fully-qualified path to represent + * a organization_location resource. + * + * @param string $organization + * @param string $location + * + * @return string The formatted organization_location resource. + * @experimental + */ + public static function organizationLocationName($organization, $location) + { + return self::getOrganizationLocationNameTemplate()->render([ + 'organization' => $organization, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent + * a organization_location_deidentify_template resource. + * + * @param string $organization + * @param string $location + * @param string $deidentifyTemplate + * + * @return string The formatted organization_location_deidentify_template resource. + * @experimental + */ + public static function organizationLocationDeidentifyTemplateName($organization, $location, $deidentifyTemplate) + { + return self::getOrganizationLocationDeidentifyTemplateNameTemplate()->render([ + 'organization' => $organization, + 'location' => $location, + 'deidentify_template' => $deidentifyTemplate, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent + * a organization_location_inspect_template resource. + * + * @param string $organization + * @param string $location + * @param string $inspectTemplate + * + * @return string The formatted organization_location_inspect_template resource. + * @experimental + */ + public static function organizationLocationInspectTemplateName($organization, $location, $inspectTemplate) + { + return self::getOrganizationLocationInspectTemplateNameTemplate()->render([ + 'organization' => $organization, + 'location' => $location, + 'inspect_template' => $inspectTemplate, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent + * a organization_location_stored_info_type resource. + * + * @param string $organization + * @param string $location + * @param string $storedInfoType + * + * @return string The formatted organization_location_stored_info_type resource. + * @experimental + */ + public static function organizationLocationStoredInfoTypeName($organization, $location, $storedInfoType) + { + return self::getOrganizationLocationStoredInfoTypeNameTemplate()->render([ + 'organization' => $organization, + 'location' => $location, + 'stored_info_type' => $storedInfoType, + ]); + } + /** * Formats a string containing the fully-qualified path to represent * a organization_stored_info_type resource. @@ -421,6 +735,24 @@ public static function projectDeidentifyTemplateName($project, $deidentifyTempla ]); } + /** + * Formats a string containing the fully-qualified path to represent + * a project_dlp_job resource. + * + * @param string $project + * @param string $dlpJob + * + * @return string The formatted project_dlp_job resource. + * @experimental + */ + public static function projectDlpJobName($project, $dlpJob) + { + return self::getProjectDlpJobNameTemplate()->render([ + 'project' => $project, + 'dlp_job' => $dlpJob, + ]); + } + /** * Formats a string containing the fully-qualified path to represent * a project_inspect_template resource. @@ -457,6 +789,106 @@ public static function projectJobTriggerName($project, $jobTrigger) ]); } + /** + * Formats a string containing the fully-qualified path to represent + * a project_location_deidentify_template resource. + * + * @param string $project + * @param string $location + * @param string $deidentifyTemplate + * + * @return string The formatted project_location_deidentify_template resource. + * @experimental + */ + public static function projectLocationDeidentifyTemplateName($project, $location, $deidentifyTemplate) + { + return self::getProjectLocationDeidentifyTemplateNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'deidentify_template' => $deidentifyTemplate, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent + * a project_location_dlp_job resource. + * + * @param string $project + * @param string $location + * @param string $dlpJob + * + * @return string The formatted project_location_dlp_job resource. + * @experimental + */ + public static function projectLocationDlpJobName($project, $location, $dlpJob) + { + return self::getProjectLocationDlpJobNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'dlp_job' => $dlpJob, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent + * a project_location_inspect_template resource. + * + * @param string $project + * @param string $location + * @param string $inspectTemplate + * + * @return string The formatted project_location_inspect_template resource. + * @experimental + */ + public static function projectLocationInspectTemplateName($project, $location, $inspectTemplate) + { + return self::getProjectLocationInspectTemplateNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'inspect_template' => $inspectTemplate, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent + * a project_location_job_trigger resource. + * + * @param string $project + * @param string $location + * @param string $jobTrigger + * + * @return string The formatted project_location_job_trigger resource. + * @experimental + */ + public static function projectLocationJobTriggerName($project, $location, $jobTrigger) + { + return self::getProjectLocationJobTriggerNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'job_trigger' => $jobTrigger, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent + * a project_location_stored_info_type resource. + * + * @param string $project + * @param string $location + * @param string $storedInfoType + * + * @return string The formatted project_location_stored_info_type resource. + * @experimental + */ + public static function projectLocationStoredInfoTypeName($project, $location, $storedInfoType) + { + return self::getProjectLocationStoredInfoTypeNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'stored_info_type' => $storedInfoType, + ]); + } + /** * Formats a string containing the fully-qualified path to represent * a project_stored_info_type resource. @@ -475,20 +907,53 @@ public static function projectStoredInfoTypeName($project, $storedInfoType) ]); } + /** + * Formats a string containing the fully-qualified path to represent + * a stored_info_type resource. + * + * @param string $organization + * @param string $storedInfoType + * + * @return string The formatted stored_info_type resource. + * @experimental + */ + public static function storedInfoTypeName($organization, $storedInfoType) + { + return self::getStoredInfoTypeNameTemplate()->render([ + 'organization' => $organization, + 'stored_info_type' => $storedInfoType, + ]); + } + /** * 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} - * - projectStoredInfoType: projects/{project}/storedInfoTypes/{stored_info_type}. + * - 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 @@ -601,17 +1066,17 @@ public function __construct(array $options = []) * ``` * $dlpServiceClient = new DlpServiceClient(); * try { - * $formattedParent = $dlpServiceClient->projectName('[PROJECT]'); - * $response = $dlpServiceClient->inspectContent($formattedParent); + * $response = $dlpServiceClient->inspectContent(); * } finally { * $dlpServiceClient->close(); * } * ``` * - * @param string $parent The parent resource name, for example projects/my-project-id. - * @param array $optionalArgs { - * Optional. + * @param array $optionalArgs { + * Optional. * + * @type string $parent + * The parent resource name, for example projects/my-project-id. * @type InspectConfig $inspectConfig * Configuration for the inspector. What specified here will override * the template referenced by the inspect_template_name argument. @@ -638,10 +1103,12 @@ public function __construct(array $options = []) * @throws ApiException if the remote call fails * @experimental */ - public function inspectContent($parent, array $optionalArgs = []) + public function inspectContent(array $optionalArgs = []) { $request = new InspectContentRequest(); - $request->setParent($parent); + if (isset($optionalArgs['parent'])) { + $request->setParent($optionalArgs['parent']); + } if (isset($optionalArgs['inspectConfig'])) { $request->setInspectConfig($optionalArgs['inspectConfig']); } @@ -684,17 +1151,17 @@ public function inspectContent($parent, array $optionalArgs = []) * ``` * $dlpServiceClient = new DlpServiceClient(); * try { - * $formattedParent = $dlpServiceClient->projectName('[PROJECT]'); - * $response = $dlpServiceClient->redactImage($formattedParent); + * $response = $dlpServiceClient->redactImage(); * } finally { * $dlpServiceClient->close(); * } * ``` * - * @param string $parent The parent resource name, for example projects/my-project-id. - * @param array $optionalArgs { - * Optional. + * @param array $optionalArgs { + * Optional. * + * @type string $parent + * The parent resource name, for example projects/my-project-id. * @type string $locationId * The geographic location to process the request. Reserved for future * extensions. @@ -719,10 +1186,12 @@ public function inspectContent($parent, array $optionalArgs = []) * @throws ApiException if the remote call fails * @experimental */ - public function redactImage($parent, array $optionalArgs = []) + public function redactImage(array $optionalArgs = []) { $request = new RedactImageRequest(); - $request->setParent($parent); + if (isset($optionalArgs['parent'])) { + $request->setParent($optionalArgs['parent']); + } if (isset($optionalArgs['locationId'])) { $request->setLocationId($optionalArgs['locationId']); } @@ -768,17 +1237,17 @@ public function redactImage($parent, array $optionalArgs = []) * ``` * $dlpServiceClient = new DlpServiceClient(); * try { - * $formattedParent = $dlpServiceClient->projectName('[PROJECT]'); - * $response = $dlpServiceClient->deidentifyContent($formattedParent); + * $response = $dlpServiceClient->deidentifyContent(); * } finally { * $dlpServiceClient->close(); * } * ``` * - * @param string $parent The parent resource name, for example projects/my-project-id. - * @param array $optionalArgs { - * Optional. + * @param array $optionalArgs { + * Optional. * + * @type string $parent + * The parent resource name, for example projects/my-project-id. * @type DeidentifyConfig $deidentifyConfig * Configuration for the de-identification of the content item. * Items specified here will override the template referenced by the @@ -816,10 +1285,12 @@ public function redactImage($parent, array $optionalArgs = []) * @throws ApiException if the remote call fails * @experimental */ - public function deidentifyContent($parent, array $optionalArgs = []) + public function deidentifyContent(array $optionalArgs = []) { $request = new DeidentifyContentRequest(); - $request->setParent($parent); + if (isset($optionalArgs['parent'])) { + $request->setParent($optionalArgs['parent']); + } if (isset($optionalArgs['deidentifyConfig'])) { $request->setDeidentifyConfig($optionalArgs['deidentifyConfig']); } @@ -1033,20 +1504,20 @@ public function listInfoTypes(array $optionalArgs = []) * ``` * $dlpServiceClient = new DlpServiceClient(); * try { - * $formattedParent = $dlpServiceClient->organizationName('[ORGANIZATION]'); - * $response = $dlpServiceClient->createInspectTemplate($formattedParent); + * $formattedParent = $dlpServiceClient->organizationLocationName('[ORGANIZATION]', '[LOCATION]'); + * $inspectTemplate = new InspectTemplate(); + * $response = $dlpServiceClient->createInspectTemplate($formattedParent, $inspectTemplate); * } finally { * $dlpServiceClient->close(); * } * ``` * - * @param string $parent Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - * @param array $optionalArgs { - * Optional. + * @param string $parent Required. The parent resource name, for example projects/my-project-id or + * organizations/my-org-id. + * @param InspectTemplate $inspectTemplate Required. The InspectTemplate to create. + * @param array $optionalArgs { + * Optional. * - * @type InspectTemplate $inspectTemplate - * Required. The InspectTemplate to create. * @type string $templateId * The template id can contain uppercase and lowercase letters, * numbers, and hyphens; that is, it must match the regular @@ -1067,13 +1538,11 @@ public function listInfoTypes(array $optionalArgs = []) * @throws ApiException if the remote call fails * @experimental */ - public function createInspectTemplate($parent, array $optionalArgs = []) + public function createInspectTemplate($parent, $inspectTemplate, array $optionalArgs = []) { $request = new CreateInspectTemplateRequest(); $request->setParent($parent); - if (isset($optionalArgs['inspectTemplate'])) { - $request->setInspectTemplate($optionalArgs['inspectTemplate']); - } + $request->setInspectTemplate($inspectTemplate); if (isset($optionalArgs['templateId'])) { $request->setTemplateId($optionalArgs['templateId']); } @@ -1167,19 +1636,19 @@ public function updateInspectTemplate($name, array $optionalArgs = []) * ``` * $dlpServiceClient = new DlpServiceClient(); * try { - * $response = $dlpServiceClient->getInspectTemplate(); + * $formattedName = $dlpServiceClient->organizationInspectTemplateName('[ORGANIZATION]', '[INSPECT_TEMPLATE]'); + * $response = $dlpServiceClient->getInspectTemplate($formattedName); * } finally { * $dlpServiceClient->close(); * } * ``` * - * @param array $optionalArgs { - * Optional. + * @param string $name Required. Resource name of the organization and inspectTemplate to be read, + * for example `organizations/433245324/inspectTemplates/432452342` or + * projects/project-id/inspectTemplates/432452342. + * @param array $optionalArgs { + * Optional. * - * @type string $name - * Required. Resource name of the organization and inspectTemplate to be read, - * for example `organizations/433245324/inspectTemplates/432452342` or - * projects/project-id/inspectTemplates/432452342. * @type RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a * {@see Google\ApiCore\RetrySettings} object, or an associative array @@ -1192,12 +1661,10 @@ public function updateInspectTemplate($name, array $optionalArgs = []) * @throws ApiException if the remote call fails * @experimental */ - public function getInspectTemplate(array $optionalArgs = []) + public function getInspectTemplate($name, array $optionalArgs = []) { $request = new GetInspectTemplateRequest(); - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - } + $request->setName($name); $requestParams = new RequestParamsHeaderDescriptor([ 'name' => $request->getName(), @@ -1222,7 +1689,7 @@ public function getInspectTemplate(array $optionalArgs = []) * ``` * $dlpServiceClient = new DlpServiceClient(); * try { - * $formattedParent = $dlpServiceClient->organizationName('[ORGANIZATION]'); + * $formattedParent = $dlpServiceClient->organizationLocationName('[ORGANIZATION]', '[LOCATION]'); * // Iterate over pages of elements * $pagedResponse = $dlpServiceClient->listInspectTemplates($formattedParent); * foreach ($pagedResponse->iteratePages() as $page) { @@ -1380,20 +1847,20 @@ public function deleteInspectTemplate($name, array $optionalArgs = []) * ``` * $dlpServiceClient = new DlpServiceClient(); * try { - * $formattedParent = $dlpServiceClient->organizationName('[ORGANIZATION]'); - * $response = $dlpServiceClient->createDeidentifyTemplate($formattedParent); + * $formattedParent = $dlpServiceClient->organizationLocationName('[ORGANIZATION]', '[LOCATION]'); + * $deidentifyTemplate = new DeidentifyTemplate(); + * $response = $dlpServiceClient->createDeidentifyTemplate($formattedParent, $deidentifyTemplate); * } finally { * $dlpServiceClient->close(); * } * ``` * - * @param string $parent Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - * @param array $optionalArgs { - * Optional. + * @param string $parent Required. The parent resource name, for example projects/my-project-id or + * organizations/my-org-id. + * @param DeidentifyTemplate $deidentifyTemplate Required. The DeidentifyTemplate to create. + * @param array $optionalArgs { + * Optional. * - * @type DeidentifyTemplate $deidentifyTemplate - * Required. The DeidentifyTemplate to create. * @type string $templateId * The template id can contain uppercase and lowercase letters, * numbers, and hyphens; that is, it must match the regular @@ -1414,13 +1881,11 @@ public function deleteInspectTemplate($name, array $optionalArgs = []) * @throws ApiException if the remote call fails * @experimental */ - public function createDeidentifyTemplate($parent, array $optionalArgs = []) + public function createDeidentifyTemplate($parent, $deidentifyTemplate, array $optionalArgs = []) { $request = new CreateDeidentifyTemplateRequest(); $request->setParent($parent); - if (isset($optionalArgs['deidentifyTemplate'])) { - $request->setDeidentifyTemplate($optionalArgs['deidentifyTemplate']); - } + $request->setDeidentifyTemplate($deidentifyTemplate); if (isset($optionalArgs['templateId'])) { $request->setTemplateId($optionalArgs['templateId']); } @@ -1571,7 +2036,7 @@ public function getDeidentifyTemplate($name, array $optionalArgs = []) * ``` * $dlpServiceClient = new DlpServiceClient(); * try { - * $formattedParent = $dlpServiceClient->organizationName('[ORGANIZATION]'); + * $formattedParent = $dlpServiceClient->organizationLocationName('[ORGANIZATION]', '[LOCATION]'); * // Iterate over pages of elements * $pagedResponse = $dlpServiceClient->listDeidentifyTemplates($formattedParent); * foreach ($pagedResponse->iteratePages() as $page) { @@ -1955,8 +2420,8 @@ public function listDlpJobs($parent, array $optionalArgs = []) * ``` * $dlpServiceClient = new DlpServiceClient(); * try { - * $formattedName = $dlpServiceClient->dlpJobName('[PROJECT]', '[DLP_JOB]'); - * $response = $dlpServiceClient->getDlpJob($formattedName); + * $name = ''; + * $response = $dlpServiceClient->getDlpJob($name); * } finally { * $dlpServiceClient->close(); * } @@ -2009,8 +2474,8 @@ public function getDlpJob($name, array $optionalArgs = []) * ``` * $dlpServiceClient = new DlpServiceClient(); * try { - * $formattedName = $dlpServiceClient->dlpJobName('[PROJECT]', '[DLP_JOB]'); - * $dlpServiceClient->deleteDlpJob($formattedName); + * $name = ''; + * $dlpServiceClient->deleteDlpJob($name); * } finally { * $dlpServiceClient->close(); * } @@ -2061,8 +2526,8 @@ public function deleteDlpJob($name, array $optionalArgs = []) * ``` * $dlpServiceClient = new DlpServiceClient(); * try { - * $formattedName = $dlpServiceClient->dlpJobName('[PROJECT]', '[DLP_JOB]'); - * $dlpServiceClient->cancelDlpJob($formattedName); + * $name = ''; + * $dlpServiceClient->cancelDlpJob($name); * } finally { * $dlpServiceClient->close(); * } @@ -2113,8 +2578,8 @@ public function cancelDlpJob($name, array $optionalArgs = []) * ``` * $dlpServiceClient = new DlpServiceClient(); * try { - * $formattedName = $dlpServiceClient->dlpJobName('[PROJECT]', '[DLP_JOB]'); - * $dlpServiceClient->finishDlpJob($formattedName); + * $name = ''; + * $dlpServiceClient->finishDlpJob($name); * } finally { * $dlpServiceClient->close(); * } @@ -2409,8 +2874,8 @@ public function getJobTrigger($name, array $optionalArgs = []) * ``` * $dlpServiceClient = new DlpServiceClient(); * try { - * $name = ''; - * $dlpServiceClient->deleteJobTrigger($name); + * $formattedName = $dlpServiceClient->projectJobTriggerName('[PROJECT]', '[JOB_TRIGGER]'); + * $dlpServiceClient->deleteJobTrigger($formattedName); * } finally { * $dlpServiceClient->close(); * } @@ -2463,8 +2928,8 @@ public function deleteJobTrigger($name, array $optionalArgs = []) * ``` * $dlpServiceClient = new DlpServiceClient(); * try { - * $name = ''; - * $response = $dlpServiceClient->hybridInspectJobTrigger($name); + * $formattedName = $dlpServiceClient->projectJobTriggerName('[PROJECT]', '[JOB_TRIGGER]'); + * $response = $dlpServiceClient->hybridInspectJobTrigger($formattedName); * } finally { * $dlpServiceClient->close(); * } @@ -2584,18 +3049,18 @@ public function updateJobTrigger($name, array $optionalArgs = []) * $dlpServiceClient = new DlpServiceClient(); * try { * $formattedParent = $dlpServiceClient->projectName('[PROJECT]'); - * $response = $dlpServiceClient->createJobTrigger($formattedParent); + * $jobTrigger = new JobTrigger(); + * $response = $dlpServiceClient->createJobTrigger($formattedParent, $jobTrigger); * } finally { * $dlpServiceClient->close(); * } * ``` * - * @param string $parent Required. The parent resource name, for example projects/my-project-id. - * @param array $optionalArgs { - * Optional. + * @param string $parent Required. The parent resource name, for example projects/my-project-id. + * @param JobTrigger $jobTrigger Required. The JobTrigger to create. + * @param array $optionalArgs { + * Optional. * - * @type JobTrigger $jobTrigger - * Required. The JobTrigger to create. * @type string $triggerId * The trigger id can contain uppercase and lowercase letters, * numbers, and hyphens; that is, it must match the regular @@ -2616,13 +3081,11 @@ public function updateJobTrigger($name, array $optionalArgs = []) * @throws ApiException if the remote call fails * @experimental */ - public function createJobTrigger($parent, array $optionalArgs = []) + public function createJobTrigger($parent, $jobTrigger, array $optionalArgs = []) { $request = new CreateJobTriggerRequest(); $request->setParent($parent); - if (isset($optionalArgs['jobTrigger'])) { - $request->setJobTrigger($optionalArgs['jobTrigger']); - } + $request->setJobTrigger($jobTrigger); if (isset($optionalArgs['triggerId'])) { $request->setTriggerId($optionalArgs['triggerId']); } @@ -2654,20 +3117,20 @@ public function createJobTrigger($parent, array $optionalArgs = []) * ``` * $dlpServiceClient = new DlpServiceClient(); * try { - * $formattedParent = $dlpServiceClient->organizationName('[ORGANIZATION]'); - * $response = $dlpServiceClient->createStoredInfoType($formattedParent); + * $formattedParent = $dlpServiceClient->organizationLocationName('[ORGANIZATION]', '[LOCATION]'); + * $config = new StoredInfoTypeConfig(); + * $response = $dlpServiceClient->createStoredInfoType($formattedParent, $config); * } finally { * $dlpServiceClient->close(); * } * ``` * - * @param string $parent Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - * @param array $optionalArgs { - * Optional. + * @param string $parent Required. The parent resource name, for example projects/my-project-id or + * organizations/my-org-id. + * @param StoredInfoTypeConfig $config Required. Configuration of the storedInfoType to create. + * @param array $optionalArgs { + * Optional. * - * @type StoredInfoTypeConfig $config - * Required. Configuration of the storedInfoType to create. * @type string $storedInfoTypeId * The storedInfoType ID can contain uppercase and lowercase letters, * numbers, and hyphens; that is, it must match the regular @@ -2688,13 +3151,11 @@ public function createJobTrigger($parent, array $optionalArgs = []) * @throws ApiException if the remote call fails * @experimental */ - public function createStoredInfoType($parent, array $optionalArgs = []) + public function createStoredInfoType($parent, $config, array $optionalArgs = []) { $request = new CreateStoredInfoTypeRequest(); $request->setParent($parent); - if (isset($optionalArgs['config'])) { - $request->setConfig($optionalArgs['config']); - } + $request->setConfig($config); if (isset($optionalArgs['storedInfoTypeId'])) { $request->setStoredInfoTypeId($optionalArgs['storedInfoTypeId']); } @@ -2847,7 +3308,7 @@ public function getStoredInfoType($name, array $optionalArgs = []) * ``` * $dlpServiceClient = new DlpServiceClient(); * try { - * $formattedParent = $dlpServiceClient->organizationName('[ORGANIZATION]'); + * $formattedParent = $dlpServiceClient->organizationLocationName('[ORGANIZATION]', '[LOCATION]'); * // Iterate over pages of elements * $pagedResponse = $dlpServiceClient->listStoredInfoTypes($formattedParent); * foreach ($pagedResponse->iteratePages() as $page) { diff --git a/Dlp/src/V2/HybridFindingDetails.php b/Dlp/src/V2/HybridFindingDetails.php index ad24aece5819..90c0099f30b5 100644 --- a/Dlp/src/V2/HybridFindingDetails.php +++ b/Dlp/src/V2/HybridFindingDetails.php @@ -54,12 +54,13 @@ class HybridFindingDetails extends \Google\Protobuf\Internal\Message * The labels associated with `Finding`'s produced by hybrid * inspection. * Label keys must be between 1 and 63 characters long and must conform - * to the following regular expression: \[a-z\](\[-a-z0-9\]*\[a-z0-9\])?. + * to the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. * Label values must be between 0 and 63 characters long and must conform - * to the regular expression (\[a-z\](\[-a-z0-9\]*\[a-z0-9\])?)?. + * to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. * No more than 10 labels can be associated with a given finding. - * Example: "environment" : "production" - * Example: "pipeline" : "etl" + * Examples: + * * `"environment" : "production"` + * * `"pipeline" : "etl"` * * Generated from protobuf field map labels = 5; */ @@ -94,12 +95,13 @@ class HybridFindingDetails extends \Google\Protobuf\Internal\Message * The labels associated with `Finding`'s produced by hybrid * inspection. * Label keys must be between 1 and 63 characters long and must conform - * to the following regular expression: \[a-z\](\[-a-z0-9\]*\[a-z0-9\])?. + * to the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. * Label values must be between 0 and 63 characters long and must conform - * to the regular expression (\[a-z\](\[-a-z0-9\]*\[a-z0-9\])?)?. + * to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. * No more than 10 labels can be associated with a given finding. - * Example: "environment" : "production" - * Example: "pipeline" : "etl" + * Examples: + * * `"environment" : "production"` + * * `"pipeline" : "etl"` * } */ public function __construct($data = NULL) { @@ -235,12 +237,13 @@ public function setTableOptions($var) * The labels associated with `Finding`'s produced by hybrid * inspection. * Label keys must be between 1 and 63 characters long and must conform - * to the following regular expression: \[a-z\](\[-a-z0-9\]*\[a-z0-9\])?. + * to the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. * Label values must be between 0 and 63 characters long and must conform - * to the regular expression (\[a-z\](\[-a-z0-9\]*\[a-z0-9\])?)?. + * to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. * No more than 10 labels can be associated with a given finding. - * Example: "environment" : "production" - * Example: "pipeline" : "etl" + * Examples: + * * `"environment" : "production"` + * * `"pipeline" : "etl"` * * Generated from protobuf field map labels = 5; * @return \Google\Protobuf\Internal\MapField @@ -256,12 +259,13 @@ public function getLabels() * The labels associated with `Finding`'s produced by hybrid * inspection. * Label keys must be between 1 and 63 characters long and must conform - * to the following regular expression: \[a-z\](\[-a-z0-9\]*\[a-z0-9\])?. + * to the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. * Label values must be between 0 and 63 characters long and must conform - * to the regular expression (\[a-z\](\[-a-z0-9\]*\[a-z0-9\])?)?. + * to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. * No more than 10 labels can be associated with a given finding. - * Example: "environment" : "production" - * Example: "pipeline" : "etl" + * Examples: + * * `"environment" : "production"` + * * `"pipeline" : "etl"` * * Generated from protobuf field map labels = 5; * @param array|\Google\Protobuf\Internal\MapField $var diff --git a/Dlp/src/V2/HybridOptions.php b/Dlp/src/V2/HybridOptions.php index ec102f409fb2..44681a8fb626 100644 --- a/Dlp/src/V2/HybridOptions.php +++ b/Dlp/src/V2/HybridOptions.php @@ -28,7 +28,7 @@ class HybridOptions extends \Google\Protobuf\Internal\Message * 'finding_labels' map. Request may contain others, but any missing one of * these will be rejected. * Label keys must be between 1 and 63 characters long and must conform - * to the following regular expression: \[a-z\](\[-a-z0-9\]*\[a-z0-9\])?. + * to the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. * No more than 10 keys can be required. * * Generated from protobuf field repeated string required_finding_label_keys = 2; @@ -37,12 +37,13 @@ class HybridOptions extends \Google\Protobuf\Internal\Message /** * To organize findings, these labels will be added to each finding. * Label keys must be between 1 and 63 characters long and must conform - * to the following regular expression: \[a-z\](\[-a-z0-9\]*\[a-z0-9\])?. + * to the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. * Label values must be between 0 and 63 characters long and must conform - * to the regular expression (\[a-z\](\[-a-z0-9\]*\[a-z0-9\])?)?. + * to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. * No more than 10 labels can be associated with a given finding. - * Example: "environment" : "production" - * Example: "pipeline" : "etl" + * Examples: + * * `"environment" : "production"` + * * `"pipeline" : "etl"` * * Generated from protobuf field map labels = 3; */ @@ -69,17 +70,18 @@ class HybridOptions extends \Google\Protobuf\Internal\Message * 'finding_labels' map. Request may contain others, but any missing one of * these will be rejected. * Label keys must be between 1 and 63 characters long and must conform - * to the following regular expression: \[a-z\](\[-a-z0-9\]*\[a-z0-9\])?. + * to the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. * No more than 10 keys can be required. * @type array|\Google\Protobuf\Internal\MapField $labels * To organize findings, these labels will be added to each finding. * Label keys must be between 1 and 63 characters long and must conform - * to the following regular expression: \[a-z\](\[-a-z0-9\]*\[a-z0-9\])?. + * to the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. * Label values must be between 0 and 63 characters long and must conform - * to the regular expression (\[a-z\](\[-a-z0-9\]*\[a-z0-9\])?)?. + * to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. * No more than 10 labels can be associated with a given finding. - * Example: "environment" : "production" - * Example: "pipeline" : "etl" + * Examples: + * * `"environment" : "production"` + * * `"pipeline" : "etl"` * @type \Google\Cloud\Dlp\V2\TableOptions $table_options * If the container is a table, additional information to make findings * meaningful such as the columns that are primary keys. @@ -123,7 +125,7 @@ public function setDescription($var) * 'finding_labels' map. Request may contain others, but any missing one of * these will be rejected. * Label keys must be between 1 and 63 characters long and must conform - * to the following regular expression: \[a-z\](\[-a-z0-9\]*\[a-z0-9\])?. + * to the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. * No more than 10 keys can be required. * * Generated from protobuf field repeated string required_finding_label_keys = 2; @@ -139,7 +141,7 @@ public function getRequiredFindingLabelKeys() * 'finding_labels' map. Request may contain others, but any missing one of * these will be rejected. * Label keys must be between 1 and 63 characters long and must conform - * to the following regular expression: \[a-z\](\[-a-z0-9\]*\[a-z0-9\])?. + * to the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. * No more than 10 keys can be required. * * Generated from protobuf field repeated string required_finding_label_keys = 2; @@ -157,12 +159,13 @@ public function setRequiredFindingLabelKeys($var) /** * To organize findings, these labels will be added to each finding. * Label keys must be between 1 and 63 characters long and must conform - * to the following regular expression: \[a-z\](\[-a-z0-9\]*\[a-z0-9\])?. + * to the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. * Label values must be between 0 and 63 characters long and must conform - * to the regular expression (\[a-z\](\[-a-z0-9\]*\[a-z0-9\])?)?. + * to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. * No more than 10 labels can be associated with a given finding. - * Example: "environment" : "production" - * Example: "pipeline" : "etl" + * Examples: + * * `"environment" : "production"` + * * `"pipeline" : "etl"` * * Generated from protobuf field map labels = 3; * @return \Google\Protobuf\Internal\MapField @@ -175,12 +178,13 @@ public function getLabels() /** * To organize findings, these labels will be added to each finding. * Label keys must be between 1 and 63 characters long and must conform - * to the following regular expression: \[a-z\](\[-a-z0-9\]*\[a-z0-9\])?. + * to the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. * Label values must be between 0 and 63 characters long and must conform - * to the regular expression (\[a-z\](\[-a-z0-9\]*\[a-z0-9\])?)?. + * to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. * No more than 10 labels can be associated with a given finding. - * Example: "environment" : "production" - * Example: "pipeline" : "etl" + * Examples: + * * `"environment" : "production"` + * * `"pipeline" : "etl"` * * Generated from protobuf field map labels = 3; * @param array|\Google\Protobuf\Internal\MapField $var diff --git a/Dlp/src/V2/InfoType.php b/Dlp/src/V2/InfoType.php index 5834dcda737b..a76b5a036a3a 100644 --- a/Dlp/src/V2/InfoType.php +++ b/Dlp/src/V2/InfoType.php @@ -20,7 +20,7 @@ class InfoType extends \Google\Protobuf\Internal\Message * creating a CustomInfoType, or one of the names listed * at https://cloud.google.com/dlp/docs/infotypes-reference when specifying * a built-in type. InfoType names should conform to the pattern - * [a-zA-Z0-9_]{1,64}. + * `[a-zA-Z0-9_]{1,64}`. * * Generated from protobuf field string name = 1; */ @@ -37,7 +37,7 @@ class InfoType extends \Google\Protobuf\Internal\Message * creating a CustomInfoType, or one of the names listed * at https://cloud.google.com/dlp/docs/infotypes-reference when specifying * a built-in type. InfoType names should conform to the pattern - * [a-zA-Z0-9_]{1,64}. + * `[a-zA-Z0-9_]{1,64}`. * } */ public function __construct($data = NULL) { @@ -50,7 +50,7 @@ public function __construct($data = NULL) { * creating a CustomInfoType, or one of the names listed * at https://cloud.google.com/dlp/docs/infotypes-reference when specifying * a built-in type. InfoType names should conform to the pattern - * [a-zA-Z0-9_]{1,64}. + * `[a-zA-Z0-9_]{1,64}`. * * Generated from protobuf field string name = 1; * @return string @@ -65,7 +65,7 @@ public function getName() * creating a CustomInfoType, or one of the names listed * at https://cloud.google.com/dlp/docs/infotypes-reference when specifying * a built-in type. InfoType names should conform to the pattern - * [a-zA-Z0-9_]{1,64}. + * `[a-zA-Z0-9_]{1,64}`. * * Generated from protobuf field string name = 1; * @param string $var diff --git a/Dlp/synth.metadata b/Dlp/synth.metadata index 9e1c8c51dbd0..543b642d9f11 100644 --- a/Dlp/synth.metadata +++ b/Dlp/synth.metadata @@ -1,27 +1,25 @@ { - "updateTime": "2020-03-19T10:06:39.695749Z", "sources": [ { - "generator": { - "name": "artman", - "version": "1.1.1", - "dockerImage": "googleapis/artman@sha256:5ef340c8d9334719bc5c6981d95f4a5d2737b0a6a24f2b9a0d430e96fff85c5b" + "git": { + "name": ".", + "remote": "https://github.com/googleapis/google-cloud-php.git", + "sha": "b37d1ceb7de49ae9f18a5719f10e3c0f7f8a314d" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "275fbcce2c900278d487c33293a3c7e1fbcd3a34", - "internalRef": "301661567", - "log": "275fbcce2c900278d487c33293a3c7e1fbcd3a34\nfeat: pubsub/v1 add an experimental filter field to Subscription\n\nPiperOrigin-RevId: 301661567\n\nf2b18cec51d27c999ad30011dba17f3965677e9c\nFix: UpdateBackupRequest.backup is a resource, not a resource reference - remove annotation.\n\nPiperOrigin-RevId: 301636171\n\n800384063ac93a0cac3a510d41726fa4b2cd4a83\nCloud Billing Budget API v1beta1\nModified api documentation to include warnings about the new filter field.\n\nPiperOrigin-RevId: 301634389\n\n0cc6c146b660db21f04056c3d58a4b752ee445e3\nCloud Billing Budget API v1alpha1\nModified api documentation to include warnings about the new filter field.\n\nPiperOrigin-RevId: 301630018\n\nff2ea00f69065585c3ac0993c8b582af3b6fc215\nFix: Add resource definition for a parent of InspectTemplate which was otherwise missing.\n\nPiperOrigin-RevId: 301623052\n\n55fa441c9daf03173910760191646399338f2b7c\nAdd proto definition for AccessLevel, AccessPolicy, and ServicePerimeter.\n\nPiperOrigin-RevId: 301620844\n\ne7b10591c5408a67cf14ffafa267556f3290e262\nCloud Bigtable Managed Backup service and message proto files.\n\nPiperOrigin-RevId: 301585144\n\nd8e226f702f8ddf92915128c9f4693b63fb8685d\nfeat: Add time-to-live in a queue for builds\n\nPiperOrigin-RevId: 301579876\n\n430375af011f8c7a5174884f0d0e539c6ffa7675\ndocs: add missing closing backtick\n\nPiperOrigin-RevId: 301538851\n\n0e9f1f60ded9ad1c2e725e37719112f5b487ab65\nbazel: Use latest release of gax_java\n\nPiperOrigin-RevId: 301480457\n\n5058c1c96d0ece7f5301a154cf5a07b2ad03a571\nUpdate GAPIC v2 with batching parameters for Logging API\n\nPiperOrigin-RevId: 301443847\n\n64ab9744073de81fec1b3a6a931befc8a90edf90\nFix: Introduce location-based organization/folder/billing-account resources\nChore: Update copyright years\n\nPiperOrigin-RevId: 301373760\n\n23d5f09e670ebb0c1b36214acf78704e2ecfc2ac\nUpdate field_behavior annotations in V1 and V2.\n\nPiperOrigin-RevId: 301337970\n\n" + "sha": "e0f9d9e1f9de890db765be46f45ca8490723e3eb", + "internalRef": "309824146" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "bcad3e01b69851ad682a87f8202003a1683ad73a" + "sha": "04cb397eb7590ea1e6c10a39fca3d8fe0fb3d256" } } ], @@ -32,8 +30,7 @@ "apiName": "dlp", "apiVersion": "v2", "language": "php", - "generator": "gapic", - "config": "google/privacy/dlp/artman_dlp_v2.yaml" + "generator": "bazel" } } ] diff --git a/Dlp/tests/Unit/V2/DlpServiceClientTest.php b/Dlp/tests/Unit/V2/DlpServiceClientTest.php index 5821f6186fb5..71370bd4efcc 100644 --- a/Dlp/tests/Unit/V2/DlpServiceClientTest.php +++ b/Dlp/tests/Unit/V2/DlpServiceClientTest.php @@ -43,6 +43,7 @@ use Google\Cloud\Dlp\V2\RedactImageResponse; use Google\Cloud\Dlp\V2\ReidentifyContentResponse; use Google\Cloud\Dlp\V2\StoredInfoType; +use Google\Cloud\Dlp\V2\StoredInfoTypeConfig; use Google\Protobuf\Any; use Google\Protobuf\GPBEmpty; use Google\Rpc\Code; @@ -98,10 +99,7 @@ public function inspectContentTest() $expectedResponse = new InspectContentResponse(); $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $client->projectName('[PROJECT]'); - - $response = $client->inspectContent($formattedParent); + $response = $client->inspectContent(); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -109,10 +107,6 @@ public function inspectContentTest() $actualRequestObject = $actualRequests[0]->getRequestObject(); $this->assertSame('/google.privacy.dlp.v2.DlpService/InspectContent', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); } @@ -138,11 +132,8 @@ public function inspectContentExceptionTest() ], JSON_PRETTY_PRINT); $transport->addResponse(null, $status); - // Mock request - $formattedParent = $client->projectName('[PROJECT]'); - try { - $client->inspectContent($formattedParent); + $client->inspectContent(); // If the $client method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { @@ -173,10 +164,7 @@ public function redactImageTest() $expectedResponse->setExtractedText($extractedText); $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $client->projectName('[PROJECT]'); - - $response = $client->redactImage($formattedParent); + $response = $client->redactImage(); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -184,10 +172,6 @@ public function redactImageTest() $actualRequestObject = $actualRequests[0]->getRequestObject(); $this->assertSame('/google.privacy.dlp.v2.DlpService/RedactImage', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); } @@ -213,11 +197,8 @@ public function redactImageExceptionTest() ], JSON_PRETTY_PRINT); $transport->addResponse(null, $status); - // Mock request - $formattedParent = $client->projectName('[PROJECT]'); - try { - $client->redactImage($formattedParent); + $client->redactImage(); // If the $client method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { @@ -244,10 +225,7 @@ public function deidentifyContentTest() $expectedResponse = new DeidentifyContentResponse(); $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $client->projectName('[PROJECT]'); - - $response = $client->deidentifyContent($formattedParent); + $response = $client->deidentifyContent(); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -255,10 +233,6 @@ public function deidentifyContentTest() $actualRequestObject = $actualRequests[0]->getRequestObject(); $this->assertSame('/google.privacy.dlp.v2.DlpService/DeidentifyContent', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); } @@ -284,11 +258,8 @@ public function deidentifyContentExceptionTest() ], JSON_PRETTY_PRINT); $transport->addResponse(null, $status); - // Mock request - $formattedParent = $client->projectName('[PROJECT]'); - try { - $client->deidentifyContent($formattedParent); + $client->deidentifyContent(); // If the $client method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { @@ -454,9 +425,10 @@ public function createInspectTemplateTest() $transport->addResponse($expectedResponse); // Mock request - $formattedParent = $client->organizationName('[ORGANIZATION]'); + $formattedParent = $client->organizationLocationName('[ORGANIZATION]', '[LOCATION]'); + $inspectTemplate = new InspectTemplate(); - $response = $client->createInspectTemplate($formattedParent); + $response = $client->createInspectTemplate($formattedParent, $inspectTemplate); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -467,6 +439,9 @@ public function createInspectTemplateTest() $actualValue = $actualRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getInspectTemplate(); + + $this->assertProtobufEquals($inspectTemplate, $actualValue); $this->assertTrue($transport->isExhausted()); } @@ -494,10 +469,11 @@ public function createInspectTemplateExceptionTest() $transport->addResponse(null, $status); // Mock request - $formattedParent = $client->organizationName('[ORGANIZATION]'); + $formattedParent = $client->organizationLocationName('[ORGANIZATION]', '[LOCATION]'); + $inspectTemplate = new InspectTemplate(); try { - $client->createInspectTemplate($formattedParent); + $client->createInspectTemplate($formattedParent, $inspectTemplate); // If the $client method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { @@ -598,16 +574,19 @@ public function getInspectTemplateTest() $this->assertTrue($transport->isExhausted()); // Mock response - $name = 'name3373707'; + $name2 = 'name2-1052831874'; $displayName = 'displayName1615086568'; $description = 'description-1724546052'; $expectedResponse = new InspectTemplate(); - $expectedResponse->setName($name); + $expectedResponse->setName($name2); $expectedResponse->setDisplayName($displayName); $expectedResponse->setDescription($description); $transport->addResponse($expectedResponse); - $response = $client->getInspectTemplate(); + // Mock request + $formattedName = $client->organizationInspectTemplateName('[ORGANIZATION]', '[INSPECT_TEMPLATE]'); + + $response = $client->getInspectTemplate($formattedName); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -615,6 +594,10 @@ public function getInspectTemplateTest() $actualRequestObject = $actualRequests[0]->getRequestObject(); $this->assertSame('/google.privacy.dlp.v2.DlpService/GetInspectTemplate', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); } @@ -640,8 +623,11 @@ public function getInspectTemplateExceptionTest() ], JSON_PRETTY_PRINT); $transport->addResponse(null, $status); + // Mock request + $formattedName = $client->organizationInspectTemplateName('[ORGANIZATION]', '[INSPECT_TEMPLATE]'); + try { - $client->getInspectTemplate(); + $client->getInspectTemplate($formattedName); // If the $client method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { @@ -674,7 +660,7 @@ public function listInspectTemplatesTest() $transport->addResponse($expectedResponse); // Mock request - $formattedParent = $client->organizationName('[ORGANIZATION]'); + $formattedParent = $client->organizationLocationName('[ORGANIZATION]', '[LOCATION]'); $response = $client->listInspectTemplates($formattedParent); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); @@ -717,7 +703,7 @@ public function listInspectTemplatesExceptionTest() $transport->addResponse(null, $status); // Mock request - $formattedParent = $client->organizationName('[ORGANIZATION]'); + $formattedParent = $client->organizationLocationName('[ORGANIZATION]', '[LOCATION]'); try { $client->listInspectTemplates($formattedParent); @@ -824,9 +810,10 @@ public function createDeidentifyTemplateTest() $transport->addResponse($expectedResponse); // Mock request - $formattedParent = $client->organizationName('[ORGANIZATION]'); + $formattedParent = $client->organizationLocationName('[ORGANIZATION]', '[LOCATION]'); + $deidentifyTemplate = new DeidentifyTemplate(); - $response = $client->createDeidentifyTemplate($formattedParent); + $response = $client->createDeidentifyTemplate($formattedParent, $deidentifyTemplate); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -837,6 +824,9 @@ public function createDeidentifyTemplateTest() $actualValue = $actualRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getDeidentifyTemplate(); + + $this->assertProtobufEquals($deidentifyTemplate, $actualValue); $this->assertTrue($transport->isExhausted()); } @@ -864,10 +854,11 @@ public function createDeidentifyTemplateExceptionTest() $transport->addResponse(null, $status); // Mock request - $formattedParent = $client->organizationName('[ORGANIZATION]'); + $formattedParent = $client->organizationLocationName('[ORGANIZATION]', '[LOCATION]'); + $deidentifyTemplate = new DeidentifyTemplate(); try { - $client->createDeidentifyTemplate($formattedParent); + $client->createDeidentifyTemplate($formattedParent, $deidentifyTemplate); // If the $client method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { @@ -1054,7 +1045,7 @@ public function listDeidentifyTemplatesTest() $transport->addResponse($expectedResponse); // Mock request - $formattedParent = $client->organizationName('[ORGANIZATION]'); + $formattedParent = $client->organizationLocationName('[ORGANIZATION]', '[LOCATION]'); $response = $client->listDeidentifyTemplates($formattedParent); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); @@ -1097,7 +1088,7 @@ public function listDeidentifyTemplatesExceptionTest() $transport->addResponse(null, $status); // Mock request - $formattedParent = $client->organizationName('[ORGANIZATION]'); + $formattedParent = $client->organizationLocationName('[ORGANIZATION]', '[LOCATION]'); try { $client->listDeidentifyTemplates($formattedParent); @@ -1356,9 +1347,9 @@ public function getDlpJobTest() $transport->addResponse($expectedResponse); // Mock request - $formattedName = $client->dlpJobName('[PROJECT]', '[DLP_JOB]'); + $name = 'name3373707'; - $response = $client->getDlpJob($formattedName); + $response = $client->getDlpJob($name); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -1368,7 +1359,7 @@ public function getDlpJobTest() $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertProtobufEquals($name, $actualValue); $this->assertTrue($transport->isExhausted()); } @@ -1396,10 +1387,10 @@ public function getDlpJobExceptionTest() $transport->addResponse(null, $status); // Mock request - $formattedName = $client->dlpJobName('[PROJECT]', '[DLP_JOB]'); + $name = 'name3373707'; try { - $client->getDlpJob($formattedName); + $client->getDlpJob($name); // If the $client method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { @@ -1427,9 +1418,9 @@ public function deleteDlpJobTest() $transport->addResponse($expectedResponse); // Mock request - $formattedName = $client->dlpJobName('[PROJECT]', '[DLP_JOB]'); + $name = 'name3373707'; - $client->deleteDlpJob($formattedName); + $client->deleteDlpJob($name); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); @@ -1438,7 +1429,7 @@ public function deleteDlpJobTest() $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertProtobufEquals($name, $actualValue); $this->assertTrue($transport->isExhausted()); } @@ -1466,10 +1457,10 @@ public function deleteDlpJobExceptionTest() $transport->addResponse(null, $status); // Mock request - $formattedName = $client->dlpJobName('[PROJECT]', '[DLP_JOB]'); + $name = 'name3373707'; try { - $client->deleteDlpJob($formattedName); + $client->deleteDlpJob($name); // If the $client method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { @@ -1497,9 +1488,9 @@ public function cancelDlpJobTest() $transport->addResponse($expectedResponse); // Mock request - $formattedName = $client->dlpJobName('[PROJECT]', '[DLP_JOB]'); + $name = 'name3373707'; - $client->cancelDlpJob($formattedName); + $client->cancelDlpJob($name); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); @@ -1508,7 +1499,7 @@ public function cancelDlpJobTest() $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertProtobufEquals($name, $actualValue); $this->assertTrue($transport->isExhausted()); } @@ -1536,10 +1527,10 @@ public function cancelDlpJobExceptionTest() $transport->addResponse(null, $status); // Mock request - $formattedName = $client->dlpJobName('[PROJECT]', '[DLP_JOB]'); + $name = 'name3373707'; try { - $client->cancelDlpJob($formattedName); + $client->cancelDlpJob($name); // If the $client method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { @@ -1567,9 +1558,9 @@ public function finishDlpJobTest() $transport->addResponse($expectedResponse); // Mock request - $formattedName = $client->dlpJobName('[PROJECT]', '[DLP_JOB]'); + $name = 'name3373707'; - $client->finishDlpJob($formattedName); + $client->finishDlpJob($name); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); @@ -1578,7 +1569,7 @@ public function finishDlpJobTest() $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertProtobufEquals($name, $actualValue); $this->assertTrue($transport->isExhausted()); } @@ -1606,10 +1597,10 @@ public function finishDlpJobExceptionTest() $transport->addResponse(null, $status); // Mock request - $formattedName = $client->dlpJobName('[PROJECT]', '[DLP_JOB]'); + $name = 'name3373707'; try { - $client->finishDlpJob($formattedName); + $client->finishDlpJob($name); // If the $client method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { @@ -1864,9 +1855,9 @@ public function deleteJobTriggerTest() $transport->addResponse($expectedResponse); // Mock request - $name = 'name3373707'; + $formattedName = $client->projectJobTriggerName('[PROJECT]', '[JOB_TRIGGER]'); - $client->deleteJobTrigger($name); + $client->deleteJobTrigger($formattedName); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); @@ -1875,7 +1866,7 @@ public function deleteJobTriggerTest() $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($name, $actualValue); + $this->assertProtobufEquals($formattedName, $actualValue); $this->assertTrue($transport->isExhausted()); } @@ -1903,10 +1894,10 @@ public function deleteJobTriggerExceptionTest() $transport->addResponse(null, $status); // Mock request - $name = 'name3373707'; + $formattedName = $client->projectJobTriggerName('[PROJECT]', '[JOB_TRIGGER]'); try { - $client->deleteJobTrigger($name); + $client->deleteJobTrigger($formattedName); // If the $client method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { @@ -1934,9 +1925,9 @@ public function hybridInspectJobTriggerTest() $transport->addResponse($expectedResponse); // Mock request - $name = 'name3373707'; + $formattedName = $client->projectJobTriggerName('[PROJECT]', '[JOB_TRIGGER]'); - $response = $client->hybridInspectJobTrigger($name); + $response = $client->hybridInspectJobTrigger($formattedName); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -1946,7 +1937,7 @@ public function hybridInspectJobTriggerTest() $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($name, $actualValue); + $this->assertProtobufEquals($formattedName, $actualValue); $this->assertTrue($transport->isExhausted()); } @@ -1974,10 +1965,10 @@ public function hybridInspectJobTriggerExceptionTest() $transport->addResponse(null, $status); // Mock request - $name = 'name3373707'; + $formattedName = $client->projectJobTriggerName('[PROJECT]', '[JOB_TRIGGER]'); try { - $client->hybridInspectJobTrigger($name); + $client->hybridInspectJobTrigger($formattedName); // If the $client method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { @@ -2089,8 +2080,9 @@ public function createJobTriggerTest() // Mock request $formattedParent = $client->projectName('[PROJECT]'); + $jobTrigger = new JobTrigger(); - $response = $client->createJobTrigger($formattedParent); + $response = $client->createJobTrigger($formattedParent, $jobTrigger); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -2101,6 +2093,9 @@ public function createJobTriggerTest() $actualValue = $actualRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getJobTrigger(); + + $this->assertProtobufEquals($jobTrigger, $actualValue); $this->assertTrue($transport->isExhausted()); } @@ -2129,9 +2124,10 @@ public function createJobTriggerExceptionTest() // Mock request $formattedParent = $client->projectName('[PROJECT]'); + $jobTrigger = new JobTrigger(); try { - $client->createJobTrigger($formattedParent); + $client->createJobTrigger($formattedParent, $jobTrigger); // If the $client method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { @@ -2161,9 +2157,10 @@ public function createStoredInfoTypeTest() $transport->addResponse($expectedResponse); // Mock request - $formattedParent = $client->organizationName('[ORGANIZATION]'); + $formattedParent = $client->organizationLocationName('[ORGANIZATION]', '[LOCATION]'); + $config = new StoredInfoTypeConfig(); - $response = $client->createStoredInfoType($formattedParent); + $response = $client->createStoredInfoType($formattedParent, $config); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); @@ -2174,6 +2171,9 @@ public function createStoredInfoTypeTest() $actualValue = $actualRequestObject->getParent(); $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getConfig(); + + $this->assertProtobufEquals($config, $actualValue); $this->assertTrue($transport->isExhausted()); } @@ -2201,10 +2201,11 @@ public function createStoredInfoTypeExceptionTest() $transport->addResponse(null, $status); // Mock request - $formattedParent = $client->organizationName('[ORGANIZATION]'); + $formattedParent = $client->organizationLocationName('[ORGANIZATION]', '[LOCATION]'); + $config = new StoredInfoTypeConfig(); try { - $client->createStoredInfoType($formattedParent); + $client->createStoredInfoType($formattedParent, $config); // If the $client method call did not throw, fail the test $this->fail('Expected an ApiException, but no exception was thrown.'); } catch (ApiException $ex) { @@ -2383,7 +2384,7 @@ public function listStoredInfoTypesTest() $transport->addResponse($expectedResponse); // Mock request - $formattedParent = $client->organizationName('[ORGANIZATION]'); + $formattedParent = $client->organizationLocationName('[ORGANIZATION]', '[LOCATION]'); $response = $client->listStoredInfoTypes($formattedParent); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); @@ -2426,7 +2427,7 @@ public function listStoredInfoTypesExceptionTest() $transport->addResponse(null, $status); // Mock request - $formattedParent = $client->organizationName('[ORGANIZATION]'); + $formattedParent = $client->organizationLocationName('[ORGANIZATION]', '[LOCATION]'); try { $client->listStoredInfoTypes($formattedParent);