Skip to content

Commit da3deef

Browse files
[Storage] Prepare azure_storage_queue for v0.1.0 initial beta release (Azure#3197)
1 parent db51e09 commit da3deef

File tree

8 files changed

+86
-237
lines changed

8 files changed

+86
-237
lines changed

sdk/storage/azure_storage_blob/src/clients/blob_client.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ impl BlobClient {
195195
///
196196
/// # Arguments
197197
///
198-
/// * `metadata` - The metadata headers.
198+
/// * `metadata` - A [`HashMap`] containing the metadata key-value pairs to set for the blob.
199199
/// * `options` - Optional configuration for the request.
200200
pub async fn set_metadata(
201201
&self,
@@ -357,6 +357,8 @@ impl BlobClient {
357357
self.client.get_account_info(options).await
358358
}
359359

360+
/// Checks if the blob exists.
361+
///
360362
/// Returns `true` if the blob exists, `false` if the blob does not exist, and propagates all other errors.
361363
pub async fn exists(&self) -> Result<bool> {
362364
match self.client.get_properties(None).await {

sdk/storage/azure_storage_blob/src/clients/blob_container_client.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ impl BlobContainerClient {
114114
///
115115
/// # Arguments
116116
///
117-
/// * `metadata` - The metadata headers.
117+
/// * `metadata` - A [`HashMap`] containing the metadata key-value pairs to set for the container.
118118
/// * `options` - Optional configuration for the request.
119119
pub async fn set_metadata(
120120
&self,
@@ -277,6 +277,8 @@ impl BlobContainerClient {
277277
self.client.get_account_info(options).await
278278
}
279279

280+
/// Checks if the container exists.
281+
///
280282
/// Returns `true` if the container exists, `false` if the container does not exist, and propagates all other errors.
281283
pub async fn exists(&self) -> Result<bool> {
282284
match self.client.get_properties(None).await {
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
# Release History
22

3-
## 0.1.0 (Unreleased)
3+
## 0.1.0 (2025-10-15)
44

55
### Features Added
66

77
* Initial supported release.
8-
9-
### Breaking Changes
10-
11-
- Client methods that return a `Response<T>>` asynchronously buffer the entire model within the internal pipeline, so `into_body()` and other methods on the response are no longer async.

sdk/storage/azure_storage_queue/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,10 @@ You may need to specify RBAC roles to access Queues via Microsoft Entra ID. Plea
6262

6363
## Examples
6464

65-
<!-- TODO: Uncomment the links below when the PR is merged -->
6665
You can find executable examples for all major SDK functions in:
6766

68-
* [queue_client.rs]<!--(https://github.com/Azure/azure-sdk-for-rust/tree/main/sdk/storage/azure_storage_queue/samples/queue_client.rs)-->
69-
* [queue_service_client.rs]<!--(https://github.com/Azure/azure-sdk-for-rust/tree/main/sdk/storage/azure_storage_queue/samples/queue_service_client.rs)-->
67+
* [queue_client.rs](https://github.com/Azure/azure-sdk-for-rust/tree/main/sdk/storage/azure_storage_queue/examples/queue_client.rs)
68+
* [queue_service_client.rs](https://github.com/Azure/azure-sdk-for-rust/tree/main/sdk/storage/azure_storage_queue/examples/queue_service_client.rs)
7069

7170
## Next steps
7271

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

Lines changed: 42 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,14 @@ pub struct QueueClient {
1818
}
1919

2020
impl QueueClient {
21-
/// Returns the endpoint URL of the Azure storage account this client is associated with.
22-
///
23-
/// # Returns
24-
///
25-
/// A reference to the URL of the storage account.
26-
pub fn endpoint(&self) -> &Url {
27-
self.client.endpoint()
28-
}
29-
30-
/// Returns the name of the queue this client is associated with.
31-
///
32-
/// # Returns
33-
///
34-
/// A reference to the name of the queue.
35-
pub fn queue_name(&self) -> &str {
36-
&self.client.queue_name
37-
}
38-
3921
/// Creates a new QueueClient using Entra ID authentication.
4022
///
4123
/// # Arguments
4224
///
43-
/// * `endpoint` - The full URL of the Azure storage account, for example `https://<storage_account_name>.queue.core.windows.net/`
44-
/// * `queue_name` - The name of the queue to interact with
45-
/// * `credential` - An implementation of [`TokenCredential`] that can provide an Entra ID token for authentication
46-
/// * `options` - Optional configuration for the client
25+
/// * `endpoint` - The full URL of the Azure storage account, for example `https://myaccount.queue.core.windows.net/`
26+
/// * `queue_name` - The name of the queue to interact with.
27+
/// * `credential` - An implementation of [`TokenCredential`] that can provide an Entra ID token to use when authenticating.
28+
/// * `options` - Optional configuration for the client.
4729
///
4830
/// # Returns
4931
///
@@ -65,19 +47,21 @@ impl QueueClient {
6547
Ok(Self { client })
6648
}
6749

50+
/// Returns the endpoint URL of the Azure storage account this client is associated with.
51+
pub fn endpoint(&self) -> &Url {
52+
self.client.endpoint()
53+
}
54+
55+
/// Returns the name of the queue this client is associated with.
56+
pub fn queue_name(&self) -> &str {
57+
&self.client.queue_name
58+
}
59+
6860
/// Creates a new queue under the given account.
6961
///
7062
/// # Arguments
7163
///
72-
/// * `options` - Optional parameters for the request
73-
///
74-
/// # Returns
75-
///
76-
/// Returns a `Result` containing the response if successful
77-
///
78-
/// # Errors
79-
///
80-
/// Returns an error if the queue already exists or if the request fails
64+
/// * `options` - Optional configuration for the request.
8165
pub async fn create(
8266
&self,
8367
options: Option<QueueClientCreateOptions<'_>>,
@@ -89,15 +73,7 @@ impl QueueClient {
8973
///
9074
/// # Arguments
9175
///
92-
/// * `options` - Optional parameters for the request
93-
///
94-
/// # Returns
95-
///
96-
/// Returns a `Result` containing the response if successful
97-
///
98-
/// # Errors
99-
///
100-
/// Returns an error if the queue doesn't exist or if the request fails
76+
/// * `options` - Optional configuration for the request.
10177
pub async fn delete(
10278
&self,
10379
options: Option<QueueClientDeleteOptions<'_>>,
@@ -107,15 +83,7 @@ impl QueueClient {
10783

10884
/// Checks if the queue exists.
10985
///
110-
/// # Returns
111-
///
112-
/// Returns a `Result` containing:
113-
/// - `Ok(true)` if the queue exists
114-
/// - `Ok(false)` if the queue does not exist
115-
///
116-
/// # Errors
117-
///
118-
/// Returns an error if the request fails for any reason other than a non-existent queue
86+
/// Returns `true` if the queue exists, `false` if the queue does not exist, and propagates all other errors.
11987
pub async fn exists(&self) -> Result<bool> {
12088
match self.get_metadata(None).await {
12189
Ok(_) => Ok(true),
@@ -134,38 +102,22 @@ impl QueueClient {
134102
///
135103
/// # Arguments
136104
///
137-
/// * `options` - Optional parameters for the request
138-
///
139-
/// # Returns
140-
///
141-
/// Returns a `Result` containing the response if successful
142-
///
143-
/// # Errors
144-
///
145-
/// Returns an error if the queue doesn't exist or if the request fails
105+
/// * `options` - Optional configuration for the request.
146106
pub async fn clear(
147107
&self,
148108
options: Option<QueueClientClearOptions<'_>>,
149109
) -> Result<Response<(), NoFormat>> {
150110
self.client.clear(options).await
151111
}
152112

153-
/// Sets the metadata for the specified queue.
113+
/// Sets user-defined metadata for the specified queue as one or more name-value pairs. Each call to this operation
114+
/// replaces all existing metadata attached to the queue. To remove all metadata from the queue, call this operation with
115+
/// no metadata headers.
154116
///
155117
/// # Arguments
156118
///
157-
/// * `metadata` - A HashMap containing the metadata key-value pairs to set for the queue.
158-
/// This will replace all existing metadata on the queue. If an empty HashMap is provided, all
159-
/// existing metadata will be deleted from the queue.
160-
/// * `options` - Optional parameters for the request
161-
///
162-
/// # Returns
163-
///
164-
/// Returns a `Result` containing the response if successful
165-
///
166-
/// # Errors
167-
///
168-
/// Returns an error if the queue doesn't exist or if the request fails
119+
/// * `metadata` - A [`HashMap`] containing the metadata key-value pairs to set for the queue.
120+
/// * `options` - Optional configuration for the request.
169121
pub async fn set_metadata(
170122
&self,
171123
metadata: HashMap<String, String>,
@@ -178,15 +130,7 @@ impl QueueClient {
178130
///
179131
/// # Arguments
180132
///
181-
/// * `options` - Optional parameters for the request
182-
///
183-
/// # Returns
184-
///
185-
/// Returns a `Result` containing the queue's metadata if successful
186-
///
187-
/// # Errors
188-
///
189-
/// Returns an error if the queue doesn't exist or if the request fails
133+
/// * `options` - Optional configuration for the request.
190134
pub async fn get_metadata(
191135
&self,
192136
options: Option<QueueClientGetMetadataOptions<'_>>,
@@ -198,16 +142,8 @@ impl QueueClient {
198142
///
199143
/// # Arguments
200144
///
201-
/// * `message` - The message text to be added to the queue
202-
/// * `options` - Optional parameters for the enqueue operation, including visibility timeout and message time-to-live
203-
///
204-
/// # Returns
205-
///
206-
/// Returns a `Result` containing the enqueued message details if successful
207-
///
208-
/// # Errors
209-
///
210-
/// Returns an error if the queue doesn't exist, if no message was sent, or if the request fails
145+
/// * `message` - The message text to be added to the queue.
146+
/// * `options` - Optional configuration for the request.
211147
pub async fn send_message(
212148
&self,
213149
queue_message: RequestContent<QueueMessage, XmlFormat>,
@@ -221,22 +157,13 @@ impl QueueClient {
221157
.await
222158
}
223159

224-
/// Deletes a specific message from the queue.
160+
/// Deletes the specified message from the queue.
225161
///
226162
/// # Arguments
227163
///
228-
/// * `message_id` - The ID of the message to delete
229-
/// * `pop_receipt` - The pop receipt obtained when the message was retrieved
230-
/// * `options` - Optional parameters for the delete operation
231-
///
232-
/// # Returns
233-
///
234-
/// Returns a `Result` containing the response if successful
235-
///
236-
/// # Errors
237-
///
238-
/// Returns an error if the message doesn't exist, the pop receipt is invalid,
239-
/// or if the request fails
164+
/// * `message_id` - The ID of the message to delete.
165+
/// * `pop_receipt` - The pop receipt obtained when the message was retrieved.
166+
/// * `options` - Optional configuration for the request.
240167
pub async fn delete_message(
241168
&self,
242169
message_id: &str,
@@ -248,23 +175,14 @@ impl QueueClient {
248175
.await
249176
}
250177

251-
/// Updates a specific message in the queue.
178+
/// Updates the specified message in the queue.
252179
///
253180
/// # Arguments
254181
///
255-
/// * `message_id` - The ID of the message to update
256-
/// * `pop_receipt` - The pop receipt obtained when the message was retrieved
257-
/// * `visibility_timeout` - The new visibility timeout for the message, in seconds
258-
/// * `options` - Optional parameters for the update operation
259-
///
260-
/// # Returns
261-
///
262-
/// Returns a `Result` containing the response if successful
263-
///
264-
/// # Errors
265-
///
266-
/// Returns an error if the message doesn't exist, the pop receipt is invalid,
267-
/// or if the request fails
182+
/// * `message_id` - The ID of the message to update.
183+
/// * `pop_receipt` - The pop receipt obtained when the message was retrieved.
184+
/// * `visibility_timeout` - The new visibility timeout for the message, in seconds.
185+
/// * `options` - Optional configuration for the request.
268186
pub async fn update_message(
269187
&self,
270188
message_id: &str,
@@ -277,21 +195,12 @@ impl QueueClient {
277195
.await
278196
}
279197

280-
/// The Dequeue operation retrieves one or more messages from the front of the queue.
198+
/// Retrieves one or more messages from the front of the queue.
281199
///
282200
/// # Arguments
283201
///
284-
/// * `options` - Optional parameters for the dequeue operation. Use `number_of_messages` to specify
285-
/// how many messages to retrieve (up to 32) and set the visibility timeout
286-
///
287-
/// # Returns
288-
///
289-
/// Returns a `Result` containing the dequeued messages if successful. The messages will be invisible
290-
/// to other consumers for the duration specified in the visibility timeout
291-
///
292-
/// # Errors
293-
///
294-
/// Returns an error if the queue doesn't exist or if the request fails
202+
/// * `options` - Optional configuration for the request. Use `number_of_messages` to specify
203+
/// how many messages to retrieve (up to 32) and set the visibility timeout.
295204
pub async fn receive_messages(
296205
&self,
297206
options: Option<QueueClientReceiveMessagesOptions<'_>>,
@@ -303,25 +212,16 @@ impl QueueClient {
303212
///
304213
/// # Arguments
305214
///
306-
/// * `options` - Optional parameters for the peek operation. Use `number_of_messages`
307-
/// to specify how many messages to peek (up to 32)
308-
///
309-
/// # Returns
310-
///
311-
/// Returns a `Result` containing the messages at the front of the queue if successful.
312-
/// The messages remain visible to other consumers
313-
///
314-
/// # Errors
315-
///
316-
/// Returns an error if the queue doesn't exist or if the request fails
215+
/// * `options` - Optional configuration for the request. Use `number_of_messages`
216+
/// to specify how many messages to peek (up to 32).
317217
pub async fn peek_messages(
318218
&self,
319219
options: Option<QueueClientPeekMessagesOptions<'_>>,
320220
) -> Result<Response<ListOfPeekedMessage, XmlFormat>> {
321221
self.client.peek_messages(options).await
322222
}
323223

324-
/// Helper function to extract the first message from a list response and convert it to a single message response
224+
/// Helper function to extract the first message from a list response and convert it to a single message response.
325225
async fn extract_first_message<T, U>(
326226
response: Response<T, XmlFormat>,
327227
extract_fn: impl Fn(&T) -> Vec<U>,
@@ -338,7 +238,7 @@ impl QueueClient {
338238
let first_message = messages.into_iter().next().ok_or_else(|| {
339239
azure_core::Error::with_message(
340240
azure_core::error::ErrorKind::DataConversion,
341-
"No messages found in the response",
241+
"No messages found in the response.",
342242
)
343243
})?;
344244

0 commit comments

Comments
 (0)