Azure / azure-sdk-for-rust

This repository is for active development of the *unofficial* Azure SDK for Rust. This repository is *not* supported by the Azure SDK team.
MIT License
692 stars 237 forks source link

How to set "x-ms-version" in a service client, e.g. a blob client #1514

Closed dlf-dds closed 8 months ago

dlf-dds commented 8 months ago

using it like this

let blob_client = ClientBuilder::new(account, storage_credentials)
        .cloud_location(cloud_location)
        .blob_client(container, blob_name);
    let data = data.as_bytes().to_vec();
    blob_client.put_block_blob(data).await?;

I don't see how to set the api version when using the azure sdk.

dlf-dds commented 8 months ago

I think it's hard coded here: https://github.com/Azure/azure-sdk-for-rust/blob/aac41053c04585335d2764dc2d341750bc43fb38/sdk/storage/src/clients.rs#L27 and then used here https://github.com/Azure/azure-sdk-for-rust/blob/aac41053c04585335d2764dc2d341750bc43fb38/sdk/storage/src/clients.rs#L87-L99 ... Is there some way to modify this after the client is created, but before it is used?

johnbatty commented 8 months ago

It is possible to override the header value using a pipeline Policy - see here for details: https://github.com/Azure/azure-sdk-for-rust/issues/1290

demoray commented 8 months ago

Closed. Thanks for providing the answer @johnbatty