* Azure SDK for Rust dependencies to 0.16

* changes
This commit is contained in:
Krishan 2023-11-06 19:42:22 +00:00 коммит произвёл GitHub
Родитель 95af3f5c8c
Коммит 74dfd6a28d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 31 добавлений и 24 удалений

Просмотреть файл

@ -15,11 +15,11 @@ categories = ["api-bindings"]
[dependencies]
arrow-array = { version = "42", optional = true }
arrow-schema = { version = "42", optional = true }
azure_core = { version = "0.15", features = [
azure_core = { version = "0.16", features = [
"enable_reqwest",
"enable_reqwest_gzip",
] }
azure_identity = "0.15"
azure_identity = "0.16"
async-trait = "0.1.64"
async-convert = "1.0.0"
bytes = "1.4"

Просмотреть файл

@ -8,10 +8,10 @@ edition = "2021"
[dependencies]
azure-kusto-data = {path = "../azure-kusto-data"}
# Azure SDK for Rust crates versions must be kept in sync
azure_core = "0.15"
azure_storage = "0.15"
azure_storage_blobs = "0.15"
azure_storage_queues = "0.15"
azure_core = "0.16"
azure_storage = "0.16"
azure_storage_blobs = "0.16"
azure_storage_queues = "0.16"
anyhow = "1"
chrono = { version = "0.4", default-features = false, features = ["serde"] }

Просмотреть файл

@ -18,14 +18,12 @@ use azure_kusto_ingest::queued_ingest::QueuedIngestClient;
#[tokio::main]
async fn main() -> Result<()> {
let cluster_ingest_uri = env::var("KUSTO_INGEST_URI").expect("Must define KUSTO_INGEST_URI");
let user_mi_object_id = env::var("KUSTO_USER_MI_OBJECT_ID").expect("Must define KUSTO_USER_MI_OBJECT_ID");
let user_mi_object_id =
env::var("KUSTO_USER_MI_OBJECT_ID").expect("Must define KUSTO_USER_MI_OBJECT_ID");
// Create a Kusto client with managed identity authentication via the user assigned identity
let kusto_client = KustoClient::new(
ConnectionString::with_managed_identity_auth(
cluster_ingest_uri,
Some(user_mi_object_id),
),
ConnectionString::with_managed_identity_auth(cluster_ingest_uri, Some(user_mi_object_id)),
KustoClientOptions::default(),
)?;

Просмотреть файл

@ -65,10 +65,12 @@ pub(crate) trait ClientFromResourceUri {
impl ClientFromResourceUri for QueueClient {
fn create_client(resource_uri: ResourceUri, client_options: ClientOptions) -> Self {
QueueServiceClientBuilder::with_location(azure_storage::CloudLocation::Custom {
uri: resource_uri.service_uri,
credentials: resource_uri.sas_token,
})
QueueServiceClientBuilder::with_location(
azure_storage::CloudLocation::Custom {
uri: resource_uri.service_uri,
},
resource_uri.sas_token,
)
.client_options(client_options)
.build()
.queue_client(resource_uri.object_name)
@ -77,10 +79,12 @@ impl ClientFromResourceUri for QueueClient {
impl ClientFromResourceUri for ContainerClient {
fn create_client(resource_uri: ResourceUri, client_options: ClientOptions) -> Self {
ClientBuilder::with_location(azure_storage::CloudLocation::Custom {
uri: resource_uri.service_uri,
credentials: resource_uri.sas_token,
})
ClientBuilder::with_location(
azure_storage::CloudLocation::Custom {
uri: resource_uri.service_uri,
},
resource_uri.sas_token,
)
.client_options(client_options)
.container_client(resource_uri.object_name)
}
@ -88,6 +92,8 @@ impl ClientFromResourceUri for ContainerClient {
#[cfg(test)]
mod tests {
use azure_storage::StorageCredentialsInner;
use super::*;
use std::convert::TryFrom;
@ -102,12 +108,15 @@ mod tests {
);
assert_eq!(resource_uri.object_name, "containerobjectname");
let storage_credential_inner = std::sync::Arc::into_inner(resource_uri.sas_token.0)
.unwrap()
.into_inner();
assert!(matches!(
resource_uri.sas_token,
StorageCredentials::SASToken(_)
storage_credential_inner,
StorageCredentialsInner::SASToken(_)
));
if let StorageCredentials::SASToken(sas_vec) = resource_uri.sas_token {
if let StorageCredentialsInner::SASToken(sas_vec) = storage_credential_inner {
assert_eq!(sas_vec.len(), 1);
assert_eq!(sas_vec[0].0, "sas");
assert_eq!(sas_vec[0].1, "token");
@ -154,7 +163,7 @@ mod tests {
let resource_uri = ResourceUri {
service_uri: "https://mystorageaccount.queue.core.windows.net".to_string(),
object_name: "queuename".to_string(),
sas_token: StorageCredentials::SASToken(vec![("sas".to_string(), "token".to_string())]),
sas_token: StorageCredentials::sas_token("sas=token").unwrap(),
};
let client_options = ClientOptions::default();
@ -168,7 +177,7 @@ mod tests {
let resource_uri = ResourceUri {
service_uri: "https://mystorageaccount.blob.core.windows.net".to_string(),
object_name: "containername".to_string(),
sas_token: StorageCredentials::SASToken(vec![("sas".to_string(), "token".to_string())]),
sas_token: StorageCredentials::sas_token("sas=token").unwrap(),
};
let client_options = ClientOptions::default();