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

Finish Cosmos database client #455

Merged
merged 5 commits into from
Oct 29, 2021
Merged

Finish Cosmos database client #455

merged 5 commits into from
Oct 29, 2021

Conversation

rylev
Copy link
Contributor

@rylev rylev commented Oct 28, 2021

This moves the remaining operations in the Comsos database client over to the pipeline architecture.

It also expands a test to exercise listing collections and deleting a database. Happily, this prevented a bug from being checked in. 😊

@rylev rylev requested a review from MindFlavor October 28, 2021 12:52
@rylev rylev added the Cosmos The azure_cosmos crate label Oct 28, 2021
@rylev rylev requested a review from yoshuawuyts October 28, 2021 15:42
Copy link
Member

@cataggar cataggar left a comment

Choose a reason for hiding this comment

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

Thank you 💯

use azure_core::collect_pinned_stream;
use azure_core::headers::{continuation_token_from_headers_optional, session_token_from_headers};
use azure_core::prelude::*;
use azure_core::Request as HttpRequest;
Copy link
Member

Choose a reason for hiding this comment

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

Should we rename them to HttpRequest in Core (in another PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good. I made an issue for this: #462

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.

Good work! ❤️

) -> crate::Result<DeleteDatabaseResponse> {
let mut request = self
.cosmos_client()
.prepare_request_pipeline(&format!("dbs/{}", self.database_name()), http::Method::GET);
Copy link
Contributor

@MindFlavor MindFlavor Oct 28, 2021

Choose a reason for hiding this comment

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

We should probably escape the resources (in this case the db name) at some point. To conform with other SDKs we should not validate the name (we decided to leave it to Azure) but improperly escaped URIs can cause trouble and can have security implications.

I've created #459 to track this.

@cataggar cataggar added this to the azure_cosmos 0.1.0 milestone Oct 28, 2021
@rylev rylev merged commit edd64a2 into Azure:main Oct 29, 2021
@rylev rylev deleted the finish-db-client branch October 29, 2021 09:04
) -> crate::Result<DeleteDatabaseResponse> {
let mut request = self
.cosmos_client()
.prepare_request_pipeline(&format!("dbs/{}", self.database_name()), http::Method::GET);
Copy link
Member

Choose a reason for hiding this comment

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

This GETs the database, it doesn't delete it at all!

Will be fixed in #375 once we catch up with main and update that MR, if you don't get to it first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cosmos The azure_cosmos crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants