Skip to content

Commit 2a7798a

Browse files
committed
Regenerated client and adjusted the crate to allow metadata to be an argument in the method directly rather than in the option bag.
1 parent 46105ca commit 2a7798a

File tree

6 files changed

+40
-31
lines changed

6 files changed

+40
-31
lines changed

sdk/storage/azure_storage_queue/samples/queue_client.rs

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ use azure_identity::DefaultAzureCredential;
1313
use azure_storage_queue::{
1414
models::{
1515
QueueClientGetMetadataResultHeaders, QueueClientPeekMessagesOptions,
16-
QueueClientReceiveMessagesOptions, QueueClientSetMetadataOptions, QueueClientUpdateOptions,
17-
QueueMessage, SentMessage,
16+
QueueClientReceiveMessagesOptions, QueueClientUpdateOptions, QueueMessage, SentMessage,
1817
},
1918
QueueClient,
2019
};
@@ -97,14 +96,15 @@ async fn send_and_update_message(
9796
async fn set_and_get_metadata(
9897
queue_client: &QueueClient,
9998
) -> Result<(), Box<dyn std::error::Error>> {
100-
let metadata_options = Some(QueueClientSetMetadataOptions {
101-
metadata: Some(HashMap::from([
102-
("key1".to_string(), "value1".to_string()),
103-
("key2".to_string(), "value2".to_string()),
104-
])),
105-
..Default::default()
106-
});
107-
let result = queue_client.set_metadata(metadata_options).await;
99+
let result = queue_client
100+
.set_metadata(
101+
HashMap::from([
102+
("key1".to_string(), "value1".to_string()),
103+
("key2".to_string(), "value2".to_string()),
104+
]),
105+
None,
106+
)
107+
.await;
108108
log_operation_result(&result, "set_metadata");
109109

110110
let result = queue_client.get_metadata(None).await;
@@ -115,6 +115,17 @@ async fn set_and_get_metadata(
115115
println!("Metadata - {}: {}", key, value);
116116
}
117117

118+
let result = queue_client.set_metadata(HashMap::new(), None).await;
119+
log_operation_result(&result, "set_metadata_empty");
120+
121+
let result = queue_client.get_metadata(None).await;
122+
log_operation_result(&result, "get_metadata_empty");
123+
124+
let metadata = result.unwrap().metadata().unwrap_or_default();
125+
for (key, value) in metadata {
126+
println!("Metadata - {}: {}", key, value);
127+
}
128+
118129
Ok(())
119130
}
120131

sdk/storage/azure_storage_queue/src/clients/queue_client.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use azure_core::{
1010
http::{NoFormat, RawResponse, RequestContent, Response, StatusCode, Url, XmlFormat},
1111
xml, Bytes, Result,
1212
};
13-
use std::sync::Arc;
13+
use std::{collections::HashMap, sync::Arc};
1414

1515
/// A client to interact with a specific Azure storage queue, although that queue may not yet exist.
1616
pub struct QueueClient {
@@ -169,9 +169,10 @@ impl QueueClient {
169169
/// Returns an error if the queue doesn't exist or if the request fails
170170
pub async fn set_metadata(
171171
&self,
172+
metadata: HashMap<String, String>,
172173
options: Option<QueueClientSetMetadataOptions<'_>>,
173174
) -> Result<Response<(), NoFormat>> {
174-
self.client.set_metadata(options).await
175+
self.client.set_metadata(metadata, options).await
175176
}
176177

177178
/// Retrieves the metadata of the specified queue.

sdk/storage/azure_storage_queue/src/generated/clients/queue_client.rs

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/storage/azure_storage_queue/src/generated/models/method_options.rs

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/storage/azure_storage_queue/tests/queue_client.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use azure_core_test::{recorded, Recording, TestContext};
66
use azure_storage_queue::{
77
models::{
88
QueueClientPeekMessagesOptions, QueueClientReceiveMessagesOptions,
9-
QueueClientSetMetadataOptions, QueueClientUpdateOptions, QueueMessage,
9+
QueueClientUpdateOptions, QueueMessage,
1010
},
1111
QueueClient, QueueClientOptions,
1212
};
@@ -122,15 +122,15 @@ async fn test_set_metadata(ctx: TestContext) -> Result<()> {
122122
let test_result = async {
123123
// Set metadata for the queue
124124

125-
let metadata_options = Some(QueueClientSetMetadataOptions {
126-
metadata: Some(HashMap::from([
127-
("key1".to_string(), "value1".to_string()),
128-
("key2".to_string(), "value2".to_string()),
129-
])),
130-
..Default::default()
131-
});
132-
133-
let response = queue_client.set_metadata(metadata_options).await?;
125+
let response = queue_client
126+
.set_metadata(
127+
HashMap::from([
128+
("key1".to_string(), "value1".to_string()),
129+
("key2".to_string(), "value2".to_string()),
130+
]),
131+
None,
132+
)
133+
.await?;
134134

135135
assert_successful_response(&response);
136136

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
directory: specification/storage/Microsoft.QueueStorage
2-
commit: b5e461fffa843a48cb45b233f7d53d69739ad477
2+
commit: 32a39e8db24d3042d9c7a786efd2569690537138
33
repo: Azure/azure-rest-api-specs
44
additionalDirectories:

0 commit comments

Comments
 (0)