Google Cloud Data Catalog V1 Client - Class DataCatalogClient (1.3.9)

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
NameDescription
project string
location string
entryGroup string
entry string
Returns
TypeDescription
stringThe formatted entry resource.

entryGroupName

Formats a string containing the fully-qualified path to represent a entry_group resource.

Parameters
NameDescription
project string
location string
entryGroup string
Returns
TypeDescription
stringThe formatted entry_group resource.

locationName

Formats a string containing the fully-qualified path to represent a location resource.

Parameters
NameDescription
project string
location string
Returns
TypeDescription
stringThe formatted location resource.

tagName

Formats a string containing the fully-qualified path to represent a tag resource.

Parameters
NameDescription
project string
location string
entryGroup string
entry string
tag string
Returns
TypeDescription
stringThe formatted tag resource.

tagTemplateName

Formats a string containing the fully-qualified path to represent a tag_template resource.

Parameters
NameDescription
project string
location string
tagTemplate string
Returns
TypeDescription
stringThe formatted tag_template resource.

tagTemplateFieldName

Formats a string containing the fully-qualified path to represent a tag_template_field resource.

Parameters
NameDescription
project string
location string
tagTemplate string
field string
Returns
TypeDescription
stringThe formatted tag_template_field resource.

tagTemplateFieldEnumValueName

Formats a string containing the fully-qualified path to represent a tag_template_field_enum_value resource.

Parameters
NameDescription
project string
location string
tagTemplate string
tagTemplateFieldId string
enumValueDisplayName string
Returns
TypeDescription
stringThe 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
NameDescription
formattedName string

The formatted name string

template string

Optional name of template to match

Returns
TypeDescription
arrayAn associative array from name component IDs to component values.

__construct

Constructor.

Parameters
NameDescription
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 false.

↳ 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 rest or grpc. Defaults to grpc if gRPC support is detected on the system. Advanced usage: Additionally, it is possible to pass in an already instantiated Google\ApiCore\Transport\TransportInterface object. Note that when this object is provided, any settings in $transportConfig, and any $apiEndpoint setting, will be ignored.

↳ 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
NameDescription
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
TypeDescription
Google\Cloud\DataCatalog\V1\Entry
Example
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
NameDescription
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
TypeDescription
Google\Cloud\DataCatalog\V1\EntryGroup
Example
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
NameDescription
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
TypeDescription
Google\Cloud\DataCatalog\V1\Tag
Example
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
NameDescription
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
TypeDescription
Google\Cloud\DataCatalog\V1\TagTemplate
Example
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
NameDescription
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
TypeDescription
Google\Cloud\DataCatalog\V1\TagTemplateField
Example
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
NameDescription
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.

Example
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
NameDescription
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.

Example
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
NameDescription
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.

Example
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
NameDescription
name string

Required. The name of the tag template to delete.

force bool

Required. If true, deletes all tags that use this template.

Currently, true is the only supported value.

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.

Example
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
NameDescription
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, true is the only supported value.

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.

Example
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
NameDescription
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
TypeDescription
Google\Cloud\DataCatalog\V1\Entry
Example
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
NameDescription
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
TypeDescription
Google\Cloud\DataCatalog\V1\EntryGroup
Example
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:

  • ANOT_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
NameDescription
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 GetPolicyOptions object for specifying options to GetIamPolicy.

↳ 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
TypeDescription
Google\Cloud\Iam\V1\Policy
Example
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
NameDescription
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
TypeDescription
Google\Cloud\DataCatalog\V1\TagTemplate
Example
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
NameDescription
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 name field, set read_mask to only one path with the name value.

↳ 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
TypeDescription
Google\ApiCore\PagedListResponse
Example
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
NameDescription
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
TypeDescription
Google\ApiCore\PagedListResponse
Example
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
NameDescription
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 /entries/{entries} at the end).

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
TypeDescription
Google\ApiCore\PagedListResponse
Example
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
NameDescription
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: * //bigquery.googleapis.com/projects/{PROJECT_ID}/datasets/{DATASET_ID}/tables/{TABLE_ID} * //pubsub.googleapis.com/projects/{PROJECT_ID}/topics/{TOPIC_ID}

↳ sqlResource string

The SQL name of the entry. SQL names are case-sensitive. Examples: * pubsub.topic.{PROJECT_ID}.{TOPIC_ID} * pubsub.topic.{PROJECT_ID}.`{TOPIC.ID.SEPARATED.WITH.DOTS}` * bigquery.table.{PROJECT_ID}.{DATASET_ID}.{TABLE_ID} * bigquery.dataset.{PROJECT_ID}.{DATASET_ID} * datacatalog.entry.{PROJECT_ID}.{LOCATION_ID}.{ENTRY_GROUP_ID}.{ENTRY_ID} Identifiers (*_ID) should comply with the Lexical structure in Standard SQL.

↳ fullyQualifiedName string

Fully qualified name (FQN) of the resource. FQNs take two forms: * For non-regionalized resources: {SYSTEM}:{PROJECT}.{PATH_TO_RESOURCE_SEPARATED_WITH_DOTS} * For regionalized resources: {SYSTEM}:{PROJECT}.{LOCATION_ID}.{PATH_TO_RESOURCE_SEPARATED_WITH_DOTS} Example for a DPMS table: dataproc_metastore:{PROJECT_ID}.{LOCATION_ID}.{INSTANCE_ID}.{DATABASE_ID}.{TABLE_ID}

↳ 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
TypeDescription
Google\Cloud\DataCatalog\V1\Entry
Example
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
NameDescription
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
TypeDescription
Google\Cloud\DataCatalog\V1\Contacts
Example
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
NameDescription
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
TypeDescription
Google\Cloud\DataCatalog\V1\EntryOverview
Example
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
NameDescription
name string

Required. The name of the tag template field.

newTagTemplateFieldId string

Required. The new ID of this tag template field. For example, my_new_field.

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
TypeDescription
Google\Cloud\DataCatalog\V1\TagTemplateField
Example
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
NameDescription
name string

Required. The name of the enum field value.

newEnumValueDisplayName string

Required. The new display name of the enum value. For example, my_new_enum_value.

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
TypeDescription
Google\Cloud\DataCatalog\V1\TagTemplateField
Example
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
NameDescription
scope Google\Cloud\DataCatalog\V1\SearchCatalogRequest\Scope

Required. The scope of this search request.

The scope is invalid if include_org_ids, include_project_ids are empty AND include_gcp_public_datasets is set to false. In this case, the request returns an error.

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 xyz or qualified by predicates:

  • name:x
  • column:y
  • description:z
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: * relevance that can only be descending * last_modified_timestamp [asc|desc] with descending (desc) as default * default that can only be descending If this parameter is omitted, it defaults to the descending relevance.

↳ 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
TypeDescription
Google\ApiCore\PagedListResponse
Example
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
NameDescription
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 resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.

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: paths: "bindings, etag"

↳ 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
TypeDescription
Google\Cloud\Iam\V1\Policy
Example
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
NameDescription
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
TypeDescription
Google\Cloud\DataCatalog\V1\StarEntryResponse
Example
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
NameDescription
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 resource. Permissions with wildcards (such as '' or 'storage.') are not allowed. For more information see IAM 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
TypeDescription
Google\Cloud\Iam\V1\TestIamPermissionsResponse
Example
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
NameDescription
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
TypeDescription
Google\Cloud\DataCatalog\V1\UnstarEntryResponse
Example
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
NameDescription
entry Google\Cloud\DataCatalog\V1\Entry

Required. Updates for the entry. The name field must be set.

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 DATA_STREAM: * schema For entries with type FILESET: * schema * display_name * description * gcs_fileset_spec * gcs_fileset_spec.file_patterns For entries with user_specified_type: * schema * display_name * description * user_specified_type * user_specified_system * linked_resource * source_system_timestamps

↳ 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
TypeDescription
Google\Cloud\DataCatalog\V1\Entry
Example
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
NameDescription
entryGroup Google\Cloud\DataCatalog\V1\EntryGroup

Required. Updates for the entry group. The name field must be set.

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
TypeDescription
Google\Cloud\DataCatalog\V1\EntryGroup
Example
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
NameDescription
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 fields. In general, 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
TypeDescription
Google\Cloud\DataCatalog\V1\Tag
Example
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
NameDescription
tagTemplate Google\Cloud\DataCatalog\V1\TagTemplate

Required. The template to update. The name field must be set.

optionalArgs array

Optional.

↳ updateMask FieldMask

Names of fields whose values to overwrite on a tag template. Currently, only display_name and is_publicly_readable can be overwritten. 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. Note: Updating the is_publicly_readable field may require up to 12 hours to take effect in search results.

↳ 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
TypeDescription
Google\Cloud\DataCatalog\V1\TagTemplate
Example
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
NameDescription
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: * display_name * type.enum_type * is_required 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 with one exception: when updating an enum type, the provided values are merged with the existing values. Therefore, enum values can only be added, existing enum values cannot be deleted or renamed. Additionally, updating a template field from optional to required is not allowed.

↳ 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
TypeDescription
Google\Cloud\DataCatalog\V1\TagTemplateField
Example
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.