From 059660bddf9390c886f27883100dbd19075c1ccb Mon Sep 17 00:00:00 2001 From: Justin Donn Date: Tue, 31 Oct 2023 10:29:56 -0700 Subject: [PATCH] fix: use MetadataAuditStamp instead of com.linkedin.common.AuditStamp --- .../metadata/events/MetadataAuditStamp.pdl | 25 +++++++++++++++++++ .../annotatedAspectBar/MetadataAuditEvent.pdl | 4 +-- .../main/resources/MetadataAuditEvent.rythm | 4 +-- ...adataEventsGeneratorPluginIntegTest.groovy | 8 +++--- 4 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 dao-api/src/main/pegasus/com/linkedin/metadata/events/MetadataAuditStamp.pdl diff --git a/dao-api/src/main/pegasus/com/linkedin/metadata/events/MetadataAuditStamp.pdl b/dao-api/src/main/pegasus/com/linkedin/metadata/events/MetadataAuditStamp.pdl new file mode 100644 index 000000000..530fd8e95 --- /dev/null +++ b/dao-api/src/main/pegasus/com/linkedin/metadata/events/MetadataAuditStamp.pdl @@ -0,0 +1,25 @@ +namespace com.linkedin.metadata.events + +/** + * Data captured on a resource/association/sub-resource level giving insight into when that resource/association/sub-resource moved into a particular lifecycle stage, and who acted to move it into that specific lifecycle stage. + */ +record MetadataAuditStamp { + + /** + * When did the resource/association/sub-resource move into the specific lifecycle stage represented by this MetadataAuditEvent. + * i.e. createdon column of a metadata entity table + */ + time: long + + /** + * The entity (e.g. a member URN) which will be credited for moving the resource/association/sub-resource into the specific lifecycle stage. It is also the one used to authorize the change. + * i.e. createdby column of a metadata entity table + */ + actor: string + + /** + * The entity (e.g. a service URN) which performs the change on behalf of the Actor and must be authorized to act as the Actor. + * i.e. createdfor column of a metadata entity table + */ + impersonator: optional string +} diff --git a/gradle-plugins/metadata-annotations-test-models/src/main/pegasus/com/linkedin/testing/mxe/bar/annotatedAspectBar/MetadataAuditEvent.pdl b/gradle-plugins/metadata-annotations-test-models/src/main/pegasus/com/linkedin/testing/mxe/bar/annotatedAspectBar/MetadataAuditEvent.pdl index 563735b78..afdb4c56c 100644 --- a/gradle-plugins/metadata-annotations-test-models/src/main/pegasus/com/linkedin/testing/mxe/bar/annotatedAspectBar/MetadataAuditEvent.pdl +++ b/gradle-plugins/metadata-annotations-test-models/src/main/pegasus/com/linkedin/testing/mxe/bar/annotatedAspectBar/MetadataAuditEvent.pdl @@ -1,10 +1,10 @@ namespace com.linkedin.testing.mxe.bar.annotatedAspectBar import com.linkedin.avro2pegasus.events.KafkaAuditHeader -import com.linkedin.common.AuditStamp import com.linkedin.metadata.events.ChangeType import com.linkedin.metadata.events.IngestionTrackingContext import com.linkedin.metadata.events.IngestionMode +import com.linkedin.metadata.events.MetadataAuditStamp import com.linkedin.testing.BarUrn import com.linkedin.testing.AnnotatedAspectBar @@ -47,7 +47,7 @@ record MetadataAuditEvent { /** * Audit info (i.e. createdon, createdby, createdfor) to track the version history of metadata changes. */ - auditStamp: union[null, AuditStamp] = null + auditStamp: union[null, MetadataAuditStamp] = null /** * Type of the ingestion. Allow null for backward compatibility. Downstream should treat null as live ingestion. diff --git a/gradle-plugins/metadata-events-generator-lib/src/main/resources/MetadataAuditEvent.rythm b/gradle-plugins/metadata-events-generator-lib/src/main/resources/MetadataAuditEvent.rythm index 34ad408d6..9a63880a6 100644 --- a/gradle-plugins/metadata-events-generator-lib/src/main/resources/MetadataAuditEvent.rythm +++ b/gradle-plugins/metadata-events-generator-lib/src/main/resources/MetadataAuditEvent.rythm @@ -4,10 +4,10 @@ namespace @(eventSpec.getNamespace()) import com.linkedin.avro2pegasus.events.KafkaAuditHeader -import com.linkedin.common.AuditStamp import com.linkedin.metadata.events.ChangeType import com.linkedin.metadata.events.IngestionTrackingContext import com.linkedin.metadata.events.IngestionMode +import com.linkedin.metadata.events.MetadataAuditStamp import @eventSpec.getUrnType() import @eventSpec.getFullValueType() @@ -50,7 +50,7 @@ record MetadataAuditEvent { /** * Audit info (i.e. createdon, createdby, createdfor) to track the version history of metadata changes. */ - auditStamp: union[null, AuditStamp] = null + auditStamp: union[null, MetadataAuditStamp] = null /** * Type of the ingestion. Allow null for backward compatibility. Downstream should treat null as live ingestion. diff --git a/gradle-plugins/metadata-events-generator-plugin/src/test/groovy/com/linkedin/metadata/gradle/MetadataEventsGeneratorPluginIntegTest.groovy b/gradle-plugins/metadata-events-generator-plugin/src/test/groovy/com/linkedin/metadata/gradle/MetadataEventsGeneratorPluginIntegTest.groovy index 8ee7f3453..6147c7c20 100644 --- a/gradle-plugins/metadata-events-generator-plugin/src/test/groovy/com/linkedin/metadata/gradle/MetadataEventsGeneratorPluginIntegTest.groovy +++ b/gradle-plugins/metadata-events-generator-plugin/src/test/groovy/com/linkedin/metadata/gradle/MetadataEventsGeneratorPluginIntegTest.groovy @@ -135,10 +135,10 @@ class MetadataEventsGeneratorPluginIntegTest extends Specification { namespace com.linkedin.mxe.foo.testAspect import com.linkedin.avro2pegasus.events.KafkaAuditHeader - import com.linkedin.common.AuditStamp import com.linkedin.metadata.events.ChangeType import com.linkedin.metadata.events.IngestionTrackingContext import com.linkedin.metadata.events.IngestionMode + import com.linkedin.metadata.events.MetadataAuditStamp import com.linkedin.testing.FooUrn import com.linkedin.metadata.test.aspects.TestAspect @@ -181,7 +181,7 @@ class MetadataEventsGeneratorPluginIntegTest extends Specification { /** * Audit info (i.e. createdon, createdby, createdfor) to track the version history of metadata changes. */ - auditStamp: union[null, AuditStamp] = null + auditStamp: union[null, MetadataAuditStamp] = null /** * Type of the ingestion. Allow null for backward compatibility. Downstream should treat null as live ingestion. @@ -261,10 +261,10 @@ class MetadataEventsGeneratorPluginIntegTest extends Specification { namespace com.linkedin.mxe.foo.testTyperefAspect import com.linkedin.avro2pegasus.events.KafkaAuditHeader - import com.linkedin.common.AuditStamp import com.linkedin.metadata.events.ChangeType import com.linkedin.metadata.events.IngestionTrackingContext import com.linkedin.metadata.events.IngestionMode + import com.linkedin.metadata.events.MetadataAuditStamp import com.linkedin.testing.FooUrn import com.linkedin.metadata.test.aspects.TestTyperefAspect @@ -307,7 +307,7 @@ class MetadataEventsGeneratorPluginIntegTest extends Specification { /** * Audit info (i.e. createdon, createdby, createdfor) to track the version history of metadata changes. */ - auditStamp: union[null, AuditStamp] = null + auditStamp: union[null, MetadataAuditStamp] = null /** * Type of the ingestion. Allow null for backward compatibility. Downstream should treat null as live ingestion.