Skip to content

Commit

Permalink
refactor(services/azblob): Adopt new reqsign (apache#1902)
Browse files Browse the repository at this point in the history
* refactor: Change presign to async for future refactor

Signed-off-by: Xuanwo <github@xuanwo.io>

* Fix unit test

Signed-off-by: Xuanwo <github@xuanwo.io>

* refactor(services/azblob): Adopt new reqsign

Signed-off-by: Xuanwo <github@xuanwo.io>

---------

Signed-off-by: Xuanwo <github@xuanwo.io>
  • Loading branch information
Xuanwo authored and wcy-fdu committed Apr 12, 2023
1 parent 88279bb commit 9d2e664
Show file tree
Hide file tree
Showing 9 changed files with 431 additions and 329 deletions.
34 changes: 33 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ redis = { version = "0.22", features = [
"tokio-comp",
"connection-manager",
], optional = true }
# NOTE: we keep this for service migration one by one. And finally we will replace reqsign by v0.9.
reqsign = "0.8.5"
reqsign_0_9 = { package = "reqsign", git = "https://github.com/Xuanwo/reqsign", rev = "c1e44223a984a612b63c80ee8092f0c089ff62bd" }
reqwest = { version = "0.11.13", features = [
"multipart",
"stream",
Expand Down
10 changes: 10 additions & 0 deletions core/src/raw/http_util/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ pub fn new_request_build_error(err: http::Error) -> Error {
.set_source(err)
}

/// Create a new error happened during signing request.
pub fn new_request_credential_error(err: anyhow::Error) -> Error {
Error::new(
ErrorKind::Unexpected,
"loading credentail to sign http request",
)
.with_operation("reqsign::LoadCredential")
.set_source(err)
}

/// Create a new error happened during signing request.
pub fn new_request_sign_error(err: anyhow::Error) -> Error {
Error::new(ErrorKind::Unexpected, "signing http request")
Expand Down
1 change: 1 addition & 0 deletions core/src/raw/http_util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub use uri::percent_encode_path;

mod error;
pub use error::new_request_build_error;
pub use error::new_request_credential_error;
pub use error::new_request_sign_error;
pub use error::parse_error_response;
pub use error::ErrorResponse;
Expand Down
Loading

0 comments on commit 9d2e664

Please sign in to comment.