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

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.

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.

Namespace

Google \ Cloud \ DataCatalog \ V1 \ Client

Methods

__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.

The async variant is Google\Cloud\DataCatalog\V1\Client\DataCatalogClient::createEntryAsync() .

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\CreateEntryRequest

A request to house fields associated with the call.

callOptions 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\Client\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\CreateEntryRequest;
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 the request message.
    $entry = new Entry();
    $request = (new CreateEntryRequest())
        ->setParent($formattedParent)
        ->setEntryId($entryId)
        ->setEntry($entry);

    // Call the API and handle any network failures.
    try {
        /** @var Entry $response */
        $response = $dataCatalogClient->createEntry($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = 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.

The async variant is Google\Cloud\DataCatalog\V1\Client\DataCatalogClient::createEntryGroupAsync() .

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\CreateEntryGroupRequest

A request to house fields associated with the call.

callOptions 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\EntryGroup
Example
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\Client\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\CreateEntryGroupRequest;
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();

    // Prepare the request message.
    $request = (new CreateEntryGroupRequest())
        ->setParent($formattedParent)
        ->setEntryGroupId($entryGroupId);

    // Call the API and handle any network failures.
    try {
        /** @var EntryGroup $response */
        $response = $dataCatalogClient->createEntryGroup($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = 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.

The async variant is Google\Cloud\DataCatalog\V1\Client\DataCatalogClient::createTagAsync() .

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\CreateTagRequest

A request to house fields associated with the call.

callOptions 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\Client\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\CreateTagRequest;
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 the request message.
    $tagFields = [];
    $tag = (new Tag())
        ->setTemplate($tagTemplate)
        ->setFields($tagFields);
    $request = (new CreateTagRequest())
        ->setParent($formattedParent)
        ->setTag($tag);

    // Call the API and handle any network failures.
    try {
        /** @var Tag $response */
        $response = $dataCatalogClient->createTag($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = 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.

The async variant is Google\Cloud\DataCatalog\V1\Client\DataCatalogClient::createTagTemplateAsync() .

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\CreateTagTemplateRequest

A request to house fields associated with the call.

callOptions 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\Client\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\CreateTagTemplateRequest;
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 the request message.
    $tagTemplateFields = [];
    $tagTemplate = (new TagTemplate())
        ->setFields($tagTemplateFields);
    $request = (new CreateTagTemplateRequest())
        ->setParent($formattedParent)
        ->setTagTemplateId($tagTemplateId)
        ->setTagTemplate($tagTemplate);

    // Call the API and handle any network failures.
    try {
        /** @var TagTemplate $response */
        $response = $dataCatalogClient->createTagTemplate($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = 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.

The async variant is Google\Cloud\DataCatalog\V1\Client\DataCatalogClient::createTagTemplateFieldAsync() .

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\CreateTagTemplateFieldRequest

A request to house fields associated with the call.

callOptions 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\Client\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\CreateTagTemplateFieldRequest;
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 the request message.
    $tagTemplateFieldType = new FieldType();
    $tagTemplateField = (new TagTemplateField())
        ->setType($tagTemplateFieldType);
    $request = (new CreateTagTemplateFieldRequest())
        ->setParent($formattedParent)
        ->setTagTemplateFieldId($tagTemplateFieldId)
        ->setTagTemplateField($tagTemplateField);

    // Call the API and handle any network failures.
    try {
        /** @var TagTemplateField $response */
        $response = $dataCatalogClient->createTagTemplateField($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = 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.

The async variant is Google\Cloud\DataCatalog\V1\Client\DataCatalogClient::deleteEntryAsync() .

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\DeleteEntryRequest

A request to house fields associated with the call.

callOptions 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\Client\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\DeleteEntryRequest;

/**
 * @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();

    // Prepare the request message.
    $request = (new DeleteEntryRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        $dataCatalogClient->deleteEntry($request);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = 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.

The async variant is Google\Cloud\DataCatalog\V1\Client\DataCatalogClient::deleteEntryGroupAsync() .

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\DeleteEntryGroupRequest

A request to house fields associated with the call.

callOptions 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\Client\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\DeleteEntryGroupRequest;

/**
 * @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();

    // Prepare the request message.
    $request = (new DeleteEntryGroupRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        $dataCatalogClient->deleteEntryGroup($request);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = DataCatalogClient::entryGroupName('[PROJECT]', '[LOCATION]', '[ENTRY_GROUP]');

    delete_entry_group_sample($formattedName);
}

deleteTag

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\DeleteTagRequest

A request to house fields associated with the call.

callOptions 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\Client\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\DeleteTagRequest;

/**
 * @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();

    // Prepare the request message.
    $request = (new DeleteTagRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        $dataCatalogClient->deleteTag($request);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = 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.

The async variant is Google\Cloud\DataCatalog\V1\Client\DataCatalogClient::deleteTagTemplateAsync() .

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\DeleteTagTemplateRequest

A request to house fields associated with the call.

callOptions 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\Client\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\DeleteTagTemplateRequest;

/**
 * @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();

    // Prepare the request message.
    $request = (new DeleteTagTemplateRequest())
        ->setName($formattedName)
        ->setForce($force);

    // Call the API and handle any network failures.
    try {
        $dataCatalogClient->deleteTagTemplate($request);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = 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.

The async variant is Google\Cloud\DataCatalog\V1\Client\DataCatalogClient::deleteTagTemplateFieldAsync() .

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\DeleteTagTemplateFieldRequest

A request to house fields associated with the call.

callOptions 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\Client\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\DeleteTagTemplateFieldRequest;

/**
 * @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();

    // Prepare the request message.
    $request = (new DeleteTagTemplateFieldRequest())
        ->setName($formattedName)
        ->setForce($force);

    // Call the API and handle any network failures.
    try {
        $dataCatalogClient->deleteTagTemplateField($request);
        printf('Call completed successfully.' . PHP_EOL);
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = DataCatalogClient::tagTemplateFieldName(
        '[PROJECT]',
        '[LOCATION]',
        '[TAG_TEMPLATE]',
        '[FIELD]'
    );
    $force = false;

    delete_tag_template_field_sample($formattedName, $force);
}

getEntry

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\GetEntryRequest

A request to house fields associated with the call.

callOptions 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\Client\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\Entry;
use Google\Cloud\DataCatalog\V1\GetEntryRequest;

/**
 * @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();

    // Prepare the request message.
    $request = (new GetEntryRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var Entry $response */
        $response = $dataCatalogClient->getEntry($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = DataCatalogClient::entryName(
        '[PROJECT]',
        '[LOCATION]',
        '[ENTRY_GROUP]',
        '[ENTRY]'
    );

    get_entry_sample($formattedName);
}

getEntryGroup

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\GetEntryGroupRequest

A request to house fields associated with the call.

callOptions 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\EntryGroup
Example
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\Client\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\EntryGroup;
use Google\Cloud\DataCatalog\V1\GetEntryGroupRequest;

/**
 * @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();

    // Prepare the request message.
    $request = (new GetEntryGroupRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var EntryGroup $response */
        $response = $dataCatalogClient->getEntryGroup($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = 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.

The async variant is Google\Cloud\DataCatalog\V1\Client\DataCatalogClient::getIamPolicyAsync() .

Parameters
NameDescription
request Google\Cloud\Iam\V1\GetIamPolicyRequest

A request to house fields associated with the call.

callOptions 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\Policy
Example
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\Client\DataCatalogClient;
use Google\Cloud\Iam\V1\GetIamPolicyRequest;
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();

    // Prepare the request message.
    $request = (new GetIamPolicyRequest())
        ->setResource($resource);

    // Call the API and handle any network failures.
    try {
        /** @var Policy $response */
        $response = $dataCatalogClient->getIamPolicy($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $resource = '[RESOURCE]';

    get_iam_policy_sample($resource);
}

getTagTemplate

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\GetTagTemplateRequest

A request to house fields associated with the call.

callOptions 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\Client\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\GetTagTemplateRequest;
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();

    // Prepare the request message.
    $request = (new GetTagTemplateRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var TagTemplate $response */
        $response = $dataCatalogClient->getTagTemplate($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = DataCatalogClient::tagTemplateName('[PROJECT]', '[LOCATION]', '[TAG_TEMPLATE]');

    get_tag_template_sample($formattedName);
}

importEntries

Imports entries from a source, such as data previously dumped into a Cloud Storage bucket, into Data Catalog. Import of entries is a sync operation that reconciles the state of the third-party system with the Data Catalog.

ImportEntries accepts source data snapshots of a third-party system. Snapshot should be delivered as a .wire or base65-encoded .txt file containing a sequence of Protocol Buffer messages of DumpItem type.

ImportEntries returns a long-running operation resource that can be queried with Operations.GetOperation to return ImportEntriesMetadata and an ImportEntriesResponse message.

The async variant is Google\Cloud\DataCatalog\V1\Client\DataCatalogClient::importEntriesAsync() .

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\ImportEntriesRequest

A request to house fields associated with the call.

callOptions 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\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\DataCatalog\V1\Client\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\ImportEntriesRequest;
use Google\Cloud\DataCatalog\V1\ImportEntriesResponse;
use Google\Rpc\Status;

/**
 * @param string $formattedParent Target entry group for ingested entries. Please see
 *                                {@see DataCatalogClient::entryGroupName()} for help formatting this field.
 */
function import_entries_sample(string $formattedParent): void
{
    // Create a client.
    $dataCatalogClient = new DataCatalogClient();

    // Prepare the request message.
    $request = (new ImportEntriesRequest())
        ->setParent($formattedParent);

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

        if ($response->operationSucceeded()) {
            /** @var ImportEntriesResponse $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = DataCatalogClient::entryGroupName('[PROJECT]', '[LOCATION]', '[ENTRY_GROUP]');

    import_entries_sample($formattedParent);
}

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.

The async variant is Google\Cloud\DataCatalog\V1\Client\DataCatalogClient::listEntriesAsync() .

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\ListEntriesRequest

A request to house fields associated with the call.

callOptions 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\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\DataCatalog\V1\Client\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\Entry;
use Google\Cloud\DataCatalog\V1\ListEntriesRequest;

/**
 * @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();

    // Prepare the request message.
    $request = (new ListEntriesRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $dataCatalogClient->listEntries($request);

        /** @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());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = DataCatalogClient::entryGroupName('[PROJECT]', '[LOCATION]', '[ENTRY_GROUP]');

    list_entries_sample($formattedParent);
}

listEntryGroups

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\ListEntryGroupsRequest

A request to house fields associated with the call.

callOptions 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\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\DataCatalog\V1\Client\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\EntryGroup;
use Google\Cloud\DataCatalog\V1\ListEntryGroupsRequest;

/**
 * @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();

    // Prepare the request message.
    $request = (new ListEntryGroupsRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $dataCatalogClient->listEntryGroups($request);

        /** @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());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = DataCatalogClient::locationName('[PROJECT]', '[LOCATION]');

    list_entry_groups_sample($formattedParent);
}

listTags

Lists tags assigned to an Entry.

The columns in the response are lowercased.

The async variant is Google\Cloud\DataCatalog\V1\Client\DataCatalogClient::listTagsAsync() .

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\ListTagsRequest

A request to house fields associated with the call.

callOptions 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\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\DataCatalog\V1\Client\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\ListTagsRequest;
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();

    // Prepare the request message.
    $request = (new ListTagsRequest())
        ->setParent($formattedParent);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $dataCatalogClient->listTags($request);

        /** @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());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = DataCatalogClient::entryName(
        '[PROJECT]',
        '[LOCATION]',
        '[ENTRY_GROUP]',
        '[ENTRY]'
    );

    list_tags_sample($formattedParent);
}

lookupEntry

Gets an entry by its target resource name.

The resource name comes from the source Google Cloud Platform service.

The async variant is Google\Cloud\DataCatalog\V1\Client\DataCatalogClient::lookupEntryAsync() .

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\LookupEntryRequest

A request to house fields associated with the call.

callOptions 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\Client\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\Entry;
use Google\Cloud\DataCatalog\V1\LookupEntryRequest;

/**
 * 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();

    // Prepare the request message.
    $request = new LookupEntryRequest();

    // Call the API and handle any network failures.
    try {
        /** @var Entry $response */
        $response = $dataCatalogClient->lookupEntry($request);
        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.

The async variant is Google\Cloud\DataCatalog\V1\Client\DataCatalogClient::modifyEntryContactsAsync() .

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\ModifyEntryContactsRequest

A request to house fields associated with the call.

callOptions 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\Client\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\Contacts;
use Google\Cloud\DataCatalog\V1\ModifyEntryContactsRequest;

/**
 * @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 the request message.
    $contacts = new Contacts();
    $request = (new ModifyEntryContactsRequest())
        ->setName($formattedName)
        ->setContacts($contacts);

    // Call the API and handle any network failures.
    try {
        /** @var Contacts $response */
        $response = $dataCatalogClient->modifyEntryContacts($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = 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.

The async variant is Google\Cloud\DataCatalog\V1\Client\DataCatalogClient::modifyEntryOverviewAsync() .

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\ModifyEntryOverviewRequest

A request to house fields associated with the call.

callOptions 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\Client\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\EntryOverview;
use Google\Cloud\DataCatalog\V1\ModifyEntryOverviewRequest;

/**
 * @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 the request message.
    $entryOverview = new EntryOverview();
    $request = (new ModifyEntryOverviewRequest())
        ->setName($formattedName)
        ->setEntryOverview($entryOverview);

    // Call the API and handle any network failures.
    try {
        /** @var EntryOverview $response */
        $response = $dataCatalogClient->modifyEntryOverview($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = DataCatalogClient::entryName(
        '[PROJECT]',
        '[LOCATION]',
        '[ENTRY_GROUP]',
        '[ENTRY]'
    );

    modify_entry_overview_sample($formattedName);
}

reconcileTags

ReconcileTags creates or updates a list of tags on the entry.

If the ReconcileTagsRequest.force_delete_missing parameter is set, the operation deletes tags not included in the input tag list.

ReconcileTags returns a long-running operation resource that can be queried with Operations.GetOperation to return ReconcileTagsMetadata and a ReconcileTagsResponse message.

The async variant is Google\Cloud\DataCatalog\V1\Client\DataCatalogClient::reconcileTagsAsync() .

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\ReconcileTagsRequest

A request to house fields associated with the call.

callOptions 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\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\DataCatalog\V1\Client\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\ReconcileTagsRequest;
use Google\Cloud\DataCatalog\V1\ReconcileTagsResponse;
use Google\Rpc\Status;

/**
 * @param string $formattedParent      Name of [Entry][google.cloud.datacatalog.v1.Entry] to be tagged. Please see
 *                                     {@see DataCatalogClient::entryName()} for help formatting this field.
 * @param string $formattedTagTemplate The name of the tag template, which is used for reconciliation. Please see
 *                                     {@see DataCatalogClient::tagTemplateName()} for help formatting this field.
 */
function reconcile_tags_sample(string $formattedParent, string $formattedTagTemplate): void
{
    // Create a client.
    $dataCatalogClient = new DataCatalogClient();

    // Prepare the request message.
    $request = (new ReconcileTagsRequest())
        ->setParent($formattedParent)
        ->setTagTemplate($formattedTagTemplate);

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

        if ($response->operationSucceeded()) {
            /** @var ReconcileTagsResponse $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = DataCatalogClient::entryName(
        '[PROJECT]',
        '[LOCATION]',
        '[ENTRY_GROUP]',
        '[ENTRY]'
    );
    $formattedTagTemplate = DataCatalogClient::tagTemplateName(
        '[PROJECT]',
        '[LOCATION]',
        '[TAG_TEMPLATE]'
    );

    reconcile_tags_sample($formattedParent, $formattedTagTemplate);
}

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.

The async variant is Google\Cloud\DataCatalog\V1\Client\DataCatalogClient::renameTagTemplateFieldAsync() .

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\RenameTagTemplateFieldRequest

A request to house fields associated with the call.

callOptions 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\Client\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\RenameTagTemplateFieldRequest;
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();

    // Prepare the request message.
    $request = (new RenameTagTemplateFieldRequest())
        ->setName($formattedName)
        ->setNewTagTemplateFieldId($newTagTemplateFieldId);

    // Call the API and handle any network failures.
    try {
        /** @var TagTemplateField $response */
        $response = $dataCatalogClient->renameTagTemplateField($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = 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.

The async variant is Google\Cloud\DataCatalog\V1\Client\DataCatalogClient::renameTagTemplateFieldEnumValueAsync() .

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\RenameTagTemplateFieldEnumValueRequest

A request to house fields associated with the call.

callOptions 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\Client\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\RenameTagTemplateFieldEnumValueRequest;
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();

    // Prepare the request message.
    $request = (new RenameTagTemplateFieldEnumValueRequest())
        ->setName($formattedName)
        ->setNewEnumValueDisplayName($newEnumValueDisplayName);

    // Call the API and handle any network failures.
    try {
        /** @var TagTemplateField $response */
        $response = $dataCatalogClient->renameTagTemplateFieldEnumValue($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = 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.

The async variant is Google\Cloud\DataCatalog\V1\Client\DataCatalogClient::searchCatalogAsync() .

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\SearchCatalogRequest

A request to house fields associated with the call.

callOptions 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\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\DataCatalog\V1\Client\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\SearchCatalogRequest;
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 the request message.
    $scope = new Scope();
    $request = (new SearchCatalogRequest())
        ->setScope($scope)
        ->setQuery($query);

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $dataCatalogClient->searchCatalog($request);

        /** @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());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $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.

The async variant is Google\Cloud\DataCatalog\V1\Client\DataCatalogClient::setIamPolicyAsync() .

Parameters
NameDescription
request Google\Cloud\Iam\V1\SetIamPolicyRequest

A request to house fields associated with the call.

callOptions 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\Policy
Example
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\Client\DataCatalogClient;
use Google\Cloud\Iam\V1\Policy;
use Google\Cloud\Iam\V1\SetIamPolicyRequest;

/**
 * @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 the request message.
    $policy = new Policy();
    $request = (new SetIamPolicyRequest())
        ->setResource($resource)
        ->setPolicy($policy);

    // Call the API and handle any network failures.
    try {
        /** @var Policy $response */
        $response = $dataCatalogClient->setIamPolicy($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $resource = '[RESOURCE]';

    set_iam_policy_sample($resource);
}

starEntry

Marks an Entry as starred by the current user. Starring information is private to each user.

The async variant is Google\Cloud\DataCatalog\V1\Client\DataCatalogClient::starEntryAsync() .

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\StarEntryRequest

A request to house fields associated with the call.

callOptions 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\Client\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\StarEntryRequest;
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();

    // Prepare the request message.
    $request = (new StarEntryRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var StarEntryResponse $response */
        $response = $dataCatalogClient->starEntry($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = 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.

The async variant is Google\Cloud\DataCatalog\V1\Client\DataCatalogClient::testIamPermissionsAsync() .

Parameters
NameDescription
request Google\Cloud\Iam\V1\TestIamPermissionsRequest

A request to house fields associated with the call.

callOptions 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\Client\DataCatalogClient;
use Google\Cloud\Iam\V1\TestIamPermissionsRequest;
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 the request message.
    $permissions = [$permissionsElement,];
    $request = (new TestIamPermissionsRequest())
        ->setResource($resource)
        ->setPermissions($permissions);

    // Call the API and handle any network failures.
    try {
        /** @var TestIamPermissionsResponse $response */
        $response = $dataCatalogClient->testIamPermissions($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $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.

The async variant is Google\Cloud\DataCatalog\V1\Client\DataCatalogClient::unstarEntryAsync() .

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\UnstarEntryRequest

A request to house fields associated with the call.

callOptions 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\Client\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\UnstarEntryRequest;
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();

    // Prepare the request message.
    $request = (new UnstarEntryRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var UnstarEntryResponse $response */
        $response = $dataCatalogClient->unstarEntry($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = 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.

The async variant is Google\Cloud\DataCatalog\V1\Client\DataCatalogClient::updateEntryAsync() .

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\UpdateEntryRequest

A request to house fields associated with the call.

callOptions 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\Client\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\Entry;
use Google\Cloud\DataCatalog\V1\UpdateEntryRequest;

/**
 * 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 the request message.
    $entry = new Entry();
    $request = (new UpdateEntryRequest())
        ->setEntry($entry);

    // Call the API and handle any network failures.
    try {
        /** @var Entry $response */
        $response = $dataCatalogClient->updateEntry($request);
        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.

The async variant is Google\Cloud\DataCatalog\V1\Client\DataCatalogClient::updateEntryGroupAsync() .

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\UpdateEntryGroupRequest

A request to house fields associated with the call.

callOptions 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\EntryGroup
Example
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\V1\Client\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\EntryGroup;
use Google\Cloud\DataCatalog\V1\UpdateEntryGroupRequest;

/**
 * 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 the request message.
    $entryGroup = new EntryGroup();
    $request = (new UpdateEntryGroupRequest())
        ->setEntryGroup($entryGroup);

    // Call the API and handle any network failures.
    try {
        /** @var EntryGroup $response */
        $response = $dataCatalogClient->updateEntryGroup($request);
        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.

The async variant is Google\Cloud\DataCatalog\V1\Client\DataCatalogClient::updateTagAsync() .

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\UpdateTagRequest

A request to house fields associated with the call.

callOptions 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\Client\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\Tag;
use Google\Cloud\DataCatalog\V1\UpdateTagRequest;

/**
 * @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 the request message.
    $tagFields = [];
    $tag = (new Tag())
        ->setTemplate($tagTemplate)
        ->setFields($tagFields);
    $request = (new UpdateTagRequest())
        ->setTag($tag);

    // Call the API and handle any network failures.
    try {
        /** @var Tag $response */
        $response = $dataCatalogClient->updateTag($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $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.

The async variant is Google\Cloud\DataCatalog\V1\Client\DataCatalogClient::updateTagTemplateAsync() .

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\UpdateTagTemplateRequest

A request to house fields associated with the call.

callOptions 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\Client\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\TagTemplate;
use Google\Cloud\DataCatalog\V1\UpdateTagTemplateRequest;

/**
 * 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 the request message.
    $tagTemplateFields = [];
    $tagTemplate = (new TagTemplate())
        ->setFields($tagTemplateFields);
    $request = (new UpdateTagTemplateRequest())
        ->setTagTemplate($tagTemplate);

    // Call the API and handle any network failures.
    try {
        /** @var TagTemplate $response */
        $response = $dataCatalogClient->updateTagTemplate($request);
        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.

The async variant is Google\Cloud\DataCatalog\V1\Client\DataCatalogClient::updateTagTemplateFieldAsync() .

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\UpdateTagTemplateFieldRequest

A request to house fields associated with the call.

callOptions 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\Client\DataCatalogClient;
use Google\Cloud\DataCatalog\V1\FieldType;
use Google\Cloud\DataCatalog\V1\TagTemplateField;
use Google\Cloud\DataCatalog\V1\UpdateTagTemplateFieldRequest;

/**
 * @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 the request message.
    $tagTemplateFieldType = new FieldType();
    $tagTemplateField = (new TagTemplateField())
        ->setType($tagTemplateFieldType);
    $request = (new UpdateTagTemplateFieldRequest())
        ->setName($formattedName)
        ->setTagTemplateField($tagTemplateField);

    // Call the API and handle any network failures.
    try {
        /** @var TagTemplateField $response */
        $response = $dataCatalogClient->updateTagTemplateField($request);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = DataCatalogClient::tagTemplateFieldName(
        '[PROJECT]',
        '[LOCATION]',
        '[TAG_TEMPLATE]',
        '[FIELD]'
    );

    update_tag_template_field_sample($formattedName);
}

createEntryAsync

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\CreateEntryRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

createEntryGroupAsync

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\CreateEntryGroupRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

createTagAsync

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\CreateTagRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

createTagTemplateAsync

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\CreateTagTemplateRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

createTagTemplateFieldAsync

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\CreateTagTemplateFieldRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

deleteEntryAsync

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\DeleteEntryRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

deleteEntryGroupAsync

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\DeleteEntryGroupRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

deleteTagAsync

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\DeleteTagRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

deleteTagTemplateAsync

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\DeleteTagTemplateRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

deleteTagTemplateFieldAsync

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\DeleteTagTemplateFieldRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

getEntryAsync

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\GetEntryRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

getEntryGroupAsync

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\GetEntryGroupRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

getIamPolicyAsync

Parameters
NameDescription
request Google\Cloud\Iam\V1\GetIamPolicyRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

getTagTemplateAsync

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\GetTagTemplateRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

importEntriesAsync

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\ImportEntriesRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

listEntriesAsync

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\ListEntriesRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

listEntryGroupsAsync

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\ListEntryGroupsRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

listTagsAsync

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\ListTagsRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

lookupEntryAsync

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\LookupEntryRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

modifyEntryContactsAsync

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\ModifyEntryContactsRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

modifyEntryOverviewAsync

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\ModifyEntryOverviewRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

reconcileTagsAsync

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\ReconcileTagsRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

renameTagTemplateFieldAsync

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\RenameTagTemplateFieldRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

renameTagTemplateFieldEnumValueAsync

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\RenameTagTemplateFieldEnumValueRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

searchCatalogAsync

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\SearchCatalogRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

setIamPolicyAsync

Parameters
NameDescription
request Google\Cloud\Iam\V1\SetIamPolicyRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

starEntryAsync

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\StarEntryRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

testIamPermissionsAsync

Parameters
NameDescription
request Google\Cloud\Iam\V1\TestIamPermissionsRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

unstarEntryAsync

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\UnstarEntryRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

updateEntryAsync

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\UpdateEntryRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

updateEntryGroupAsync

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\UpdateEntryGroupRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

updateTagAsync

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\UpdateTagRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

updateTagTemplateAsync

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\UpdateTagTemplateRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

updateTagTemplateFieldAsync

Parameters
NameDescription
request Google\Cloud\DataCatalog\V1\UpdateTagTemplateFieldRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

getOperationsClient

Return an OperationsClient object with the same endpoint as $this.

Returns
TypeDescription
Google\ApiCore\LongRunning\OperationsClient

resumeOperation

Resume an existing long running operation that was previously started by a long running API method. If $methodName is not provided, or does not match a long running API method, then the operation can still be resumed, but the OperationResponse object will not deserialize the final response.

Parameters
NameDescription
operationName string

The name of the long running operation

methodName string

The name of the method used to start the operation

Returns
TypeDescription
Google\ApiCore\OperationResponse

static::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.

static::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.

static::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.

static::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.

static::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.

static::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.

static::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.

static::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.