googleapis / nodejs-pubsub

Node.js client for Google Cloud Pub/Sub: Ingest event streams from anywhere, at any scale, for simple, reliable, real-time stream analytics.
https://cloud.google.com/pubsub/
Apache License 2.0
516 stars 227 forks source link

feat: add schema revision samples #1870

Closed feywind closed 5 months ago

feywind commented 6 months ago

This adds support for easily getting a schema gapic client, along with samples for schema revisions.

snippet-bot[bot] commented 6 months ago

Here is the summary of changes.

You are about to add 18 region tags. - [samples/commitAvroSchema.js:32](https://github.com/feywind/nodejs-pubsub/blob/f328879a15c014e3a1d69701fce8763187995ffd/samples/commitAvroSchema.js#L32), tag `pubsub_commit_avro_schema` - [samples/commitProtoSchema.js:32](https://github.com/feywind/nodejs-pubsub/blob/f328879a15c014e3a1d69701fce8763187995ffd/samples/commitProtoSchema.js#L32), tag `pubsub_commit_proto_schema` - [samples/createTopicWithSchemaRevisions.js:32](https://github.com/feywind/nodejs-pubsub/blob/f328879a15c014e3a1d69701fce8763187995ffd/samples/createTopicWithSchemaRevisions.js#L32), tag `pubsub_create_topic_with_schema_revisions` - [samples/deleteSchemaRevision.js:32](https://github.com/feywind/nodejs-pubsub/blob/f328879a15c014e3a1d69701fce8763187995ffd/samples/deleteSchemaRevision.js#L32), tag `pubsub_delete_schema_revision` - [samples/getSchemaRevision.js:32](https://github.com/feywind/nodejs-pubsub/blob/f328879a15c014e3a1d69701fce8763187995ffd/samples/getSchemaRevision.js#L32), tag `pubsub_get_schema_revision` - [samples/listSchemaRevisions.js:32](https://github.com/feywind/nodejs-pubsub/blob/f328879a15c014e3a1d69701fce8763187995ffd/samples/listSchemaRevisions.js#L32), tag `pubsub_list_schema_revisions` - [samples/listenForAvroRecordsWithRevisions.js:32](https://github.com/feywind/nodejs-pubsub/blob/f328879a15c014e3a1d69701fce8763187995ffd/samples/listenForAvroRecordsWithRevisions.js#L32), tag `pubsub_subscribe_avro_records_with_revisions` - [samples/rollbackSchema.js:32](https://github.com/feywind/nodejs-pubsub/blob/f328879a15c014e3a1d69701fce8763187995ffd/samples/rollbackSchema.js#L32), tag `pubsub_rollback_schema` - [samples/typescript/commitAvroSchema.ts:28](https://github.com/feywind/nodejs-pubsub/blob/f328879a15c014e3a1d69701fce8763187995ffd/samples/typescript/commitAvroSchema.ts#L28), tag `pubsub_commit_avro_schema` - [samples/typescript/commitProtoSchema.ts:28](https://github.com/feywind/nodejs-pubsub/blob/f328879a15c014e3a1d69701fce8763187995ffd/samples/typescript/commitProtoSchema.ts#L28), tag `pubsub_commit_proto_schema` - [samples/typescript/createTopicWithSchemaRevisions.ts:28](https://github.com/feywind/nodejs-pubsub/blob/f328879a15c014e3a1d69701fce8763187995ffd/samples/typescript/createTopicWithSchemaRevisions.ts#L28), tag `pubsub_create_topic_with_schema_revisions` - [samples/typescript/deleteSchemaRevision.ts:28](https://github.com/feywind/nodejs-pubsub/blob/f328879a15c014e3a1d69701fce8763187995ffd/samples/typescript/deleteSchemaRevision.ts#L28), tag `pubsub_delete_schema_revision` - [samples/typescript/getSchemaRevision.ts:28](https://github.com/feywind/nodejs-pubsub/blob/f328879a15c014e3a1d69701fce8763187995ffd/samples/typescript/getSchemaRevision.ts#L28), tag `pubsub_get_schema_revision` - [samples/typescript/listSchemaRevisions.ts:28](https://github.com/feywind/nodejs-pubsub/blob/f328879a15c014e3a1d69701fce8763187995ffd/samples/typescript/listSchemaRevisions.ts#L28), tag `pubsub_list_schema_revisions` - [samples/typescript/listenForAvroRecordsWithRevisions.ts:28](https://github.com/feywind/nodejs-pubsub/blob/f328879a15c014e3a1d69701fce8763187995ffd/samples/typescript/listenForAvroRecordsWithRevisions.ts#L28), tag `pubsub_subscribe_avro_records_with_revisions` - [samples/typescript/rollbackSchema.ts:28](https://github.com/feywind/nodejs-pubsub/blob/f328879a15c014e3a1d69701fce8763187995ffd/samples/typescript/rollbackSchema.ts#L28), tag `pubsub_rollback_schema` - [samples/typescript/updateTopicSchema.ts:28](https://github.com/feywind/nodejs-pubsub/blob/f328879a15c014e3a1d69701fce8763187995ffd/samples/typescript/updateTopicSchema.ts#L28), tag `pubsub_update_topic_schema` - [samples/updateTopicSchema.js:32](https://github.com/feywind/nodejs-pubsub/blob/f328879a15c014e3a1d69701fce8763187995ffd/samples/updateTopicSchema.js#L32), tag `pubsub_update_topic_schema`

This comment is generated by snippet-bot. If you find problems with this result, please file an issue at: https://github.com/googleapis/repo-automation-bots/issues. To update this comment, add snippet-bot:force-run label or use the checkbox below:

generated-files-bot[bot] commented 6 months ago

Warning: This pull request is touching the following templated files:

feywind commented 6 months ago

Hmm. The sample tests are going to need some more manual testing.

feywind commented 5 months ago

These samples look good. I think there are a few missing ones,most important is probably pubsub_get_schema_revision but also pubsub_commit_proto_schema and pubsub_subscribe_avro_records_with_revisions. The first two should probably go in this PR, while the latter two can be in a separate PR?

Hmm, those didn't make it into my hotlist. I'll just add them in this PR.