GoogleCloudPlatform / GoogleCloudPlatform/functions-framework-conformance
CloudEvents to legacy events mapping for legacy pubsub and legacy storage events.
- Dominant language
- Go
- Stars
- 22
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
When converting CloudEvents to legacy events, a [legacy pubsub CloudEvent](https://github.com/GoogleCloudPlatform/functions-framework-conformance/blob/master/events/generate/data/legacy_pubsub-cloudevent-input.json) has `type` attribute `"google.cloud.pubsub.topic.v1.messagePublished"`. This can be converted to a legacy event `eventType` as
* `google.pubsub.topic.publish`
* `providers/cloud.pubsub/eventTypes/topic.publish` (deprecated).
Similarly, the CloudEvent `source` attribute e.g. `//pubsub.googleapis.com/projects/sample-project/topics/gcf-test` can be converted into a legacy event `resource` as
* structured format:
```
{
"service":"pubsub.googleapis.com",
"name":"projects/sample-project/topics/gcf-test",
"type":"type.googleapis.com/google.pubsub.v1.PubsubMessage"
}
```
* raw path: `projects/sample-project/topics/gcf-test` (deprecated).
(This is also the case for legacy storage [events.)](https://github.com/GoogleCloudPlatform/functions-framework-conformance/blob/master/events/generate/data/legacy_storage_change-cloudevent-input.json)
1. Is this reasonable to always convert to the *non-deprecated* format? User's function _might_ still depend on the deprecated format.
2. Is there a way to distinguish CloudEvents for legacy pubsub/storage and CloudEvents for normal pubsub/storage?
cc: @grant @jskeet
Contributor guide
Assessment
This issue has not been assessed yet.