Allow specific metadata for notifications from Google Cloud Storage
When GCS is registered as a publisher to a topic, we can specify none as the payload if all we need are the eventType, bucketId, objectId, and objectGeneration fields. This is great since the message data is only roughly 650 bytes for reasonably size bucket names and file names. For most projects, that's all we need. It's great that objectGeneration happens to be included.
However, if we need just one other field from the object's metadata, say Content-Length for example, which would add roughly 20 more bytes, we're stuck with the entire basket of metadata fields. We'd like to specify "content-length" as the payload. But we can't. We have to specify JSONAPIV1 as the payload and that brings with it all 20 or so metadata fields. So instead of ~650 bytes plus ~20 bytes, we end up with ~2200 bytes. That's a lot of additional data at scale.
Official documentation: https://cloud.google.com/storage/docs/pubsub-notifications#format