diff --git a/src/agent/Cargo.lock b/src/agent/Cargo.lock index 10e62ea47e9..86b46349108 100644 --- a/src/agent/Cargo.lock +++ b/src/agent/Cargo.lock @@ -140,9 +140,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "azure_core" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6e66a6d993197d1b575cffd08bf725e04bc1414de6586baeb3537925e49b4ff" +checksum = "a6424becb946de1b1eff7bf5fbc86fabf7457637c88b63dd967b219a712c322c" dependencies = [ "async-trait", "base64", @@ -158,6 +158,7 @@ dependencies = [ "reqwest", "rustc_version", "serde", + "serde-xml-rs 0.6.0", "serde_json", "time", "url", @@ -166,9 +167,9 @@ dependencies = [ [[package]] name = "azure_storage" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55aa63fb0426c76b9cc909234e94e69764f5e777a62b7ed6411f3cc04aa94a16" +checksum = "28d0de4ed66067ca1afa0a07d787a6fe001288a162409b8308c45909044552ca" dependencies = [ "RustyXML", "async-trait", @@ -180,7 +181,7 @@ dependencies = [ "log", "once_cell", "serde", - "serde-xml-rs", + "serde-xml-rs 0.6.0", "serde_derive", "serde_json", "sha2", @@ -191,9 +192,9 @@ dependencies = [ [[package]] name = "azure_storage_blobs" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33f953cedd7c240347ed0f6ed8a0bd7472b32579c38341ab9e117eaa6173e9ba" +checksum = "a69ea7177f0b3c64196766fcd442ac9664658a194070d082ae8876406800040b" dependencies = [ "RustyXML", "azure_core", @@ -204,7 +205,7 @@ dependencies = [ "log", "md5", "serde", - "serde-xml-rs", + "serde-xml-rs 0.6.0", "serde_derive", "serde_json", "time", @@ -1934,7 +1935,7 @@ dependencies = [ "reqwest", "reqwest-retry", "serde", - "serde-xml-rs", + "serde-xml-rs 0.5.1", "serde_json", "stacktrace-parser", "storage-queue", @@ -2654,6 +2655,18 @@ dependencies = [ "xml-rs", ] +[[package]] +name = "serde-xml-rs" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb3aa78ecda1ebc9ec9847d5d3aba7d618823446a049ba2491940506da6e2782" +dependencies = [ + "log", + "serde", + "thiserror", + "xml-rs", +] + [[package]] name = "serde_derive" version = "1.0.136" @@ -2890,7 +2903,7 @@ dependencies = [ "reqwest", "reqwest-retry", "serde", - "serde-xml-rs", + "serde-xml-rs 0.5.1", "serde_derive", "serde_json", "tokio", diff --git a/src/agent/onefuzz-task/Cargo.toml b/src/agent/onefuzz-task/Cargo.toml index 8fcde436436..515b86bf32d 100644 --- a/src/agent/onefuzz-task/Cargo.toml +++ b/src/agent/onefuzz-task/Cargo.toml @@ -48,6 +48,6 @@ url = { version = "2.3", features = ["serde"] } uuid = { version = "0.8", features = ["serde", "v4"] } chrono = { version = "0.4", default-features = false, features = ["clock", "std"] } -azure_core = { version = "0.4", default-features = false, features = ["enable_reqwest_rustls"] } -azure_storage = { version = "0.5", default-features = false, features = ["enable_reqwest_rustls"] } -azure_storage_blobs = { version = "0.5", default-features = false, features = ["enable_reqwest_rustls"] } +azure_core = { version = "0.5", default-features = false, features = ["enable_reqwest_rustls"] } +azure_storage = { version = "0.6", default-features = false, features = ["enable_reqwest_rustls"] } +azure_storage_blobs = { version = "0.6", default-features = false, features = ["enable_reqwest_rustls"] } diff --git a/src/agent/onefuzz-task/src/tasks/task_logger.rs b/src/agent/onefuzz-task/src/tasks/task_logger.rs index 56ff7aa70e7..c2780544188 100644 --- a/src/agent/onefuzz-task/src/tasks/task_logger.rs +++ b/src/agent/onefuzz-task/src/tasks/task_logger.rs @@ -5,9 +5,9 @@ use anyhow::{anyhow, Result}; use async_trait::async_trait; use azure_core::error::HttpError; use azure_core::StatusCode; -use azure_storage::prelude::StorageClient; +use azure_storage::StorageCredentials; +use azure_storage_blobs::container::operations::ListBlobsResponse; use azure_storage_blobs::prelude::*; -use azure_storage_blobs::{container::operations::ListBlobsResponse, prelude::AsContainerClient}; use futures::TryStreamExt; use onefuzz_telemetry::{LogTrace, LoggingEvent}; use reqwest::Url; @@ -68,17 +68,17 @@ impl BlobLogWriter { ) -> Result { let container_client = TaskLogger::create_container_client(&log_container)?; let prefix = format!("{}/{}", task_id, machine_id); - let blob_list: Vec = container_client + let pages: Vec = container_client .list_blobs() .prefix(prefix.clone()) .into_stream() .try_collect() .await?; - let mut blob_ids: Vec = blob_list - .into_iter() - .flat_map(|lbr: ListBlobsResponse| lbr.blobs.blobs) - .filter_map(|b: Blob| { + let mut blob_ids: Vec = pages + .iter() + .flat_map(|p| p.blobs.blobs()) + .filter_map(|b: &Blob| { b.name .strip_prefix(&prefix) .map(PathBuf::from) @@ -258,7 +258,8 @@ impl TaskLogger { .query() .ok_or(anyhow!("Invalid log container"))?; - let client = StorageClient::new_sas_token(account, sas_token)?; + let sas_credentials = StorageCredentials::sas_token(sas_token)?; + let client = BlobServiceClient::new(account, sas_credentials); Ok(client.container_client(container)) } @@ -484,15 +485,11 @@ mod tests { println!( "blob prefix {:?}", - responses - .first() - .expect("expected some blobs") - .blobs - .blob_prefix + responses.first().expect("expected some blobs").prefix ); for response in responses { - for blob in response.blobs.blobs { + for blob in response.blobs.blobs() { println!("{}", blob.name); } } @@ -686,7 +683,7 @@ mod tests { .await .map_err(|e| anyhow!(e.to_string()))?; - let blobs: Vec<_> = pages.into_iter().flat_map(|p| p.blobs.blobs).collect(); + let blobs: Vec<_> = pages.iter().flat_map(|p| p.blobs.blobs()).collect(); // test initial blob creation assert_eq!(blobs.len(), 1, "expected exactly one blob"); @@ -732,9 +729,9 @@ mod tests { .await .map_err(|e| anyhow!(e.to_string()))?; - let blobs: Vec<_> = pages.into_iter().flat_map(|p| p.blobs.blobs).collect(); + let blobs: Vec<_> = pages.iter().flat_map(|p| p.blobs.blobs()).collect(); - assert_eq!(blobs.len(), 2, "expected exactly 2 blob"); + assert_eq!(blobs.len(), 2, "expected exactly 2 blobs"); assert!( blobs