Skip to content

Commit

Permalink
feat: add support for new ImportEntries() API, including format of th…
Browse files Browse the repository at this point in the history
…e dump (#5964)

feat: add support for new ImportEntries() API, including format of the dump
feat: add support for entries associated with Looker and CloudSQL
feat: add support for a ReconcileTags() API method
PiperOrigin-RevId: 516484690
Source-Link: googleapis/googleapis@50eef0f
Source-Link: googleapis/googleapis-gen@09b2058
Copy-Tag: eyJwIjoiRGF0YUNhdGFsb2cvLk93bEJvdC55YW1sIiwiaCI6IjA5YjIwNTgxOWFhNmQ4MjM5M2VmODY1YjU5NjU3MTgxNGM1ZDE4NDAifQ==
  • Loading branch information
gcf-owl-bot[bot] committed Mar 14, 2023
1 parent 534f8ab commit cd27d6a
Show file tree
Hide file tree
Showing 80 changed files with 4,136 additions and 194 deletions.
Binary file modified DataCatalog/metadata/V1/Common.php
Binary file not shown.
Binary file modified DataCatalog/metadata/V1/Datacatalog.php
Binary file not shown.
Binary file added DataCatalog/metadata/V1/DumpContent.php
Binary file not shown.
Binary file modified DataCatalog/metadata/V1/Policytagmanager.php
Binary file not shown.
Binary file modified DataCatalog/metadata/V1/Schema.php
Binary file not shown.
Binary file modified DataCatalog/metadata/V1/Usage.php
Binary file not shown.
Expand Up @@ -56,7 +56,8 @@
* the `parent` parameter. For more information, see [Data Catalog resource
* project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
*
* @param string $formattedParent The names of the project and location that the new entry group belongs to.
* @param string $formattedParent The names of the project and location that the new entry group
* belongs to.
*
* Note: The entry group itself and its child resources might not be
* stored in the location specified in its name. Please see
Expand Down
95 changes: 95 additions & 0 deletions DataCatalog/samples/V1/DataCatalogClient/import_entries.php
@@ -0,0 +1,95 @@
<?php
/*
* Copyright 2023 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 datacatalog_v1_generated_DataCatalog_ImportEntries_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\ImportEntriesResponse;
use Google\Rpc\Status;

/**
* Imports entries from a source, such as data previously dumped into a
* Cloud Storage bucket, into Data Catalog. Import of entries
* is a sync operation that reconciles the state of the third-party system
* with the Data Catalog.
*
* `ImportEntries` accepts source data snapshots of a third-party system.
* Snapshot should be delivered as a .wire or base65-encoded .txt file
* containing a sequence of Protocol Buffer messages of
* [DumpItem][google.cloud.datacatalog.v1.DumpItem] type.
*
* `ImportEntries` returns a [long-running operation]
* [google.longrunning.Operation] resource that can be queried with
* [Operations.GetOperation][google.longrunning.Operations.GetOperation]
* to return
* [ImportEntriesMetadata][google.cloud.datacatalog.v1.ImportEntriesMetadata]
* and an
* [ImportEntriesResponse][google.cloud.datacatalog.v1.ImportEntriesResponse]
* message.
*
* @param string $formattedParent Target entry group for ingested entries. Please see
* {@see DataCatalogClient::entryGroupName()} for help formatting this field.
*/
function import_entries_sample(string $formattedParent): void
{
// Create a client.
$dataCatalogClient = new DataCatalogClient();

// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $dataCatalogClient->importEntries($formattedParent);
$response->pollUntilComplete();

if ($response->operationSucceeded()) {
/** @var ImportEntriesResponse $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->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 = DataCatalogClient::entryGroupName('[PROJECT]', '[LOCATION]', '[ENTRY_GROUP]');

import_entries_sample($formattedParent);
}
// [END datacatalog_v1_generated_DataCatalog_ImportEntries_sync]
102 changes: 102 additions & 0 deletions DataCatalog/samples/V1/DataCatalogClient/reconcile_tags.php
@@ -0,0 +1,102 @@
<?php
/*
* Copyright 2023 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 datacatalog_v1_generated_DataCatalog_ReconcileTags_sync]
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\ReconcileTagsResponse;
use Google\Rpc\Status;

/**
* `ReconcileTags` creates or updates a list of tags on the entry.
* If the
* [ReconcileTagsRequest.force_delete_missing][google.cloud.datacatalog.v1.ReconcileTagsRequest.force_delete_missing]
* parameter is set, the operation deletes tags not included in the input tag
* list.
*
* `ReconcileTags` returns a [long-running operation]
* [google.longrunning.Operation] resource that can be queried with
* [Operations.GetOperation][google.longrunning.Operations.GetOperation]
* to return [ReconcileTagsMetadata]
* [google.cloud.datacatalog.v1.ReconcileTagsMetadata] and
* a [ReconcileTagsResponse]
* [google.cloud.datacatalog.v1.ReconcileTagsResponse] message.
*
* @param string $formattedParent Name of [Entry][google.cloud.datacatalog.v1.Entry] to be tagged. Please see
* {@see DataCatalogClient::entryName()} for help formatting this field.
* @param string $formattedTagTemplate The name of the tag template, which is used for reconciliation. Please see
* {@see DataCatalogClient::tagTemplateName()} for help formatting this field.
*/
function reconcile_tags_sample(string $formattedParent, string $formattedTagTemplate): void
{
// Create a client.
$dataCatalogClient = new DataCatalogClient();

// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $dataCatalogClient->reconcileTags($formattedParent, $formattedTagTemplate);
$response->pollUntilComplete();

if ($response->operationSucceeded()) {
/** @var ReconcileTagsResponse $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->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 = DataCatalogClient::entryName(
'[PROJECT]',
'[LOCATION]',
'[ENTRY_GROUP]',
'[ENTRY]'
);
$formattedTagTemplate = DataCatalogClient::tagTemplateName(
'[PROJECT]',
'[LOCATION]',
'[TAG_TEMPLATE]'
);

reconcile_tags_sample($formattedParent, $formattedTagTemplate);
}
// [END datacatalog_v1_generated_DataCatalog_ReconcileTags_sync]
Expand Up @@ -36,7 +36,8 @@
*
* @param string $formattedName The name of the tag template field. Please see
* {@see DataCatalogClient::tagTemplateFieldName()} for help formatting this field.
* @param string $newTagTemplateFieldId The new ID of this tag template field. For example, `my_new_field`.
* @param string $newTagTemplateFieldId The new ID of this tag template field. For example,
* `my_new_field`.
*/
function rename_tag_template_field_sample(
string $formattedName,
Expand Down
Expand Up @@ -34,7 +34,8 @@
*
* @param string $formattedName The name of the enum field value. Please see
* {@see DataCatalogClient::tagTemplateFieldEnumValueName()} for help formatting this field.
* @param string $newEnumValueDisplayName The new display name of the enum value. For example, `my_new_enum_value`.
* @param string $newEnumValueDisplayName The new display name of the enum value. For example,
* `my_new_enum_value`.
*/
function rename_tag_template_field_enum_value_sample(
string $formattedName,
Expand Down
5 changes: 2 additions & 3 deletions DataCatalog/samples/V1/DataCatalogClient/search_catalog.php
Expand Up @@ -46,9 +46,8 @@
* For more information, see [Data Catalog search syntax]
* (https://cloud.google.com/data-catalog/docs/how-to/search-reference).
*
* @param string $query Optional. The query string with a minimum of 3 characters and specific syntax.
* For more information, see
* [Data Catalog search
* @param string $query Optional. The query string with a minimum of 3 characters and specific
* syntax. For more information, see [Data Catalog search
* syntax](https://cloud.google.com/data-catalog/docs/how-to/search-reference).
*
* An empty query string returns all data assets (in the specified scope)
Expand Down
Expand Up @@ -35,7 +35,8 @@
* This method generates `SerializedTaxonomy` protocol buffers with nested
* policy tags that can be used as input for `ImportTaxonomies` calls.
*
* @param string $formattedParent Resource name of the project that the exported taxonomies belong to. Please see
* @param string $formattedParent Resource name of the project that the exported taxonomies belong
* to. Please see
* {@see PolicyTagManagerSerializationClient::locationName()} for help formatting this field.
* @param string $formattedTaxonomiesElement Resource names of the taxonomies to export. Please see
* {@see PolicyTagManagerSerializationClient::taxonomyName()} for help formatting this field.
Expand Down
Expand Up @@ -37,7 +37,8 @@
* For an inlined source, taxonomies and policy tags are created in bulk using
* nested protocol buffer structures.
*
* @param string $formattedParent Resource name of project that the imported taxonomies will belong to. Please see
* @param string $formattedParent Resource name of project that the imported taxonomies will belong
* to. Please see
* {@see PolicyTagManagerSerializationClient::locationName()} for help formatting this field.
*/
function import_taxonomies_sample(string $formattedParent): void
Expand Down
Expand Up @@ -45,7 +45,8 @@
*
* @param string $formattedName Resource name of the taxonomy to update. Please see
* {@see PolicyTagManagerSerializationClient::taxonomyName()} for help formatting this field.
* @param string $serializedTaxonomyDisplayName Display name of the taxonomy. At most 200 bytes when encoded in UTF-8.
* @param string $serializedTaxonomyDisplayName Display name of the taxonomy. At most 200 bytes when encoded in
* UTF-8.
*/
function replace_taxonomy_sample(
string $formattedName,
Expand Down
16 changes: 8 additions & 8 deletions DataCatalog/src/V1/BigQueryDateShardedSpec.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cd27d6a

Please sign in to comment.