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

Move create document to pipeline architecture #331

Merged
merged 5 commits into from
Aug 5, 2021

Conversation

rylev
Copy link
Contributor

@rylev rylev commented Jul 21, 2021

Continuing #290.

IMPORTANT: I've not yet tested these changes, so while it's ready for a review, I'd like to run the e2e tests before merging.

@rylev rylev requested a review from MindFlavor July 21, 2021 16:00
@MindFlavor
Copy link
Contributor

I love it ❤️. Before going further, would you please try and use the just merged authorization policy? It should be enough to call prepare_request_pipeline and wrap the received context with let mut pipeline_context = PipelineContext::new(ctx, ResourceType::Collections.into()).

PS: I'll make sure to run the E2E tests on my account as soon as the integration tests will be green.

@rylev rylev force-pushed the create-document-pipeline branch from 635f022 to 1946f4b Compare July 26, 2021 10:04
Copy link
Contributor

@MindFlavor MindFlavor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work. 👍
Unfortunately something is amiss because the generated requests aren't compliant with the specs (and as such they fail).

I believe we should accept structs that implement both CosmosEntity and Serialize so we can easily extract the correct partition key.

sdk/cosmos/src/clients/collection_client.rs Outdated Show resolved Hide resolved
@rylev rylev force-pushed the create-document-pipeline branch from 1946f4b to b77b98b Compare July 30, 2021 15:56
@rylev
Copy link
Contributor Author

rylev commented Jul 30, 2021

@MindFlavor thanks for the review. I believe I've addressed all the issues you found. Can you review again? Thanks!

@rylev rylev requested a review from MindFlavor August 2, 2021 15:34
Copy link
Contributor

@MindFlavor MindFlavor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a quick URI to fix and the tests pass!

As a side note, the permission_token_usage test fails but it's not due to your code. It's a regression introduced by the AuthorizationPolicy (or, better, by the fact that some methods use it and some don't). I will open a issue to tackle it in another PR.


fn prepare_request_pipeline(&self, http_method: http::Method) -> Request {
let path = &format!(
"dbs/{}/colls/{}",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be "dbs/{}/colls/{}/docs" as per https://docs.microsoft.com/en-us/rest/api/cosmos-db/create-a-document

Copy link
Contributor

@MindFlavor MindFlavor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@rylev rylev merged commit 881f5c5 into Azure:main Aug 5, 2021
@rylev rylev deleted the create-document-pipeline branch August 11, 2021 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants