Google Cloud Data Catalog Lineage V1 Client - Class LineageClient (1.0.2)

Reference documentation and code samples for the Google Cloud Data Catalog Lineage V1 Client class LineageClient.

Service Description: Lineage is used to track data flows between assets over time. You can create LineageEvents to record lineage between multiple sources and a single target, for example, when table data is based on data from multiple tables.

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 \ Lineage \ V1 \ Client

Methods

__construct

Constructor.

Parameters
Name Description
options array

Optional. Options for configuring the service API wrapper.

↳ apiEndpoint string

The address of the API remote host. May optionally include the port, formatted as "

↳ credentials string|array|FetchAuthTokenInterface|CredentialsWrapper

The credentials to be used by the client to authorize API calls. This option accepts either a path to a credentials file, or a decoded credentials file as a PHP array. Advanced usage: In addition, this option can also accept a pre-constructed Google\Auth\FetchAuthTokenInterface object or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored.

↳ credentialsConfig array

Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() .

↳ disableRetries bool

Determines whether or not retries defined by the client configuration should be disabled. Defaults to 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.

↳ logger false|LoggerInterface

A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the 'GOOGLE_SDK_PHP_LOGGING' environment flag

batchSearchLinkProcesses

Retrieve information about LineageProcesses associated with specific links. LineageProcesses are transformation pipelines that result in data flowing from source to target assets. Links between assets represent this operation.

If you have specific link names, you can use this method to verify which LineageProcesses contribute to creating those links. See the SearchLinks method for more information on how to retrieve link name.

You can retrieve the LineageProcess information in every project where you have the datalineage.events.get permission. The project provided in the URL is used for Billing and Quota.

The async variant is LineageClient::batchSearchLinkProcessesAsync() .

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\BatchSearchLinkProcessesRequest

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
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\DataCatalog\Lineage\V1\BatchSearchLinkProcessesRequest;
use Google\Cloud\DataCatalog\Lineage\V1\Client\LineageClient;
use Google\Cloud\DataCatalog\Lineage\V1\ProcessLinks;

/**
 * @param string $formattedParent The project and location where you want to search. Please see
 *                                {@see LineageClient::locationName()} for help formatting this field.
 * @param string $linksElement    An array of links to check for their associated LineageProcesses.
 *
 *                                The maximum number of items in this array is 100.
 *                                If the request contains more than 100 links, it returns the
 *                                `INVALID_ARGUMENT` error.
 *
 *                                Format: `projects/{project}/locations/{location}/links/{link}`.
 */
function batch_search_link_processes_sample(string $formattedParent, string $linksElement): void
{
    // Create a client.
    $lineageClient = new LineageClient();

    // Prepare the request message.
    $links = [$linksElement,];
    $request = (new BatchSearchLinkProcessesRequest())
        ->setParent($formattedParent)
        ->setLinks($links);

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

        /** @var ProcessLinks $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 = LineageClient::locationName('[PROJECT]', '[LOCATION]');
    $linksElement = '[LINKS]';

    batch_search_link_processes_sample($formattedParent, $linksElement);
}

createLineageEvent

Creates a new lineage event.

The async variant is LineageClient::createLineageEventAsync() .

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\CreateLineageEventRequest

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
Type Description
Google\Cloud\DataCatalog\Lineage\V1\LineageEvent
Example
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\Lineage\V1\Client\LineageClient;
use Google\Cloud\DataCatalog\Lineage\V1\CreateLineageEventRequest;
use Google\Cloud\DataCatalog\Lineage\V1\LineageEvent;
use Google\Protobuf\Timestamp;

/**
 * @param string $formattedParent The name of the run that should own the lineage event. Please see
 *                                {@see LineageClient::runName()} for help formatting this field.
 */
function create_lineage_event_sample(string $formattedParent): void
{
    // Create a client.
    $lineageClient = new LineageClient();

    // Prepare the request message.
    $lineageEventStartTime = new Timestamp();
    $lineageEvent = (new LineageEvent())
        ->setStartTime($lineageEventStartTime);
    $request = (new CreateLineageEventRequest())
        ->setParent($formattedParent)
        ->setLineageEvent($lineageEvent);

    // Call the API and handle any network failures.
    try {
        /** @var LineageEvent $response */
        $response = $lineageClient->createLineageEvent($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 = LineageClient::runName('[PROJECT]', '[LOCATION]', '[PROCESS]', '[RUN]');

    create_lineage_event_sample($formattedParent);
}

createProcess

Creates a new process.

The async variant is LineageClient::createProcessAsync() .

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\CreateProcessRequest

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
Type Description
Google\Cloud\DataCatalog\Lineage\V1\Process
Example
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\Lineage\V1\Client\LineageClient;
use Google\Cloud\DataCatalog\Lineage\V1\CreateProcessRequest;
use Google\Cloud\DataCatalog\Lineage\V1\Process;

/**
 * @param string $formattedParent The name of the project and its location that should own the
 *                                process. Please see
 *                                {@see LineageClient::locationName()} for help formatting this field.
 */
function create_process_sample(string $formattedParent): void
{
    // Create a client.
    $lineageClient = new LineageClient();

    // Prepare the request message.
    $process = new Process();
    $request = (new CreateProcessRequest())
        ->setParent($formattedParent)
        ->setProcess($process);

    // Call the API and handle any network failures.
    try {
        /** @var Process $response */
        $response = $lineageClient->createProcess($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 = LineageClient::locationName('[PROJECT]', '[LOCATION]');

    create_process_sample($formattedParent);
}

createRun

Creates a new run.

The async variant is LineageClient::createRunAsync() .

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\CreateRunRequest

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
Type Description
Google\Cloud\DataCatalog\Lineage\V1\Run
Example
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\Lineage\V1\Client\LineageClient;
use Google\Cloud\DataCatalog\Lineage\V1\CreateRunRequest;
use Google\Cloud\DataCatalog\Lineage\V1\Run;
use Google\Cloud\DataCatalog\Lineage\V1\Run\State;
use Google\Protobuf\Timestamp;

/**
 * @param string $formattedParent The name of the process that should own the run. Please see
 *                                {@see LineageClient::processName()} for help formatting this field.
 * @param int    $runState        The state of the run.
 */
function create_run_sample(string $formattedParent, int $runState): void
{
    // Create a client.
    $lineageClient = new LineageClient();

    // Prepare the request message.
    $runStartTime = new Timestamp();
    $run = (new Run())
        ->setStartTime($runStartTime)
        ->setState($runState);
    $request = (new CreateRunRequest())
        ->setParent($formattedParent)
        ->setRun($run);

    // Call the API and handle any network failures.
    try {
        /** @var Run $response */
        $response = $lineageClient->createRun($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 = LineageClient::processName('[PROJECT]', '[LOCATION]', '[PROCESS]');
    $runState = State::UNKNOWN;

    create_run_sample($formattedParent, $runState);
}

deleteLineageEvent

Deletes the lineage event with the specified name.

The async variant is LineageClient::deleteLineageEventAsync() .

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\DeleteLineageEventRequest

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\Lineage\V1\Client\LineageClient;
use Google\Cloud\DataCatalog\Lineage\V1\DeleteLineageEventRequest;

/**
 * @param string $formattedName The name of the lineage event to delete. Please see
 *                              {@see LineageClient::lineageEventName()} for help formatting this field.
 */
function delete_lineage_event_sample(string $formattedName): void
{
    // Create a client.
    $lineageClient = new LineageClient();

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

    // Call the API and handle any network failures.
    try {
        $lineageClient->deleteLineageEvent($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 = LineageClient::lineageEventName(
        '[PROJECT]',
        '[LOCATION]',
        '[PROCESS]',
        '[RUN]',
        '[LINEAGE_EVENT]'
    );

    delete_lineage_event_sample($formattedName);
}

deleteProcess

Deletes the process with the specified name.

The async variant is LineageClient::deleteProcessAsync() .

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\DeleteProcessRequest

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
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\DataCatalog\Lineage\V1\Client\LineageClient;
use Google\Cloud\DataCatalog\Lineage\V1\DeleteProcessRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the process to delete. Please see
 *                              {@see LineageClient::processName()} for help formatting this field.
 */
function delete_process_sample(string $formattedName): void
{
    // Create a client.
    $lineageClient = new LineageClient();

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

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

        if ($response->operationSucceeded()) {
            printf('Operation completed successfully.' . PHP_EOL);
        } 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
{
    $formattedName = LineageClient::processName('[PROJECT]', '[LOCATION]', '[PROCESS]');

    delete_process_sample($formattedName);
}

deleteRun

Deletes the run with the specified name.

The async variant is LineageClient::deleteRunAsync() .

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\DeleteRunRequest

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
Type Description
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\DataCatalog\Lineage\V1\Client\LineageClient;
use Google\Cloud\DataCatalog\Lineage\V1\DeleteRunRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the run to delete. Please see
 *                              {@see LineageClient::runName()} for help formatting this field.
 */
function delete_run_sample(string $formattedName): void
{
    // Create a client.
    $lineageClient = new LineageClient();

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

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

        if ($response->operationSucceeded()) {
            printf('Operation completed successfully.' . PHP_EOL);
        } 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
{
    $formattedName = LineageClient::runName('[PROJECT]', '[LOCATION]', '[PROCESS]', '[RUN]');

    delete_run_sample($formattedName);
}

getLineageEvent

Gets details of a specified lineage event.

The async variant is LineageClient::getLineageEventAsync() .

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\GetLineageEventRequest

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
Type Description
Google\Cloud\DataCatalog\Lineage\V1\LineageEvent
Example
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\Lineage\V1\Client\LineageClient;
use Google\Cloud\DataCatalog\Lineage\V1\GetLineageEventRequest;
use Google\Cloud\DataCatalog\Lineage\V1\LineageEvent;

/**
 * @param string $formattedName The name of the lineage event to get. Please see
 *                              {@see LineageClient::lineageEventName()} for help formatting this field.
 */
function get_lineage_event_sample(string $formattedName): void
{
    // Create a client.
    $lineageClient = new LineageClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var LineageEvent $response */
        $response = $lineageClient->getLineageEvent($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 = LineageClient::lineageEventName(
        '[PROJECT]',
        '[LOCATION]',
        '[PROCESS]',
        '[RUN]',
        '[LINEAGE_EVENT]'
    );

    get_lineage_event_sample($formattedName);
}

getProcess

Gets the details of the specified process.

The async variant is LineageClient::getProcessAsync() .

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\GetProcessRequest

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
Type Description
Google\Cloud\DataCatalog\Lineage\V1\Process
Example
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\Lineage\V1\Client\LineageClient;
use Google\Cloud\DataCatalog\Lineage\V1\GetProcessRequest;
use Google\Cloud\DataCatalog\Lineage\V1\Process;

/**
 * @param string $formattedName The name of the process to get. Please see
 *                              {@see LineageClient::processName()} for help formatting this field.
 */
function get_process_sample(string $formattedName): void
{
    // Create a client.
    $lineageClient = new LineageClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Process $response */
        $response = $lineageClient->getProcess($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 = LineageClient::processName('[PROJECT]', '[LOCATION]', '[PROCESS]');

    get_process_sample($formattedName);
}

getRun

Gets the details of the specified run.

The async variant is LineageClient::getRunAsync() .

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\GetRunRequest

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
Type Description
Google\Cloud\DataCatalog\Lineage\V1\Run
Example
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\Lineage\V1\Client\LineageClient;
use Google\Cloud\DataCatalog\Lineage\V1\GetRunRequest;
use Google\Cloud\DataCatalog\Lineage\V1\Run;

/**
 * @param string $formattedName The name of the run to get. Please see
 *                              {@see LineageClient::runName()} for help formatting this field.
 */
function get_run_sample(string $formattedName): void
{
    // Create a client.
    $lineageClient = new LineageClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Run $response */
        $response = $lineageClient->getRun($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 = LineageClient::runName('[PROJECT]', '[LOCATION]', '[PROCESS]', '[RUN]');

    get_run_sample($formattedName);
}

listLineageEvents

Lists lineage events in the given project and location. The list order is not defined.

The async variant is LineageClient::listLineageEventsAsync() .

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\ListLineageEventsRequest

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
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\DataCatalog\Lineage\V1\Client\LineageClient;
use Google\Cloud\DataCatalog\Lineage\V1\LineageEvent;
use Google\Cloud\DataCatalog\Lineage\V1\ListLineageEventsRequest;

/**
 * @param string $formattedParent The name of the run that owns the collection of lineage events to
 *                                get. Please see {@see LineageClient::runName()} for help formatting this field.
 */
function list_lineage_events_sample(string $formattedParent): void
{
    // Create a client.
    $lineageClient = new LineageClient();

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

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

        /** @var LineageEvent $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 = LineageClient::runName('[PROJECT]', '[LOCATION]', '[PROCESS]', '[RUN]');

    list_lineage_events_sample($formattedParent);
}

listProcesses

List processes in the given project and location. List order is descending by insertion time.

The async variant is LineageClient::listProcessesAsync() .

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\ListProcessesRequest

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
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\DataCatalog\Lineage\V1\Client\LineageClient;
use Google\Cloud\DataCatalog\Lineage\V1\ListProcessesRequest;
use Google\Cloud\DataCatalog\Lineage\V1\Process;

/**
 * @param string $formattedParent The name of the project and its location that owns this
 *                                collection of processes. Please see
 *                                {@see LineageClient::locationName()} for help formatting this field.
 */
function list_processes_sample(string $formattedParent): void
{
    // Create a client.
    $lineageClient = new LineageClient();

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

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

        /** @var Process $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 = LineageClient::locationName('[PROJECT]', '[LOCATION]');

    list_processes_sample($formattedParent);
}

listRuns

Lists runs in the given project and location. List order is descending by start_time.

The async variant is LineageClient::listRunsAsync() .

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\ListRunsRequest

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
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\DataCatalog\Lineage\V1\Client\LineageClient;
use Google\Cloud\DataCatalog\Lineage\V1\ListRunsRequest;
use Google\Cloud\DataCatalog\Lineage\V1\Run;

/**
 * @param string $formattedParent The name of process that owns this collection of runs. Please see
 *                                {@see LineageClient::processName()} for help formatting this field.
 */
function list_runs_sample(string $formattedParent): void
{
    // Create a client.
    $lineageClient = new LineageClient();

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

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

        /** @var Run $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 = LineageClient::processName('[PROJECT]', '[LOCATION]', '[PROCESS]');

    list_runs_sample($formattedParent);
}

processOpenLineageRunEvent

Creates new lineage events together with their parents: process and run.

Updates the process and run if they already exist. Mapped from Open Lineage specification: https://github.com/OpenLineage/OpenLineage/blob/main/spec/OpenLineage.json.

The async variant is LineageClient::processOpenLineageRunEventAsync() .

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\ProcessOpenLineageRunEventRequest

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
Type Description
Google\Cloud\DataCatalog\Lineage\V1\ProcessOpenLineageRunEventResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\Lineage\V1\Client\LineageClient;
use Google\Cloud\DataCatalog\Lineage\V1\ProcessOpenLineageRunEventRequest;
use Google\Cloud\DataCatalog\Lineage\V1\ProcessOpenLineageRunEventResponse;
use Google\Protobuf\Struct;

/**
 * @param string $parent The name of the project and its location that should own the
 *                       process, run, and lineage event.
 */
function process_open_lineage_run_event_sample(string $parent): void
{
    // Create a client.
    $lineageClient = new LineageClient();

    // Prepare the request message.
    $openLineage = new Struct();
    $request = (new ProcessOpenLineageRunEventRequest())
        ->setParent($parent)
        ->setOpenLineage($openLineage);

    // Call the API and handle any network failures.
    try {
        /** @var ProcessOpenLineageRunEventResponse $response */
        $response = $lineageClient->processOpenLineageRunEvent($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
{
    $parent = '[PARENT]';

    process_open_lineage_run_event_sample($parent);
}

Retrieve a list of links connected to a specific asset.

Links represent the data flow between source (upstream) and target (downstream) assets in transformation pipelines. Links are stored in the same project as the Lineage Events that create them.

You can retrieve links in every project where you have the datalineage.events.get permission. The project provided in the URL is used for Billing and Quota.

The async variant is LineageClient::searchLinksAsync() .

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\SearchLinksRequest

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
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\DataCatalog\Lineage\V1\Client\LineageClient;
use Google\Cloud\DataCatalog\Lineage\V1\Link;
use Google\Cloud\DataCatalog\Lineage\V1\SearchLinksRequest;

/**
 * @param string $formattedParent The project and location you want search in. Please see
 *                                {@see LineageClient::locationName()} for help formatting this field.
 */
function search_links_sample(string $formattedParent): void
{
    // Create a client.
    $lineageClient = new LineageClient();

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

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

        /** @var Link $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 = LineageClient::locationName('[PROJECT]', '[LOCATION]');

    search_links_sample($formattedParent);
}

updateProcess

Updates a process.

The async variant is LineageClient::updateProcessAsync() .

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\UpdateProcessRequest

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
Type Description
Google\Cloud\DataCatalog\Lineage\V1\Process
Example
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\Lineage\V1\Client\LineageClient;
use Google\Cloud\DataCatalog\Lineage\V1\Process;
use Google\Cloud\DataCatalog\Lineage\V1\UpdateProcessRequest;

/**
 * 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_process_sample(): void
{
    // Create a client.
    $lineageClient = new LineageClient();

    // Prepare the request message.
    $process = new Process();
    $request = (new UpdateProcessRequest())
        ->setProcess($process);

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

updateRun

Updates a run.

The async variant is LineageClient::updateRunAsync() .

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\UpdateRunRequest

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
Type Description
Google\Cloud\DataCatalog\Lineage\V1\Run
Example
use Google\ApiCore\ApiException;
use Google\Cloud\DataCatalog\Lineage\V1\Client\LineageClient;
use Google\Cloud\DataCatalog\Lineage\V1\Run;
use Google\Cloud\DataCatalog\Lineage\V1\Run\State;
use Google\Cloud\DataCatalog\Lineage\V1\UpdateRunRequest;
use Google\Protobuf\Timestamp;

/**
 * @param int $runState The state of the run.
 */
function update_run_sample(int $runState): void
{
    // Create a client.
    $lineageClient = new LineageClient();

    // Prepare the request message.
    $runStartTime = new Timestamp();
    $run = (new Run())
        ->setStartTime($runStartTime)
        ->setState($runState);
    $request = (new UpdateRunRequest())
        ->setRun($run);

    // Call the API and handle any network failures.
    try {
        /** @var Run $response */
        $response = $lineageClient->updateRun($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
{
    $runState = State::UNKNOWN;

    update_run_sample($runState);
}

batchSearchLinkProcessesAsync

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\BatchSearchLinkProcessesRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

createLineageEventAsync

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\CreateLineageEventRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\DataCatalog\Lineage\V1\LineageEvent>

createProcessAsync

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\CreateProcessRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\DataCatalog\Lineage\V1\Process>

createRunAsync

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\CreateRunRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\DataCatalog\Lineage\V1\Run>

deleteLineageEventAsync

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\DeleteLineageEventRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<void>

deleteProcessAsync

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\DeleteProcessRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

deleteRunAsync

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\DeleteRunRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\OperationResponse>

getLineageEventAsync

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\GetLineageEventRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\DataCatalog\Lineage\V1\LineageEvent>

getProcessAsync

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\GetProcessRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\DataCatalog\Lineage\V1\Process>

getRunAsync

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\GetRunRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\DataCatalog\Lineage\V1\Run>

listLineageEventsAsync

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\ListLineageEventsRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

listProcessesAsync

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\ListProcessesRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

listRunsAsync

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\ListRunsRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

processOpenLineageRunEventAsync

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\ProcessOpenLineageRunEventRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\DataCatalog\Lineage\V1\ProcessOpenLineageRunEventResponse>

searchLinksAsync

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\SearchLinksRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

updateProcessAsync

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\UpdateProcessRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\DataCatalog\Lineage\V1\Process>

updateRunAsync

Parameters
Name Description
request Google\Cloud\DataCatalog\Lineage\V1\UpdateRunRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\DataCatalog\Lineage\V1\Run>

getOperationsClient

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

Returns
Type Description
Google\LongRunning\Client\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
Name Description
operationName string

The name of the long running operation

methodName string

The name of the method used to start the operation

Returns
Type Description
Google\ApiCore\OperationResponse

static::lineageEventName

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

Parameters
Name Description
project string
location string
process string
run string
lineageEvent string
Returns
Type Description
string The formatted lineage_event resource.

static::locationName

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

Parameters
Name Description
project string
location string
Returns
Type Description
string The formatted location resource.

static::processName

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

Parameters
Name Description
project string
location string
process string
Returns
Type Description
string The formatted process resource.

static::runName

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

Parameters
Name Description
project string
location string
process string
run string
Returns
Type Description
string The formatted run 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

  • lineageEvent: projects/{project}/locations/{location}/processes/{process}/runs/{run}/lineageEvents/{lineage_event}
  • location: projects/{project}/locations/{location}
  • process: projects/{project}/locations/{location}/processes/{process}
  • run: projects/{project}/locations/{location}/processes/{process}/runs/{run}

The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.

Parameters
Name Description
formattedName string

The formatted name string

template ?string

Optional name of template to match

Returns
Type Description
array An associative array from name component IDs to component values.