Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
aef273a
AppendBlobClient and PageBlobClient first draft
vincenttran-msft Jun 5, 2025
00859d5
nit
vincenttran-msft Jun 5, 2025
a9808ea
Regenerate against latest version + removed response headers
vincenttran-msft Jun 11, 2025
536f268
Merge branch 'main' into vincenttran/handwritten_subclients
vincenttran-msft Jun 11, 2025
074d6f4
Refactor handwritten layer to match generated code changes
vincenttran-msft Jun 11, 2025
7f934e9
Merge branch 'main' into vincenttran/handwritten_subclients
vincenttran-msft Jun 18, 2025
1b6655e
Regen feature/blob-tsp
vincenttran-msft Jun 18, 2025
0665a7b
Need generated code support
vincenttran-msft Jun 18, 2025
e217cb3
PR feedback, regen against corrected .tsp
vincenttran-msft Jun 20, 2025
e89584a
Merge branch 'main' into vincenttran/handwritten_subclients
vincenttran-msft Jun 20, 2025
b6e9a0a
Added create-if-not-exists scenario to create_page_blob test suite
vincenttran-msft Jun 20, 2025
72b825f
Add helper concept, refactor after helper
vincenttran-msft Jun 23, 2025
df0cbce
Regen against v0.17 & tsp changes
vincenttran-msft Jun 24, 2025
8cf4757
PR feedback
vincenttran-msft Jun 24, 2025
421192b
Merge branch 'main' into vincenttran/handwritten_subclients
vincenttran-msft Jun 24, 2025
99272e9
Fix test recordings for CI
vincenttran-msft Jun 24, 2025
3f77c8a
initial impl, blobs
vincenttran-msft Jun 24, 2025
f92d168
Refactor on PR feedback, move to extension traits, still wip helper
vincenttran-msft Jun 25, 2025
8f68359
nit
vincenttran-msft Jun 25, 2025
d5be6ee
Refactor both to be extension traits
vincenttran-msft Jun 25, 2025
c3fb770
nit docs
vincenttran-msft Jun 25, 2025
d8786ea
Refactor, storage_utils for common helpers, storage_traits for option…
vincenttran-msft Jun 25, 2025
186cc1a
First draft, full testcases for Blobs
vincenttran-msft Jun 26, 2025
f3a017e
Finish BlobContainerClient impl and tests
vincenttran-msft Jun 26, 2025
75abb34
Refactor to helpers, extension traits in models folder, add models fo…
vincenttran-msft Jun 27, 2025
0c9e844
nit
vincenttran-msft Jun 27, 2025
1d314ee
Regenerate after making duration required param
vincenttran-msft Jun 30, 2025
f48a3e7
Added testcase for using non-lease APIs with active lease
vincenttran-msft Jun 30, 2025
7a69e1b
Rename to parsers, regen against feature/blob-tsp
vincenttran-msft Jul 7, 2025
85eb592
Merge branch 'main' into vincenttran/handwritten_subclients
vincenttran-msft Jul 7, 2025
97cfd3a
append_block, append_block_from_url, seal for AppendBlob
vincenttran-msft Jul 8, 2025
2ff96c4
nit
vincenttran-msft Jul 9, 2025
1b25e87
Merge in lease API work
vincenttran-msft Jul 10, 2025
509c4f1
Merge branch 'main' into vincenttran/append_blob_apis
vincenttran-msft Jul 10, 2025
2ede8dc
Merge branch 'vincenttran/append_blob_apis' into vincenttran/lease_ops
vincenttran-msft Jul 10, 2025
462139c
Test recordings
vincenttran-msft Jul 10, 2025
93c66d6
Regenerate against TypeSpec
vincenttran-msft Jul 10, 2025
2a9a9df
Regen against feature/blob-tsp
vincenttran-msft Jul 11, 2025
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/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_83b2698a78",
"Tag": "rust/azure_storage_blob_f12afa9550",
"TagPrefix": "rust/azure_storage_blob"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@

use crate::{
generated::clients::AppendBlobClient as GeneratedAppendBlobClient,
models::{AppendBlobClientCreateOptions, AppendBlobClientCreateResult},
models::{
AppendBlobClientAppendBlockFromUrlOptions, AppendBlobClientAppendBlockFromUrlResult,
AppendBlobClientAppendBlockOptions, AppendBlobClientAppendBlockResult,
AppendBlobClientCreateOptions, AppendBlobClientCreateResult, AppendBlobClientSealOptions,
AppendBlobClientSealResult,
},
pipeline::StorageHeadersPolicy,
AppendBlobClientOptions, BlobClientOptions,
};
Expand Down Expand Up @@ -97,4 +102,53 @@ impl AppendBlobClient {
) -> Result<Response<AppendBlobClientCreateResult, NoFormat>> {
self.client.create(options).await
}

/// Commits a new block of data to the end of an Append blob.
///
/// # Arguments
///
/// * `data` - The blob data to append.
/// * `content_length` - Total length of the blob data to be appended.
/// * `options` - Optional configuration for the request.
pub async fn append_block(
&self,
data: RequestContent<Bytes>,
content_length: u64,
options: Option<AppendBlobClientAppendBlockOptions<'_>>,
) -> Result<Response<AppendBlobClientAppendBlockResult, NoFormat>> {
self.client
.append_block(data, content_length, options)
.await
}

/// Creates a new block to be committed as part of an Append blob where the contents are
/// read from a URL.
///
/// # Arguments
///
/// * `source_url` - The URL of the copy source.
/// * `content_length` - Total length of the blob data to be appended.
/// * `options` - Optional configuration for the request.
pub async fn append_block_from_url(
&self,
source_url: String,
content_length: u64,
options: Option<AppendBlobClientAppendBlockFromUrlOptions<'_>>,
) -> Result<Response<AppendBlobClientAppendBlockFromUrlResult, NoFormat>> {
self.client
.append_block_from_url(source_url, content_length, options)
.await
}

/// Seals the Append blob to make it read-only. Seal is supported only on version 2019-12-12 or later.
///
/// # Arguments
///
/// * `options` - Optional parameters for the request.
pub async fn seal(
&self,
options: Option<AppendBlobClientSealOptions<'_>>,
) -> Result<Response<AppendBlobClientSealResult, NoFormat>> {
self.client.seal(options).await
}
}
92 changes: 86 additions & 6 deletions sdk/storage/azure_storage_blob/src/clients/blob_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
use crate::{
generated::clients::BlobClient as GeneratedBlobClient,
generated::models::{
BlobClientDownloadResult, BlobClientGetPropertiesResult,
BlockBlobClientCommitBlockListResult, BlockBlobClientStageBlockResult,
BlockBlobClientUploadResult,
BlobClientAcquireLeaseResult, BlobClientBreakLeaseResult, BlobClientChangeLeaseResult,
BlobClientDownloadResult, BlobClientGetPropertiesResult, BlobClientReleaseLeaseResult,
BlobClientRenewLeaseResult, BlockBlobClientCommitBlockListResult,
BlockBlobClientStageBlockResult, BlockBlobClientUploadResult,
},
models::{
AccessTierOptional, BlobClientDeleteOptions, BlobClientDownloadOptions,
BlobClientGetPropertiesOptions, BlobClientSetMetadataOptions,
BlobClientSetPropertiesOptions, BlobClientSetTierOptions,
AccessTierOptional, BlobClientAcquireLeaseOptions, BlobClientBreakLeaseOptions,
BlobClientChangeLeaseOptions, BlobClientDeleteOptions, BlobClientDownloadOptions,
BlobClientGetPropertiesOptions, BlobClientReleaseLeaseOptions, BlobClientRenewLeaseOptions,
BlobClientSetMetadataOptions, BlobClientSetPropertiesOptions, BlobClientSetTierOptions,
BlockBlobClientCommitBlockListOptions, BlockBlobClientUploadOptions, BlockList,
BlockListType, BlockLookupList,
},
Expand Down Expand Up @@ -233,4 +235,82 @@ impl BlobClient {
) -> Result<Response<(), NoFormat>> {
self.client.set_tier(tier, options).await
}

/// Requests a new lease on a blob. The lease lock duration can be 15 to 60 seconds, or can be infinite.
///
/// # Arguments
///
/// * `duration` - Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A
/// non-infinite lease can be between 15 and 60 seconds.
/// * `options` - Optional configuration for the request.
pub async fn acquire_lease(
&self,
duration: i32,
options: Option<BlobClientAcquireLeaseOptions<'_>>,
) -> Result<Response<BlobClientAcquireLeaseResult, NoFormat>> {
self.client.acquire_lease(duration, options).await
}

/// Ends a lease and ensures that another client can't acquire a new lease until the current lease
/// period has expired.
///
/// # Arguments
///
/// * `options` - Optional configuration for the request.
pub async fn break_lease(
&self,
options: Option<BlobClientBreakLeaseOptions<'_>>,
) -> Result<Response<BlobClientBreakLeaseResult, NoFormat>> {
self.client.break_lease(options).await
}

/// Changes the ID of an existing lease to the proposed lease ID.
///
/// # Arguments
///
/// * `lease_id` - A lease ID for the source path. The source path must have an active lease and the
/// lease ID must match.
/// * `proposed_lease_id` - The proposed lease ID for the blob.
/// * `options` - Optional configuration for the request.
pub async fn change_lease(
&self,
lease_id: String,
proposed_lease_id: String,
options: Option<BlobClientChangeLeaseOptions<'_>>,
) -> Result<Response<BlobClientChangeLeaseResult, NoFormat>> {
self.client
.change_lease(lease_id, proposed_lease_id, options)
.await
}

/// Frees the lease so that another client can immediately acquire a lease
/// against the blob as soon as the release is complete.
///
/// # Arguments
///
/// * `lease_id` - A lease ID for the source path. The source path must have an active lease and the
/// lease ID must match.
/// * `options` - Optional configuration for the request.
pub async fn release_lease(
&self,
lease_id: String,
options: Option<BlobClientReleaseLeaseOptions<'_>>,
) -> Result<Response<BlobClientReleaseLeaseResult, NoFormat>> {
self.client.release_lease(lease_id, options).await
}

/// Renews the lease on a blob.
///
/// # Arguments
///
/// * `lease_id` - A lease ID for the source path. The source path must have an active lease and the
/// lease ID must match.
/// * `options` - Optional configuration for the request.
pub async fn renew_lease(
&self,
lease_id: String,
options: Option<BlobClientRenewLeaseOptions<'_>>,
) -> Result<Response<BlobClientRenewLeaseResult, NoFormat>> {
self.client.renew_lease(lease_id, options).await
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@

use crate::{
generated::clients::BlobContainerClient as GeneratedBlobContainerClient,
generated::models::BlobContainerClientGetPropertiesResult,
generated::models::{
BlobContainerClientAcquireLeaseResult, BlobContainerClientBreakLeaseResult,
BlobContainerClientChangeLeaseResult, BlobContainerClientGetPropertiesResult,
BlobContainerClientReleaseLeaseResult, BlobContainerClientRenewLeaseResult,
},
models::{
BlobContainerClientCreateOptions, BlobContainerClientDeleteOptions,
BlobContainerClientGetPropertiesOptions, BlobContainerClientListBlobFlatSegmentOptions,
BlobContainerClientSetMetadataOptions, ListBlobsFlatSegmentResponse,
BlobContainerClientAcquireLeaseOptions, BlobContainerClientBreakLeaseOptions,
BlobContainerClientChangeLeaseOptions, BlobContainerClientCreateOptions,
BlobContainerClientDeleteOptions, BlobContainerClientGetPropertiesOptions,
BlobContainerClientListBlobFlatSegmentOptions, BlobContainerClientReleaseLeaseOptions,
BlobContainerClientRenewLeaseOptions, BlobContainerClientSetMetadataOptions,
ListBlobsFlatSegmentResponse,
},
pipeline::StorageHeadersPolicy,
BlobClient, BlobContainerClientOptions,
Expand Down Expand Up @@ -157,4 +164,82 @@ impl BlobContainerClient {
) -> Result<PageIterator<Response<ListBlobsFlatSegmentResponse, XmlFormat>>> {
self.client.list_blob_flat_segment(options)
}

/// Requests a new lease on a container. The lease lock duration can be 15 to 60 seconds, or can be infinite.
///
/// # Arguments
///
/// * `duration` - Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A
/// non-infinite lease can be between 15 and 60 seconds.
/// * `options` - Optional configuration for the request.
pub async fn acquire_lease(
&self,
duration: i32,
options: Option<BlobContainerClientAcquireLeaseOptions<'_>>,
) -> Result<Response<BlobContainerClientAcquireLeaseResult, NoFormat>> {
self.client.acquire_lease(duration, options).await
}

/// Ends a lease and ensures that another client can't acquire a new lease until the current lease
/// period has expired.
///
/// # Arguments
///
/// * `options` - Optional configuration for the request.
pub async fn break_lease(
&self,
options: Option<BlobContainerClientBreakLeaseOptions<'_>>,
) -> Result<Response<BlobContainerClientBreakLeaseResult, NoFormat>> {
self.client.break_lease(options).await
}

/// Changes the ID of an existing lease to the proposed lease ID.
///
/// # Arguments
///
/// * `lease_id` - A lease ID for the source path. The source path must have an active lease and the
/// lease ID must match.
/// * `proposed_lease_id` - The proposed lease ID for the container.
/// * `options` - Optional configuration for the request.
pub async fn change_lease(
&self,
lease_id: String,
proposed_lease_id: String,
options: Option<BlobContainerClientChangeLeaseOptions<'_>>,
) -> Result<Response<BlobContainerClientChangeLeaseResult, NoFormat>> {
self.client
.change_lease(lease_id, proposed_lease_id, options)
.await
}

/// Frees the lease so that another client can immediately acquire a lease
/// against the container as soon as the release is complete.
///
/// # Arguments
///
/// * `lease_id` - A lease ID for the source path. The source path must have an active lease and the
/// lease ID must match.
/// * `options` - Optional configuration for the request.
pub async fn release_lease(
&self,
lease_id: String,
options: Option<BlobContainerClientReleaseLeaseOptions<'_>>,
) -> Result<Response<BlobContainerClientReleaseLeaseResult, NoFormat>> {
self.client.release_lease(lease_id, options).await
}

/// Renews the lease on a container.
///
/// # Arguments
///
/// * `lease_id` - A lease ID for the source path. The source path must have an active lease and the
/// lease ID must match.
/// * `options` - Optional configuration for the request.
pub async fn renew_lease(
&self,
lease_id: String,
options: Option<BlobContainerClientRenewLeaseOptions<'_>>,
) -> Result<Response<BlobContainerClientRenewLeaseResult, NoFormat>> {
self.client.renew_lease(lease_id, options).await
}
}

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.

Loading