Storage - STG102 object level smart access#48392
Storage - STG102 object level smart access#48392browndav-msft wants to merge 24 commits intoAzure:feature/storage/stg102basefrom
Conversation
- We needed to add AccessTier smartAccessTier to all constructors in BlobProperties, which is different than what is recommended in BlobPropertiesInternal. Made a deliberate decision to go this route, but will go the other route, if necessessary
@test @RequiredServiceVersion(clazz = DataLakeServiceVersion.class, min = "2026-02-04") public void getInferredTierWhenAssignedSmart() { // Arrange // Create a file in a file system with the smart tiering feature enabled, and set the access tier to smart. // Did this manually to prove feature works fc = premiumDataLakeServiceClient.getFileSystemClient("5333bf800setblobaccesstiersmart26f99030889cd17d8581") .getFileClient("5333bf801setblobaccesstiersmart26f71508c0c760a5e356"); Response<PathProperties> response = fc.getPropertiesWithResponse(null, null, null); HttpHeaders headers = response.getHeaders(); PathProperties properties = response.getValue(); validateBasicHeaders(headers); assertEquals(AccessTier.SMART, properties.getAccessTier()); assertEquals(AccessTier.HOT, properties.getSmartAccessTier()); }
...e/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileApiTest.java
Outdated
Show resolved
Hide resolved
…/azure-sdk-for-java into stg102/ObjectLevelSmartAccess
…owndav-msft/azure-sdk-for-java into stg102/ObjectLevelSmartAccess
…owndav-msft/azure-sdk-for-java into stg102/ObjectLevelSmartAccess
…owndav-msft/azure-sdk-for-java into stg102/ObjectLevelSmartAccess
ibrandes
left a comment
There was a problem hiding this comment.
had a couple more suggestions for further polishing
...orage/azure-storage-blob-batch/src/test/java/com/azure/storage/blob/batch/BatchApiTests.java
Show resolved
Hide resolved
| @Override | ||
| public AccessTier getSmartAccessTier() { | ||
| return null; | ||
| } | ||
|
|
There was a problem hiding this comment.
this looks weird without context - maybe we should add a comment that says something like "Null because this property is set through BlobPropertiesConstructorProxy"
There was a problem hiding this comment.
@ibrandes I had to trace this, but this should return smartAccessTier. It took me a while to figure it out, but I'm going to make the change to the code. The public API remains unchanged, but the service returns smartAccessTier, so this should return a value.
sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobProperties.java
Show resolved
Hide resolved
|
|
||
| @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2026-02-06") | ||
| @Test | ||
| public void startCopyFromURLSmartAccessTier() { |
There was a problem hiding this comment.
we also need to add these tests to BlobBaseAsyncApiTests
| @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2026-02-06") | ||
| @Test | ||
| public void uploadStreamAccessTierSmart() { | ||
|
|
||
| Flux<BlobItem> response | ||
| = primaryBlobServiceAsyncClient.createBlobContainer(generateContainerName()).flatMapMany(cc -> { | ||
| BlockBlobAsyncClient bc = cc.getBlobAsyncClient(generateBlobName()).getBlockBlobAsyncClient(); | ||
| return bc.upload(DATA.getDefaultFlux(), DATA.getDefaultData().remaining()) | ||
| .then(bc.setAccessTierWithResponse(AccessTier.SMART, null, null)) | ||
| .flatMap(r -> { | ||
| HttpHeaders headers = r.getHeaders(); | ||
|
|
||
| assertTrue(r.getStatusCode() == 200 || r.getStatusCode() == 202); | ||
| assertNotNull(headers.getValue(X_MS_VERSION)); | ||
| assertNotNull(headers.getValue(X_MS_REQUEST_ID)); | ||
| return Mono.empty(); | ||
| }) | ||
| .then(bc.getProperties()) | ||
| .flatMap(r -> { | ||
| assertEquals(AccessTier.SMART, r.getAccessTier()); | ||
| return Mono.empty(); | ||
| }) | ||
| .thenMany(cc.listBlobs()); | ||
| }); | ||
|
|
||
| StepVerifier.create(response) | ||
| .assertNext(r -> assertEquals(AccessTier.SMART, r.getProperties().getAccessTier())) | ||
| .verifyComplete(); | ||
| } | ||
|
|
There was a problem hiding this comment.
this test is a lot more complex than it needs to be - if you use a blobclient instead of a blockblob you can use uploadWithResponse which lets us set the access tier and upload data at the same time:
@RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2026-02-06")
@Test
public void uploadStreamAccessTierSmart() {
bc = ccAsync.getBlobAsyncClient(generateBlobName());
BlobParallelUploadOptions options = new BlobParallelUploadOptions(DATA.getDefaultFlux())
.setTier(AccessTier.SMART);
Mono<Response<BlobProperties>> response = bc.uploadWithResponse(options)
.then(bc.getPropertiesWithResponse(null));
StepVerifier.create(response)
.assertNext(r -> {
assertEquals(AccessTier.SMART, r.getValue().getAccessTier());
assertNotNull(r.getValue().getSmartAccessTier());
})
.verifyComplete();
}
| static final HttpHeaderName X_MS_ACCESS_TIER_INFERRED = HttpHeaderName.fromString("x-ms-access-tier-inferred"); | ||
| static final HttpHeaderName X_MS_SMART_ACCESS_TIER = HttpHeaderName.fromString("x-ms-smart-access-tier"); |
There was a problem hiding this comment.
i added these by mistake - these can be removed
| protected DataLakeFileSystemAsyncClient dataLakeFileSystemAsyncClient; | ||
| protected DataLakeServiceClient primaryDataLakeServiceClient; | ||
| protected DataLakeServiceAsyncClient primaryDataLakeServiceAsyncClient; | ||
| protected DataLakeServiceClient premiumDataLakeServiceClient; |
There was a problem hiding this comment.
this can be removed since we aren't adding tests for datalake
No description provided.