Skip to content

Conversation

@macintacos
Copy link
Contributor

This change would allow a user to do something like the following, just before making the API call, allowing them to specify the URI_STUB manually for endpoints that accept something other than v1.5 (for example:
https://www.mongodb.com/docs/atlas/reference/api-resources-spec/#operation/returnOneAdvancedClusterFromOneProject)

You could then do something like this to change the value before making the call:

import os

os.environ["URI_STUB"] = "/api/atlas/v1.5"
atlas.Clusters.get_single_cluster(cluster_name) # would now be using a different URI_STUB behind the scenes

To set if back, the user can just clear the environment variable, or manually revert it to "/api/atlas/v1.0".

…ts value on-the-fly

This change would allow a user to do something like the following, just before making the API call,
allowing them to specify the `URI_STUB` manually for endpoints that accept something other than v1.5
(for example:
https://www.mongodb.com/docs/atlas/reference/api-resources-spec/#operation/returnOneAdvancedClusterFromOneProject)
@macintacos
Copy link
Contributor Author

This is very much a bandaid - a proper solution would restrict what values are allowed by a user (I think only v1.0 and v1.5 would be valid in the Atlas API today anyway).

@mgmonteleone
Copy link
Owner

@macintacos , looking at how to implement this now..

@mgmonteleone mgmonteleone self-assigned this Aug 19, 2022
@mgmonteleone mgmonteleone marked this pull request as draft August 19, 2022 19:11
mgmonteleone pushed a commit that referenced this pull request Aug 19, 2022
Also moved the URI_STUB param to all URIs.

This will need to be handled diffferntly for the full fix, and this workaround will need to be backed out.

The full solution will be to implement the 1.5 endpoints directly, and analyze and modify the appropriate methods to sue the 1.5 endpoints and needed.

Currently it looks like only multi-cloud endpoints use 1.5.
@mgmonteleone
Copy link
Owner

@macintacos , have updated the PR with a few fixes, but would like to discuss if we should go with this workaround, or just go ahead and do the full fix. Since this workaround will cause the full fix to be breaking, and will require a new major version.

@mgmonteleone mgmonteleone marked this pull request as ready for review August 19, 2022 19:24
mgmonteleone pushed a commit that referenced this pull request Aug 27, 2022
Implemented first changes for #121.. First 3 tests passed, moving on to next group of tests.
@mgmonteleone mgmonteleone merged commit 0a74f02 into mgmonteleone:master Aug 28, 2022
mgmonteleone pushed a commit that referenced this pull request Aug 29, 2022
* Fixed Typo for PR #118.

Implemented first changes for #121.. First 3 tests passed, moving on to next group of tests.

* Implemented first changes for #121.. First 3 tests passed, moving on to next group of tests.

* Progress on #121, tests up to test_21.

Partitions and databases endpoints remain.

* Completed all monitoring and metrics tests for #112.

* Removed unused iterator class for #112

* removed old monitoring test file.

* Added refactor note.

* Small update to enable one more test in monitoring.

* Add FEDERATED_DATABASE events (#120)

* fix(settings): allow `URI_STUB` to be set in the environment to set its value on-the-fly (#118)

This change would allow a user to do something like the following, just before making the API call,
allowing them to specify the `URI_STUB` manually for endpoints that accept something other than v1.5
(for example:
https://www.mongodb.com/docs/atlas/reference/api-resources-spec/#operation/returnOneAdvancedClusterFromOneProject)

* Further updates to the events list.

Small cleanup of settings file.

Co-authored-by: Jérémy Pinsolle <82467106+jpinsolle-betclic@users.noreply.github.com>
Co-authored-by: Julian Torres <julian.torres@mongodb.com>
@macintacos macintacos deleted the flexible-uri-stub branch August 30, 2022 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants