Skip to content

[Storage] Report the access tier of a blob download - #51400

Closed
Andrew Gaul (gaul) wants to merge 1 commit into
Azure:mainfrom
gaul:storage-blob-download-access-tier
Closed

Andrew Gaul (gaul) wants to merge 1 commit into
Azure:mainfrom
gaul:storage-blob-download-access-tier

Conversation

@gaul

Copy link
Copy Markdown
Contributor

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:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

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
@azure-sdk-automation

Copy link
Copy Markdown
Contributor

The sdk-api-review-ready label cannot create a review PR for this working PR because its branch is in a fork repository. Prefer a working branch in the registered upstream repository, or reach out to the ARH maintainers for help. Fork reviews are supported through the Azure SDK CLI (azsdk apireview create), but the fork requires its own ARH registration and the review PR is created in the fork rather than the upstream repository.

@github-actions github-actions Bot added Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization. Storage Storage Service (Queues, Blobs, Files) labels Nov 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution Andrew Gaul (@gaul)! We will review the pull request and get back to you soon.

@azure-pipelines

Copy link
Copy Markdown
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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 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, including BlobInputStream.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

@gaul

Copy link
Copy Markdown
Contributor Author

Looks like flaky CI:

Failed to fetch Copilot analysis result.

@ibrandes

Copy link
Copy Markdown
Member

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization. Storage Storage Service (Queues, Blobs, Files)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants