-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Adding the ability to set Subscription path #919
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
Adding the ability to set Subscription path #919
Conversation
|
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project, in which case you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
076b491 to
3567321
Compare
|
CLAs look good, thanks! |
8aecf6a to
cd8460a
Compare
cd8460a to
3121e40
Compare
|
@philibuster Can you give some sample code using this or some description of why you'd want to be able to change the project on the fly. This change is a little too ad-hoc for the object model, but that doesn't mean we can't take the spirit of the change and turn it into something useful. A subscription has 4 properties name
topic
ack_deadline
push_endpointand you could accomplish essentially what you want with topic1 = Topic(name, project=project1)
topic2 = Topic(name, project=project2)
subscription1 = Subscription(sub_name, topic1, ack_deadline=AD, push_endpoint=PE)
subscription2 = Subscription(sub_name, topic2, ack_deadline=AD, push_endpoint=PE)but it could be more convenient to have something which preserved all properties except for the topic via: subscription2 = Subscription.copy_from(subscription1, topic=topic2)Even more, you want the same topic name, but just a different project, so this still isn't quite the same. |
|
Thank you for the response. Sorry I made a mistake in my code, what I originally wrote would have no value. Example:
As project2 I want to make a subscription to the other projects topic. What I am proposing is using any project in the subscription path. It still will only work if they are allowed access to create the subscription anyway. |
659e5e7 to
3121e40
Compare
18c04af to
70d9787
Compare
|
I see. So my proposal would need to be tweaked to something like >>> topic = Topic(name, project=project1)
>>> subscription = Subscription(sub_name, topic, ack_deadline=AD, push_endpoint=PE)
>>> # New code
>>> subscription2 = Subscription.copy_from(subscription1, project=project2)
>>> subscription.topic.name == subscription2.topic.name
True
>>> subscription.topic is subscription2.topic
False
>>> subscription.topic.project == subscription2.topic.project
FalsePS @philibuster Sorry for getting behind on this. |
|
@dhermes No problem :) Not exactly, the topic should not be changed, just the subscription path |
|
@philibuster That breaks the model, which is why I was offering the alternative. As of right now (June 18), the hierarchy is and a |
|
@philibuster WDYT of the proposed given my comment? I want to keep this moving (either to close it out or to get to something we can agree on implementing). |
|
@philibuster I'd love to take this up, let's re-open if you get some bandwidth to keep the discussion moving forward. |
|
@dhermes Sorry about the delay. Yeah all for a copy_from method, maybe similar to modify_push_configuration. I think it'd be a useful method (at least to me and those that work with me), as it'd allow subscribing to other projects topics. |
* test: make pyarrow sample less flaky * add comment
* test: make pyarrow sample less flaky * add comment
🤖 I have created a release \*beep\* \*boop\* --- ## [0.49.0](https://www.github.com/googleapis/gapic-generator-python/compare/v0.48.1...v0.49.0) (2021-06-11) ### Features * add async samples ([#861](https://www.github.com/googleapis/gapic-generator-python/issues/861)) ([e385ffd](https://www.github.com/googleapis/gapic-generator-python/commit/e385ffd7f012c6a38c9fcd7c5f36ce090311032b)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
* feat: Expose the `FindNearest.distance_result_field` parameter feat: Expose the `FindNearest.distance_threshold` parameter PiperOrigin-RevId: 660557033 Source-Link: googleapis/googleapis@28685f7 Source-Link: googleapis/googleapis-gen@38f25b0 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzhmMjViMGJjZjU0NjEzNzU4ZWQ1NWE2MzkwYmM4NGU0MDM2OGRjMiJ9 chore: Update gapic-generator-python to v1.18.4 PiperOrigin-RevId: 657207628 Source-Link: googleapis/googleapis@33fe71e Source-Link: googleapis/googleapis-gen@e02739d Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZTAyNzM5ZDEyMmVkMTViZDVlZjU3NzFjNTdmMTJhODNkNDdhMWRkYSJ9 chore: Update gapic-generator-python to v1.18.3 PiperOrigin-RevId: 656040068 Source-Link: googleapis/googleapis@3f4e29a Source-Link: googleapis/googleapis-gen@b8feb21 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjhmZWIyMTA5ZGRlN2IwOTM4YzIyYzk5M2QwMDIyNTFhYzY3MTRkYyJ9 chore: Update gapic-generator-python to v1.18.3 PiperOrigin-RevId: 655567917 Source-Link: googleapis/googleapis@43aa65e Source-Link: googleapis/googleapis-gen@0e38378 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMGUzODM3ODc1MzA3NGMwZjY2ZmY2MzM0OGQ2ODY0OTI5ZTEwNGQ1YyJ9 chore: expose new experimental FindNearest distance params to the preview branch docs: minor documentation clarifications on FindNearest DistanceMeasure options PiperOrigin-RevId: 655267922 Source-Link: googleapis/googleapis@7858db4 Source-Link: googleapis/googleapis-gen@c075428 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzA3NTQyODJlODA2MjU2NTk1OWI1MjM5MWJiM2FkZGI4NzAyNjdiOCJ9 feat(spanner): Add support for Cloud Spanner Scheduled Backups PiperOrigin-RevId: 649277844 Source-Link: googleapis/googleapis@fd7efa2 Source-Link: googleapis/googleapis-gen@50be251 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTBiZTI1MTMyOWQ4ZGI1YjU1NTYyNmViZDQ4ODY3MjFmNTQ3ZDNjYyJ9 feat: add bulk delete api docs: update field api description PiperOrigin-RevId: 642337904 Source-Link: googleapis/googleapis@9aab32e Source-Link: googleapis/googleapis-gen@757cf9d Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzU3Y2Y5ZDhlMmQxMzlkN2IyODcxY2UwMTNkNWUyZWRjNDAxNzZkMyJ9 chore: Update gapic-generator-python to v1.18.0 PiperOrigin-RevId: 638650618 Source-Link: googleapis/googleapis@6330f03 Source-Link: googleapis/googleapis-gen@44fa4f1 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDRmYTRmMTk3OWRjNDVjMTc3OGZkN2NhZjEzZjhlNjFjNmQxY2FlOCJ9 chore: Update gapic-generator-python to v1.17.1 PiperOrigin-RevId: 629071173 Source-Link: googleapis/googleapis@4afa392 Source-Link: googleapis/googleapis-gen@16dbbb4 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMTZkYmJiNGQwNDU3ZGI1ZTYxYWM5Zjk5YjBkNTJhNDYxNTQ0NTVhYyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: Update gapic-generator-python to v1.18.5 PiperOrigin-RevId: 661268868 Source-Link: googleapis/googleapis@f7d214c Source-Link: googleapis/googleapis-gen@79a8411 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzlhODQxMWJiZGIyNWE5ODNmYTNhYWU4YzBlMTQzMjdkZjEyOWY5NCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Test types under CI using new 'mypy' nox session. Co-authored-by: arithmetic1728 <58957152+arithmetic1728@users.noreply.github.com>
🤖 I have created a release *beep* *boop* --- ## [2.4.0](googleapis/google-auth-library-python@v2.3.3...v2.4.0) (2022-01-20) ### Features * add 'py.typed' declaration ([#919](googleapis/google-auth-library-python#919)) ([c993504](googleapis/google-auth-library-python@c993504)) * add api key support ([#826](googleapis/google-auth-library-python#826)) ([3b15092](googleapis/google-auth-library-python@3b15092)) ### Bug Fixes * **deps:** allow cachetools 5.0 for python 3.7+ ([#937](googleapis/google-auth-library-python#937)) ([1eae37d](googleapis/google-auth-library-python@1eae37d)) * fix the message format for metadata server exception ([#916](googleapis/google-auth-library-python#916)) ([e756f08](googleapis/google-auth-library-python@e756f08)) ### Documentation * fix intersphinx link for 'requests-oauthlib' ([#921](googleapis/google-auth-library-python#921)) ([967be4f](googleapis/google-auth-library-python@967be4f)) * note ValueError in `verify_oauth2_token` ([#928](googleapis/google-auth-library-python#928)) ([82bc5f0](googleapis/google-auth-library-python@82bc5f0)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
A user should be able to set the path of the subscription, so it isn't always set to the topics project.
This allow users to subscribe to topics in other projects (if they have edit rights to said project).