diff --git a/DataCatalogLineage/metadata/V1/Lineage.php b/DataCatalogLineage/metadata/V1/Lineage.php
index decabe03d58d..155e66baf2bd 100644
Binary files a/DataCatalogLineage/metadata/V1/Lineage.php and b/DataCatalogLineage/metadata/V1/Lineage.php differ
diff --git a/DataCatalogLineage/samples/V1/LineageClient/batch_search_link_processes.php b/DataCatalogLineage/samples/V1/LineageClient/batch_search_link_processes.php
index fc1b44d52cd3..68e9a401868d 100644
--- a/DataCatalogLineage/samples/V1/LineageClient/batch_search_link_processes.php
+++ b/DataCatalogLineage/samples/V1/LineageClient/batch_search_link_processes.php
@@ -45,8 +45,8 @@
* have the `datalineage.events.get` permission. The project provided in the
* URL is used for Billing and Quota.
*
- * @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 $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.
diff --git a/DataCatalogLineage/samples/V1/LineageClient/create_lineage_event.php b/DataCatalogLineage/samples/V1/LineageClient/create_lineage_event.php
index 708598c1828e..c9da4efde8aa 100644
--- a/DataCatalogLineage/samples/V1/LineageClient/create_lineage_event.php
+++ b/DataCatalogLineage/samples/V1/LineageClient/create_lineage_event.php
@@ -27,6 +27,7 @@
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;
/**
* Creates a new lineage event.
@@ -40,7 +41,9 @@ function create_lineage_event_sample(string $formattedParent): void
$lineageClient = new LineageClient();
// Prepare the request message.
- $lineageEvent = new LineageEvent();
+ $lineageEventStartTime = new Timestamp();
+ $lineageEvent = (new LineageEvent())
+ ->setStartTime($lineageEventStartTime);
$request = (new CreateLineageEventRequest())
->setParent($formattedParent)
->setLineageEvent($lineageEvent);
diff --git a/DataCatalogLineage/samples/V1/LineageClient/process_open_lineage_run_event.php b/DataCatalogLineage/samples/V1/LineageClient/process_open_lineage_run_event.php
new file mode 100644
index 000000000000..31d127d270ef
--- /dev/null
+++ b/DataCatalogLineage/samples/V1/LineageClient/process_open_lineage_run_event.php
@@ -0,0 +1,77 @@
+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);
+}
+// [END datalineage_v1_generated_Lineage_ProcessOpenLineageRunEvent_sync]
diff --git a/DataCatalogLineage/samples/V1/LineageClient/search_links.php b/DataCatalogLineage/samples/V1/LineageClient/search_links.php
index 84d588e16a42..0e5b874e858f 100644
--- a/DataCatalogLineage/samples/V1/LineageClient/search_links.php
+++ b/DataCatalogLineage/samples/V1/LineageClient/search_links.php
@@ -40,8 +40,8 @@
* `datalineage.events.get` permission. The project provided in the URL
* is used for Billing and Quota.
*
- * @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 $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
{
diff --git a/DataCatalogLineage/src/V1/BatchSearchLinkProcessesRequest.php b/DataCatalogLineage/src/V1/BatchSearchLinkProcessesRequest.php
index 4e8c23adcbb2..75a9ce2414ac 100644
--- a/DataCatalogLineage/src/V1/BatchSearchLinkProcessesRequest.php
+++ b/DataCatalogLineage/src/V1/BatchSearchLinkProcessesRequest.php
@@ -17,7 +17,7 @@
class BatchSearchLinkProcessesRequest extends \Google\Protobuf\Internal\Message
{
/**
- * Required. The project and location you want search in the format `projects/*/locations/*`
+ * Required. The project and location where you want to search.
*
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
@@ -57,7 +57,7 @@ class BatchSearchLinkProcessesRequest extends \Google\Protobuf\Internal\Message
* Optional. Data for populating the Message object.
*
* @type string $parent
- * Required. The project and location you want search in the format `projects/*/locations/*`
+ * Required. The project and location where you want to search.
* @type array|\Google\Protobuf\Internal\RepeatedField $links
* Required. An array of links to check for their associated LineageProcesses.
* The maximum number of items in this array is 100.
@@ -81,7 +81,7 @@ public function __construct($data = NULL) {
}
/**
- * Required. The project and location you want search in the format `projects/*/locations/*`
+ * Required. The project and location where you want to search.
*
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
* @return string
@@ -92,7 +92,7 @@ public function getParent()
}
/**
- * Required. The project and location you want search in the format `projects/*/locations/*`
+ * Required. The project and location where you want to search.
*
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
* @param string $var
diff --git a/DataCatalogLineage/src/V1/Client/LineageClient.php b/DataCatalogLineage/src/V1/Client/LineageClient.php
index e4d33148af22..7abb39d57029 100644
--- a/DataCatalogLineage/src/V1/Client/LineageClient.php
+++ b/DataCatalogLineage/src/V1/Client/LineageClient.php
@@ -50,6 +50,8 @@
use Google\Cloud\DataCatalog\Lineage\V1\ListProcessesRequest;
use Google\Cloud\DataCatalog\Lineage\V1\ListRunsRequest;
use Google\Cloud\DataCatalog\Lineage\V1\Process;
+use Google\Cloud\DataCatalog\Lineage\V1\ProcessOpenLineageRunEventRequest;
+use Google\Cloud\DataCatalog\Lineage\V1\ProcessOpenLineageRunEventResponse;
use Google\Cloud\DataCatalog\Lineage\V1\Run;
use Google\Cloud\DataCatalog\Lineage\V1\SearchLinksRequest;
use Google\Cloud\DataCatalog\Lineage\V1\UpdateProcessRequest;
@@ -90,6 +92,7 @@
* @method PromiseInterface listLineageEventsAsync(ListLineageEventsRequest $request, array $optionalArgs = [])
* @method PromiseInterface listProcessesAsync(ListProcessesRequest $request, array $optionalArgs = [])
* @method PromiseInterface listRunsAsync(ListRunsRequest $request, array $optionalArgs = [])
+ * @method PromiseInterface processOpenLineageRunEventAsync(ProcessOpenLineageRunEventRequest $request, array $optionalArgs = [])
* @method PromiseInterface searchLinksAsync(SearchLinksRequest $request, array $optionalArgs = [])
* @method PromiseInterface updateProcessAsync(UpdateProcessRequest $request, array $optionalArgs = [])
* @method PromiseInterface updateRunAsync(UpdateRunRequest $request, array $optionalArgs = [])
@@ -697,6 +700,35 @@ public function listRuns(ListRunsRequest $request, array $callOptions = []): Pag
return $this->startApiCall('ListRuns', $request, $callOptions);
}
+ /**
+ * 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 {@see LineageClient::processOpenLineageRunEventAsync()} .
+ *
+ * @example samples/V1/LineageClient/process_open_lineage_run_event.php
+ *
+ * @param ProcessOpenLineageRunEventRequest $request A request to house fields associated with the call.
+ * @param array $callOptions {
+ * Optional.
+ *
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @return ProcessOpenLineageRunEventResponse
+ *
+ * @throws ApiException Thrown if the API call fails.
+ */
+ public function processOpenLineageRunEvent(ProcessOpenLineageRunEventRequest $request, array $callOptions = []): ProcessOpenLineageRunEventResponse
+ {
+ return $this->startApiCall('ProcessOpenLineageRunEvent', $request, $callOptions)->wait();
+ }
+
/**
* Retrieve a list of links connected to a specific asset.
* Links represent the data flow between **source** (upstream)
diff --git a/DataCatalogLineage/src/V1/EntityReference.php b/DataCatalogLineage/src/V1/EntityReference.php
index d226e432446a..9925e0dce8a7 100644
--- a/DataCatalogLineage/src/V1/EntityReference.php
+++ b/DataCatalogLineage/src/V1/EntityReference.php
@@ -16,14 +16,9 @@
class EntityReference extends \Google\Protobuf\Internal\Message
{
/**
- * Required. Fully Qualified Name of the entity. Useful for referencing
- * entities that aren't represented as GCP resources, for example, tables in
- * Dataproc Metastore API.
- * Examples:
- * * `bigquery:dataset.project_id.dataset_id`
- * * `bigquery:table.project_id.dataset_id.table_id`
- * * `pubsub:project_id.topic_id`
- * * `dataproc_metastore:projectId.locationId.instanceId.databaseId.tableId`
+ * Required. [Fully Qualified Name
+ * (FQN)](https://cloud.google.com/data-catalog/docs/fully-qualified-names)
+ * of the entity.
*
* Generated from protobuf field string fully_qualified_name = 1 [(.google.api.field_behavior) = REQUIRED];
*/
@@ -36,14 +31,9 @@ class EntityReference extends \Google\Protobuf\Internal\Message
* Optional. Data for populating the Message object.
*
* @type string $fully_qualified_name
- * Required. Fully Qualified Name of the entity. Useful for referencing
- * entities that aren't represented as GCP resources, for example, tables in
- * Dataproc Metastore API.
- * Examples:
- * * `bigquery:dataset.project_id.dataset_id`
- * * `bigquery:table.project_id.dataset_id.table_id`
- * * `pubsub:project_id.topic_id`
- * * `dataproc_metastore:projectId.locationId.instanceId.databaseId.tableId`
+ * Required. [Fully Qualified Name
+ * (FQN)](https://cloud.google.com/data-catalog/docs/fully-qualified-names)
+ * of the entity.
* }
*/
public function __construct($data = NULL) {
@@ -52,14 +42,9 @@ public function __construct($data = NULL) {
}
/**
- * Required. Fully Qualified Name of the entity. Useful for referencing
- * entities that aren't represented as GCP resources, for example, tables in
- * Dataproc Metastore API.
- * Examples:
- * * `bigquery:dataset.project_id.dataset_id`
- * * `bigquery:table.project_id.dataset_id.table_id`
- * * `pubsub:project_id.topic_id`
- * * `dataproc_metastore:projectId.locationId.instanceId.databaseId.tableId`
+ * Required. [Fully Qualified Name
+ * (FQN)](https://cloud.google.com/data-catalog/docs/fully-qualified-names)
+ * of the entity.
*
* Generated from protobuf field string fully_qualified_name = 1 [(.google.api.field_behavior) = REQUIRED];
* @return string
@@ -70,14 +55,9 @@ public function getFullyQualifiedName()
}
/**
- * Required. Fully Qualified Name of the entity. Useful for referencing
- * entities that aren't represented as GCP resources, for example, tables in
- * Dataproc Metastore API.
- * Examples:
- * * `bigquery:dataset.project_id.dataset_id`
- * * `bigquery:table.project_id.dataset_id.table_id`
- * * `pubsub:project_id.topic_id`
- * * `dataproc_metastore:projectId.locationId.instanceId.databaseId.tableId`
+ * Required. [Fully Qualified Name
+ * (FQN)](https://cloud.google.com/data-catalog/docs/fully-qualified-names)
+ * of the entity.
*
* Generated from protobuf field string fully_qualified_name = 1 [(.google.api.field_behavior) = REQUIRED];
* @param string $var
diff --git a/DataCatalogLineage/src/V1/Gapic/LineageGapicClient.php b/DataCatalogLineage/src/V1/Gapic/LineageGapicClient.php
index 4ff83a02d9e5..6d227fea2a33 100644
--- a/DataCatalogLineage/src/V1/Gapic/LineageGapicClient.php
+++ b/DataCatalogLineage/src/V1/Gapic/LineageGapicClient.php
@@ -55,6 +55,8 @@
use Google\Cloud\DataCatalog\Lineage\V1\ListRunsRequest;
use Google\Cloud\DataCatalog\Lineage\V1\ListRunsResponse;
use Google\Cloud\DataCatalog\Lineage\V1\Process;
+use Google\Cloud\DataCatalog\Lineage\V1\ProcessOpenLineageRunEventRequest;
+use Google\Cloud\DataCatalog\Lineage\V1\ProcessOpenLineageRunEventResponse;
use Google\Cloud\DataCatalog\Lineage\V1\Run;
use Google\Cloud\DataCatalog\Lineage\V1\SearchLinksRequest;
use Google\Cloud\DataCatalog\Lineage\V1\SearchLinksResponse;
@@ -63,6 +65,7 @@
use Google\LongRunning\Operation;
use Google\Protobuf\FieldMask;
use Google\Protobuf\GPBEmpty;
+use Google\Protobuf\Struct;
/**
* Service Description: Lineage is used to track data flows between assets over time. You can
@@ -461,7 +464,7 @@ public function __construct(array $options = [])
* }
* ```
*
- * @param string $parent Required. The project and location you want search in the format `projects/*/locations/*`
+ * @param string $parent Required. The project and location where you want to search.
* @param string[] $links Required. An array of links to check for their associated LineageProcesses.
*
* The maximum number of items in this array is 100.
@@ -1170,6 +1173,61 @@ public function listRuns($parent, array $optionalArgs = [])
return $this->getPagedListResponse('ListRuns', $optionalArgs, ListRunsResponse::class, $request);
}
+ /**
+ * 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.
+ *
+ * Sample code:
+ * ```
+ * $lineageClient = new LineageClient();
+ * try {
+ * $parent = 'parent';
+ * $openLineage = new Struct();
+ * $response = $lineageClient->processOpenLineageRunEvent($parent, $openLineage);
+ * } finally {
+ * $lineageClient->close();
+ * }
+ * ```
+ *
+ * @param string $parent Required. The name of the project and its location that should own the
+ * process, run, and lineage event.
+ * @param Struct $openLineage Required. OpenLineage message following OpenLineage format:
+ * https://github.com/OpenLineage/OpenLineage/blob/main/spec/OpenLineage.json
+ * @param array $optionalArgs {
+ * Optional.
+ *
+ * @type string $requestId
+ * 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.
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @return \Google\Cloud\DataCatalog\Lineage\V1\ProcessOpenLineageRunEventResponse
+ *
+ * @throws ApiException if the remote call fails
+ */
+ public function processOpenLineageRunEvent($parent, $openLineage, array $optionalArgs = [])
+ {
+ $request = new ProcessOpenLineageRunEventRequest();
+ $requestParamHeaders = [];
+ $request->setParent($parent);
+ $request->setOpenLineage($openLineage);
+ $requestParamHeaders['parent'] = $parent;
+ if (isset($optionalArgs['requestId'])) {
+ $request->setRequestId($optionalArgs['requestId']);
+ }
+
+ $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
+ $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
+ return $this->startCall('ProcessOpenLineageRunEvent', ProcessOpenLineageRunEventResponse::class, $optionalArgs, $request)->wait();
+ }
+
/**
* Retrieve a list of links connected to a specific asset.
* Links represent the data flow between **source** (upstream)
@@ -1204,7 +1262,7 @@ public function listRuns($parent, array $optionalArgs = [])
* }
* ```
*
- * @param string $parent Required. The project and location you want search in the format `projects/*/locations/*`
+ * @param string $parent Required. The project and location you want search in.
* @param array $optionalArgs {
* Optional.
*
@@ -1340,6 +1398,8 @@ public function updateProcess($process, array $optionalArgs = [])
* @type FieldMask $updateMask
* The list of fields to update. Currently not used. The whole message is
* updated.
+ * @type bool $allowMissing
+ * If set to true and the run is not found, the request creates it.
* @type RetrySettings|array $retrySettings
* Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
* associative array of retry settings parameters. See the documentation on
@@ -1360,6 +1420,10 @@ public function updateRun($run, array $optionalArgs = [])
$request->setUpdateMask($optionalArgs['updateMask']);
}
+ if (isset($optionalArgs['allowMissing'])) {
+ $request->setAllowMissing($optionalArgs['allowMissing']);
+ }
+
$requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
$optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
return $this->startCall('UpdateRun', Run::class, $optionalArgs, $request)->wait();
diff --git a/DataCatalogLineage/src/V1/LineageEvent.php b/DataCatalogLineage/src/V1/LineageEvent.php
index 8a7f7044abf9..2f6da93d3340 100644
--- a/DataCatalogLineage/src/V1/LineageEvent.php
+++ b/DataCatalogLineage/src/V1/LineageEvent.php
@@ -34,11 +34,11 @@ class LineageEvent extends \Google\Protobuf\Internal\Message
*/
private $links;
/**
- * Optional. The beginning of the transformation which resulted in this
+ * Required. The beginning of the transformation which resulted in this
* lineage event. For streaming scenarios, it should be the beginning of the
* period from which the lineage is being reported.
*
- * Generated from protobuf field .google.protobuf.Timestamp start_time = 6 [(.google.api.field_behavior) = OPTIONAL];
+ * Generated from protobuf field .google.protobuf.Timestamp start_time = 6 [(.google.api.field_behavior) = REQUIRED];
*/
protected $start_time = null;
/**
@@ -66,7 +66,7 @@ class LineageEvent extends \Google\Protobuf\Internal\Message
* @type array<\Google\Cloud\DataCatalog\Lineage\V1\EventLink>|\Google\Protobuf\Internal\RepeatedField $links
* Optional. List of source-target pairs. Can't contain more than 100 tuples.
* @type \Google\Protobuf\Timestamp $start_time
- * Optional. The beginning of the transformation which resulted in this
+ * Required. The beginning of the transformation which resulted in this
* lineage event. For streaming scenarios, it should be the beginning of the
* period from which the lineage is being reported.
* @type \Google\Protobuf\Timestamp $end_time
@@ -143,11 +143,11 @@ public function setLinks($var)
}
/**
- * Optional. The beginning of the transformation which resulted in this
+ * Required. The beginning of the transformation which resulted in this
* lineage event. For streaming scenarios, it should be the beginning of the
* period from which the lineage is being reported.
*
- * Generated from protobuf field .google.protobuf.Timestamp start_time = 6 [(.google.api.field_behavior) = OPTIONAL];
+ * Generated from protobuf field .google.protobuf.Timestamp start_time = 6 [(.google.api.field_behavior) = REQUIRED];
* @return \Google\Protobuf\Timestamp|null
*/
public function getStartTime()
@@ -166,11 +166,11 @@ public function clearStartTime()
}
/**
- * Optional. The beginning of the transformation which resulted in this
+ * Required. The beginning of the transformation which resulted in this
* lineage event. For streaming scenarios, it should be the beginning of the
* period from which the lineage is being reported.
*
- * Generated from protobuf field .google.protobuf.Timestamp start_time = 6 [(.google.api.field_behavior) = OPTIONAL];
+ * Generated from protobuf field .google.protobuf.Timestamp start_time = 6 [(.google.api.field_behavior) = REQUIRED];
* @param \Google\Protobuf\Timestamp $var
* @return $this
*/
diff --git a/DataCatalogLineage/src/V1/OperationMetadata/Type.php b/DataCatalogLineage/src/V1/OperationMetadata/Type.php
index 8d81ee4f6faa..190f28ceea6a 100644
--- a/DataCatalogLineage/src/V1/OperationMetadata/Type.php
+++ b/DataCatalogLineage/src/V1/OperationMetadata/Type.php
@@ -25,10 +25,17 @@ class Type
* Generated from protobuf enum DELETE = 1;
*/
const DELETE = 1;
+ /**
+ * The resource creation operation.
+ *
+ * Generated from protobuf enum CREATE = 2;
+ */
+ const CREATE = 2;
private static $valueToName = [
self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED',
self::DELETE => 'DELETE',
+ self::CREATE => 'CREATE',
];
public static function name($value)
diff --git a/DataCatalogLineage/src/V1/Origin.php b/DataCatalogLineage/src/V1/Origin.php
index 369d744cfb75..7ff80980f5ac 100644
--- a/DataCatalogLineage/src/V1/Origin.php
+++ b/DataCatalogLineage/src/V1/Origin.php
@@ -17,6 +17,9 @@ class Origin extends \Google\Protobuf\Internal\Message
{
/**
* Type of the source.
+ * Use of a source_type other than `CUSTOM` for process creation
+ * or updating is highly discouraged, and may be restricted in the future
+ * without notice.
*
* Generated from protobuf field .google.cloud.datacatalog.lineage.v1.Origin.SourceType source_type = 1;
*/
@@ -43,6 +46,9 @@ class Origin extends \Google\Protobuf\Internal\Message
*
* @type int $source_type
* Type of the source.
+ * Use of a source_type other than `CUSTOM` for process creation
+ * or updating is highly discouraged, and may be restricted in the future
+ * without notice.
* @type string $name
* If the source_type isn't CUSTOM, the value of this field should be a GCP
* resource name of the system, which reports lineage. The project and
@@ -61,6 +67,9 @@ public function __construct($data = NULL) {
/**
* Type of the source.
+ * Use of a source_type other than `CUSTOM` for process creation
+ * or updating is highly discouraged, and may be restricted in the future
+ * without notice.
*
* Generated from protobuf field .google.cloud.datacatalog.lineage.v1.Origin.SourceType source_type = 1;
* @return int
@@ -72,6 +81,9 @@ public function getSourceType()
/**
* Type of the source.
+ * Use of a source_type other than `CUSTOM` for process creation
+ * or updating is highly discouraged, and may be restricted in the future
+ * without notice.
*
* Generated from protobuf field .google.cloud.datacatalog.lineage.v1.Origin.SourceType source_type = 1;
* @param int $var
diff --git a/DataCatalogLineage/src/V1/Origin/SourceType.php b/DataCatalogLineage/src/V1/Origin/SourceType.php
index a119c039e9ed..0a2243e4304a 100644
--- a/DataCatalogLineage/src/V1/Origin/SourceType.php
+++ b/DataCatalogLineage/src/V1/Origin/SourceType.php
@@ -49,6 +49,12 @@ class SourceType
* Generated from protobuf enum LOOKER_STUDIO = 5;
*/
const LOOKER_STUDIO = 5;
+ /**
+ * Dataproc
+ *
+ * Generated from protobuf enum DATAPROC = 6;
+ */
+ const DATAPROC = 6;
private static $valueToName = [
self::SOURCE_TYPE_UNSPECIFIED => 'SOURCE_TYPE_UNSPECIFIED',
@@ -57,6 +63,7 @@ class SourceType
self::DATA_FUSION => 'DATA_FUSION',
self::COMPOSER => 'COMPOSER',
self::LOOKER_STUDIO => 'LOOKER_STUDIO',
+ self::DATAPROC => 'DATAPROC',
];
public static function name($value)
diff --git a/DataCatalogLineage/src/V1/Process.php b/DataCatalogLineage/src/V1/Process.php
index 2127534369a1..7e3b5ce22728 100644
--- a/DataCatalogLineage/src/V1/Process.php
+++ b/DataCatalogLineage/src/V1/Process.php
@@ -34,8 +34,10 @@ class Process extends \Google\Protobuf\Internal\Message
*/
protected $display_name = '';
/**
- * Optional. The attributes of the process. Can be anything, for example,
- * "author". Up to 100 attributes are allowed.
+ * Optional. The attributes of the process. Should only be used for the
+ * purpose of non-semantic management (classifying, describing or labeling the
+ * process).
+ * Up to 100 attributes are allowed.
*
* Generated from protobuf field map attributes = 3 [(.google.api.field_behavior) = OPTIONAL];
*/
@@ -64,8 +66,10 @@ class Process extends \Google\Protobuf\Internal\Message
* Must be not longer than 200 characters and only contain UTF-8 letters
* or numbers, spaces or characters like `_-:&.`
* @type array|\Google\Protobuf\Internal\MapField $attributes
- * Optional. The attributes of the process. Can be anything, for example,
- * "author". Up to 100 attributes are allowed.
+ * Optional. The attributes of the process. Should only be used for the
+ * purpose of non-semantic management (classifying, describing or labeling the
+ * process).
+ * Up to 100 attributes are allowed.
* @type \Google\Cloud\DataCatalog\Lineage\V1\Origin $origin
* Optional. The origin of this process and its runs and lineage events.
* }
@@ -140,8 +144,10 @@ public function setDisplayName($var)
}
/**
- * Optional. The attributes of the process. Can be anything, for example,
- * "author". Up to 100 attributes are allowed.
+ * Optional. The attributes of the process. Should only be used for the
+ * purpose of non-semantic management (classifying, describing or labeling the
+ * process).
+ * Up to 100 attributes are allowed.
*
* Generated from protobuf field map attributes = 3 [(.google.api.field_behavior) = OPTIONAL];
* @return \Google\Protobuf\Internal\MapField
@@ -152,8 +158,10 @@ public function getAttributes()
}
/**
- * Optional. The attributes of the process. Can be anything, for example,
- * "author". Up to 100 attributes are allowed.
+ * Optional. The attributes of the process. Should only be used for the
+ * purpose of non-semantic management (classifying, describing or labeling the
+ * process).
+ * Up to 100 attributes are allowed.
*
* Generated from protobuf field map attributes = 3 [(.google.api.field_behavior) = OPTIONAL];
* @param array|\Google\Protobuf\Internal\MapField $var
diff --git a/DataCatalogLineage/src/V1/ProcessOpenLineageRunEventRequest.php b/DataCatalogLineage/src/V1/ProcessOpenLineageRunEventRequest.php
new file mode 100644
index 000000000000..b079efe53f2e
--- /dev/null
+++ b/DataCatalogLineage/src/V1/ProcessOpenLineageRunEventRequest.php
@@ -0,0 +1,179 @@
+google.cloud.datacatalog.lineage.v1.ProcessOpenLineageRunEventRequest
+ */
+class ProcessOpenLineageRunEventRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Required. The name of the project and its location that should own the
+ * process, run, and lineage event.
+ *
+ * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED];
+ */
+ protected $parent = '';
+ /**
+ * Required. OpenLineage message following OpenLineage format:
+ * https://github.com/OpenLineage/OpenLineage/blob/main/spec/OpenLineage.json
+ *
+ * Generated from protobuf field .google.protobuf.Struct open_lineage = 2 [(.google.api.field_behavior) = REQUIRED];
+ */
+ protected $open_lineage = null;
+ /**
+ * 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.
+ *
+ * Generated from protobuf field string request_id = 3;
+ */
+ protected $request_id = '';
+
+ /**
+ * @param string $parent Required. The name of the project and its location that should own the
+ * process, run, and lineage event.
+ * @param \Google\Protobuf\Struct $openLineage Required. OpenLineage message following OpenLineage format:
+ * https://github.com/OpenLineage/OpenLineage/blob/main/spec/OpenLineage.json
+ *
+ * @return \Google\Cloud\DataCatalog\Lineage\V1\ProcessOpenLineageRunEventRequest
+ *
+ * @experimental
+ */
+ public static function build(string $parent, \Google\Protobuf\Struct $openLineage): self
+ {
+ return (new self())
+ ->setParent($parent)
+ ->setOpenLineage($openLineage);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $parent
+ * Required. The name of the project and its location that should own the
+ * process, run, and lineage event.
+ * @type \Google\Protobuf\Struct $open_lineage
+ * Required. OpenLineage message following OpenLineage format:
+ * https://github.com/OpenLineage/OpenLineage/blob/main/spec/OpenLineage.json
+ * @type string $request_id
+ * 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.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Datacatalog\Lineage\V1\Lineage::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Required. The name of the project and its location that should own the
+ * process, run, and lineage event.
+ *
+ * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED];
+ * @return string
+ */
+ public function getParent()
+ {
+ return $this->parent;
+ }
+
+ /**
+ * Required. The name of the project and its location that should own the
+ * process, run, and lineage event.
+ *
+ * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED];
+ * @param string $var
+ * @return $this
+ */
+ public function setParent($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->parent = $var;
+
+ return $this;
+ }
+
+ /**
+ * Required. OpenLineage message following OpenLineage format:
+ * https://github.com/OpenLineage/OpenLineage/blob/main/spec/OpenLineage.json
+ *
+ * Generated from protobuf field .google.protobuf.Struct open_lineage = 2 [(.google.api.field_behavior) = REQUIRED];
+ * @return \Google\Protobuf\Struct|null
+ */
+ public function getOpenLineage()
+ {
+ return $this->open_lineage;
+ }
+
+ public function hasOpenLineage()
+ {
+ return isset($this->open_lineage);
+ }
+
+ public function clearOpenLineage()
+ {
+ unset($this->open_lineage);
+ }
+
+ /**
+ * Required. OpenLineage message following OpenLineage format:
+ * https://github.com/OpenLineage/OpenLineage/blob/main/spec/OpenLineage.json
+ *
+ * Generated from protobuf field .google.protobuf.Struct open_lineage = 2 [(.google.api.field_behavior) = REQUIRED];
+ * @param \Google\Protobuf\Struct $var
+ * @return $this
+ */
+ public function setOpenLineage($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class);
+ $this->open_lineage = $var;
+
+ return $this;
+ }
+
+ /**
+ * 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.
+ *
+ * Generated from protobuf field string request_id = 3;
+ * @return string
+ */
+ public function getRequestId()
+ {
+ return $this->request_id;
+ }
+
+ /**
+ * 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.
+ *
+ * Generated from protobuf field string request_id = 3;
+ * @param string $var
+ * @return $this
+ */
+ public function setRequestId($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->request_id = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/DataCatalogLineage/src/V1/ProcessOpenLineageRunEventResponse.php b/DataCatalogLineage/src/V1/ProcessOpenLineageRunEventResponse.php
new file mode 100644
index 000000000000..37a196bfebfd
--- /dev/null
+++ b/DataCatalogLineage/src/V1/ProcessOpenLineageRunEventResponse.php
@@ -0,0 +1,156 @@
+google.cloud.datacatalog.lineage.v1.ProcessOpenLineageRunEventResponse
+ */
+class ProcessOpenLineageRunEventResponse extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Created process name.
+ * Format: `projects/{project}/locations/{location}/processes/{process}`.
+ *
+ * Generated from protobuf field string process = 1 [(.google.api.resource_reference) = {
+ */
+ protected $process = '';
+ /**
+ * Created run name.
+ * Format:
+ * `projects/{project}/locations/{location}/processes/{process}/runs/{run}`.
+ *
+ * Generated from protobuf field string run = 2 [(.google.api.resource_reference) = {
+ */
+ protected $run = '';
+ /**
+ * Created lineage event names.
+ * Format:
+ * `projects/{project}/locations/{location}/processes/{process}/runs/{run}/lineageEvents/{lineage_event}`.
+ *
+ * Generated from protobuf field repeated string lineage_events = 3 [(.google.api.resource_reference) = {
+ */
+ private $lineage_events;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $process
+ * Created process name.
+ * Format: `projects/{project}/locations/{location}/processes/{process}`.
+ * @type string $run
+ * Created run name.
+ * Format:
+ * `projects/{project}/locations/{location}/processes/{process}/runs/{run}`.
+ * @type array|\Google\Protobuf\Internal\RepeatedField $lineage_events
+ * Created lineage event names.
+ * Format:
+ * `projects/{project}/locations/{location}/processes/{process}/runs/{run}/lineageEvents/{lineage_event}`.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Datacatalog\Lineage\V1\Lineage::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Created process name.
+ * Format: `projects/{project}/locations/{location}/processes/{process}`.
+ *
+ * Generated from protobuf field string process = 1 [(.google.api.resource_reference) = {
+ * @return string
+ */
+ public function getProcess()
+ {
+ return $this->process;
+ }
+
+ /**
+ * Created process name.
+ * Format: `projects/{project}/locations/{location}/processes/{process}`.
+ *
+ * Generated from protobuf field string process = 1 [(.google.api.resource_reference) = {
+ * @param string $var
+ * @return $this
+ */
+ public function setProcess($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->process = $var;
+
+ return $this;
+ }
+
+ /**
+ * Created run name.
+ * Format:
+ * `projects/{project}/locations/{location}/processes/{process}/runs/{run}`.
+ *
+ * Generated from protobuf field string run = 2 [(.google.api.resource_reference) = {
+ * @return string
+ */
+ public function getRun()
+ {
+ return $this->run;
+ }
+
+ /**
+ * Created run name.
+ * Format:
+ * `projects/{project}/locations/{location}/processes/{process}/runs/{run}`.
+ *
+ * Generated from protobuf field string run = 2 [(.google.api.resource_reference) = {
+ * @param string $var
+ * @return $this
+ */
+ public function setRun($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->run = $var;
+
+ return $this;
+ }
+
+ /**
+ * Created lineage event names.
+ * Format:
+ * `projects/{project}/locations/{location}/processes/{process}/runs/{run}/lineageEvents/{lineage_event}`.
+ *
+ * Generated from protobuf field repeated string lineage_events = 3 [(.google.api.resource_reference) = {
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getLineageEvents()
+ {
+ return $this->lineage_events;
+ }
+
+ /**
+ * Created lineage event names.
+ * Format:
+ * `projects/{project}/locations/{location}/processes/{process}/runs/{run}/lineageEvents/{lineage_event}`.
+ *
+ * Generated from protobuf field repeated string lineage_events = 3 [(.google.api.resource_reference) = {
+ * @param array|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setLineageEvents($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
+ $this->lineage_events = $arr;
+
+ return $this;
+ }
+
+}
+
diff --git a/DataCatalogLineage/src/V1/Run.php b/DataCatalogLineage/src/V1/Run.php
index ffc30d399699..b9f690869130 100644
--- a/DataCatalogLineage/src/V1/Run.php
+++ b/DataCatalogLineage/src/V1/Run.php
@@ -35,8 +35,9 @@ class Run extends \Google\Protobuf\Internal\Message
*/
protected $display_name = '';
/**
- * Optional. The attributes of the run. Can be anything, for example, a string
- * with an SQL request. Up to 100 attributes are allowed.
+ * Optional. The attributes of the run. Should only be used for the purpose of
+ * non-semantic management (classifying, describing or labeling the run).
+ * Up to 100 attributes are allowed.
*
* Generated from protobuf field map attributes = 3 [(.google.api.field_behavior) = OPTIONAL];
*/
@@ -77,8 +78,9 @@ class Run extends \Google\Protobuf\Internal\Message
* Must be not longer than 1024 characters and only contain UTF-8 letters
* or numbers, spaces or characters like `_-:&.`
* @type array|\Google\Protobuf\Internal\MapField $attributes
- * Optional. The attributes of the run. Can be anything, for example, a string
- * with an SQL request. Up to 100 attributes are allowed.
+ * Optional. The attributes of the run. Should only be used for the purpose of
+ * non-semantic management (classifying, describing or labeling the run).
+ * Up to 100 attributes are allowed.
* @type \Google\Protobuf\Timestamp $start_time
* Required. The timestamp of the start of the run.
* @type \Google\Protobuf\Timestamp $end_time
@@ -157,8 +159,9 @@ public function setDisplayName($var)
}
/**
- * Optional. The attributes of the run. Can be anything, for example, a string
- * with an SQL request. Up to 100 attributes are allowed.
+ * Optional. The attributes of the run. Should only be used for the purpose of
+ * non-semantic management (classifying, describing or labeling the run).
+ * Up to 100 attributes are allowed.
*
* Generated from protobuf field map attributes = 3 [(.google.api.field_behavior) = OPTIONAL];
* @return \Google\Protobuf\Internal\MapField
@@ -169,8 +172,9 @@ public function getAttributes()
}
/**
- * Optional. The attributes of the run. Can be anything, for example, a string
- * with an SQL request. Up to 100 attributes are allowed.
+ * Optional. The attributes of the run. Should only be used for the purpose of
+ * non-semantic management (classifying, describing or labeling the run).
+ * Up to 100 attributes are allowed.
*
* Generated from protobuf field map attributes = 3 [(.google.api.field_behavior) = OPTIONAL];
* @param array|\Google\Protobuf\Internal\MapField $var
diff --git a/DataCatalogLineage/src/V1/SearchLinksRequest.php b/DataCatalogLineage/src/V1/SearchLinksRequest.php
index d2db56e9fb55..61cfe999f15d 100644
--- a/DataCatalogLineage/src/V1/SearchLinksRequest.php
+++ b/DataCatalogLineage/src/V1/SearchLinksRequest.php
@@ -17,7 +17,7 @@
class SearchLinksRequest extends \Google\Protobuf\Internal\Message
{
/**
- * Required. The project and location you want search in the format `projects/*/locations/*`
+ * Required. The project and location you want search in.
*
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
@@ -50,7 +50,7 @@ class SearchLinksRequest extends \Google\Protobuf\Internal\Message
* Optional. Data for populating the Message object.
*
* @type string $parent
- * Required. The project and location you want search in the format `projects/*/locations/*`
+ * Required. The project and location you want search in.
* @type \Google\Cloud\DataCatalog\Lineage\V1\EntityReference $source
* Optional. Send asset information in the **source** field to retrieve all
* links that lead from the specified asset to downstream assets.
@@ -76,7 +76,7 @@ public function __construct($data = NULL) {
}
/**
- * Required. The project and location you want search in the format `projects/*/locations/*`
+ * Required. The project and location you want search in.
*
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
* @return string
@@ -87,7 +87,7 @@ public function getParent()
}
/**
- * Required. The project and location you want search in the format `projects/*/locations/*`
+ * Required. The project and location you want search in.
*
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
* @param string $var
diff --git a/DataCatalogLineage/src/V1/UpdateRunRequest.php b/DataCatalogLineage/src/V1/UpdateRunRequest.php
index 72b5866ce820..8122fdd17704 100644
--- a/DataCatalogLineage/src/V1/UpdateRunRequest.php
+++ b/DataCatalogLineage/src/V1/UpdateRunRequest.php
@@ -32,6 +32,12 @@ class UpdateRunRequest extends \Google\Protobuf\Internal\Message
* Generated from protobuf field .google.protobuf.FieldMask update_mask = 2;
*/
protected $update_mask = null;
+ /**
+ * If set to true and the run is not found, the request creates it.
+ *
+ * Generated from protobuf field bool allow_missing = 3;
+ */
+ protected $allow_missing = false;
/**
* @param \Google\Cloud\DataCatalog\Lineage\V1\Run $run Required. The lineage run to update.
@@ -68,6 +74,8 @@ public static function build(\Google\Cloud\DataCatalog\Lineage\V1\Run $run, \Goo
* @type \Google\Protobuf\FieldMask $update_mask
* The list of fields to update. Currently not used. The whole message is
* updated.
+ * @type bool $allow_missing
+ * If set to true and the run is not found, the request creates it.
* }
*/
public function __construct($data = NULL) {
@@ -155,5 +163,31 @@ public function setUpdateMask($var)
return $this;
}
+ /**
+ * If set to true and the run is not found, the request creates it.
+ *
+ * Generated from protobuf field bool allow_missing = 3;
+ * @return bool
+ */
+ public function getAllowMissing()
+ {
+ return $this->allow_missing;
+ }
+
+ /**
+ * If set to true and the run is not found, the request creates it.
+ *
+ * Generated from protobuf field bool allow_missing = 3;
+ * @param bool $var
+ * @return $this
+ */
+ public function setAllowMissing($var)
+ {
+ GPBUtil::checkBool($var);
+ $this->allow_missing = $var;
+
+ return $this;
+ }
+
}
diff --git a/DataCatalogLineage/src/V1/gapic_metadata.json b/DataCatalogLineage/src/V1/gapic_metadata.json
index 7d0f974b35cc..1668b663dd4a 100644
--- a/DataCatalogLineage/src/V1/gapic_metadata.json
+++ b/DataCatalogLineage/src/V1/gapic_metadata.json
@@ -75,6 +75,11 @@
"listRuns"
]
},
+ "ProcessOpenLineageRunEvent": {
+ "methods": [
+ "processOpenLineageRunEvent"
+ ]
+ },
"SearchLinks": {
"methods": [
"searchLinks"
diff --git a/DataCatalogLineage/src/V1/resources/lineage_client_config.json b/DataCatalogLineage/src/V1/resources/lineage_client_config.json
index d8dd8870a7c9..33da215543da 100644
--- a/DataCatalogLineage/src/V1/resources/lineage_client_config.json
+++ b/DataCatalogLineage/src/V1/resources/lineage_client_config.json
@@ -93,6 +93,11 @@
"retry_codes_name": "retry_policy_1_codes",
"retry_params_name": "retry_policy_1_params"
},
+ "ProcessOpenLineageRunEvent": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "retry_policy_1_codes",
+ "retry_params_name": "retry_policy_1_params"
+ },
"SearchLinks": {
"timeout_millis": 60000,
"retry_codes_name": "retry_policy_1_codes",
diff --git a/DataCatalogLineage/src/V1/resources/lineage_descriptor_config.php b/DataCatalogLineage/src/V1/resources/lineage_descriptor_config.php
index 6ead216d0eb0..67a2be85f895 100644
--- a/DataCatalogLineage/src/V1/resources/lineage_descriptor_config.php
+++ b/DataCatalogLineage/src/V1/resources/lineage_descriptor_config.php
@@ -205,6 +205,18 @@
],
],
],
+ 'ProcessOpenLineageRunEvent' => [
+ 'callType' => \Google\ApiCore\Call::UNARY_CALL,
+ 'responseType' => 'Google\Cloud\DataCatalog\Lineage\V1\ProcessOpenLineageRunEventResponse',
+ 'headerParams' => [
+ [
+ 'keyName' => 'parent',
+ 'fieldAccessors' => [
+ 'getParent',
+ ],
+ ],
+ ],
+ ],
'SearchLinks' => [
'pageStreaming' => [
'requestPageTokenGetMethod' => 'getPageToken',
diff --git a/DataCatalogLineage/src/V1/resources/lineage_rest_client_config.php b/DataCatalogLineage/src/V1/resources/lineage_rest_client_config.php
index 39ff25c49e3a..0f8e407dc4fb 100644
--- a/DataCatalogLineage/src/V1/resources/lineage_rest_client_config.php
+++ b/DataCatalogLineage/src/V1/resources/lineage_rest_client_config.php
@@ -150,6 +150,18 @@
],
],
],
+ 'ProcessOpenLineageRunEvent' => [
+ 'method' => 'post',
+ 'uriTemplate' => '/v1/{parent=projects/*/locations/*}:processOpenLineageRunEvent',
+ 'body' => 'open_lineage',
+ 'placeholders' => [
+ 'parent' => [
+ 'getters' => [
+ 'getParent',
+ ],
+ ],
+ ],
+ ],
'SearchLinks' => [
'method' => 'post',
'uriTemplate' => '/v1/{parent=projects/*/locations/*}:searchLinks',
diff --git a/DataCatalogLineage/tests/Unit/V1/Client/LineageClientTest.php b/DataCatalogLineage/tests/Unit/V1/Client/LineageClientTest.php
index 456e2e8591ec..58f95fc0d16b 100644
--- a/DataCatalogLineage/tests/Unit/V1/Client/LineageClientTest.php
+++ b/DataCatalogLineage/tests/Unit/V1/Client/LineageClientTest.php
@@ -49,6 +49,8 @@
use Google\Cloud\DataCatalog\Lineage\V1\ListRunsResponse;
use Google\Cloud\DataCatalog\Lineage\V1\Process;
use Google\Cloud\DataCatalog\Lineage\V1\ProcessLinks;
+use Google\Cloud\DataCatalog\Lineage\V1\ProcessOpenLineageRunEventRequest;
+use Google\Cloud\DataCatalog\Lineage\V1\ProcessOpenLineageRunEventResponse;
use Google\Cloud\DataCatalog\Lineage\V1\Run;
use Google\Cloud\DataCatalog\Lineage\V1\Run\State;
use Google\Cloud\DataCatalog\Lineage\V1\SearchLinksRequest;
@@ -59,6 +61,7 @@
use Google\LongRunning\Operation;
use Google\Protobuf\Any;
use Google\Protobuf\GPBEmpty;
+use Google\Protobuf\Struct;
use Google\Protobuf\Timestamp;
use Google\Rpc\Code;
use stdClass;
@@ -185,6 +188,8 @@ public function createLineageEventTest()
// Mock request
$formattedParent = $gapicClient->runName('[PROJECT]', '[LOCATION]', '[PROCESS]', '[RUN]');
$lineageEvent = new LineageEvent();
+ $lineageEventStartTime = new Timestamp();
+ $lineageEvent->setStartTime($lineageEventStartTime);
$request = (new CreateLineageEventRequest())
->setParent($formattedParent)
->setLineageEvent($lineageEvent);
@@ -223,6 +228,8 @@ public function createLineageEventExceptionTest()
// Mock request
$formattedParent = $gapicClient->runName('[PROJECT]', '[LOCATION]', '[PROCESS]', '[RUN]');
$lineageEvent = new LineageEvent();
+ $lineageEventStartTime = new Timestamp();
+ $lineageEvent->setStartTime($lineageEventStartTime);
$request = (new CreateLineageEventRequest())
->setParent($formattedParent)
->setLineageEvent($lineageEvent);
@@ -1106,6 +1113,78 @@ public function listRunsExceptionTest()
$this->assertTrue($transport->isExhausted());
}
+ /** @test */
+ public function processOpenLineageRunEventTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $process = 'process-309518737';
+ $run = 'run113291';
+ $expectedResponse = new ProcessOpenLineageRunEventResponse();
+ $expectedResponse->setProcess($process);
+ $expectedResponse->setRun($run);
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $parent = 'parent-995424086';
+ $openLineage = new Struct();
+ $request = (new ProcessOpenLineageRunEventRequest())
+ ->setParent($parent)
+ ->setOpenLineage($openLineage);
+ $response = $gapicClient->processOpenLineageRunEvent($request);
+ $this->assertEquals($expectedResponse, $response);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.cloud.datacatalog.lineage.v1.Lineage/ProcessOpenLineageRunEvent', $actualFuncCall);
+ $actualValue = $actualRequestObject->getParent();
+ $this->assertProtobufEquals($parent, $actualValue);
+ $actualValue = $actualRequestObject->getOpenLineage();
+ $this->assertProtobufEquals($openLineage, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function processOpenLineageRunEventExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+ $transport->addResponse(null, $status);
+ // Mock request
+ $parent = 'parent-995424086';
+ $openLineage = new Struct();
+ $request = (new ProcessOpenLineageRunEventRequest())
+ ->setParent($parent)
+ ->setOpenLineage($openLineage);
+ try {
+ $gapicClient->processOpenLineageRunEvent($request);
+ // If the $gapicClient method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
/** @test */
public function searchLinksTest()
{
diff --git a/DataCatalogLineage/tests/Unit/V1/LineageClientTest.php b/DataCatalogLineage/tests/Unit/V1/LineageClientTest.php
index 575205c031dc..d704af8f5acd 100644
--- a/DataCatalogLineage/tests/Unit/V1/LineageClientTest.php
+++ b/DataCatalogLineage/tests/Unit/V1/LineageClientTest.php
@@ -36,6 +36,7 @@
use Google\Cloud\DataCatalog\Lineage\V1\ListRunsResponse;
use Google\Cloud\DataCatalog\Lineage\V1\Process;
use Google\Cloud\DataCatalog\Lineage\V1\ProcessLinks;
+use Google\Cloud\DataCatalog\Lineage\V1\ProcessOpenLineageRunEventResponse;
use Google\Cloud\DataCatalog\Lineage\V1\Run;
use Google\Cloud\DataCatalog\Lineage\V1\Run\State;
use Google\Cloud\DataCatalog\Lineage\V1\SearchLinksResponse;
@@ -43,6 +44,7 @@
use Google\LongRunning\Operation;
use Google\Protobuf\Any;
use Google\Protobuf\GPBEmpty;
+use Google\Protobuf\Struct;
use Google\Protobuf\Timestamp;
use Google\Rpc\Code;
use stdClass;
@@ -163,6 +165,8 @@ public function createLineageEventTest()
// Mock request
$formattedParent = $gapicClient->runName('[PROJECT]', '[LOCATION]', '[PROCESS]', '[RUN]');
$lineageEvent = new LineageEvent();
+ $lineageEventStartTime = new Timestamp();
+ $lineageEvent->setStartTime($lineageEventStartTime);
$response = $gapicClient->createLineageEvent($formattedParent, $lineageEvent);
$this->assertEquals($expectedResponse, $response);
$actualRequests = $transport->popReceivedCalls();
@@ -198,6 +202,8 @@ public function createLineageEventExceptionTest()
// Mock request
$formattedParent = $gapicClient->runName('[PROJECT]', '[LOCATION]', '[PROCESS]', '[RUN]');
$lineageEvent = new LineageEvent();
+ $lineageEventStartTime = new Timestamp();
+ $lineageEvent->setStartTime($lineageEventStartTime);
try {
$gapicClient->createLineageEvent($formattedParent, $lineageEvent);
// If the $gapicClient method call did not throw, fail the test
@@ -1030,6 +1036,72 @@ public function listRunsExceptionTest()
$this->assertTrue($transport->isExhausted());
}
+ /** @test */
+ public function processOpenLineageRunEventTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $process = 'process-309518737';
+ $run = 'run113291';
+ $expectedResponse = new ProcessOpenLineageRunEventResponse();
+ $expectedResponse->setProcess($process);
+ $expectedResponse->setRun($run);
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $parent = 'parent-995424086';
+ $openLineage = new Struct();
+ $response = $gapicClient->processOpenLineageRunEvent($parent, $openLineage);
+ $this->assertEquals($expectedResponse, $response);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame('/google.cloud.datacatalog.lineage.v1.Lineage/ProcessOpenLineageRunEvent', $actualFuncCall);
+ $actualValue = $actualRequestObject->getParent();
+ $this->assertProtobufEquals($parent, $actualValue);
+ $actualValue = $actualRequestObject->getOpenLineage();
+ $this->assertProtobufEquals($openLineage, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function processOpenLineageRunEventExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+ $expectedExceptionMessage = json_encode([
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ], JSON_PRETTY_PRINT);
+ $transport->addResponse(null, $status);
+ // Mock request
+ $parent = 'parent-995424086';
+ $openLineage = new Struct();
+ try {
+ $gapicClient->processOpenLineageRunEvent($parent, $openLineage);
+ // If the $gapicClient method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
/** @test */
public function searchLinksTest()
{