Skip to content

Support for ExpiryOptions on BlobStore requests #291

Closed
@JensWalter

Description

@JensWalter

I tried setting the expiry option on some blob store request, but I could not find the appropriate way to do so.

Setting an expiration is described in the official documentation:
https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-expiry

So far I could not figure out how I could send such options. I tried setting those parameters through the metadata field, but this lead to the following result.

let mut metadata = Metadata::new();
metadata.insert("x-ms-expiry-time".to_string(), "300000".to_string());
metadata.insert("x-ms-expiry-option".to_string(), "RealtiveToCreation".to_string());
let res = container
  .as_blob_client(blob_key)
  .put_block_blob(blob_data.clone())
  .content_type("text/plain")
  .hash(&hash)
  .metadata(&metadata)
  .execute()
  .await.unwrap();

The header was transformed into

  headers: {
    "content-length": "181",
    "x-ms-blob-type": "BlockBlob",
    "content-md5": "cew9Xo2MS8dQ+UyCtsta3w==",
    "content-type": "text/plain",
    "x-ms-meta-x-ms-expiry-option": "RealtiveToCreation",
    "x-ms-meta-x-ms-expiry-time": "300000",
    "x-ms-date": "Fri, 11 Jun 2021 15:23:19 GMT",
    "x-ms-version": "2019-12-12",
    "authorization": "SharedKey ******",
  },

What would be the correct way to set the expiration?
If this feature does not yet exist, what would be the best approach integrating this into the sdk?

Metadata

Metadata

Assignees

No one assigned

    Labels

    StorageStorage Service (Queues, Blobs, Files)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions