Azure-sdk-for-java: [FEATURE REQ] [Blob Storage] Return properties of blob uploaded using EncryptedBlobClient

Created on 4 May 2020  ·  5Comments  ·  Source: Azure/azure-sdk-for-java

Is your feature request related to a problem? Please describe.
I use synchronous version of the blob clients in the storage SDK (v12.6.0). When a blob is uploaded using BlockBlobClient, it returns a BlockBlobItem that contains the properties of the uploaded blob like content MD5, ETag etc. But when EncryptedBlobClient is used instead for client-side encrypting the blob before uploading, it does not return these properties. So I have to make an additional call to download these properties.

Describe the solution you'd like
Expose the properties returned by the storage service with the PUT request so the application doesn't have to make an additional call.

Describe alternatives you've considered
I couldn't find an alternative that avoids additional calls.

Additional context
Signature of upload API exposed by BlockBlobClient:

public Response<BlockBlobItem> uploadWithResponse(InputStream data, long length, BlobHttpHeaders headers,
        Map<String, String> metadata, AccessTier tier, byte[] contentMd5, BlobRequestConditions requestConditions,
        Duration timeout, Context context);

Signature of upload API exposed by EncryptedBlobClient:

public void uploadWithResponse(InputStream data, long length, ParallelTransferOptions parallelTransferOptions,
        BlobHttpHeaders headers, Map<String, String> metadata, AccessTier tier, BlobRequestConditions requestConditions,
        Duration timeout, Context context);

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • [x] Description Added
  • [x] Expected solution specified
Storage customer-reported feature-request question

All 5 comments

Hi, @SukruthKS. Thank you for reporting this. We should be able to make this update. Can you let us know the urgency of this request and if it is a blocker for you right now so we can prioritize it appropriately?

For future dev reference: This upload method is actually inherited from BlobClient, and that method doesn't return a BlobItem because it uploads by internally writing to a BlobOutputStream, which doesn't give any of these properties back. We should be able to resolve this issue by having the BlobOutputStream store these properties either on the create (Append and Page) or on the commit (Block) and then allowing the customer to get those properties in one of two ways. 1. We can add another overload of close to BlobOutputStream which returns a BlobItem. This isn't standard to the OutputStream interface, which isn't great, but is more concise and guarantees there's always something to return. 2. We can add a getBlobItem method to the type which returns the desired values. This doesn't muck with the OutputStream interface at all, but it does require a separate method call (though not a network request), and it could be possible for blockBlobs in particular that it return null if it is called before closing the stream.

We should also probably take this opportunity to address #8822 while we're at it.

Hello @rickle-msft,

Can you let us know the urgency of this request and if it is a blocker for you right now so we can prioritize it appropriately?

It's not a blocker right now and getting around it by making another request to fetch the properties. We are still in the testing phases for upgrading the storage SDK.

Thank you for that information. Given that it's early in the month, I think there's a good chance we can get this in for the June release (May just happened), though that may change based on some work for upcoming service features. I'll keep you posted, and please let us know if this in any way approaches becoming a blocker for you.

Hey @rickle-msft, this has now become a blocker. I just discovered some application code paths which have write-only credentials to storage so I cannot make that additional call to download blob properties.

Also, as per our discussion in #11231, I'll be using BlobClient instead of BlockBlobClient for uploads so this support needs to be added for BlobClient along with EncryptedBlobClient.

Was this page helpful?
0 / 5 - 0 ratings