Reference documentation and code samples for the Google Cloud Data Catalog V1 Client class DataCatalogClient.
Service Description: Data Catalog API service allows you to discover, understand, and manage your data.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
$dataCatalogClient = new DataCatalogClient();
try {
$formattedParent = $dataCatalogClient->entryGroupName('[PROJECT]', '[LOCATION]', '[ENTRY_GROUP]');
$entryId = 'entry_id';
$entry = new Entry();
$response = $dataCatalogClient->createEntry($formattedParent, $entryId, $entry);
} finally {
$dataCatalogClient->close();
}
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parseName method to extract the individual identifiers contained within formatted names that are returned by the API.
Methods
entryName
Formats a string containing the fully-qualified path to represent a entry resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
entryGroup |
string
|
entry |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted entry resource. |
entryGroupName
Formats a string containing the fully-qualified path to represent a entry_group resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
entryGroup |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted entry_group resource. |
locationName
Formats a string containing the fully-qualified path to represent a location resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted location resource. |
tagName
Formats a string containing the fully-qualified path to represent a tag resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
entryGroup |
string
|
entry |
string
|
tag |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted tag resource. |
tagTemplateName
Formats a string containing the fully-qualified path to represent a tag_template resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
tagTemplate |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted tag_template resource. |
tagTemplateFieldName
Formats a string containing the fully-qualified path to represent a tag_template_field resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
tagTemplate |
string
|
field |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted tag_template_field resource. |
tagTemplateFieldEnumValueName
Formats a string containing the fully-qualified path to represent a tag_template_field_enum_value resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
tagTemplate |
string
|
tagTemplateFieldId |
string
|
enumValueDisplayName |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted tag_template_field_enum_value resource. |
parseName
Parses a formatted name string and returns an associative array of the components in the name.
The following name formats are supported: Template: Pattern
- entry: projects/{project}/locations/{location}/entryGroups/{entry_group}/entries/{entry}
- entryGroup: projects/{project}/locations/{location}/entryGroups/{entry_group}
- location: projects/{project}/locations/{location}
- tag: projects/{project}/locations/{location}/entryGroups/{entry_group}/entries/{entry}/tags/{tag}
- tagTemplate: projects/{project}/locations/{location}/tagTemplates/{tag_template}
- tagTemplateField: projects/{project}/locations/{location}/tagTemplates/{tag_template}/fields/{field}
- tagTemplateFieldEnumValue: projects/{project}/locations/{location}/tagTemplates/{tag_template}/fields/{tag_template_field_id}/enumValues/{enum_value_display_name}
The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.
Parameters | |
---|---|
Name | Description |
formattedName |
string
The formatted name string |
template |
string
Optional name of template to match |
Returns | |
---|---|
Type | Description |
array | An associative array from name component IDs to component values. |
__construct
Constructor.
Parameters | |
---|---|
Name | Description |
options |
array
Optional. Options for configuring the service API wrapper. |
↳ apiEndpoint |
string
The address of the API remote host. May optionally include the port, formatted as "
|
↳ credentials |
string|array|FetchAuthTokenInterface|CredentialsWrapper
The credentials to be used by the client to authorize API calls. This option accepts either a path to a credentials file, or a decoded credentials file as a PHP array. Advanced usage: In addition, this option can also accept a pre-constructed Google\Auth\FetchAuthTokenInterface object or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored. |
↳ credentialsConfig |
array
Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() . |
↳ disableRetries |
bool
Determines whether or not retries defined by the client configuration should be disabled. Defaults to |
↳ clientConfig |
string|array
Client method configuration, including retry settings. This option can be either a path to a JSON file, or a PHP array containing the decoded JSON data. By default this settings points to the default client config file, which is provided in the resources folder. |
↳ transport |
string|TransportInterface
The transport used for executing network requests. May be either the string |
↳ transportConfig |
array
Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = [ 'grpc' => [...], 'rest' => [...], ]; See the Google\ApiCore\Transport\GrpcTransport::build() and Google\ApiCore\Transport\RestTransport::build() methods for the supported options. |
↳ clientCertSource |
callable
A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS. |
createEntry
Creates an entry.
You can create entries only with 'FILESET', 'CLUSTER', 'DATA_STREAM', or custom types. Data Catalog automatically creates entries with other types during metadata ingestion from integrated systems.
You must enable the Data Catalog API in the project identified by
the parent
parameter. For more information, see Data Catalog resource
project.
An entry group can have a maximum of 100,000 entries.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The name of the entry group this entry belongs to. Note: The entry itself and its child resources might not be stored in the location specified in its name. |
entryId |
string
Required. The ID of the entry to create. The ID must contain only letters (a-z, A-Z), numbers (0-9), and underscores (_). The maximum size is 64 bytes when encoded in UTF-8. |
entry |
Google\Cloud\DataCatalog\V1\Entry
Required. The entry to create. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\DataCatalog\V1\Entry |
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\Entry;
/**
* @param string $formattedParent The name of the entry group this entry belongs to.
*
* Note: The entry itself and its child resources might not be stored in
* the location specified in its name. Please see
* {@see DataCatalogClient::entryGroupName()} for help formatting this field.
* @param string $entryId The ID of the entry to create.
*
* The ID must contain only letters (a-z, A-Z), numbers (0-9),
* and underscores (_).
* The maximum size is 64 bytes when encoded in UTF-8.
*/
function create_entry_sample(string $formattedParent, string $entryId): void
{
// Create a client.
$dataCatalogClient = new DataCatalogClient();
// Prepare any non-scalar elements to be passed along with the request.
$entry = new Entry();
// Call the API and handle any network failures.
try {
/** @var Entry $response */
$response = $dataCatalogClient->createEntry($formattedParent, $entryId, $entry);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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]');
$entryId = '[ENTRY_ID]';
create_entry_sample($formattedParent, $entryId);
}
createEntryGroup
Creates an entry group.
An entry group contains logically related entries together with Cloud Identity and Access Management policies. These policies specify users who can create, edit, and view entries within entry groups.
Data Catalog automatically creates entry groups with names that start with
the @
symbol for the following resources:
- BigQuery entries (
@bigquery
) - Pub/Sub topics (
@pubsub
) - Dataproc Metastore services (
@dataproc_metastore_{SERVICE_NAME_HASH}
)
You can create your own entry groups for Cloud Storage fileset entries
and custom entries together with the corresponding IAM policies.
User-created entry groups can't contain the @
symbol, it is reserved
for automatically created groups.
Entry groups, like entries, can be searched.
A maximum of 10,000 entry groups may be created per organization across all locations.
You must enable the Data Catalog API in the project identified by
the parent
parameter. For more information, see Data Catalog resource
project.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. 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. |
entryGroupId |
string
Required. The ID of the entry group to create. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and must start with a letter or underscore. The maximum size is 64 bytes when encoded in UTF-8. |
optionalArgs |
array
Optional. |
↳ entryGroup |
EntryGroup
The entry group to create. Defaults to empty. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\DataCatalog\V1\EntryGroup |
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\EntryGroup;
/**
* @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
* {@see DataCatalogClient::locationName()} for help formatting this field.
* @param string $entryGroupId The ID of the entry group to create.
*
* The ID must contain only letters (a-z, A-Z), numbers (0-9),
* underscores (_), and must start with a letter or underscore.
* The maximum size is 64 bytes when encoded in UTF-8.
*/
function create_entry_group_sample(string $formattedParent, string $entryGroupId): void
{
// Create a client.
$dataCatalogClient = new DataCatalogClient();
// Call the API and handle any network failures.
try {
/** @var EntryGroup $response */
$response = $dataCatalogClient->createEntryGroup($formattedParent, $entryGroupId);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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::locationName('[PROJECT]', '[LOCATION]');
$entryGroupId = '[ENTRY_GROUP_ID]';
create_entry_group_sample($formattedParent, $entryGroupId);
}
createTag
Creates a tag and assigns it to:
- An Entry if the method name is
projects.locations.entryGroups.entries.tags.create
. - Or EntryGroupif the method
name is
projects.locations.entryGroups.tags.create
.
Note: The project identified by the parent
parameter for the tag
and the tag template
used to create the tag must be in the same organization.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The name of the resource to attach this tag to. Tags can be attached to entries or entry groups. An entry can have up to 1000 attached tags. Note: The tag and its child resources might not be stored in the location specified in its name. |
tag |
Google\Cloud\DataCatalog\V1\Tag
Required. The tag to create. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\DataCatalog\V1\Tag |
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\Tag;
/**
* @param string $formattedParent The name of the resource to attach this tag to.
*
* Tags can be attached to entries or entry groups. An entry can have up to
* 1000 attached tags.
*
* Note: The tag and its child resources might not be stored in
* the location specified in its name. Please see
* {@see DataCatalogClient::entryName()} for help formatting this field.
* @param string $tagTemplate The resource name of the tag template this tag uses. Example:
*
* `projects/{PROJECT_ID}/locations/{LOCATION}/tagTemplates/{TAG_TEMPLATE_ID}`
*
* This field cannot be modified after creation.
*/
function create_tag_sample(string $formattedParent, string $tagTemplate): void
{
// Create a client.
$dataCatalogClient = new DataCatalogClient();
// Prepare any non-scalar elements to be passed along with the request.
$tagFields = [];
$tag = (new Tag())
->setTemplate($tagTemplate)
->setFields($tagFields);
// Call the API and handle any network failures.
try {
/** @var Tag $response */
$response = $dataCatalogClient->createTag($formattedParent, $tag);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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]'
);
$tagTemplate = '[TEMPLATE]';
create_tag_sample($formattedParent, $tagTemplate);
}
createTagTemplate
Creates a tag template.
You must enable the Data Catalog API in the project identified by the
parent
parameter.
For more information, see Data Catalog resource project.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The name of the project and the template location region. |
tagTemplateId |
string
Required. The ID of the tag template to create. The ID must contain only lowercase letters (a-z), numbers (0-9), or underscores (_), and must start with a letter or underscore. The maximum size is 64 bytes when encoded in UTF-8. |
tagTemplate |
Google\Cloud\DataCatalog\V1\TagTemplate
Required. The tag template to create. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\DataCatalog\V1\TagTemplate |
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\TagTemplate;
/**
* @param string $formattedParent The name of the project and the template location
* [region](https://cloud.google.com/data-catalog/docs/concepts/regions). Please see
* {@see DataCatalogClient::locationName()} for help formatting this field.
* @param string $tagTemplateId The ID of the tag template to create.
*
* The ID must contain only lowercase letters (a-z), numbers (0-9),
* or underscores (_), and must start with a letter or underscore.
* The maximum size is 64 bytes when encoded in UTF-8.
*/
function create_tag_template_sample(string $formattedParent, string $tagTemplateId): void
{
// Create a client.
$dataCatalogClient = new DataCatalogClient();
// Prepare any non-scalar elements to be passed along with the request.
$tagTemplateFields = [];
$tagTemplate = (new TagTemplate())
->setFields($tagTemplateFields);
// Call the API and handle any network failures.
try {
/** @var TagTemplate $response */
$response = $dataCatalogClient->createTagTemplate($formattedParent, $tagTemplateId, $tagTemplate);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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::locationName('[PROJECT]', '[LOCATION]');
$tagTemplateId = '[TAG_TEMPLATE_ID]';
create_tag_template_sample($formattedParent, $tagTemplateId);
}
createTagTemplateField
Creates a field in a tag template.
You must enable the Data Catalog API in the project identified by
the parent
parameter. For more information, see Data Catalog resource
project.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The name of the project and the template location region. |
tagTemplateFieldId |
string
Required. The ID of the tag template field to create. Note: Adding a required field to an existing template is not allowed. Field IDs can contain letters (both uppercase and lowercase), numbers (0-9), underscores (_) and dashes (-). Field IDs must be at least 1 character long and at most 128 characters long. Field IDs must also be unique within their template. |
tagTemplateField |
Google\Cloud\DataCatalog\V1\TagTemplateField
Required. The tag template field to create. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\DataCatalog\V1\TagTemplateField |
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\FieldType;
use Google\Cloud\DataCatalog\V1\TagTemplateField;
/**
* @param string $formattedParent The name of the project and the template location
* [region](https://cloud.google.com/data-catalog/docs/concepts/regions). Please see
* {@see DataCatalogClient::tagTemplateName()} for help formatting this field.
* @param string $tagTemplateFieldId The ID of the tag template field to create.
*
* Note: Adding a required field to an existing template is *not* allowed.
*
* Field IDs can contain letters (both uppercase and lowercase), numbers
* (0-9), underscores (_) and dashes (-). Field IDs must be at least 1
* character long and at most 128 characters long. Field IDs must also be
* unique within their template.
*/
function create_tag_template_field_sample(
string $formattedParent,
string $tagTemplateFieldId
): void {
// Create a client.
$dataCatalogClient = new DataCatalogClient();
// Prepare any non-scalar elements to be passed along with the request.
$tagTemplateFieldType = new FieldType();
$tagTemplateField = (new TagTemplateField())
->setType($tagTemplateFieldType);
// Call the API and handle any network failures.
try {
/** @var TagTemplateField $response */
$response = $dataCatalogClient->createTagTemplateField(
$formattedParent,
$tagTemplateFieldId,
$tagTemplateField
);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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::tagTemplateName('[PROJECT]', '[LOCATION]', '[TAG_TEMPLATE]');
$tagTemplateFieldId = '[TAG_TEMPLATE_FIELD_ID]';
create_tag_template_field_sample($formattedParent, $tagTemplateFieldId);
}
deleteEntry
Deletes an existing entry.
You can delete only the entries created by the CreateEntry method.
You must enable the Data Catalog API in the project identified by
the name
parameter. For more information, see Data Catalog
resource
project.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the entry to delete. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
/**
* @param string $formattedName The name of the entry to delete. Please see
* {@see DataCatalogClient::entryName()} for help formatting this field.
*/
function delete_entry_sample(string $formattedName): void
{
// Create a client.
$dataCatalogClient = new DataCatalogClient();
// Call the API and handle any network failures.
try {
$dataCatalogClient->deleteEntry($formattedName);
printf('Call completed successfully.' . PHP_EOL);
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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 = DataCatalogClient::entryName(
'[PROJECT]',
'[LOCATION]',
'[ENTRY_GROUP]',
'[ENTRY]'
);
delete_entry_sample($formattedName);
}
deleteEntryGroup
Deletes an entry group.
You must enable the Data Catalog API in the project
identified by the name
parameter. For more information, see Data Catalog
resource
project.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the entry group to delete. |
optionalArgs |
array
Optional. |
↳ force |
bool
Optional. If true, deletes all entries in the entry group. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
/**
* @param string $formattedName The name of the entry group to delete. Please see
* {@see DataCatalogClient::entryGroupName()} for help formatting this field.
*/
function delete_entry_group_sample(string $formattedName): void
{
// Create a client.
$dataCatalogClient = new DataCatalogClient();
// Call the API and handle any network failures.
try {
$dataCatalogClient->deleteEntryGroup($formattedName);
printf('Call completed successfully.' . PHP_EOL);
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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 = DataCatalogClient::entryGroupName('[PROJECT]', '[LOCATION]', '[ENTRY_GROUP]');
delete_entry_group_sample($formattedName);
}
deleteTag
Deletes a tag.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the tag to delete. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
/**
* @param string $formattedName The name of the tag to delete. Please see
* {@see DataCatalogClient::entryName()} for help formatting this field.
*/
function delete_tag_sample(string $formattedName): void
{
// Create a client.
$dataCatalogClient = new DataCatalogClient();
// Call the API and handle any network failures.
try {
$dataCatalogClient->deleteTag($formattedName);
printf('Call completed successfully.' . PHP_EOL);
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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 = DataCatalogClient::entryName(
'[PROJECT]',
'[LOCATION]',
'[ENTRY_GROUP]',
'[ENTRY]'
);
delete_tag_sample($formattedName);
}
deleteTagTemplate
Deletes a tag template and all tags that use it.
You must enable the Data Catalog API in the project identified by
the name
parameter. For more information, see Data Catalog resource
project.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the tag template to delete. |
force |
bool
Required. If true, deletes all tags that use this template. Currently, |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
/**
* @param string $formattedName The name of the tag template to delete. Please see
* {@see DataCatalogClient::tagTemplateName()} for help formatting this field.
* @param bool $force If true, deletes all tags that use this template.
*
* Currently, `true` is the only supported value.
*/
function delete_tag_template_sample(string $formattedName, bool $force): void
{
// Create a client.
$dataCatalogClient = new DataCatalogClient();
// Call the API and handle any network failures.
try {
$dataCatalogClient->deleteTagTemplate($formattedName, $force);
printf('Call completed successfully.' . PHP_EOL);
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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 = DataCatalogClient::tagTemplateName('[PROJECT]', '[LOCATION]', '[TAG_TEMPLATE]');
$force = false;
delete_tag_template_sample($formattedName, $force);
}
deleteTagTemplateField
Deletes a field in a tag template and all uses of this field from the tags based on this template.
You must enable the Data Catalog API in the project identified by
the name
parameter. For more information, see Data Catalog resource
project.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the tag template field to delete. |
force |
bool
Required. If true, deletes this field from any tags that use it. Currently, |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
/**
* @param string $formattedName The name of the tag template field to delete. Please see
* {@see DataCatalogClient::tagTemplateFieldName()} for help formatting this field.
* @param bool $force If true, deletes this field from any tags that use it.
*
* Currently, `true` is the only supported value.
*/
function delete_tag_template_field_sample(string $formattedName, bool $force): void
{
// Create a client.
$dataCatalogClient = new DataCatalogClient();
// Call the API and handle any network failures.
try {
$dataCatalogClient->deleteTagTemplateField($formattedName, $force);
printf('Call completed successfully.' . PHP_EOL);
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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 = DataCatalogClient::tagTemplateFieldName(
'[PROJECT]',
'[LOCATION]',
'[TAG_TEMPLATE]',
'[FIELD]'
);
$force = false;
delete_tag_template_field_sample($formattedName, $force);
}
getEntry
Gets an entry.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the entry to get. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\DataCatalog\V1\Entry |
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\Entry;
/**
* @param string $formattedName The name of the entry to get. Please see
* {@see DataCatalogClient::entryName()} for help formatting this field.
*/
function get_entry_sample(string $formattedName): void
{
// Create a client.
$dataCatalogClient = new DataCatalogClient();
// Call the API and handle any network failures.
try {
/** @var Entry $response */
$response = $dataCatalogClient->getEntry($formattedName);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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 = DataCatalogClient::entryName(
'[PROJECT]',
'[LOCATION]',
'[ENTRY_GROUP]',
'[ENTRY]'
);
get_entry_sample($formattedName);
}
getEntryGroup
Gets an entry group.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the entry group to get. |
optionalArgs |
array
Optional. |
↳ readMask |
FieldMask
The fields to return. If empty or omitted, all fields are returned. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\DataCatalog\V1\EntryGroup |
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\EntryGroup;
/**
* @param string $formattedName The name of the entry group to get. Please see
* {@see DataCatalogClient::entryGroupName()} for help formatting this field.
*/
function get_entry_group_sample(string $formattedName): void
{
// Create a client.
$dataCatalogClient = new DataCatalogClient();
// Call the API and handle any network failures.
try {
/** @var EntryGroup $response */
$response = $dataCatalogClient->getEntryGroup($formattedName);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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 = DataCatalogClient::entryGroupName('[PROJECT]', '[LOCATION]', '[ENTRY_GROUP]');
get_entry_group_sample($formattedName);
}
getIamPolicy
Gets the access control policy for a resource.
May return:
- A
NOT_FOUND
error if the resource doesn't exist or you don't have the permission to view it. - An empty policy if the resource exists but doesn't have a set policy.
Supported resources are:
- Tag templates
- Entry groups
Note: This method doesn't get policies from Google Cloud Platform resources ingested into Data Catalog.
To call this method, you must have the following Google IAM permissions:
datacatalog.tagTemplates.getIamPolicy
to get policies on tag templates.datacatalog.entryGroups.getIamPolicy
to get policies on entry groups.
Parameters | |
---|---|
Name | Description |
resource |
string
REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field. |
optionalArgs |
array
Optional. |
↳ options |
GetPolicyOptions
OPTIONAL: A |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Iam\V1\Policy |
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
use Google\Cloud\Iam\V1\Policy;
/**
* @param string $resource REQUIRED: The resource for which the policy is being requested.
* See the operation documentation for the appropriate value for this field.
*/
function get_iam_policy_sample(string $resource): void
{
// Create a client.
$dataCatalogClient = new DataCatalogClient();
// Call the API and handle any network failures.
try {
/** @var Policy $response */
$response = $dataCatalogClient->getIamPolicy($resource);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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
{
$resource = '[RESOURCE]';
get_iam_policy_sample($resource);
}
getTagTemplate
Gets a tag template.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the tag template to get. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\DataCatalog\V1\TagTemplate |
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\TagTemplate;
/**
* @param string $formattedName The name of the tag template to get. Please see
* {@see DataCatalogClient::tagTemplateName()} for help formatting this field.
*/
function get_tag_template_sample(string $formattedName): void
{
// Create a client.
$dataCatalogClient = new DataCatalogClient();
// Call the API and handle any network failures.
try {
/** @var TagTemplate $response */
$response = $dataCatalogClient->getTagTemplate($formattedName);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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 = DataCatalogClient::tagTemplateName('[PROJECT]', '[LOCATION]', '[TAG_TEMPLATE]');
get_tag_template_sample($formattedName);
}
listEntries
Lists entries.
Note: Currently, this method can list only custom entries. To get a list of both custom and automatically created entries, use SearchCatalog.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The name of the entry group that contains the entries to list. Can be provided in URL format. |
optionalArgs |
array
Optional. |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ readMask |
FieldMask
The fields to return for each entry. If empty or omitted, all fields are returned. For example, to return a list of entries with only the |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\Entry;
/**
* @param string $formattedParent The name of the entry group that contains the entries to list.
*
* Can be provided in URL format. Please see
* {@see DataCatalogClient::entryGroupName()} for help formatting this field.
*/
function list_entries_sample(string $formattedParent): void
{
// Create a client.
$dataCatalogClient = new DataCatalogClient();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $dataCatalogClient->listEntries($formattedParent);
/** @var Entry $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());
}
}
/**
* 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]');
list_entries_sample($formattedParent);
}
listEntryGroups
Lists entry groups.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The name of the location that contains the entry groups to list. Can be provided as a URL. |
optionalArgs |
array
Optional. |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\EntryGroup;
/**
* @param string $formattedParent The name of the location that contains the entry groups to list.
*
* Can be provided as a URL. Please see
* {@see DataCatalogClient::locationName()} for help formatting this field.
*/
function list_entry_groups_sample(string $formattedParent): void
{
// Create a client.
$dataCatalogClient = new DataCatalogClient();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $dataCatalogClient->listEntryGroups($formattedParent);
/** @var EntryGroup $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());
}
}
/**
* 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::locationName('[PROJECT]', '[LOCATION]');
list_entry_groups_sample($formattedParent);
}
listTags
Lists tags assigned to an Entry.
The columns in the response are lowercased.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The name of the Data Catalog resource to list the tags of. The resource can be an Entry
or an EntryGroup
(without |
optionalArgs |
array
Optional. |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\Tag;
/**
* @param string $formattedParent The name of the Data Catalog resource to list the tags of.
*
* The resource can be an [Entry][google.cloud.datacatalog.v1.Entry]
* or an [EntryGroup][google.cloud.datacatalog.v1.EntryGroup]
* (without `/entries/{entries}` at the end). Please see
* {@see DataCatalogClient::entryName()} for help formatting this field.
*/
function list_tags_sample(string $formattedParent): void
{
// Create a client.
$dataCatalogClient = new DataCatalogClient();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $dataCatalogClient->listTags($formattedParent);
/** @var Tag $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());
}
}
/**
* 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]'
);
list_tags_sample($formattedParent);
}
lookupEntry
Gets an entry by its target resource name.
The resource name comes from the source Google Cloud Platform service.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ linkedResource |
string
The full name of the Google Cloud Platform resource the Data Catalog entry represents. For more information, see Full Resource Name. Full names are case-sensitive. For example: * |
↳ sqlResource |
string
The SQL name of the entry. SQL names are case-sensitive. Examples: * |
↳ fullyQualifiedName |
string
Fully qualified name (FQN) of the resource. FQNs take two forms: * For non-regionalized resources: |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\DataCatalog\V1\Entry |
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\Entry;
/**
* 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 lookup_entry_sample(): void
{
// Create a client.
$dataCatalogClient = new DataCatalogClient();
// Call the API and handle any network failures.
try {
/** @var Entry $response */
$response = $dataCatalogClient->lookupEntry();
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
modifyEntryContacts
Modifies contacts, part of the business context of an Entry.
To call this method, you must have the datacatalog.entries.updateContacts
IAM permission on the corresponding project.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The full resource name of the entry. |
contacts |
Google\Cloud\DataCatalog\V1\Contacts
Required. The new value for the Contacts. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\DataCatalog\V1\Contacts |
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\Contacts;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
/**
* @param string $formattedName The full resource name of the entry. Please see
* {@see DataCatalogClient::entryName()} for help formatting this field.
*/
function modify_entry_contacts_sample(string $formattedName): void
{
// Create a client.
$dataCatalogClient = new DataCatalogClient();
// Prepare any non-scalar elements to be passed along with the request.
$contacts = new Contacts();
// Call the API and handle any network failures.
try {
/** @var Contacts $response */
$response = $dataCatalogClient->modifyEntryContacts($formattedName, $contacts);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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 = DataCatalogClient::entryName(
'[PROJECT]',
'[LOCATION]',
'[ENTRY_GROUP]',
'[ENTRY]'
);
modify_entry_contacts_sample($formattedName);
}
modifyEntryOverview
Modifies entry overview, part of the business context of an Entry.
To call this method, you must have the datacatalog.entries.updateOverview
IAM permission on the corresponding project.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The full resource name of the entry. |
entryOverview |
Google\Cloud\DataCatalog\V1\EntryOverview
Required. The new value for the Entry Overview. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\DataCatalog\V1\EntryOverview |
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\EntryOverview;
/**
* @param string $formattedName The full resource name of the entry. Please see
* {@see DataCatalogClient::entryName()} for help formatting this field.
*/
function modify_entry_overview_sample(string $formattedName): void
{
// Create a client.
$dataCatalogClient = new DataCatalogClient();
// Prepare any non-scalar elements to be passed along with the request.
$entryOverview = new EntryOverview();
// Call the API and handle any network failures.
try {
/** @var EntryOverview $response */
$response = $dataCatalogClient->modifyEntryOverview($formattedName, $entryOverview);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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 = DataCatalogClient::entryName(
'[PROJECT]',
'[LOCATION]',
'[ENTRY_GROUP]',
'[ENTRY]'
);
modify_entry_overview_sample($formattedName);
}
renameTagTemplateField
Renames a field in a tag template.
You must enable the Data Catalog API in the project identified by the
name
parameter. For more information, see Data Catalog resource project.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the tag template field. |
newTagTemplateFieldId |
string
Required. The new ID of this tag template field. For example, |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\DataCatalog\V1\TagTemplateField |
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\TagTemplateField;
/**
* @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`.
*/
function rename_tag_template_field_sample(
string $formattedName,
string $newTagTemplateFieldId
): void {
// Create a client.
$dataCatalogClient = new DataCatalogClient();
// Call the API and handle any network failures.
try {
/** @var TagTemplateField $response */
$response = $dataCatalogClient->renameTagTemplateField($formattedName, $newTagTemplateFieldId);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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 = DataCatalogClient::tagTemplateFieldName(
'[PROJECT]',
'[LOCATION]',
'[TAG_TEMPLATE]',
'[FIELD]'
);
$newTagTemplateFieldId = '[NEW_TAG_TEMPLATE_FIELD_ID]';
rename_tag_template_field_sample($formattedName, $newTagTemplateFieldId);
}
renameTagTemplateFieldEnumValue
Renames an enum value in a tag template.
Within a single enum field, enum values must be unique.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the enum field value. |
newEnumValueDisplayName |
string
Required. The new display name of the enum value. For example, |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\DataCatalog\V1\TagTemplateField |
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\TagTemplateField;
/**
* @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`.
*/
function rename_tag_template_field_enum_value_sample(
string $formattedName,
string $newEnumValueDisplayName
): void {
// Create a client.
$dataCatalogClient = new DataCatalogClient();
// Call the API and handle any network failures.
try {
/** @var TagTemplateField $response */
$response = $dataCatalogClient->renameTagTemplateFieldEnumValue(
$formattedName,
$newEnumValueDisplayName
);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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 = DataCatalogClient::tagTemplateFieldEnumValueName(
'[PROJECT]',
'[LOCATION]',
'[TAG_TEMPLATE]',
'[TAG_TEMPLATE_FIELD_ID]',
'[ENUM_VALUE_DISPLAY_NAME]'
);
$newEnumValueDisplayName = '[NEW_ENUM_VALUE_DISPLAY_NAME]';
rename_tag_template_field_enum_value_sample($formattedName, $newEnumValueDisplayName);
}
searchCatalog
Searches Data Catalog for multiple resources like entries and tags that match a query.
This is a Custom Method that doesn't return all information on a resource, only its ID and high level fields. To get more information, you can subsequently call specific get methods.
Note: Data Catalog search queries don't guarantee full recall. Results that match your query might not be returned, even in subsequent result pages. Additionally, returned (and not returned) results can vary if you repeat search queries.
For more information, see Data Catalog search syntax.
Parameters | |
---|---|
Name | Description |
scope |
Google\Cloud\DataCatalog\V1\SearchCatalogRequest\Scope
Required. The scope of this search request. The |
query |
string
Optional. The query string with a minimum of 3 characters and specific syntax. For more information, see Data Catalog search syntax. An empty query string returns all data assets (in the specified scope) that you have access to. A query string can be a simple
|
optionalArgs |
array
Optional. |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ orderBy |
string
Specifies the order of results. Currently supported case-sensitive values are: * |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\SearchCatalogRequest\Scope;
use Google\Cloud\DataCatalog\V1\SearchCatalogResult;
/**
* @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)
* that you have access to.
*
* A query string can be a simple `xyz` or qualified by predicates:
*
* * `name:x`
* * `column:y`
* * `description:z`
*/
function search_catalog_sample(string $query): void
{
// Create a client.
$dataCatalogClient = new DataCatalogClient();
// Prepare any non-scalar elements to be passed along with the request.
$scope = new Scope();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $dataCatalogClient->searchCatalog($scope, $query);
/** @var SearchCatalogResult $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());
}
}
/**
* 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
{
$query = '[QUERY]';
search_catalog_sample($query);
}
setIamPolicy
Sets an access control policy for a resource. Replaces any existing policy.
Supported resources are:
- Tag templates
- Entry groups
Note: This method sets policies only within Data Catalog and can't be used to manage policies in BigQuery, Pub/Sub, Dataproc Metastore, and any external Google Cloud Platform resources synced with the Data Catalog.
To call this method, you must have the following Google IAM permissions:
datacatalog.tagTemplates.setIamPolicy
to set policies on tag templates.datacatalog.entryGroups.setIamPolicy
to set policies on entry groups.
Parameters | |
---|---|
Name | Description |
resource |
string
REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field. |
policy |
Google\Cloud\Iam\V1\Policy
REQUIRED: The complete policy to be applied to the |
optionalArgs |
array
Optional. |
↳ updateMask |
FieldMask
OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only the fields in the mask will be modified. If no mask is provided, the following default mask is used: |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Iam\V1\Policy |
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
use Google\Cloud\Iam\V1\Policy;
/**
* @param string $resource REQUIRED: The resource for which the policy is being specified.
* See the operation documentation for the appropriate value for this field.
*/
function set_iam_policy_sample(string $resource): void
{
// Create a client.
$dataCatalogClient = new DataCatalogClient();
// Prepare any non-scalar elements to be passed along with the request.
$policy = new Policy();
// Call the API and handle any network failures.
try {
/** @var Policy $response */
$response = $dataCatalogClient->setIamPolicy($resource, $policy);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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
{
$resource = '[RESOURCE]';
set_iam_policy_sample($resource);
}
starEntry
Marks an Entry as starred by the current user. Starring information is private to each user.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the entry to mark as starred. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\DataCatalog\V1\StarEntryResponse |
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\StarEntryResponse;
/**
* @param string $formattedName The name of the entry to mark as starred. Please see
* {@see DataCatalogClient::entryName()} for help formatting this field.
*/
function star_entry_sample(string $formattedName): void
{
// Create a client.
$dataCatalogClient = new DataCatalogClient();
// Call the API and handle any network failures.
try {
/** @var StarEntryResponse $response */
$response = $dataCatalogClient->starEntry($formattedName);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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 = DataCatalogClient::entryName(
'[PROJECT]',
'[LOCATION]',
'[ENTRY_GROUP]',
'[ENTRY]'
);
star_entry_sample($formattedName);
}
testIamPermissions
Gets your permissions on a resource.
Returns an empty set of permissions if the resource doesn't exist.
Supported resources are:
- Tag templates
- Entry groups
Note: This method gets policies only within Data Catalog and can't be used to get policies from BigQuery, Pub/Sub, Dataproc Metastore, and any external Google Cloud Platform resources ingested into Data Catalog.
No Google IAM permissions are required to call this method.
Parameters | |
---|---|
Name | Description |
resource |
string
REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field. |
permissions |
string[]
The set of permissions to check for the |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Iam\V1\TestIamPermissionsResponse |
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
use Google\Cloud\Iam\V1\TestIamPermissionsResponse;
/**
* @param string $resource REQUIRED: The resource for which the policy detail is being requested.
* See the operation documentation for the appropriate value for this field.
* @param string $permissionsElement The set of permissions to check for the `resource`. Permissions with
* wildcards (such as '*' or 'storage.*') are not allowed. For more
* information see
* [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
*/
function test_iam_permissions_sample(string $resource, string $permissionsElement): void
{
// Create a client.
$dataCatalogClient = new DataCatalogClient();
// Prepare any non-scalar elements to be passed along with the request.
$permissions = [$permissionsElement,];
// Call the API and handle any network failures.
try {
/** @var TestIamPermissionsResponse $response */
$response = $dataCatalogClient->testIamPermissions($resource, $permissions);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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
{
$resource = '[RESOURCE]';
$permissionsElement = '[PERMISSIONS]';
test_iam_permissions_sample($resource, $permissionsElement);
}
unstarEntry
Marks an Entry as NOT starred by the current user. Starring information is private to each user.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the entry to mark as not starred. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\DataCatalog\V1\UnstarEntryResponse |
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\UnstarEntryResponse;
/**
* @param string $formattedName The name of the entry to mark as **not** starred. Please see
* {@see DataCatalogClient::entryName()} for help formatting this field.
*/
function unstar_entry_sample(string $formattedName): void
{
// Create a client.
$dataCatalogClient = new DataCatalogClient();
// Call the API and handle any network failures.
try {
/** @var UnstarEntryResponse $response */
$response = $dataCatalogClient->unstarEntry($formattedName);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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 = DataCatalogClient::entryName(
'[PROJECT]',
'[LOCATION]',
'[ENTRY_GROUP]',
'[ENTRY]'
);
unstar_entry_sample($formattedName);
}
updateEntry
Updates an existing entry.
You must enable the Data Catalog API in the project identified by
the entry.name
parameter. For more information, see Data Catalog
resource
project.
Parameters | |
---|---|
Name | Description |
entry |
Google\Cloud\DataCatalog\V1\Entry
Required. Updates for the entry. The |
optionalArgs |
array
Optional. |
↳ updateMask |
FieldMask
Names of fields whose values to overwrite on an entry. If this parameter is absent or empty, all modifiable fields are overwritten. If such fields are non-required and omitted in the request body, their values are emptied. You can modify only the fields listed below. For entries with type |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\DataCatalog\V1\Entry |
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\Entry;
/**
* 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 update_entry_sample(): void
{
// Create a client.
$dataCatalogClient = new DataCatalogClient();
// Prepare any non-scalar elements to be passed along with the request.
$entry = new Entry();
// Call the API and handle any network failures.
try {
/** @var Entry $response */
$response = $dataCatalogClient->updateEntry($entry);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
updateEntryGroup
Updates an entry group.
You must enable the Data Catalog API in the project identified by
the entry_group.name
parameter. For more information, see Data Catalog
resource
project.
Parameters | |
---|---|
Name | Description |
entryGroup |
Google\Cloud\DataCatalog\V1\EntryGroup
Required. Updates for the entry group. The |
optionalArgs |
array
Optional. |
↳ updateMask |
FieldMask
Names of fields whose values to overwrite on an entry group. If this parameter is absent or empty, all modifiable fields are overwritten. If such fields are non-required and omitted in the request body, their values are emptied. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\DataCatalog\V1\EntryGroup |
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\EntryGroup;
/**
* 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 update_entry_group_sample(): void
{
// Create a client.
$dataCatalogClient = new DataCatalogClient();
// Prepare any non-scalar elements to be passed along with the request.
$entryGroup = new EntryGroup();
// Call the API and handle any network failures.
try {
/** @var EntryGroup $response */
$response = $dataCatalogClient->updateEntryGroup($entryGroup);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
updateTag
Updates an existing tag.
Parameters | |
---|---|
Name | Description |
tag |
Google\Cloud\DataCatalog\V1\Tag
Required. The updated tag. The "name" field must be set. |
optionalArgs |
array
Optional. |
↳ updateMask |
FieldMask
Names of fields whose values to overwrite on a tag. Currently, a tag has the only modifiable field with the name |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\DataCatalog\V1\Tag |
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\Tag;
/**
* @param string $tagTemplate The resource name of the tag template this tag uses. Example:
*
* `projects/{PROJECT_ID}/locations/{LOCATION}/tagTemplates/{TAG_TEMPLATE_ID}`
*
* This field cannot be modified after creation.
*/
function update_tag_sample(string $tagTemplate): void
{
// Create a client.
$dataCatalogClient = new DataCatalogClient();
// Prepare any non-scalar elements to be passed along with the request.
$tagFields = [];
$tag = (new Tag())
->setTemplate($tagTemplate)
->setFields($tagFields);
// Call the API and handle any network failures.
try {
/** @var Tag $response */
$response = $dataCatalogClient->updateTag($tag);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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
{
$tagTemplate = '[TEMPLATE]';
update_tag_sample($tagTemplate);
}
updateTagTemplate
Updates a tag template.
You can't update template fields with this method. These fields are separate resources with their own create, update, and delete methods.
You must enable the Data Catalog API in the project identified by
the tag_template.name
parameter. For more information, see Data Catalog
resource
project.
Parameters | |
---|---|
Name | Description |
tagTemplate |
Google\Cloud\DataCatalog\V1\TagTemplate
Required. The template to update. The |
optionalArgs |
array
Optional. |
↳ updateMask |
FieldMask
Names of fields whose values to overwrite on a tag template. Currently, only |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\DataCatalog\V1\TagTemplate |
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\TagTemplate;
/**
* 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 update_tag_template_sample(): void
{
// Create a client.
$dataCatalogClient = new DataCatalogClient();
// Prepare any non-scalar elements to be passed along with the request.
$tagTemplateFields = [];
$tagTemplate = (new TagTemplate())
->setFields($tagTemplateFields);
// Call the API and handle any network failures.
try {
/** @var TagTemplate $response */
$response = $dataCatalogClient->updateTagTemplate($tagTemplate);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
updateTagTemplateField
Updates a field in a tag template.
You can't update the field type with this method.
You must enable the Data Catalog API in the project
identified by the name
parameter. For more information, see Data Catalog
resource
project.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the tag template field. |
tagTemplateField |
Google\Cloud\DataCatalog\V1\TagTemplateField
Required. The template to update. |
optionalArgs |
array
Optional. |
↳ updateMask |
FieldMask
Optional. Names of fields whose values to overwrite on an individual field of a tag template. The following fields are modifiable: * |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\DataCatalog\V1\TagTemplateField |
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\FieldType;
use Google\Cloud\DataCatalog\V1\TagTemplateField;
/**
* @param string $formattedName The name of the tag template field. Please see
* {@see DataCatalogClient::tagTemplateFieldName()} for help formatting this field.
*/
function update_tag_template_field_sample(string $formattedName): void
{
// Create a client.
$dataCatalogClient = new DataCatalogClient();
// Prepare any non-scalar elements to be passed along with the request.
$tagTemplateFieldType = new FieldType();
$tagTemplateField = (new TagTemplateField())
->setType($tagTemplateFieldType);
// Call the API and handle any network failures.
try {
/** @var TagTemplateField $response */
$response = $dataCatalogClient->updateTagTemplateField($formattedName, $tagTemplateField);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* 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 = DataCatalogClient::tagTemplateFieldName(
'[PROJECT]',
'[LOCATION]',
'[TAG_TEMPLATE]',
'[FIELD]'
);
update_tag_template_field_sample($formattedName);
}
Constants
SERVICE_NAME
Value: 'google.cloud.datacatalog.v1.DataCatalog'
The name of the service.
SERVICE_ADDRESS
Value: 'datacatalog.googleapis.com'
The default address of the service.
DEFAULT_SERVICE_PORT
Value: 443
The default port of the service.
CODEGEN_NAME
Value: 'gapic'
The name of the code generator, to be included in the agent header.