From 083e3136855878ffbff68dfdeee90a1f709e376e Mon Sep 17 00:00:00 2001 From: Grant Timmerman <744973+grant@users.noreply.github.com> Date: Wed, 4 Nov 2020 10:50:32 -0600 Subject: [PATCH] docs: add cloudevent product name column (#105) Signed-off-by: Grant Timmerman --- README.md | 24 +++++----- .../Program.cs | 46 +++++++++++++++++-- 2 files changed, 53 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 615c2087..938818b0 100644 --- a/README.md +++ b/README.md @@ -22,18 +22,18 @@ may change. Even the core `cloud_event_type` annotation may change. This repository contains definitions for the following CloudEvents: -|Package|Event types|Data messages| -|-|-|-| -|[google.events.cloud.audit.v1](proto/google/events/cloud/audit/v1)|google.cloud.audit.log.v1.written|LogEntryData| -|[google.events.cloud.cloudbuild.v1](proto/google/events/cloud/cloudbuild/v1)|google.cloud.cloudbuild.build.v1.statusChanged|BuildEventData| -|[google.events.cloud.firestore.v1](proto/google/events/cloud/firestore/v1)|google.cloud.firestore.document.v1.created
google.cloud.firestore.document.v1.deleted
google.cloud.firestore.document.v1.updated
google.cloud.firestore.document.v1.written|DocumentEventData| -|[google.events.cloud.pubsub.v1](proto/google/events/cloud/pubsub/v1)|google.cloud.pubsub.topic.v1.messagePublished|MessagePublishedData| -|[google.events.cloud.scheduler.v1](proto/google/events/cloud/scheduler/v1)|google.cloud.scheduler.job.v1.executed|SchedulerJobData| -|[google.events.cloud.storage.v1](proto/google/events/cloud/storage/v1)|google.cloud.storage.object.v1.archived
google.cloud.storage.object.v1.deleted
google.cloud.storage.object.v1.finalized
google.cloud.storage.object.v1.metadataUpdated|StorageObjectData| -|[google.events.firebase.analytics.v1](proto/google/events/firebase/analytics/v1)|google.firebase.analytics.log.v1.written|AnalyticsLogData| -|[google.events.firebase.auth.v1](proto/google/events/firebase/auth/v1)|google.firebase.auth.user.v1.created
google.firebase.auth.user.v1.deleted|AuthEventData| -|[google.events.firebase.database.v1](proto/google/events/firebase/database/v1)|google.firebase.database.ref.v1.created
google.firebase.database.ref.v1.deleted
google.firebase.database.ref.v1.updated
google.firebase.database.ref.v1.written|ReferenceEventData| -|[google.events.firebase.remoteconfig.v1](proto/google/events/firebase/remoteconfig/v1)|google.firebase.remoteconfig.remoteConfig.v1.updated|RemoteConfigEventData| +|Product|Package|Event types|Data messages| +|-|-|-|-| +|Cloud Audit Logs|[google.events.cloud.audit.v1](proto/google/events/cloud/audit/v1)|google.cloud.audit.log.v1.written|LogEntryData| +|Cloud Build|[google.events.cloud.cloudbuild.v1](proto/google/events/cloud/cloudbuild/v1)|google.cloud.cloudbuild.build.v1.statusChanged|BuildEventData| +|Cloud Firestore|[google.events.cloud.firestore.v1](proto/google/events/cloud/firestore/v1)|google.cloud.firestore.document.v1.created
google.cloud.firestore.document.v1.deleted
google.cloud.firestore.document.v1.updated
google.cloud.firestore.document.v1.written|DocumentEventData| +|Cloud Pub/Sub|[google.events.cloud.pubsub.v1](proto/google/events/cloud/pubsub/v1)|google.cloud.pubsub.topic.v1.messagePublished|MessagePublishedData| +|Cloud Scheduler|[google.events.cloud.scheduler.v1](proto/google/events/cloud/scheduler/v1)|google.cloud.scheduler.job.v1.executed|SchedulerJobData| +|Cloud Storage|[google.events.cloud.storage.v1](proto/google/events/cloud/storage/v1)|google.cloud.storage.object.v1.archived
google.cloud.storage.object.v1.deleted
google.cloud.storage.object.v1.finalized
google.cloud.storage.object.v1.metadataUpdated|StorageObjectData| +|Google Analytics for Firebase|[google.events.firebase.analytics.v1](proto/google/events/firebase/analytics/v1)|google.firebase.analytics.log.v1.written|AnalyticsLogData| +|Firebase Authentication|[google.events.firebase.auth.v1](proto/google/events/firebase/auth/v1)|google.firebase.auth.user.v1.created
google.firebase.auth.user.v1.deleted|AuthEventData| +|Firebase Realtime Database|[google.events.firebase.database.v1](proto/google/events/firebase/database/v1)|google.firebase.database.ref.v1.created
google.firebase.database.ref.v1.deleted
google.firebase.database.ref.v1.updated
google.firebase.database.ref.v1.written|ReferenceEventData| +|Firebase Remote Config|[google.events.firebase.remoteconfig.v1](proto/google/events/firebase/remoteconfig/v1)|google.firebase.remoteconfig.remoteConfig.v1.updated|RemoteConfigEventData| ## CloudEvent Type Repos diff --git a/tools/registry/Google.Events.Tools.GenerateRegistry/Program.cs b/tools/registry/Google.Events.Tools.GenerateRegistry/Program.cs index 10a56f79..8a4a0c97 100644 --- a/tools/registry/Google.Events.Tools.GenerateRegistry/Program.cs +++ b/tools/registry/Google.Events.Tools.GenerateRegistry/Program.cs @@ -38,7 +38,7 @@ internal static class Program /// The Markdown header for the table at the start of the event registry. This string is used /// to find the table within the README. /// - private const string TableHeader = "|Package|Event types|Data messages|"; + private const string TableHeader = "|Product|Package|Event types|Data messages|"; /// /// The line between the table header and the table content. This is the same number of | characters @@ -158,6 +158,39 @@ static IEnumerable CreateTableRows(string descriptorFile) /// class TableRow { + /// + /// The product represented in this row. + /// + public string Product { + get { + switch (Package) + { + case "google.events.cloud.audit.v1": + return "Cloud Audit Logs"; + case "google.events.cloud.cloudbuild.v1": + return "Cloud Build"; + case "google.events.cloud.firestore.v1": + return "Cloud Firestore"; + case "google.events.cloud.pubsub.v1": + return "Cloud Pub/Sub"; + case "google.events.cloud.scheduler.v1": + return "Cloud Scheduler"; + case "google.events.cloud.storage.v1": + return "Cloud Storage"; + case "google.events.firebase.analytics.v1": + return "Google Analytics for Firebase"; + case "google.events.firebase.auth.v1": + return "Firebase Authentication"; + case "google.events.firebase.database.v1": + return "Firebase Realtime Database"; + case "google.events.firebase.remoteconfig.v1": + return "Firebase Remote Config"; + default: + throw new ArgumentException("Unknown product. Please add corresponding product name."); + } + } + } + /// /// The protobuf package represented in this row. /// @@ -183,17 +216,20 @@ public TableRow(string package) => /// public string ToMarkdown() { - // The first column is the package name, with a link to the directory containing the protos. + // Product name / API name + var productColumn = Product; + + // Package name with a link to the directory containing the protos. var packageColumn = $"[{Package}](proto/{string.Join("/", Package.Split('.'))})"; - // The second column is the event types, in lexicographic order, separated by HTML line breaks. + // Event types in lexicographic order, separated by HTML line breaks. var eventTypesColumn = string.Join("
", EventTypes.OrderBy(type => type, StringComparer.Ordinal)); - // The third column is the data messages, in lexicographic order, separated by HTML line breaks. + // Data messages, in lexicographic order, separated by HTML line breaks. var dataMessagesColumn = string.Join("
", DataMessages.OrderBy(type => type, StringComparer.Ordinal)); // Join the columns together, using | as the delimiter. - return $"|{packageColumn}|{eventTypesColumn}|{dataMessagesColumn}|"; + return $"|{productColumn}|{packageColumn}|{eventTypesColumn}|{dataMessagesColumn}|"; } } }