-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add Cloud Storage discovery support (#7521)
docs: Updated method documentation PiperOrigin-RevId: 651452151 Source-Link: googleapis/googleapis@0fe479d Source-Link: googleapis/googleapis-gen@3b6ab8d Copy-Tag: eyJwIjoiRGxwLy5Pd2xCb3QueWFtbCIsImgiOiIzYjZhYjhkYzA4MGM2ZTA1N2EzNTAyYmI2YjAzNDJjZWJkYjcwMTUyIn0=
- Loading branch information
1 parent
3ab5453
commit d3d00ad
Showing
87 changed files
with
5,945 additions
and
339 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
Dlp/samples/V2/DlpServiceClient/delete_file_store_data_profile.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
/* | ||
* Copyright 2024 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/* | ||
* GENERATED CODE WARNING | ||
* This file was automatically generated - do not edit! | ||
*/ | ||
|
||
require_once __DIR__ . '/../../../vendor/autoload.php'; | ||
|
||
// [START dlp_v2_generated_DlpService_DeleteFileStoreDataProfile_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\Cloud\Dlp\V2\Client\DlpServiceClient; | ||
use Google\Cloud\Dlp\V2\DeleteFileStoreDataProfileRequest; | ||
|
||
/** | ||
* Delete a FileStoreDataProfile. Will not prevent the profile from being | ||
* regenerated if the resource is still included in a discovery configuration. | ||
* | ||
* @param string $formattedName Resource name of the file store data profile. Please see | ||
* {@see DlpServiceClient::fileStoreDataProfileName()} for help formatting this field. | ||
*/ | ||
function delete_file_store_data_profile_sample(string $formattedName): void | ||
{ | ||
// Create a client. | ||
$dlpServiceClient = new DlpServiceClient(); | ||
|
||
// Prepare the request message. | ||
$request = (new DeleteFileStoreDataProfileRequest()) | ||
->setName($formattedName); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
$dlpServiceClient->deleteFileStoreDataProfile($request); | ||
printf('Call completed successfully.' . PHP_EOL); | ||
} catch (ApiException $ex) { | ||
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); | ||
} | ||
} | ||
|
||
/** | ||
* Helper to execute the sample. | ||
* | ||
* 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::fileStoreDataProfileName( | ||
'[ORGANIZATION]', | ||
'[LOCATION]', | ||
'[FILE_STORE_DATA_PROFILE]' | ||
); | ||
|
||
delete_file_store_data_profile_sample($formattedName); | ||
} | ||
// [END dlp_v2_generated_DlpService_DeleteFileStoreDataProfile_sync] |
76 changes: 76 additions & 0 deletions
76
Dlp/samples/V2/DlpServiceClient/get_file_store_data_profile.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?php | ||
/* | ||
* Copyright 2024 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/* | ||
* GENERATED CODE WARNING | ||
* This file was automatically generated - do not edit! | ||
*/ | ||
|
||
require_once __DIR__ . '/../../../vendor/autoload.php'; | ||
|
||
// [START dlp_v2_generated_DlpService_GetFileStoreDataProfile_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\Cloud\Dlp\V2\Client\DlpServiceClient; | ||
use Google\Cloud\Dlp\V2\FileStoreDataProfile; | ||
use Google\Cloud\Dlp\V2\GetFileStoreDataProfileRequest; | ||
|
||
/** | ||
* Gets a file store data profile. | ||
* | ||
* @param string $formattedName Resource name, for example | ||
* `organizations/12345/locations/us/fileStoreDataProfiles/53234423`. Please see | ||
* {@see DlpServiceClient::projectDataProfileName()} for help formatting this field. | ||
*/ | ||
function get_file_store_data_profile_sample(string $formattedName): void | ||
{ | ||
// Create a client. | ||
$dlpServiceClient = new DlpServiceClient(); | ||
|
||
// Prepare the request message. | ||
$request = (new GetFileStoreDataProfileRequest()) | ||
->setName($formattedName); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
/** @var FileStoreDataProfile $response */ | ||
$response = $dlpServiceClient->getFileStoreDataProfile($request); | ||
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); | ||
} catch (ApiException $ex) { | ||
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); | ||
} | ||
} | ||
|
||
/** | ||
* Helper to execute the sample. | ||
* | ||
* 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::projectDataProfileName( | ||
'[ORGANIZATION]', | ||
'[LOCATION]', | ||
'[PROJECT_DATA_PROFILE]' | ||
); | ||
|
||
get_file_store_data_profile_sample($formattedName); | ||
} | ||
// [END dlp_v2_generated_DlpService_GetFileStoreDataProfile_sync] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
Dlp/samples/V2/DlpServiceClient/list_file_store_data_profiles.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?php | ||
/* | ||
* Copyright 2024 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/* | ||
* GENERATED CODE WARNING | ||
* This file was automatically generated - do not edit! | ||
*/ | ||
|
||
require_once __DIR__ . '/../../../vendor/autoload.php'; | ||
|
||
// [START dlp_v2_generated_DlpService_ListFileStoreDataProfiles_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\ApiCore\PagedListResponse; | ||
use Google\Cloud\Dlp\V2\Client\DlpServiceClient; | ||
use Google\Cloud\Dlp\V2\FileStoreDataProfile; | ||
use Google\Cloud\Dlp\V2\ListFileStoreDataProfilesRequest; | ||
|
||
/** | ||
* Lists file store data profiles for an organization. | ||
* | ||
* @param string $formattedParent Resource name of the organization or project, for | ||
* example `organizations/433245324/locations/europe` or | ||
* `projects/project-id/locations/asia`. Please see | ||
* {@see DlpServiceClient::organizationLocationName()} for help formatting this field. | ||
*/ | ||
function list_file_store_data_profiles_sample(string $formattedParent): void | ||
{ | ||
// Create a client. | ||
$dlpServiceClient = new DlpServiceClient(); | ||
|
||
// Prepare the request message. | ||
$request = (new ListFileStoreDataProfilesRequest()) | ||
->setParent($formattedParent); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
/** @var PagedListResponse $response */ | ||
$response = $dlpServiceClient->listFileStoreDataProfiles($request); | ||
|
||
/** @var FileStoreDataProfile $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()); | ||
} | ||
} | ||
|
||
/** | ||
* Helper to execute the sample. | ||
* | ||
* 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_file_store_data_profiles_sample($formattedParent); | ||
} | ||
// [END dlp_v2_generated_DlpService_ListFileStoreDataProfiles_sync] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.