Skip to content

Added sdk/storage/azure_storage_queue (#2730) #2732

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

lsiddiquee
Copy link
Member

@lsiddiquee lsiddiquee commented Jun 24, 2025

Fixes #2708

Added support for the 2018-03-28 Queue API. The following functions have been created on the new QueueClient, roughly following the pattern in the .Net SDK:

QueueServiceClient

The QueueServiceClient provides operations to interact with the Azure Storage Queue service at the account level.

Method Parameters Return Type Description
new endpoint: &str
credential: Arc<dyn TokenCredential>
options: Option<QueueServiceClientOptions>
Result<Self> Creates a new QueueServiceClient using Entra ID authentication
endpoint &self &Url Returns the endpoint URL of the Azure storage account
queue_client &self
queue_name: String
QueueClient Returns a new QueueClient instance for a specific queue
create_queue &self
queue_name: &str
options: Option<QueueClientCreateOptions<'_>>
Result<Response<(), NoFormat>> Creates a new queue under the account
delete_queue &self
queue_name: &str
options: Option<QueueClientDeleteOptions<'_>>
Result<Response<(), NoFormat>> Permanently deletes the specified queue
get_properties &self
options: Option<QueueServiceClientGetPropertiesOptions<'_>>
Result<Response<StorageServiceProperties, XmlFormat>> Retrieves the properties of the queue service
set_properties &self
storage_service_properties: RequestContent<StorageServiceProperties>
options: Option<QueueServiceClientSetPropertiesOptions<'_>>
Result<Response<(), NoFormat>> Sets the properties of the queue service
list_queues_segment &self
options: Option<QueueServiceClientListQueuesSegmentOptions<'_>>
Result<PageIterator<Response<ListQueuesSegmentResponse, XmlFormat>>> Lists queues in the storage account with pagination
get_statistics &self
options: Option<QueueServiceClientGetStatisticsOptions<'_>>
Result<Response<StorageServiceStats, XmlFormat>> Retrieves statistics related to replication for the Queue service. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the storage account

QueueClient

The QueueClient provides operations to interact with a specific Azure Storage Queue.

Method Parameters Return Type Description
new endpoint: &str
queue_name: &str
credential: Arc<dyn TokenCredential>
options: Option<QueueClientOptions>
Result<Self> Creates a new QueueClient using Entra ID authentication
endpoint &self &Url Returns the endpoint URL of the Azure storage account
queue_name &self &str Returns the name of the queue this client is associated with

Queue Management

Method Parameters Return Type Description
create &self
options: Option<QueueClientCreateOptions<'_>>
Result<Response<(), NoFormat>> Creates a new queue
create_if_not_exists &self
options: Option<QueueClientCreateOptions<'_>>
Result<Response<(), NoFormat>> Creates a queue if it doesn't already exist
delete &self
options: Option<QueueClientDeleteOptions<'_>>
Result<Response<(), NoFormat>> Permanently deletes the queue
delete_if_exists &self
options: Option<QueueClientDeleteOptions<'_>>
Result<Response<(), NoFormat>> Deletes the queue if it exists
exists &self Result<bool> Checks if the queue exists
clear &self
options: Option<QueueClientClearOptions<'_>>
Result<Response<(), NoFormat>> Clears all messages in the queue

Metadata Operations

Method Parameters Return Type Description
set_metadata &self
options: Option<QueueClientSetMetadataOptions<'_>>
Result<Response<(), NoFormat>> Sets the metadata for the queue
get_metadata &self
options: Option<QueueClientGetMetadataOptions<'_>>
Result<Response<QueueClientGetMetadataResult, NoFormat>> Retrieves the metadata of the queue

Message Operations

Method Parameters Return Type Description
enqueue_message &self
message: &str
options: Option<QueueClientEnqueueOptions<'_>>
Result<Response<Option<EnqueuedMessage>, XmlFormat>> Enqueues a message to the queue
dequeue_message &self
options: Option<QueueClientDequeueOptions<'_>>
Result<Response<Option<DequeuedMessage>, XmlFormat>> Retrieves a single message from the front of the queue
dequeue_messages &self
options: Option<QueueClientDequeueOptions<'_>>
Result<Response<ListOfDequeuedMessage, XmlFormat>> Retrieves multiple messages from the front of the queue
peek_message &self
options: Option<QueueClientPeekOptions<'_>>
Result<Response<Option<PeekedMessage>, XmlFormat>> Peeks a single message without removing it
peek_messages &self
options: Option<QueueClientPeekOptions<'_>>
Result<Response<ListOfPeekedMessage, XmlFormat>> Peeks multiple messages without removing them
delete_message &self
message_id: &str
pop_receipt: &str
options: Option<QueueClientDeleteMessageOptions<'_>>
Result<Response<(), NoFormat>> Deletes a specific message from the queue
update_message &self
message_id: &str
pop_receipt: &str
visibility_timeout: i32
options: Option<QueueClientUpdateOptions<'_>>
Result<Response<(), NoFormat>> Updates a specific message in the queue

Access Policy Operations

Method Parameters Return Type Description
get_access_policy &self
options: Option<QueueClientGetAccessPolicyOptions<'_>>
Result<Response<ListOfSignedIdentifier, XmlFormat>> Retrieves the access policy for the queue
set_access_policy &self
queue_acl: RequestContent<ListOfSignedIdentifier>
options: Option<QueueClientSetAccessPolicyOptions<'_>>
Result<Response<QueueClientSetAccessPolicyResult, NoFormat>> Sets the access policy for the queue

Examples of how to use each method has been provided in the sdk/storage/examples/queue_client.rs file.

Recorded tests has also been pushed to the repo Azure/azure-sdk-assets and the assets.json updated.

The client is generated using tsp-client using remote Azure/azure-rest-api-specs repo.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements initial support for the 2018-03-28 Queue API in the Azure Storage Queue SDK for Rust. Key changes include the introduction of new client functions for managing queues, a comprehensive test suite covering the new operations, and several example programs and documentation updates.

Reviewed Changes

Copilot reviewed 18 out of 36 changed files in this pull request and generated no comments.

Show a summary per file
File Description
sdk/storage/azure_storage_queue/tsp-location.yaml Adds configuration metadata for the queue API
sdk/storage/azure_storage_queue/tests/queue_service_client.rs Introduces recorded tests for queue service
sdk/storage/azure_storage_queue/src/lib.rs Sets up module exports for clients and models
sdk/storage/azure_storage_queue/src/clients/queue_service_client.rs Implements QueueServiceClient API functions
sdk/storage/azure_storage_queue/examples/* Provides usage examples and helper functions
sdk/storage/azure_storage_queue/Cargo.toml Configures the crate with required dependencies and features
sdk/storage/azure_storage_queue/CHANGELOG.md Documents the initial supported release
sdk/storage/assets.json Updates asset references
sdk/storage/.dict.txt Updates custom dictionary with new terms
Cargo.toml Adds the queue SDK to the workspace members
Comments suppressed due to low confidence (1)

sdk/storage/azure_storage_queue/src/clients/queue_service_client.rs:90

  • The documentation for the 'queue_name' parameter in the delete_queue function incorrectly states that it is 'to create' the queue. Please update the description to indicate that it is the name of the queue to delete.
    /// * `queue_name` - The name of the queue to create

@lsiddiquee lsiddiquee marked this pull request as draft June 24, 2025 18:51
@github-actions github-actions bot added the Storage Storage Service (Queues, Blobs, Files) label Jun 24, 2025
Copy link

github-actions bot commented Jun 24, 2025

API Change Check

APIView identified API level changes in this PR and created the following API reviews

azure_storage_queue

@lsiddiquee lsiddiquee changed the title Initial implementation of the queue sdk (#2730) Added sdk/storage/azure_storage_queue (#2730) Jun 24, 2025
@lsiddiquee lsiddiquee force-pushed the feature/queue-sdk branch 2 times, most recently from 24925f4 to ce518e5 Compare June 30, 2025 14:33
Fixes #2708

Added support for the 2018-03-28 Queue API. The following functions have been created on the new QueueClient, roughly following the pattern in the .Net SDK:

queue_client:
new
create
create_if_not_exists
clear
delete
delete_if_exists
delete_message

exists
get_metadata
get_properties
enqueue_message
dequeue_message
dequeue_messages
peek_message
peek_messages
set_metadata
update_message
get_access_policy
set_access_policy

queue_service_client:
new

create_queue
delete_queue
get_properties
set_properties
list_queues_segment (paginated)

Examples of how to use each method has been provided in the ~/sdk/storage/examples/queue_client.rs file.

Recorded tests has also been pushed to the repo Azure/azure-sdk-assets and the assets.json updated.

The client is generated using tsp-client using remote Azure/azure-rest-api-specs repo.
  * Regenerated client based on new TSP
  * Switching set and get metadata to use the generated client.
  * Added get_statistics
  * Updated samples to show how to pass realistic parameters.
@lsiddiquee lsiddiquee force-pushed the feature/queue-sdk branch from ce518e5 to 1833dda Compare July 1, 2025 11:43
…json for the queue crate. Removing access policy api as there is issue with (de)serialization and this is also not yet implemented in blob.
@lsiddiquee lsiddiquee force-pushed the feature/queue-sdk branch from 1833dda to 114ff2e Compare July 1, 2025 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support storage queues
1 participant