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

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. Sample code to get started:

$lineageClient = new LineageClient();
try {
    $formattedParent = $lineageClient->locationName('[PROJECT]', '[LOCATION]');
    $links = [];
    // Iterate over pages of elements
    $pagedResponse = $lineageClient->batchSearchLinkProcesses($formattedParent, $links);
    foreach ($pagedResponse->iteratePages() as $page) {
        foreach ($page as $element) {
            // doSomethingWith($element);
        }
    }
    // Alternatively:
    // Iterate through all elements
    $pagedResponse = $lineageClient->batchSearchLinkProcesses($formattedParent, $links);
    foreach ($pagedResponse->iterateAllElements() as $element) {
        // doSomethingWith($element);
    }
} finally {
    $lineageClient->close();
}

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parseName method to extract the individual identifiers contained within formatted names that are returned by the API.

This service has a new (beta) implementation. See Google\Cloud\DataCatalog\Lineage\V1\Client\LineageClient to use the new surface.

Namespace

Google \ Cloud \ DataCatalog \ Lineage \ V1

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.

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.

Parameters
NameDescription
parent string

Required. The project and location you want search in the format projects/*/locations/*

links string[]

Required. 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}.

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\DataCatalog\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 you want search in the format `projects/*/locations/*`
 *                                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.

Parameters
NameDescription
parent string

Required. The name of the run that should own the lineage event.

lineageEvent Google\Cloud\DataCatalog\Lineage\V1\LineageEvent

Required. The lineage event to create.

optionalArgs array

Optional.

↳ requestId string

A unique identifier for this request. Restricted to 36 ASCII characters. A random UUID is recommended. This request is idempotent only if a request_id is provided.

↳ 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\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;

/**
 * @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.
    $lineageEvent = new LineageEvent();
    $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.

Parameters
NameDescription
parent string

Required. The name of the project and its location that should own the process.

process Google\Cloud\DataCatalog\Lineage\V1\Process

Required. The process to create.

optionalArgs array

Optional.

↳ requestId string

A unique identifier for this request. Restricted to 36 ASCII characters. A random UUID is recommended. This request is idempotent only if a request_id is provided.

↳ 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\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.

Parameters
NameDescription
parent string

Required. The name of the process that should own the run.

run Google\Cloud\DataCatalog\Lineage\V1\Run

Required. The run to create.

optionalArgs array

Optional.

↳ requestId string

A unique identifier for this request. Restricted to 36 ASCII characters. A random UUID is recommended. This request is idempotent only if a request_id is provided.

↳ 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\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.

Parameters
NameDescription
name string

Required. The name of the lineage event to delete.

optionalArgs array

Optional.

↳ allowMissing bool

If set to true and the lineage event is not found, the request succeeds but the server doesn't perform any actions.

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

Parameters
NameDescription
name string

Required. The name of the process to delete.

optionalArgs array

Optional.

↳ allowMissing bool

If set to true and the process is not found, the request succeeds but the server doesn't perform any actions.

↳ 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\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.

Parameters
NameDescription
name string

Required. The name of the run to delete.

optionalArgs array

Optional.

↳ allowMissing bool

If set to true and the run is not found, the request succeeds but the server doesn't perform any actions.

↳ 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\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.

Parameters
NameDescription
name string

Required. The name of the lineage event to get.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\DataCatalog\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.

Parameters
NameDescription
name string

Required. The name of the process to get.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\DataCatalog\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.

Parameters
NameDescription
name string

Required. The name of the run to get.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\DataCatalog\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.

Parameters
NameDescription
parent string

Required. The name of the run that owns the collection of lineage events to get.

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\DataCatalog\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.

Parameters
NameDescription
parent string

Required. The name of the project and its location that owns this collection of processes.

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\DataCatalog\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.

Parameters
NameDescription
parent string

Required. The name of process that owns this collection of runs.

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\DataCatalog\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);
}

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.

Parameters
NameDescription
parent string

Required. The project and location you want search in the format projects/*/locations/*

optionalArgs array

Optional.

↳ source EntityReference

Optional. Send asset information in the source field to retrieve all links that lead from the specified asset to downstream assets.

↳ target EntityReference

Optional. Send asset information in the target field to retrieve all links that lead from upstream assets to the specified asset.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\DataCatalog\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 the format `projects/*/locations/*`
 *                                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.

Parameters
NameDescription
process Google\Cloud\DataCatalog\Lineage\V1\Process

Required. The lineage process to update.

The process's name field is used to identify the process to update.

optionalArgs array

Optional.

↳ updateMask FieldMask

The list of fields to update. Currently not used. The whole message is updated.

↳ allowMissing bool

If set to true and the process is not found, the request inserts it.

↳ 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\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.

Parameters
NameDescription
run Google\Cloud\DataCatalog\Lineage\V1\Run

Required. The lineage run to update.

The run's name field is used to identify the run to update.

Format: projects/{project}/locations/{location}/processes/{process}/runs/{run}.

optionalArgs array

Optional.

↳ updateMask FieldMask

The list of fields to update. Currently not used. The whole message is updated.

↳ 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\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);
}

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::lineageEventName

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

Parameters
NameDescription
project string
location string
process string
run string
lineageEvent string
Returns
TypeDescription
stringThe formatted lineage_event 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::processName

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

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

static::runName

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

Parameters
NameDescription
project string
location string
process string
run string
Returns
TypeDescription
stringThe 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
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.

Constants

SERVICE_NAME

Value: 'google.cloud.datacatalog.lineage.v1.Lineage'

The name of the service.

SERVICE_ADDRESS

Value: 'datalineage.googleapis.com'

The default address of the service.

DEFAULT_SERVICE_PORT

Value: 443

The default port of the service.

CODEGEN_NAME

Value: 'gapic'

The name of the code generator, to be included in the agent header.