Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add RPCs for deleting TableDataProfiles (#7294)
feat: Add RPCs for enabling discovery of Cloud SQL feat: Add field to InspectJobs num_rows_processed for BigQuery inspect jobs feat: Add new countries for supported detectors docs: Updated method documentation PiperOrigin-RevId: 631084904 Source-Link: googleapis/googleapis@67baa8f Source-Link: googleapis/googleapis-gen@e808b48 Copy-Tag: eyJwIjoiRGxwLy5Pd2xCb3QueWFtbCIsImgiOiJlODA4YjQ4MmUyMzU3ZTMwY2VhNDFhNjdiMmQ5MDUyYmQ0ZTFjNDlkIn0=
- Loading branch information
1 parent
3c0f6e6
commit d905def
Showing
59 changed files
with
5,939 additions
and
40 deletions.
There are no files selected for viewing
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
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_CreateConnection_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\Cloud\Dlp\V2\Client\DlpServiceClient; | ||
use Google\Cloud\Dlp\V2\Connection; | ||
use Google\Cloud\Dlp\V2\ConnectionState; | ||
use Google\Cloud\Dlp\V2\CreateConnectionRequest; | ||
|
||
/** | ||
* Create a Connection to an external data source. | ||
* | ||
* @param string $formattedParent Parent resource name in the format: | ||
* `projects/{project}/locations/{location}`. Please see | ||
* {@see DlpServiceClient::locationName()} for help formatting this field. | ||
* @param int $connectionState The connection's state in its lifecycle. | ||
*/ | ||
function create_connection_sample(string $formattedParent, int $connectionState): void | ||
{ | ||
// Create a client. | ||
$dlpServiceClient = new DlpServiceClient(); | ||
|
||
// Prepare the request message. | ||
$connection = (new Connection()) | ||
->setState($connectionState); | ||
$request = (new CreateConnectionRequest()) | ||
->setParent($formattedParent) | ||
->setConnection($connection); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
/** @var Connection $response */ | ||
$response = $dlpServiceClient->createConnection($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 | ||
{ | ||
$formattedParent = DlpServiceClient::locationName('[PROJECT]', '[LOCATION]'); | ||
$connectionState = ConnectionState::CONNECTION_STATE_UNSPECIFIED; | ||
|
||
create_connection_sample($formattedParent, $connectionState); | ||
} | ||
// [END dlp_v2_generated_DlpService_CreateConnection_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?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_DeleteConnection_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\Cloud\Dlp\V2\Client\DlpServiceClient; | ||
use Google\Cloud\Dlp\V2\DeleteConnectionRequest; | ||
|
||
/** | ||
* Delete a Connection. | ||
* | ||
* @param string $formattedName Resource name of the Connection to be deleted, in the format: | ||
* `projects/{project}/locations/{location}/connections/{connection}`. Please see | ||
* {@see DlpServiceClient::connectionName()} for help formatting this field. | ||
*/ | ||
function delete_connection_sample(string $formattedName): void | ||
{ | ||
// Create a client. | ||
$dlpServiceClient = new DlpServiceClient(); | ||
|
||
// Prepare the request message. | ||
$request = (new DeleteConnectionRequest()) | ||
->setName($formattedName); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
$dlpServiceClient->deleteConnection($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::connectionName('[PROJECT]', '[LOCATION]', '[CONNECTION]'); | ||
|
||
delete_connection_sample($formattedName); | ||
} | ||
// [END dlp_v2_generated_DlpService_DeleteConnection_sync] |
74 changes: 74 additions & 0 deletions
74
Dlp/samples/V2/DlpServiceClient/delete_table_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_DeleteTableDataProfile_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\Cloud\Dlp\V2\Client\DlpServiceClient; | ||
use Google\Cloud\Dlp\V2\DeleteTableDataProfileRequest; | ||
|
||
/** | ||
* Delete a TableDataProfile. Will not prevent the profile from being | ||
* regenerated if the table is still included in a discovery configuration. | ||
* | ||
* @param string $formattedName Resource name of the table data profile. Please see | ||
* {@see DlpServiceClient::tableDataProfileName()} for help formatting this field. | ||
*/ | ||
function delete_table_data_profile_sample(string $formattedName): void | ||
{ | ||
// Create a client. | ||
$dlpServiceClient = new DlpServiceClient(); | ||
|
||
// Prepare the request message. | ||
$request = (new DeleteTableDataProfileRequest()) | ||
->setName($formattedName); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
$dlpServiceClient->deleteTableDataProfile($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::tableDataProfileName( | ||
'[ORGANIZATION]', | ||
'[LOCATION]', | ||
'[TABLE_DATA_PROFILE]' | ||
); | ||
|
||
delete_table_data_profile_sample($formattedName); | ||
} | ||
// [END dlp_v2_generated_DlpService_DeleteTableDataProfile_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?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_GetConnection_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\Cloud\Dlp\V2\Client\DlpServiceClient; | ||
use Google\Cloud\Dlp\V2\Connection; | ||
use Google\Cloud\Dlp\V2\GetConnectionRequest; | ||
|
||
/** | ||
* Get a Connection by name. | ||
* | ||
* @param string $formattedName Resource name in the format: | ||
* `projects/{project}/locations/{location}/connections/{connection}`. Please see | ||
* {@see DlpServiceClient::connectionName()} for help formatting this field. | ||
*/ | ||
function get_connection_sample(string $formattedName): void | ||
{ | ||
// Create a client. | ||
$dlpServiceClient = new DlpServiceClient(); | ||
|
||
// Prepare the request message. | ||
$request = (new GetConnectionRequest()) | ||
->setName($formattedName); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
/** @var Connection $response */ | ||
$response = $dlpServiceClient->getConnection($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::connectionName('[PROJECT]', '[LOCATION]', '[CONNECTION]'); | ||
|
||
get_connection_sample($formattedName); | ||
} | ||
// [END dlp_v2_generated_DlpService_GetConnection_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?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_ListConnections_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\ApiCore\PagedListResponse; | ||
use Google\Cloud\Dlp\V2\Client\DlpServiceClient; | ||
use Google\Cloud\Dlp\V2\Connection; | ||
use Google\Cloud\Dlp\V2\ListConnectionsRequest; | ||
|
||
/** | ||
* Lists Connections in a parent. | ||
* | ||
* @param string $formattedParent Parent name, for example: | ||
* `projects/project-id/locations/global`. Please see | ||
* {@see DlpServiceClient::locationName()} for help formatting this field. | ||
*/ | ||
function list_connections_sample(string $formattedParent): void | ||
{ | ||
// Create a client. | ||
$dlpServiceClient = new DlpServiceClient(); | ||
|
||
// Prepare the request message. | ||
$request = (new ListConnectionsRequest()) | ||
->setParent($formattedParent); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
/** @var PagedListResponse $response */ | ||
$response = $dlpServiceClient->listConnections($request); | ||
|
||
/** @var Connection $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::locationName('[PROJECT]', '[LOCATION]'); | ||
|
||
list_connections_sample($formattedParent); | ||
} | ||
// [END dlp_v2_generated_DlpService_ListConnections_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
Oops, something went wrong.