From fb22ba6fe561baf5ea68afb6a0ea2e6216755579 Mon Sep 17 00:00:00 2001 From: browndav Date: Thu, 18 Jun 2026 09:14:37 -0400 Subject: [PATCH] Make Download (Get Blob) access-tier response headers regen-safe via directive Adds a swagger directive that injects x-ms-access-tier, x-ms-access-tier-inferred, x-ms-access-tier-change-time, and x-ms-smart-access-tier into the Blob_Download 200/206 responses. Previously these headers (added in #49219) came solely from the pinned spec, so a later spec/fork change silently dropped them from BlobsDownloadHeaders. The directive uses idempotent Object.assign so it is a no-op when the spec already defines them and load-bearing when it does not. --- .../azure-storage-blob/swagger/README.md | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/sdk/storage/azure-storage-blob/swagger/README.md b/sdk/storage/azure-storage-blob/swagger/README.md index 98afe0c616dc..6d0d4cfbb2bb 100644 --- a/sdk/storage/azure-storage-blob/swagger/README.md +++ b/sdk/storage/azure-storage-blob/swagger/README.md @@ -43,6 +43,31 @@ directive: $.delete.description = "If the storage account's soft delete feature is disabled then, when a blob is deleted, it is permanently removed from the storage account. If the storage account's soft delete feature is enabled, then, when a blob is deleted, it is marked for deletion and becomes inaccessible immediately. However, the blob service retains the blob or snapshot for the number of days specified by the DeleteRetentionPolicy section of [Storage service properties] (Set-Blob-Service-Properties.md). After the specified number of days has passed, the blob's data is permanently removed from the storage account. Note that you continue to be charged for the soft-deleted blob's storage until it is permanently removed. Use the List Blobs API and specify the \"include=deleted\" query parameter to discover which blobs and snapshots have been soft deleted. You can then use the Undelete Blob API to restore a soft-deleted blob. All other operations on a soft-deleted blob or snapshot causes the service to return an HTTP status code of 404 (ResourceNotFound). If the storage account's automatic snapshot feature is enabled, then, when a blob is deleted, an automatic snapshot is created. The blob becomes inaccessible immediately. All other operations on the blob causes the service to return an HTTP status code of 404 (ResourceNotFound). You can access automatic snapshot using snapshot timestamp or version id. You can restore the blob by calling Put or Copy Blob API with automatic snapshot as source. Deleting automatic snapshot requires shared key or special SAS/RBAC permissions."; $.get.responses["200"].headers["Content-MD5"]["x-ms-client-name"] = "contentMd5"; $.get.responses["206"].headers["Content-MD5"]["x-ms-client-name"] = "contentMd5"; + const accessTierDownloadHeaders = { + "x-ms-access-tier": { + "x-ms-client-name": "AccessTier", + "type": "string", + "description": "The tier of page blob on a premium storage account or tier of block blob on blob storage LRS accounts. For a list of allowed premium page blob tiers, see https://learn.microsoft.com/azure/virtual-machines/disks-types#premium-ssd. For blob storage LRS accounts, valid values are Hot/Cool/Archive." + }, + "x-ms-access-tier-inferred": { + "x-ms-client-name": "AccessTierInferred", + "type": "boolean", + "description": "For page blobs on a premium storage account only. If the access tier is not explicitly set on the blob, the tier is inferred based on its content length and this header will be returned with true value." + }, + "x-ms-access-tier-change-time": { + "x-ms-client-name": "AccessTierChangeTime", + "type": "string", + "format": "date-time-rfc1123", + "description": "The time the tier was changed on the object. This is only returned if the tier on the block blob was ever set." + }, + "x-ms-smart-access-tier": { + "x-ms-client-name": "SmartAccessTier", + "type": "string", + "description": "The underlying tier of a smart tier blob. Only returned if the blob is in Smart tier." + } + }; + $.get.responses["200"].headers = Object.assign({}, $.get.responses["200"].headers, accessTierDownloadHeaders); + $.get.responses["206"].headers = Object.assign({}, $.get.responses["206"].headers, accessTierDownloadHeaders); ```