Add azure_sas associated function to TableClient
This allows a TableClient to be created from a SAS token as well as from
an account key.
@@ -26,12 +26,20 @@ pub struct TableClient {
}
impl TableClient {
+ /// Create a new `TableClient` using a key.
pub fn new(account: &str, key: &str) -> Result<Self, AzureError> {
Ok(TableClient {
client: Client::new(account, key)?,
})
}
+ /// Create a new `TableClient` using a SAS token.
+ pub fn azure_sas(account: &str, sas_token: &str) -> Result<Self, AzureError> {
+ Ok(TableClient {
+ client: Client::azure_sas(account, sas_token)?,
+ })
+ }
+
pub async fn list_tables(&self) -> Result<Vec<String>, AzureError> {
let future_response = self.request_with_default_header(
TABLE_TABLES,
