Skip to content

Commit

Permalink
feat: add RPCs for deleting TableDataProfiles (#7294)
Browse files Browse the repository at this point in the history
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
gcf-owl-bot[bot] committed May 9, 2024
1 parent 3c0f6e6 commit d905def
Show file tree
Hide file tree
Showing 59 changed files with 5,939 additions and 40 deletions.
Binary file modified Dlp/metadata/V2/Dlp.php
Binary file not shown.
78 changes: 78 additions & 0 deletions Dlp/samples/V2/DlpServiceClient/create_connection.php
@@ -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]
70 changes: 70 additions & 0 deletions Dlp/samples/V2/DlpServiceClient/delete_connection.php
@@ -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 Dlp/samples/V2/DlpServiceClient/delete_table_data_profile.php
@@ -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]
72 changes: 72 additions & 0 deletions Dlp/samples/V2/DlpServiceClient/get_connection.php
@@ -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]
Expand Up @@ -30,7 +30,7 @@
use Google\Cloud\Dlp\V2\ListColumnDataProfilesRequest;

/**
* Lists data profiles for an organization.
* Lists column data profiles for an organization.
*
* @param string $formattedParent Resource name of the organization or project, for
* example `organizations/433245324/locations/europe` or
Expand Down
77 changes: 77 additions & 0 deletions Dlp/samples/V2/DlpServiceClient/list_connections.php
@@ -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]
Expand Up @@ -30,7 +30,7 @@
use Google\Cloud\Dlp\V2\ProjectDataProfile;

/**
* Lists data profiles for an organization.
* Lists project data profiles for an organization.
*
* @param string $formattedParent organizations/{org_id}/locations/{loc_id}
* Please see {@see DlpServiceClient::organizationLocationName()} for help formatting this field.
Expand Down

0 comments on commit d905def

Please sign in to comment.