Skip to content
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion sdk/storage/azure_storage_blob/assets.json
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_873d66a4ea",
"Tag": "rust/azure_storage_blob_84d344d028",
"TagPrefix": "rust/azure_storage_blob"
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use azure_core::{
credentials::TokenCredential,
http::{
policies::{BearerTokenCredentialPolicy, Policy},
NoFormat, RequestContent, Response, Url, XmlFormat,
NoFormat, RequestContent, Response, StatusCode, Url, XmlFormat,
},
Bytes, Result,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use azure_core::{
},
Result,
};
use std::sync::Arc;
use std::{collections::HashMap, sync::Arc};

/// A client to interact with a specified Azure storage container.
pub struct BlobContainerClient {
Expand Down Expand Up @@ -111,12 +111,14 @@ impl BlobContainerClient {
///
/// # Arguments
///
/// * `metadata` - A HashMap containing the name-value pairs to associate with the container as metadata.
/// * `options` - Optional configuration for the request.
pub async fn set_metadata(
&self,
metadata: HashMap<String, String>,
options: Option<BlobContainerClientSetMetadataOptions<'_>>,
) -> Result<Response<(), NoFormat>> {
self.client.set_metadata(options).await
self.client.set_metadata(metadata, options).await
}

/// Marks the specified container for deletion. The container and any blobs contained within are later deleted during garbage collection.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{
generated::clients::BlobServiceClient as GeneratedBlobServiceClient,
models::{
BlobServiceClientGetPropertiesOptions, BlobServiceClientListContainersSegmentOptions,
ListContainersSegmentResponse, StorageServiceProperties,
BlobServiceProperties, ListContainersSegmentResponse,
},
pipeline::StorageHeadersPolicy,
BlobContainerClient, BlobServiceClientOptions,
Expand Down Expand Up @@ -80,7 +80,7 @@ impl BlobServiceClient {
pub async fn get_properties(
&self,
options: Option<BlobServiceClientGetPropertiesOptions<'_>>,
) -> Result<Response<StorageServiceProperties, XmlFormat>> {
) -> Result<Response<BlobServiceProperties, XmlFormat>> {
self.client.get_properties(options).await
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ use crate::{
BlockBlobClientUploadResult,
},
models::{
BlobClientDeleteOptions, BlobClientDownloadOptions, BlobClientGetPropertiesOptions,
BlobClientSetMetadataOptions, BlobClientSetPropertiesOptions, BlobClientSetTierOptions,
BlockBlobClientCommitBlockListOptions, BlockBlobClientGetBlockListOptions,
BlockBlobClientStageBlockOptions, BlockBlobClientUploadOptions, BlockList, BlockListType,
BlockLookupList, StorageServiceProperties,
BlockLookupList,
},
pipeline::StorageHeadersPolicy,
BlobClientOptions, BlockBlobClientOptions,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

88 changes: 44 additions & 44 deletions sdk/storage/azure_storage_blob/src/generated/models/pub_models.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 12 additions & 11 deletions sdk/storage/azure_storage_blob/src/models/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,17 @@ pub use crate::generated::models::{
BlobContainerClientRenewLeaseOptions, BlobContainerClientRenewLeaseResult,
BlobContainerClientSetMetadataOptions, BlobFlatListSegment, BlobImmutabilityPolicyMode,
BlobItemInternal, BlobMetadata, BlobName, BlobPropertiesInternal,
BlobServiceClientGetPropertiesOptions, BlobServiceClientListContainersSegmentOptions, BlobTag,
BlobTags, BlobType, Block, BlockBlobClientCommitBlockListOptions,
BlockBlobClientCommitBlockListResult, BlockBlobClientCommitBlockListResultHeaders,
BlockBlobClientGetBlockListOptions, BlockBlobClientStageBlockOptions,
BlockBlobClientStageBlockResult, BlockBlobClientStageBlockResultHeaders,
BlockBlobClientUploadOptions, BlockBlobClientUploadResult, BlockBlobClientUploadResultHeaders,
BlockList, BlockListType, BlockLookupList, ContainerItem, CopyStatus, CorsRule, LeaseDuration,
LeaseState, LeaseStatus, ListBlobsFlatSegmentResponse, ListBlobsIncludeItem,
ListContainersIncludeType, ListContainersSegmentResponse, Logging, Metrics,
ObjectReplicationMetadata, PageBlobClientClearPagesOptions, PageBlobClientClearPagesResult,
BlobServiceClientGetPropertiesOptions, BlobServiceClientListContainersSegmentOptions,
BlobServiceProperties, BlobTag, BlobTags, BlobType, Block,
BlockBlobClientCommitBlockListOptions, BlockBlobClientCommitBlockListResult,
BlockBlobClientCommitBlockListResultHeaders, BlockBlobClientGetBlockListOptions,
BlockBlobClientStageBlockOptions, BlockBlobClientStageBlockResult,
BlockBlobClientStageBlockResultHeaders, BlockBlobClientUploadOptions,
BlockBlobClientUploadResult, BlockBlobClientUploadResultHeaders, BlockList, BlockListType,
BlockLookupList, ContainerItem, CopyStatus, CorsRule, LeaseDuration, LeaseState, LeaseStatus,
ListBlobsFlatSegmentResponse, ListBlobsIncludeItem, ListContainersIncludeType,
ListContainersSegmentResponse, Logging, Metrics, ObjectReplicationMetadata,
PageBlobClientClearPagesOptions, PageBlobClientClearPagesResult,
PageBlobClientClearPagesResultHeaders, PageBlobClientCreateOptions, PageBlobClientCreateResult,
PageBlobClientCreateResultHeaders, PageBlobClientGetPageRangesOptions,
PageBlobClientResizeOptions, PageBlobClientResizeResult, PageBlobClientResizeResultHeaders,
Expand All @@ -50,6 +51,6 @@ pub use crate::generated::models::{
PageBlobClientUploadPagesFromUrlResult, PageBlobClientUploadPagesOptions,
PageBlobClientUploadPagesResult, PageBlobClientUploadPagesResultHeaders, PageList,
PremiumPageBlobAccessTier, PublicAccessType, RehydratePriority, RetentionPolicy,
SequenceNumberActionType, StaticWebsite, StorageServiceProperties,
SequenceNumberActionType, StaticWebsite,
};
pub use extensions::*;
21 changes: 21 additions & 0 deletions sdk/storage/azure_storage_blob/tests/blob_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,27 @@ use azure_storage_blob_test::{create_test_blob, get_blob_name, get_container_cli
use std::{collections::HashMap, error::Error, time::Duration};
use tokio::time;

#[recorded::test]
async fn test_blob_exists(ctx: TestContext) -> Result<(), Box<dyn Error>> {
// Recording Setup
let recording = ctx.recording();
let container_client = get_container_client(recording, false).await?;
let blob_client = container_client.blob_client(get_blob_name(recording));
container_client.create_container(None).await?;

// Blob Does Not Exists Scenario
let response = blob_client.exists().await?;
assert!(!response);

// Blob Exists Scenario
create_test_blob(&blob_client).await?;
let response = blob_client.exists().await?;
assert!(response);

container_client.delete_container(None).await?;
Ok(())
}

#[recorded::test]
async fn test_get_blob_properties(ctx: TestContext) -> Result<(), Box<dyn Error>> {
// Recording Setup
Expand Down
11 changes: 3 additions & 8 deletions sdk/storage/azure_storage_blob/tests/blob_container_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,8 @@ async fn test_set_container_metadata(ctx: TestContext) -> Result<(), Box<dyn Err

// Set Metadata With Values
let update_metadata = HashMap::from([("hello".to_string(), "world".to_string())]);
let set_metadata_options = BlobContainerClientSetMetadataOptions {
metadata: Some(update_metadata.clone()),
..Default::default()
};
container_client
.set_metadata(Some(set_metadata_options))
.set_metadata(update_metadata.clone(), None)
.await?;

// Assert
Expand All @@ -77,7 +73,7 @@ async fn test_set_container_metadata(ctx: TestContext) -> Result<(), Box<dyn Err
assert_eq!(update_metadata, response_metadata);

// Set Metadata No Values (Clear Metadata)
container_client.set_metadata(None).await?;
container_client.set_metadata(HashMap::new(), None).await?;

// Assert
let response = container_client.get_properties(None).await?;
Expand Down Expand Up @@ -230,11 +226,10 @@ async fn test_container_lease_operations(ctx: TestContext) -> Result<(), Box<dyn
let update_metadata = HashMap::from([("hello".to_string(), "world".to_string())]);
let set_metadata_options = BlobContainerClientSetMetadataOptions {
lease_id: Some(lease_id.clone()),
metadata: Some(update_metadata.clone()),
..Default::default()
};
container_client
.set_metadata(Some(set_metadata_options))
.set_metadata(update_metadata.clone(), Some(set_metadata_options))
.await?;

// Change Lease
Expand Down
Loading
Loading