This repository has been archived by the owner on Oct 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Azure storage: Allowed either content_md5 or content_crc64 in respons…
…es (#304) * fixed put_block * prepared for release
- Loading branch information
Francesco Cogno
authored
Jun 27, 2020
1 parent
1995aac
commit 1036adc
Showing
14 changed files
with
122 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "azure_sdk_auth_aad" | ||
version = "0.46.0" | ||
version = "0.46.1" | ||
description = "Rust wrappers around Microsoft Azure REST APIs - Azure OAuth2 helper crate" | ||
readme = "README.md" | ||
authors = ["Francesco Cogno <[email protected]>"] | ||
|
@@ -15,8 +15,8 @@ categories = ["api-bindings"] | |
edition = "2018" | ||
|
||
[dependencies] | ||
azure_sdk_core = { path = "../azure_sdk_core", version = "0.43.3" } | ||
oauth2 = { version = "3.0.0-alpha.9", features = ["reqwest-010", "futures-03"], default-features = false} | ||
azure_sdk_core = { path = "../azure_sdk_core", version = "0.43.5" } | ||
oauth2 = { version = "3.0.0", features = ["reqwest-010", "futures-03"], default-features = false} | ||
url = "2.1" | ||
futures = "0.3" | ||
serde = "1.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "azure_sdk_core" | ||
version = "0.43.4" | ||
version = "0.43.5" | ||
description = "Rust wrappers around Microsoft Azure REST APIs - Core crate" | ||
readme = "README.md" | ||
authors = ["Francesco Cogno <[email protected]>", "Max Gortman <[email protected]>", "Dong Liu <[email protected]>"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "azure_sdk_cosmos" | ||
version = "0.100.2" | ||
version = "0.100.3" | ||
description = "Rust wrappers around Microsoft Azure REST APIs - Azure Cosmos DB crate" | ||
readme = "README.md" | ||
authors = ["Francesco Cogno <[email protected]>", "Max Gortman <[email protected]>"] | ||
|
@@ -15,7 +15,7 @@ categories = ["api-bindings"] | |
edition = "2018" | ||
|
||
[dependencies] | ||
azure_sdk_core = { path = "../azure_sdk_core", version = "0.43.4" } | ||
azure_sdk_core = { path = "../azure_sdk_core", version = "0.43.5" } | ||
ring = "0.16" | ||
base64 = "0.12" | ||
chrono = "0.4" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "azure_sdk_service_bus" | ||
version = "0.44.1" | ||
version = "0.44.2" | ||
description = "Rust wrappers around Microsoft Azure REST APIs - Service Bus crate" | ||
readme = "README.md" | ||
authors = ["Francesco Cogno <[email protected]>", "Max Gortman <[email protected]>", "Dong Liu <[email protected]>"] | ||
|
@@ -15,7 +15,7 @@ categories = ["api-bindings"] | |
edition = "2018" | ||
|
||
[dependencies] | ||
azure_sdk_core = { path = "../azure_sdk_core", version = "0.43.3" } | ||
azure_sdk_core = { path = "../azure_sdk_core", version = "0.43.5" } | ||
ring = "0.16" | ||
base64 = "0.12" | ||
chrono = "0.4" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "azure_sdk_storage_account" | ||
version = "0.41.1" | ||
version = "0.41.2" | ||
description = "Rust wrappers around Microsoft Azure REST APIs - Blob storage account crate" | ||
readme = "README.md" | ||
authors = ["Francesco Cogno <[email protected]>", "Max Gortman <[email protected]>"] | ||
|
@@ -15,8 +15,8 @@ categories = ["api-bindings"] | |
edition = "2018" | ||
|
||
[dependencies] | ||
azure_sdk_core = { path = "../azure_sdk_core", version = "0.43.4" } | ||
azure_sdk_storage_core = { path = "../azure_sdk_storage_core", version = "0.44.1" } | ||
azure_sdk_core = { path = "../azure_sdk_core", version = "0.43.5" } | ||
azure_sdk_storage_core = { path = "../azure_sdk_storage_core", version = "0.44.2" } | ||
chrono = "0.4" | ||
http = "0.2" | ||
hyper = "0.13" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "azure_sdk_storage_blob" | ||
version = "0.44.2" | ||
version = "0.44.3" | ||
description = "Rust wrappers around Microsoft Azure REST APIs - Blob storage crate" | ||
readme = "README.md" | ||
authors = ["Francesco Cogno <[email protected]>", "Max Gortman <[email protected]>", "Dong Liu <[email protected]>"] | ||
|
@@ -15,8 +15,8 @@ categories = ["api-bindings"] | |
edition = "2018" | ||
|
||
[dependencies] | ||
azure_sdk_core = { path = "../azure_sdk_core", version = "0.43.4" } | ||
azure_sdk_storage_core = { path = "../azure_sdk_storage_core", version = "0.44.1" } | ||
azure_sdk_core = { path = "../azure_sdk_core", version = "0.43.5" } | ||
azure_sdk_storage_core = { path = "../azure_sdk_storage_core", version = "0.44.2" } | ||
md5 = "0.7" | ||
RustyXML = "0.3" | ||
base64 = "0.12" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
use azure_sdk_core::prelude::*; | ||
use azure_sdk_storage_blob::prelude::*; | ||
use azure_sdk_storage_core::prelude::*; | ||
use std::error::Error; | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<(), Box<dyn Error>> { | ||
env_logger::init(); | ||
|
||
// First we retrieve the account name and master key from environment variables. | ||
let account = | ||
std::env::var("STORAGE_ACCOUNT").expect("Set env variable STORAGE_ACCOUNT first!"); | ||
let master_key = | ||
std::env::var("STORAGE_MASTER_KEY").expect("Set env variable STORAGE_MASTER_KEY first!"); | ||
|
||
let container_name = std::env::args() | ||
.nth(1) | ||
.expect("please specify container name as command line parameter"); | ||
|
||
let client = client::with_access_key(&account, &master_key); | ||
|
||
let data = b"1337 azure blob test"; | ||
let blob = "test1"; | ||
let mut block_ids = Vec::new(); | ||
for (i, block) in data.chunks(64 * 1024 * 1024 /* 64 MiB */).enumerate() { | ||
block_ids.push(i.to_be_bytes()); | ||
let digest = md5::compute(block); | ||
let put_block_response = client | ||
.put_block() | ||
.with_container_name(&container_name) | ||
.with_blob_name(blob) | ||
.with_body(block) | ||
.with_block_id(&i.to_be_bytes()[..]) | ||
.with_content_md5(&digest[..]) | ||
.finalize() | ||
.await?; | ||
|
||
println!("put_block_response == {:#?}", put_block_response); | ||
} | ||
|
||
let mut block_list = BlockList::default(); | ||
for id in block_ids.iter() { | ||
block_list.blocks.push(BlobBlockType::Uncommitted(&id[..])); | ||
} | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "azure_sdk_storage_core" | ||
version = "0.44.1" | ||
version = "0.44.2" | ||
description = "Rust wrappers around Microsoft Azure REST APIs - Core storage crate" | ||
readme = "README.md" | ||
authors = ["Francesco Cogno <[email protected]>", "Max Gortman <[email protected]>", "Dong Liu <[email protected]>"] | ||
|
@@ -15,7 +15,7 @@ categories = ["api-bindings"] | |
edition = "2018" | ||
|
||
[dependencies] | ||
azure_sdk_core = { path = "../azure_sdk_core", version = "0.43.4" } | ||
azure_sdk_core = { path = "../azure_sdk_core", version = "0.43.5" } | ||
ring = "0.16" | ||
base64 = "0.12" | ||
chrono = "0.4" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "azure_sdk_storage_table" | ||
version = "0.41.1" | ||
version = "0.41.2" | ||
description = "Rust wrappers around Microsoft Azure REST APIs - Table storage crate" | ||
readme = "README.md" | ||
authors = ["Francesco Cogno <[email protected]>", "gzp-crey", "Max Gortman <[email protected]>", "Dong Liu <[email protected]>"] | ||
|
@@ -15,8 +15,8 @@ categories = ["api-bindings"] | |
edition = "2018" | ||
|
||
[dependencies] | ||
azure_sdk_core = { path = "../azure_sdk_core", version = "0.43.4" } | ||
azure_sdk_storage_core = { path = "../azure_sdk_storage_core", version = "0.44.1" } | ||
azure_sdk_core = { path = "../azure_sdk_core", version = "0.43.5" } | ||
azure_sdk_storage_core = { path = "../azure_sdk_storage_core", version = "0.44.2" } | ||
chrono = "0.4" | ||
http = "0.2" | ||
hyper = "0.13" | ||
|