Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement pubsub samples #11720

Closed
alevenberg opened this issue May 24, 2023 · 2 comments
Closed

Implement pubsub samples #11720

alevenberg opened this issue May 24, 2023 · 2 comments
Assignees
Labels
samples Issues that are directly related to samples. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@alevenberg
Copy link
Member

There are 10 pubsub samples that are missing for C++

https://cloud.google.com/pubsub/docs/samples

This issue will track the implementation

@alevenberg alevenberg added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label May 24, 2023
@alevenberg alevenberg self-assigned this May 24, 2023
@product-auto-label product-auto-label bot added the samples Issues that are directly related to samples. label May 24, 2023
@alevenberg
Copy link
Member Author

alevenberg commented Jun 8, 2023

Splitting into 3 PRs

  1. add pubsub_list_schema_revisions, pubsub_commit_avro_schema, and pubsub_commit_proto_schema
    a. pubsub_list_schema_revisions
    ListSchemaRevisionss
    bazel run //google/cloud/pubsub/samples:samples list-schema-revisions alevenb-test avro-schema

b. pubsub_commit_avro_schema

To test
CreateAvroSchema
bazel run //google/cloud/pubsub/samples:samples create-avro-schema alevenb-test avro-schema ./google/cloud/pubsub/samples/testdata/schema.avsc

ListSchemaRevisionss
bazel run //google/cloud/pubsub/samples:samples list-schema-revisions alevenb-test avro-schema

CommitAvroSchema
bazel run //google/cloud/pubsub/samples:samples commit-avro-schema alevenb-test avro-schema ./google/cloud/pubsub/samples/testdata/revised_schema.avsc

c. pubsub_commit_proto_schema
pubsub_list_schema_revisions
CreateProtobufSchema
bazel run //google/cloud/pubsub/samples:samples create-protobuf-schema alevenb-test protobuf-schema ./google/cloud/pubsub/samples/testdata/schema.proto

ListSchemaRevisionss
bazel run //google/cloud/pubsub/samples:samples list-schema-revisions alevenb-test protobuf-schema

CommitProtobufSchema
bazel run //google/cloud/pubsub/samples:samples commit-protobuf-schema alevenb-test protobuf-schema ./google/cloud/pubsub/samples/testdata/revised_schema.proto

Ran before sending PR

ci/cloudbuild/build.sh -t checkers-pr --docker env GOOGLE_CLOUD_PROJECT=cloud-cpp-testing-resources bazel run //google/cloud/pubsub/samples:samples -- auto
2.
pubsub_get_schema_revision
bazel run //google/cloud/pubsub/samples:samples get-schema-revision alevenb-test protobuf-schema 19d55c5e

pubsub_rollback_schema
bazel run //google/cloud/pubsub/samples:samples rollback-schema alevenb-test protobuf-schema 19d55c5e

pubsub_delete_schema_revision
bazel run //google/cloud/pubsub/samples:samples delete-schema-revision alevenb-test protobuf-schema 19d55c5e

pubsub_create_topic_with_schema_revisions
https://cloud.google.com/pubsub/docs/samples/pubsub-create-topic-with-schema-revisions#pubsub_create_topic_with_schema_revisions-python

Testing for the proto

Executing tests from //google/cloud/pubsub/samples:samples
-----------------------------------------------------------------------------
Schema revision: name: "projects/alevenb-test/schemas/protobuf-schema@6de61b3c"
type: PROTOCOL_BUFFER
revision_id: "6de61b3c"
revision_create_time {
  seconds: 1686593498
  nanos: 750000000
}

Schema revision: name: "projects/alevenb-test/schemas/protobuf-schema@cf99cf26"
type: PROTOCOL_BUFFER
revision_id: "cf99cf26"
revision_create_time {
  seconds: 1686593490
  nanos: 496000000
}

bazel run //google/cloud/pubsub/samples:samples create-topic-with-schema-revisions alevenb-test topic-id protobuf-schema BINARY cf99cf26 6de61b3c

bazel run //google/cloud/pubsub/samples:samples create-topic-with-schema-revisions alevenb-test avro-topic-id avro-schema JSON 18e69ad0 48e5a961

pubsub_update_topic_schema
bazel run //google/cloud/pubsub/samples:samples update-topic-schema alevenb-test avro-topic-id 18e69ad0 48e5a961

@alevenberg
Copy link
Member Author

alevenberg commented Jun 12, 2023

3 more PRS
4.

pubsub_subscribe_avro_records_with_revisions
https://avro.apache.org/docs/current/api/cpp/html/index.html
https://cloud.google.com/pubsub/docs/samples/pubsub-subscribe-avro-records-with-revisions
-> we aren't currently taking the external dependency

pubsub_create_unwrapped_push_subscription

pubsub_create_cloud_storage_subscription
-> currently only available in staging

Work is in branch: issue-11720-cloud-storage-sample

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
samples Issues that are directly related to samples. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

1 participant