Skip to content

Commit cd27d6a

Browse files
feat: add support for new ImportEntries() API, including format of the 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==
1 parent 534f8ab commit cd27d6a

80 files changed

Lines changed: 4136 additions & 194 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎DataCatalog/metadata/V1/Common.php‎

136 Bytes
Binary file not shown.
2.75 KB
Binary file not shown.
1.29 KB
Binary file not shown.
285 Bytes
Binary file not shown.

‎DataCatalog/metadata/V1/Schema.php‎

682 Bytes
Binary file not shown.

‎DataCatalog/metadata/V1/Usage.php‎

336 Bytes
Binary file not shown.

‎DataCatalog/samples/V1/DataCatalogClient/create_entry_group.php‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@
5656
* the `parent` parameter. For more information, see [Data Catalog resource
5757
* project](https://cloud.google.com/data-catalog/docs/concepts/resource-project).
5858
*
59-
* @param string $formattedParent The names of the project and location that the new entry group belongs to.
59+
* @param string $formattedParent The names of the project and location that the new entry group
60+
* belongs to.
6061
*
6162
* Note: The entry group itself and its child resources might not be
6263
* stored in the location specified in its name. Please see
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<?php
2+
/*
3+
* Copyright 2023 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START datacatalog_v1_generated_DataCatalog_ImportEntries_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\ApiCore\OperationResponse;
28+
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
29+
use Google\Cloud\DataCatalog\V1\ImportEntriesResponse;
30+
use Google\Rpc\Status;
31+
32+
/**
33+
* Imports entries from a source, such as data previously dumped into a
34+
* Cloud Storage bucket, into Data Catalog. Import of entries
35+
* is a sync operation that reconciles the state of the third-party system
36+
* with the Data Catalog.
37+
*
38+
* `ImportEntries` accepts source data snapshots of a third-party system.
39+
* Snapshot should be delivered as a .wire or base65-encoded .txt file
40+
* containing a sequence of Protocol Buffer messages of
41+
* [DumpItem][google.cloud.datacatalog.v1.DumpItem] type.
42+
*
43+
* `ImportEntries` returns a [long-running operation]
44+
* [google.longrunning.Operation] resource that can be queried with
45+
* [Operations.GetOperation][google.longrunning.Operations.GetOperation]
46+
* to return
47+
* [ImportEntriesMetadata][google.cloud.datacatalog.v1.ImportEntriesMetadata]
48+
* and an
49+
* [ImportEntriesResponse][google.cloud.datacatalog.v1.ImportEntriesResponse]
50+
* message.
51+
*
52+
* @param string $formattedParent Target entry group for ingested entries. Please see
53+
* {@see DataCatalogClient::entryGroupName()} for help formatting this field.
54+
*/
55+
function import_entries_sample(string $formattedParent): void
56+
{
57+
// Create a client.
58+
$dataCatalogClient = new DataCatalogClient();
59+
60+
// Call the API and handle any network failures.
61+
try {
62+
/** @var OperationResponse $response */
63+
$response = $dataCatalogClient->importEntries($formattedParent);
64+
$response->pollUntilComplete();
65+
66+
if ($response->operationSucceeded()) {
67+
/** @var ImportEntriesResponse $result */
68+
$result = $response->getResult();
69+
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
70+
} else {
71+
/** @var Status $error */
72+
$error = $response->getError();
73+
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
74+
}
75+
} catch (ApiException $ex) {
76+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
77+
}
78+
}
79+
80+
/**
81+
* Helper to execute the sample.
82+
*
83+
* This sample has been automatically generated and should be regarded as a code
84+
* template only. It will require modifications to work:
85+
* - It may require correct/in-range values for request initialization.
86+
* - It may require specifying regional endpoints when creating the service client,
87+
* please see the apiEndpoint client configuration option for more details.
88+
*/
89+
function callSample(): void
90+
{
91+
$formattedParent = DataCatalogClient::entryGroupName('[PROJECT]', '[LOCATION]', '[ENTRY_GROUP]');
92+
93+
import_entries_sample($formattedParent);
94+
}
95+
// [END datacatalog_v1_generated_DataCatalog_ImportEntries_sync]
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
<?php
2+
/*
3+
* Copyright 2023 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START datacatalog_v1_generated_DataCatalog_ReconcileTags_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\ApiCore\OperationResponse;
28+
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
29+
use Google\Cloud\DataCatalog\V1\ReconcileTagsResponse;
30+
use Google\Rpc\Status;
31+
32+
/**
33+
* `ReconcileTags` creates or updates a list of tags on the entry.
34+
* If the
35+
* [ReconcileTagsRequest.force_delete_missing][google.cloud.datacatalog.v1.ReconcileTagsRequest.force_delete_missing]
36+
* parameter is set, the operation deletes tags not included in the input tag
37+
* list.
38+
*
39+
* `ReconcileTags` returns a [long-running operation]
40+
* [google.longrunning.Operation] resource that can be queried with
41+
* [Operations.GetOperation][google.longrunning.Operations.GetOperation]
42+
* to return [ReconcileTagsMetadata]
43+
* [google.cloud.datacatalog.v1.ReconcileTagsMetadata] and
44+
* a [ReconcileTagsResponse]
45+
* [google.cloud.datacatalog.v1.ReconcileTagsResponse] message.
46+
*
47+
* @param string $formattedParent Name of [Entry][google.cloud.datacatalog.v1.Entry] to be tagged. Please see
48+
* {@see DataCatalogClient::entryName()} for help formatting this field.
49+
* @param string $formattedTagTemplate The name of the tag template, which is used for reconciliation. Please see
50+
* {@see DataCatalogClient::tagTemplateName()} for help formatting this field.
51+
*/
52+
function reconcile_tags_sample(string $formattedParent, string $formattedTagTemplate): void
53+
{
54+
// Create a client.
55+
$dataCatalogClient = new DataCatalogClient();
56+
57+
// Call the API and handle any network failures.
58+
try {
59+
/** @var OperationResponse $response */
60+
$response = $dataCatalogClient->reconcileTags($formattedParent, $formattedTagTemplate);
61+
$response->pollUntilComplete();
62+
63+
if ($response->operationSucceeded()) {
64+
/** @var ReconcileTagsResponse $result */
65+
$result = $response->getResult();
66+
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
67+
} else {
68+
/** @var Status $error */
69+
$error = $response->getError();
70+
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
71+
}
72+
} catch (ApiException $ex) {
73+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
74+
}
75+
}
76+
77+
/**
78+
* Helper to execute the sample.
79+
*
80+
* This sample has been automatically generated and should be regarded as a code
81+
* template only. It will require modifications to work:
82+
* - It may require correct/in-range values for request initialization.
83+
* - It may require specifying regional endpoints when creating the service client,
84+
* please see the apiEndpoint client configuration option for more details.
85+
*/
86+
function callSample(): void
87+
{
88+
$formattedParent = DataCatalogClient::entryName(
89+
'[PROJECT]',
90+
'[LOCATION]',
91+
'[ENTRY_GROUP]',
92+
'[ENTRY]'
93+
);
94+
$formattedTagTemplate = DataCatalogClient::tagTemplateName(
95+
'[PROJECT]',
96+
'[LOCATION]',
97+
'[TAG_TEMPLATE]'
98+
);
99+
100+
reconcile_tags_sample($formattedParent, $formattedTagTemplate);
101+
}
102+
// [END datacatalog_v1_generated_DataCatalog_ReconcileTags_sync]

‎DataCatalog/samples/V1/DataCatalogClient/rename_tag_template_field.php‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
*
3737
* @param string $formattedName The name of the tag template field. Please see
3838
* {@see DataCatalogClient::tagTemplateFieldName()} for help formatting this field.
39-
* @param string $newTagTemplateFieldId The new ID of this tag template field. For example, `my_new_field`.
39+
* @param string $newTagTemplateFieldId The new ID of this tag template field. For example,
40+
* `my_new_field`.
4041
*/
4142
function rename_tag_template_field_sample(
4243
string $formattedName,

0 commit comments

Comments
 (0)