Skip to content

Add messages count to get-queue-metadata operation #1125

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

Merged
merged 1 commit into from
Oct 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion sdk/storage_queues/src/operations/get_queue_metadata.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
use crate::clients::QueueClient;
use azure_core::{error::Error, headers::Headers, prelude::*, Method, Response as AzureResponse};
use azure_core::{
error::Error,
headers::{HeaderName, Headers},
prelude::*,
Method, Response as AzureResponse,
};
use azure_storage::headers::CommonStorageResponseHeaders;
use std::convert::TryInto;

Expand Down Expand Up @@ -29,6 +34,7 @@ impl GetQueueMetadataBuilder {
#[derive(Debug, Clone)]
pub struct GetQueueMetadataResponse {
pub common_storage_response_headers: CommonStorageResponseHeaders,
pub approximate_messages_count: usize,
pub metadata: Metadata,
}

Expand All @@ -40,7 +46,11 @@ impl std::convert::TryFrom<AzureResponse> for GetQueueMetadataResponse {

Ok(GetQueueMetadataResponse {
common_storage_response_headers: headers.try_into()?,
approximate_messages_count: headers.get_as(&APPROXIMATE_MESSAGES_COUNT)?,
metadata: headers.into(),
})
}
}

const APPROXIMATE_MESSAGES_COUNT: HeaderName =
HeaderName::from_static("x-ms-approximate-messages-count");