-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix azure_storage_queue set_blob_service_properties (#1498)
- Loading branch information
Showing
7 changed files
with
59 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use azure_storage::prelude::*; | ||
use azure_storage_queues::{prelude::*, CorsRule}; | ||
|
||
#[tokio::main] | ||
async fn main() -> azure_core::Result<()> { | ||
env_logger::init(); | ||
|
||
// First we retrieve the account name and access key from environment variables. | ||
let account = | ||
std::env::var("STORAGE_ACCOUNT").expect("Set env variable STORAGE_ACCOUNT first!"); | ||
let access_key = | ||
std::env::var("STORAGE_ACCESS_KEY").expect("Set env variable STORAGE_ACCESS_KEY first!"); | ||
|
||
let storage_credentials = StorageCredentials::access_key(account.clone(), access_key); | ||
let queue_service = QueueServiceClient::new(account, storage_credentials); | ||
let properties = queue_service.get_queue_service_properties().await?; | ||
println!("properties: {properties:#?}"); | ||
|
||
let mut properties = properties.queue_service_properties; | ||
properties.cors.cors_rule = Some(vec![CorsRule { | ||
allowed_origins: "http://www.contoso.com,http://www.fabrikam.com".to_owned(), | ||
allowed_methods: "GET,PUT".to_owned(), | ||
allowed_headers: "x-ms-meta-abc,x-ms-meta-data*,x-ms-meta-target*,x-ms-meta-xyz".to_owned(), | ||
exposed_headers: "".to_owned(), | ||
max_age_in_seconds: 50000, | ||
}]); | ||
|
||
queue_service | ||
.set_queue_service_properties(properties.clone()) | ||
.await?; | ||
let properties = queue_service.get_queue_service_properties().await?; | ||
println!("properties: {properties:#?}"); | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters