Repository navigation
[Storage] Report the access tier of a blob download - #51400
Andrew Gaul (gaul) wants to merge 1 commit into
Conversation
Get Blob returns the blob's access tier in x-ms-access-tier, with x-ms-access-tier-inferred, x-ms-access-tier-change-time and x-ms-smart-access-tier, as Get Blob Properties does, and the generated BlobsDownloadHeaders parses them. But the public BlobDownloadHeaders had no accessors for them, and BlobPropertiesInternalDownload answered null for all four, so the BlobProperties of a download -- among them BlobInputStream.getProperties() from openInputStream -- reported no tier. A caller that wanted it, for instance to report an object's storage class with its content, had to make a second request, Get Blob Properties, for what the first had already returned. BlobDownloadHeaders gains getAccessTier, isAccessTierInferred, getAccessTierChangeTime and getSmartAccessTier with their setters, and the properties of a download read them, as those of Get Blob Properties do. BlobDownloadAccessTierTests covers the sync and async downloads, openInputStream's properties, the smart tier and a response without the headers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014pJPwDB8sUdbqTgi5xEtRx
|
The |
|
Thank you for your contribution Andrew Gaul (@gaul)! We will review the pull request and get back to you soon. |
|
Azure Pipelines: Successfully started running 1 pipeline(s). 33 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the change exposing access-tier metadata from blob downloads.
No open issues 🎉
What changed in this PR
This PR exposes access-tier metadata already returned by blob downloads in the Azure Storage Blob SDK, avoiding a separate Get Blob Properties request to retrieve that information.
Changes:
- Adds getters and setters for access tier, inferred status, tier-change time, and smart tier to
BlobDownloadHeaders. - Propagates these values into download-backed
BlobProperties, includingBlobInputStream.getProperties(). - Adds mock-response tests and documents the changes in the changelog.
| File | Description |
|---|---|
sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobDownloadAccessTierTests.java |
Tests sync and async download headers, stream properties, smart tier, absent headers, and setters. |
sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobDownloadHeaders.java |
Exposes four access-tier properties through public accessors. |
sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobPropertiesInternalDownload.java |
Reads access-tier properties from download headers instead of returning null. |
sdk/storage/azure-storage-blob/CHANGELOG.md |
Records the new accessors and corrected download-property behavior. |
Review effort: Balanced
|
Looks like flaky CI:
|
|
Thanks for bringing this to our attention. We had intended to release this feature back in May, but it had gotten lost during a complicated merge. I'm going to close this PR and create a new one with the cherrypicked changes. It should go out with the next bugfix and/or beta. Thanks again! |
Description
Get Blob returns the blob's access tier in x-ms-access-tier, with x-ms-access-tier-inferred, x-ms-access-tier-change-time and x-ms-smart-access-tier, as Get Blob Properties does, and the generated BlobsDownloadHeaders parses them. But the public BlobDownloadHeaders had no accessors for them, and BlobPropertiesInternalDownload answered null for all four, so the BlobProperties of a download -- among them BlobInputStream.getProperties() from openInputStream -- reported no tier. A caller that wanted it, for instance to report an object's storage class with its content, had to make a second request, Get Blob Properties, for what the first had already returned.
BlobDownloadHeaders gains getAccessTier, isAccessTierInferred, getAccessTierChangeTime and getSmartAccessTier with their setters, and the properties of a download read them, as those of Get Blob Properties do. BlobDownloadAccessTierTests covers the sync and async downloads, openInputStream's properties, the smart tier and a response without the headers.
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines