-
Notifications
You must be signed in to change notification settings - Fork 299
[Storage] get_account_info
all clients, set/get_tags
for BlobClient, set_properties
for BlobServiceClient
#2795
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
base: main
Are you sure you want to change the base?
Changes from 4 commits
b5bed2e
7e7f9a9
2c40e86
d133283
c47b704
4fc6dba
6e36e3a
b8a375b
2633e4d
3c3d716
b7ca0f6
e67a13c
0715c07
7fc3b5c
1c1a166
87e9d4e
1085fe0
f24aaed
ab7e12b
9fa4395
8c390ef
c30c1b3
aa92db4
61def99
790e3fa
010c18b
c243588
5f057e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"AssetsRepo": "Azure/azure-sdk-assets", | ||
"AssetsRepoPrefixPath": "rust", | ||
"Tag": "rust/azure_storage_blob_49079e88a1", | ||
"Tag": "rust/azure_storage_blob_cb9b90a35f", | ||
"TagPrefix": "rust/azure_storage_blob" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
use crate::models::{AppendBlobClientCreateOptions, PageBlobClientCreateOptions}; | ||
use crate::models::{ | ||
AppendBlobClientCreateOptions, BlobTag, BlobTags, PageBlobClientCreateOptions, | ||
}; | ||
use std::collections::{BTreeMap, HashMap}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're still importing |
||
|
||
/// Provides usage helpers for setting the `PageBlobClientCreateOptions` optional configurations. | ||
pub trait PageBlobClientCreateOptionsExt { | ||
|
@@ -38,3 +41,42 @@ impl AppendBlobClientCreateOptionsExt for AppendBlobClientCreateOptions<'_> { | |
} | ||
} | ||
} | ||
|
||
/// Converts a `BlobTags` struct into `HashMap<String, String>`. | ||
impl TryFrom<BlobTags> for HashMap<String, String> { | ||
type Error = &'static str; | ||
vincenttran-msft marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
fn try_from(blob_tags: BlobTags) -> Result<Self, Self::Error> { | ||
let mut map = HashMap::new(); | ||
|
||
if let Some(tags) = blob_tags.blob_tag_set { | ||
for tag in tags { | ||
match (tag.key, tag.value) { | ||
(Some(k), Some(v)) => { | ||
map.insert(k, v); | ||
} | ||
_ => return Err("BlobTag missing key or value"), | ||
vincenttran-msft marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} | ||
} | ||
|
||
Ok(map) | ||
} | ||
} | ||
|
||
/// Converts a `HashMap<String, String>` into a `BlobTags` struct. | ||
impl From<HashMap<String, String>> for BlobTags { | ||
fn from(tags: HashMap<String, String>) -> Self { | ||
let sorted_tags: BTreeMap<_, _> = tags.into_iter().collect(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
let mut map: HashMap<String, String> = HashMap::new();
map.insert("foo".to_string(), "1".to_string());
map.insert("bar".to_string(), "2".to_string());
let mut v: Vec<(String, String)> = Vec::with_capacity(map.len());
v.extend(map);
v.sort_by(|(k1, _), (k2, _)| k1.cmp(k2));
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi Heath, good callout here, I believed I was using However, I am still struggling to figure out how to go about this without disabling body matching. Your above suggestion: #[cfg(test)]
let mut tags = std::collections::BTreeMap::new();
#[cfg(not(test))]
let mut tags = std::collections::HashMap::new(); I don't believe is applicable to us, since these are integration tests and |
||
let blob_tags = sorted_tags | ||
.into_iter() | ||
.map(|(k, v)| BlobTag { | ||
key: Some(k), | ||
value: Some(v), | ||
}) | ||
.collect(); | ||
BlobTags { | ||
blob_tag_set: Some(blob_tags), | ||
} | ||
} | ||
} | ||
vincenttran-msft marked this conversation as resolved.
Show resolved
Hide resolved
|
Uh oh!
There was an error while loading. Please reload this page.