Azure SDK deps to 0.16 (#5)
* Azure SDK for Rust dependencies to 0.16 * changes
This commit is contained in:
Родитель
95af3f5c8c
Коммит
74dfd6a28d
|
@ -15,11 +15,11 @@ categories = ["api-bindings"]
|
||||||
[dependencies]
|
[dependencies]
|
||||||
arrow-array = { version = "42", optional = true }
|
arrow-array = { version = "42", optional = true }
|
||||||
arrow-schema = { 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",
|
||||||
"enable_reqwest_gzip",
|
"enable_reqwest_gzip",
|
||||||
] }
|
] }
|
||||||
azure_identity = "0.15"
|
azure_identity = "0.16"
|
||||||
async-trait = "0.1.64"
|
async-trait = "0.1.64"
|
||||||
async-convert = "1.0.0"
|
async-convert = "1.0.0"
|
||||||
bytes = "1.4"
|
bytes = "1.4"
|
||||||
|
|
|
@ -8,10 +8,10 @@ edition = "2021"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
azure-kusto-data = {path = "../azure-kusto-data"}
|
azure-kusto-data = {path = "../azure-kusto-data"}
|
||||||
# Azure SDK for Rust crates versions must be kept in sync
|
# Azure SDK for Rust crates versions must be kept in sync
|
||||||
azure_core = "0.15"
|
azure_core = "0.16"
|
||||||
azure_storage = "0.15"
|
azure_storage = "0.16"
|
||||||
azure_storage_blobs = "0.15"
|
azure_storage_blobs = "0.16"
|
||||||
azure_storage_queues = "0.15"
|
azure_storage_queues = "0.16"
|
||||||
|
|
||||||
anyhow = "1"
|
anyhow = "1"
|
||||||
chrono = { version = "0.4", default-features = false, features = ["serde"] }
|
chrono = { version = "0.4", default-features = false, features = ["serde"] }
|
||||||
|
|
|
@ -18,14 +18,12 @@ use azure_kusto_ingest::queued_ingest::QueuedIngestClient;
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<()> {
|
async fn main() -> Result<()> {
|
||||||
let cluster_ingest_uri = env::var("KUSTO_INGEST_URI").expect("Must define KUSTO_INGEST_URI");
|
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
|
// Create a Kusto client with managed identity authentication via the user assigned identity
|
||||||
let kusto_client = KustoClient::new(
|
let kusto_client = KustoClient::new(
|
||||||
ConnectionString::with_managed_identity_auth(
|
ConnectionString::with_managed_identity_auth(cluster_ingest_uri, Some(user_mi_object_id)),
|
||||||
cluster_ingest_uri,
|
|
||||||
Some(user_mi_object_id),
|
|
||||||
),
|
|
||||||
KustoClientOptions::default(),
|
KustoClientOptions::default(),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
|
|
@ -65,10 +65,12 @@ pub(crate) trait ClientFromResourceUri {
|
||||||
|
|
||||||
impl ClientFromResourceUri for QueueClient {
|
impl ClientFromResourceUri for QueueClient {
|
||||||
fn create_client(resource_uri: ResourceUri, client_options: ClientOptions) -> Self {
|
fn create_client(resource_uri: ResourceUri, client_options: ClientOptions) -> Self {
|
||||||
QueueServiceClientBuilder::with_location(azure_storage::CloudLocation::Custom {
|
QueueServiceClientBuilder::with_location(
|
||||||
uri: resource_uri.service_uri,
|
azure_storage::CloudLocation::Custom {
|
||||||
credentials: resource_uri.sas_token,
|
uri: resource_uri.service_uri,
|
||||||
})
|
},
|
||||||
|
resource_uri.sas_token,
|
||||||
|
)
|
||||||
.client_options(client_options)
|
.client_options(client_options)
|
||||||
.build()
|
.build()
|
||||||
.queue_client(resource_uri.object_name)
|
.queue_client(resource_uri.object_name)
|
||||||
|
@ -77,10 +79,12 @@ impl ClientFromResourceUri for QueueClient {
|
||||||
|
|
||||||
impl ClientFromResourceUri for ContainerClient {
|
impl ClientFromResourceUri for ContainerClient {
|
||||||
fn create_client(resource_uri: ResourceUri, client_options: ClientOptions) -> Self {
|
fn create_client(resource_uri: ResourceUri, client_options: ClientOptions) -> Self {
|
||||||
ClientBuilder::with_location(azure_storage::CloudLocation::Custom {
|
ClientBuilder::with_location(
|
||||||
uri: resource_uri.service_uri,
|
azure_storage::CloudLocation::Custom {
|
||||||
credentials: resource_uri.sas_token,
|
uri: resource_uri.service_uri,
|
||||||
})
|
},
|
||||||
|
resource_uri.sas_token,
|
||||||
|
)
|
||||||
.client_options(client_options)
|
.client_options(client_options)
|
||||||
.container_client(resource_uri.object_name)
|
.container_client(resource_uri.object_name)
|
||||||
}
|
}
|
||||||
|
@ -88,6 +92,8 @@ impl ClientFromResourceUri for ContainerClient {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
use azure_storage::StorageCredentialsInner;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
|
|
||||||
|
@ -102,12 +108,15 @@ mod tests {
|
||||||
);
|
);
|
||||||
assert_eq!(resource_uri.object_name, "containerobjectname");
|
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!(
|
assert!(matches!(
|
||||||
resource_uri.sas_token,
|
storage_credential_inner,
|
||||||
StorageCredentials::SASToken(_)
|
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.len(), 1);
|
||||||
assert_eq!(sas_vec[0].0, "sas");
|
assert_eq!(sas_vec[0].0, "sas");
|
||||||
assert_eq!(sas_vec[0].1, "token");
|
assert_eq!(sas_vec[0].1, "token");
|
||||||
|
@ -154,7 +163,7 @@ mod tests {
|
||||||
let resource_uri = ResourceUri {
|
let resource_uri = ResourceUri {
|
||||||
service_uri: "https://mystorageaccount.queue.core.windows.net".to_string(),
|
service_uri: "https://mystorageaccount.queue.core.windows.net".to_string(),
|
||||||
object_name: "queuename".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();
|
let client_options = ClientOptions::default();
|
||||||
|
@ -168,7 +177,7 @@ mod tests {
|
||||||
let resource_uri = ResourceUri {
|
let resource_uri = ResourceUri {
|
||||||
service_uri: "https://mystorageaccount.blob.core.windows.net".to_string(),
|
service_uri: "https://mystorageaccount.blob.core.windows.net".to_string(),
|
||||||
object_name: "containername".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();
|
let client_options = ClientOptions::default();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче