From 93ba6483329239484d09d11317742a266ca9a7bf Mon Sep 17 00:00:00 2001 From: Cameron Taggart Date: Sun, 30 May 2021 20:59:49 -0700 Subject: [PATCH 1/5] make cosmos tests pass again --- .gitignore | 1 + sdk/cosmos/examples/attachments_00.rs | 2 +- sdk/cosmos/examples/collection.rs | 2 +- sdk/cosmos/examples/create_delete_database.rs | 3 +- sdk/cosmos/examples/database_00.rs | 2 +- sdk/cosmos/examples/database_01.rs | 2 +- sdk/cosmos/examples/document_00.rs | 3 +- sdk/cosmos/examples/document_entries_00.rs | 2 +- sdk/cosmos/examples/document_entries_01.rs | 2 +- sdk/cosmos/examples/get_database.rs | 2 +- sdk/cosmos/examples/key_ranges_00.rs | 2 +- sdk/cosmos/examples/permission_00.rs | 2 +- sdk/cosmos/examples/query_document_00.rs | 2 +- sdk/cosmos/examples/readme.rs | 2 +- sdk/cosmos/examples/remove_all_documents.rs | 2 +- sdk/cosmos/examples/stored_proc_00.rs | 2 +- sdk/cosmos/examples/stored_proc_01.rs | 2 +- sdk/cosmos/examples/trigger_00.rs | 2 +- sdk/cosmos/examples/user_00.rs | 2 +- .../examples/user_defined_function_00.rs | 2 +- sdk/cosmos/examples/user_permission_token.rs | 2 +- sdk/cosmos/src/clients/cosmos_client.rs | 84 ++++++++++--------- sdk/cosmos/src/clients/mod.rs | 2 +- sdk/cosmos/src/lib.rs | 2 +- sdk/cosmos/tests/setup.rs | 2 +- 25 files changed, 71 insertions(+), 62 deletions(-) diff --git a/.gitignore b/.gitignore index dd81eddf1d..2771d20dd7 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ sample/ *.swp *.swo *.vim +__azurite*.json diff --git a/sdk/cosmos/examples/attachments_00.rs b/sdk/cosmos/examples/attachments_00.rs index 68be7eb746..027f3ce898 100644 --- a/sdk/cosmos/examples/attachments_00.rs +++ b/sdk/cosmos/examples/attachments_00.rs @@ -44,7 +44,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let client = CosmosClient::new(http_client, account, authorization_token); let client = client.into_database_client(database_name); let client = client.into_collection_client(collection_name); diff --git a/sdk/cosmos/examples/collection.rs b/sdk/cosmos/examples/collection.rs index 672bcb7329..6596bf74d5 100644 --- a/sdk/cosmos/examples/collection.rs +++ b/sdk/cosmos/examples/collection.rs @@ -25,7 +25,7 @@ async fn main() -> Result<(), Box> { // authorization token at later time if you need, for example, to escalate the privileges for a // single operation. // Here we are using reqwest but other clients are supported (check the documentation). - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let client = CosmosClient::new(http_client, account.clone(), authorization_token); // The Cosmos' client exposes a lot of methods. This one lists the databases in the specified diff --git a/sdk/cosmos/examples/create_delete_database.rs b/sdk/cosmos/examples/create_delete_database.rs index 42da48da86..cbc0b65b2c 100644 --- a/sdk/cosmos/examples/create_delete_database.rs +++ b/sdk/cosmos/examples/create_delete_database.rs @@ -30,7 +30,7 @@ async fn main() -> Result<(), Box> { // Once we have an authorization token you can create a client instance. You can change the // authorization token at later time if you need, for example, to escalate the privileges for a // single operation. - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let client = CosmosClient::new( http_client.clone(), account.clone(), @@ -45,6 +45,7 @@ async fn main() -> Result<(), Box> { println!("list_databases_response = {:#?}", list_databases_response); let cosmos_client = CosmosClient::with_pipeline( + http_client, account, authorization_token, CosmosOptions::with_client(Arc::new(reqwest::Client::new())), diff --git a/sdk/cosmos/examples/database_00.rs b/sdk/cosmos/examples/database_00.rs index d1cdd20450..0171755900 100644 --- a/sdk/cosmos/examples/database_00.rs +++ b/sdk/cosmos/examples/database_00.rs @@ -14,7 +14,7 @@ async fn main() -> Result<(), Box> { let authorization_token = permission::AuthorizationToken::primary_from_base64(&master_key)?; - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let client = CosmosClient::new(http_client, account, authorization_token); let dbs = client.list_databases().execute().await?; diff --git a/sdk/cosmos/examples/database_01.rs b/sdk/cosmos/examples/database_01.rs index 4d3b2a73b3..24388f0d71 100644 --- a/sdk/cosmos/examples/database_01.rs +++ b/sdk/cosmos/examples/database_01.rs @@ -13,7 +13,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let client = CosmosClient::new(http_client, account, authorization_token); let database_client = client.into_database_client("pollo"); diff --git a/sdk/cosmos/examples/document_00.rs b/sdk/cosmos/examples/document_00.rs index 324e3d7d51..a963377506 100644 --- a/sdk/cosmos/examples/document_00.rs +++ b/sdk/cosmos/examples/document_00.rs @@ -50,7 +50,7 @@ async fn main() -> Result<(), Box> { // Next we will create a Cosmos client. You need an authorization_token but you can later // change it if needed. - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let client = CosmosClient::new( http_client.clone(), account.clone(), @@ -70,6 +70,7 @@ async fn main() -> Result<(), Box> { .find(|db| db.id == DATABASE); let database_client = CosmosClient::with_pipeline( + http_client, account, authorization_token, CosmosOptions::with_client(Arc::new(reqwest::Client::new())), diff --git a/sdk/cosmos/examples/document_entries_00.rs b/sdk/cosmos/examples/document_entries_00.rs index ced6b1db02..c254a8580d 100644 --- a/sdk/cosmos/examples/document_entries_00.rs +++ b/sdk/cosmos/examples/document_entries_00.rs @@ -46,7 +46,7 @@ async fn main() -> Result<(), Box> { let authorization_token = permission::AuthorizationToken::primary_from_base64(&master_key)?; - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let client = CosmosClient::new(http_client, account, authorization_token); let client = client.into_database_client(database_name); let client = client.into_collection_client(collection_name); diff --git a/sdk/cosmos/examples/document_entries_01.rs b/sdk/cosmos/examples/document_entries_01.rs index 55f2a8fe16..dd6e6f27e0 100644 --- a/sdk/cosmos/examples/document_entries_01.rs +++ b/sdk/cosmos/examples/document_entries_01.rs @@ -38,7 +38,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let client = CosmosClient::new(http_client, account, authorization_token); let client = client.into_database_client(database_name); let client = client.into_collection_client(collection_name); diff --git a/sdk/cosmos/examples/get_database.rs b/sdk/cosmos/examples/get_database.rs index dd3cd2820b..2110c9b542 100644 --- a/sdk/cosmos/examples/get_database.rs +++ b/sdk/cosmos/examples/get_database.rs @@ -17,7 +17,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let client = CosmosClient::new(http_client, account.clone(), authorization_token); let database_client = client.into_database_client(database_name.clone()); diff --git a/sdk/cosmos/examples/key_ranges_00.rs b/sdk/cosmos/examples/key_ranges_00.rs index 90b2889b3b..ae5c5bf84c 100644 --- a/sdk/cosmos/examples/key_ranges_00.rs +++ b/sdk/cosmos/examples/key_ranges_00.rs @@ -18,7 +18,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let client = CosmosClient::new(http_client, account.clone(), authorization_token); let client = client.into_database_client(database); diff --git a/sdk/cosmos/examples/permission_00.rs b/sdk/cosmos/examples/permission_00.rs index 77c4bb775b..bc9f41a706 100644 --- a/sdk/cosmos/examples/permission_00.rs +++ b/sdk/cosmos/examples/permission_00.rs @@ -26,7 +26,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let client = CosmosClient::new(http_client, account.clone(), authorization_token); let database_client = client.into_database_client(database_name); diff --git a/sdk/cosmos/examples/query_document_00.rs b/sdk/cosmos/examples/query_document_00.rs index 760eef8765..2f915436a3 100644 --- a/sdk/cosmos/examples/query_document_00.rs +++ b/sdk/cosmos/examples/query_document_00.rs @@ -39,7 +39,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let client = CosmosClient::new(http_client, account.clone(), authorization_token); let client = client.into_database_client(database_name); diff --git a/sdk/cosmos/examples/readme.rs b/sdk/cosmos/examples/readme.rs index 02cddf542d..e5d63868d6 100644 --- a/sdk/cosmos/examples/readme.rs +++ b/sdk/cosmos/examples/readme.rs @@ -55,7 +55,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; // Next we will create a Cosmos client. - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let client = CosmosClient::new(http_client, account.clone(), authorization_token); // We know the database so we can obtain a database client. diff --git a/sdk/cosmos/examples/remove_all_documents.rs b/sdk/cosmos/examples/remove_all_documents.rs index 3ca700eaef..3e1945376a 100644 --- a/sdk/cosmos/examples/remove_all_documents.rs +++ b/sdk/cosmos/examples/remove_all_documents.rs @@ -26,7 +26,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; // Next we will create a Cosmos client. - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let client = CosmosClient::new(http_client, account.clone(), authorization_token); let client = client.into_database_client(database_name); diff --git a/sdk/cosmos/examples/stored_proc_00.rs b/sdk/cosmos/examples/stored_proc_00.rs index 1f68a7894c..d1699c960f 100644 --- a/sdk/cosmos/examples/stored_proc_00.rs +++ b/sdk/cosmos/examples/stored_proc_00.rs @@ -25,7 +25,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let client = CosmosClient::new(http_client, account.clone(), authorization_token); let ret = client diff --git a/sdk/cosmos/examples/stored_proc_01.rs b/sdk/cosmos/examples/stored_proc_01.rs index fa4d15cb20..52174cfed0 100644 --- a/sdk/cosmos/examples/stored_proc_01.rs +++ b/sdk/cosmos/examples/stored_proc_01.rs @@ -36,7 +36,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let client = CosmosClient::new(http_client, account.clone(), authorization_token); let database_client = client.into_database_client(database_name); diff --git a/sdk/cosmos/examples/trigger_00.rs b/sdk/cosmos/examples/trigger_00.rs index 972afd1901..4f5da4b8a1 100644 --- a/sdk/cosmos/examples/trigger_00.rs +++ b/sdk/cosmos/examples/trigger_00.rs @@ -53,7 +53,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let client = CosmosClient::new(http_client, account.clone(), authorization_token); let database_client = client.into_database_client(database); diff --git a/sdk/cosmos/examples/user_00.rs b/sdk/cosmos/examples/user_00.rs index 677f568bc2..22d1cb9aff 100644 --- a/sdk/cosmos/examples/user_00.rs +++ b/sdk/cosmos/examples/user_00.rs @@ -20,7 +20,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let client = CosmosClient::new(http_client, account.clone(), authorization_token); let database_client = client.into_database_client(database_name); diff --git a/sdk/cosmos/examples/user_defined_function_00.rs b/sdk/cosmos/examples/user_defined_function_00.rs index e433cc7de8..d97f6543b4 100644 --- a/sdk/cosmos/examples/user_defined_function_00.rs +++ b/sdk/cosmos/examples/user_defined_function_00.rs @@ -31,7 +31,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let client = CosmosClient::new(http_client, account.clone(), authorization_token); let database_client = client.into_database_client(database); diff --git a/sdk/cosmos/examples/user_permission_token.rs b/sdk/cosmos/examples/user_permission_token.rs index e15779a2d2..febd23bcdb 100644 --- a/sdk/cosmos/examples/user_permission_token.rs +++ b/sdk/cosmos/examples/user_permission_token.rs @@ -23,7 +23,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let client = CosmosClient::new(http_client, account.clone(), authorization_token); let database_client = client.clone().into_database_client(database_name.clone()); diff --git a/sdk/cosmos/src/clients/cosmos_client.rs b/sdk/cosmos/src/clients/cosmos_client.rs index 1048ec814e..245adbe44c 100644 --- a/sdk/cosmos/src/clients/cosmos_client.rs +++ b/sdk/cosmos/src/clients/cosmos_client.rs @@ -6,7 +6,9 @@ use crate::{requests, ReadonlyString}; use azure_core::pipeline::Pipeline; use azure_core::policies::{LinearRetryPolicy, Policy, TransportOptions, TransportPolicy}; +use azure_core::Context; use azure_core::HttpClient; +use azure_core::Request; use http::request::Builder as RequestBuilder; use http::{header, HeaderValue}; use ring::hmac; @@ -20,18 +22,11 @@ const AZURE_VERSION: &str = "2018-12-31"; const VERSION: &str = "1.0"; const TIME_FORMAT: &str = "%a, %d %h %Y %T GMT"; -use azure_core::*; - -#[derive(Clone, Debug)] -enum TransportStack { - Client(Arc>), - Pipeline(Pipeline), -} - /// A plain Cosmos client. #[derive(Debug, Clone)] pub struct CosmosClient { - transport: TransportStack, + http_client: Arc, + pipeline: Pipeline, auth_token: AuthorizationToken, cloud_location: CloudLocation, } @@ -51,16 +46,36 @@ impl CosmosOptions { } } +/// Create a Pipeline from CosmosOptions +fn new_pipeline_from_options(options: CosmosOptions) -> Pipeline { + let per_call_policies = Vec::new(); + let per_retry_policies = Vec::new(); + let transport_policy = TransportPolicy::new(options.transport); + Pipeline::new( + per_call_policies, + options.retry, + per_retry_policies, + Arc::new(transport_policy), + ) +} + +/// Create a Pipeline from an HttpClient +fn new_pipeline_from_http_client(http_client: Arc) -> Pipeline { + new_pipeline_from_options(CosmosOptions::with_client(http_client)) +} + impl CosmosClient { /// Create a new `CosmosClient` which connects to the account's instance in the public Azure cloud. pub fn new( - http_client: Arc>, + http_client: Arc, account: String, auth_token: AuthorizationToken, ) -> Self { let cloud_location = CloudLocation::Public(account); + let pipeline = new_pipeline_from_http_client(http_client.clone()); Self { - transport: TransportStack::Client(http_client), + http_client, + pipeline, auth_token, cloud_location, } @@ -68,13 +83,15 @@ impl CosmosClient { /// Create a new `CosmosClient` which connects to the account's instance in the Chinese Azure cloud. pub fn new_china( - http_client: Arc>, + http_client: Arc, account: String, auth_token: AuthorizationToken, ) -> Self { let cloud_location = CloudLocation::China(account); + let pipeline = new_pipeline_from_http_client(http_client.clone()); Self { - transport: TransportStack::Client(http_client), + http_client, + pipeline, auth_token, cloud_location, } @@ -82,21 +99,23 @@ impl CosmosClient { /// Create a new `CosmosClient` which connects to the account's instance in custom Azure cloud. pub fn new_custom( - http_client: Arc>, + http_client: Arc, account: String, auth_token: AuthorizationToken, uri: String, ) -> Self { let cloud_location = CloudLocation::Custom { account, uri }; + let pipeline = new_pipeline_from_http_client(http_client.clone()); Self { - transport: TransportStack::Client(http_client), + http_client, + pipeline, auth_token, cloud_location, } } /// Create a new `CosmosClient` which connects to the account's instance in Azure emulator - pub fn new_emulator(http_client: Arc>, address: &str, port: u16) -> Self { + pub fn new_emulator(http_client: Arc, address: &str, port: u16) -> Self { //Account name: localhost: //Account key: C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw== let auth_token = AuthorizationToken::primary_from_base64( @@ -107,8 +126,10 @@ impl CosmosClient { account: String::from("Custom"), uri, }; + let pipeline = new_pipeline_from_http_client(http_client.clone()); Self { - transport: TransportStack::Client(http_client), + http_client, + pipeline, auth_token, cloud_location, } @@ -116,23 +137,15 @@ impl CosmosClient { /// TODO pub fn with_pipeline( + http_client: Arc, account: String, // TODO: this will eventually be a URL auth_token: AuthorizationToken, options: CosmosOptions, ) -> Self { - let per_call_policies = Vec::new(); - let per_retry_policies = Vec::new(); - - let transport_policy = TransportPolicy::new(options.transport); - - let pipeline = Pipeline::new( - per_call_policies, - options.retry, - per_retry_policies, - Arc::new(transport_policy), - ); + let pipeline = new_pipeline_from_options(options); Self { - transport: TransportStack::Pipeline(pipeline), + http_client, + pipeline, auth_token, cloud_location: CloudLocation::Public(account), } @@ -155,7 +168,6 @@ impl CosmosClient { options.decorate_request(&mut request, database_name.as_ref())?; let response = self .pipeline() - .unwrap() .send(&mut ctx, &mut request) .await .map_err(CosmosError::PolicyError)?; @@ -163,11 +175,8 @@ impl CosmosClient { Ok(crate::operations::create_database::Response::try_from(response).await?) } - fn pipeline(&self) -> Option<&Pipeline> { - match &self.transport { - TransportStack::Pipeline(p) => Some(p), - TransportStack::Client(_) => None, - } + fn pipeline(&self) -> &Pipeline { + &self.pipeline } /// List all databases @@ -213,10 +222,7 @@ impl CosmosClient { } pub(crate) fn http_client(&self) -> &dyn HttpClient { - match &self.transport { - TransportStack::Client(c) => c.as_ref().as_ref(), - TransportStack::Pipeline(_) => panic!("No client set"), - } + self.http_client.as_ref() } fn prepare_request_with_signature( diff --git a/sdk/cosmos/src/clients/mod.rs b/sdk/cosmos/src/clients/mod.rs index 15ddee8749..98cd7e7011 100644 --- a/sdk/cosmos/src/clients/mod.rs +++ b/sdk/cosmos/src/clients/mod.rs @@ -15,7 +15,7 @@ //! let database_name: String = todo!("Think of some database name"); //! //! // Create an http client, then a `CosmosClient`, and then a `DatabaseClient` -//! let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); +//! let http_client: Arc = Arc::new(reqwest::Client::new()); //! let client = CosmosClient::new(http_client, account, authorization_token); //! let client = client.into_database_client(database_name); //! ``` diff --git a/sdk/cosmos/src/lib.rs b/sdk/cosmos/src/lib.rs index bfd1c98617..c10e4c9a88 100644 --- a/sdk/cosmos/src/lib.rs +++ b/sdk/cosmos/src/lib.rs @@ -59,7 +59,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; // Next we will create a Cosmos client. - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let client = CosmosClient::new(http_client, account.clone(), authorization_token); // We know the database so we can obtain a database client. diff --git a/sdk/cosmos/tests/setup.rs b/sdk/cosmos/tests/setup.rs index f7c7a8af34..358d62d66a 100644 --- a/sdk/cosmos/tests/setup.rs +++ b/sdk/cosmos/tests/setup.rs @@ -8,7 +8,7 @@ pub fn initialize() -> Result { std::env::var("COSMOS_MASTER_KEY").expect("Set env variable COSMOS_MASTER_KEY first!"); let authorization_token = AuthorizationToken::primary_from_base64(&key)?; - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let client = CosmosClient::new(http_client, account, authorization_token); Ok(client) From fd04d3a098b09f4d8b12a851c90d2d43fe9a05c6 Mon Sep 17 00:00:00 2001 From: Cameron Taggart Date: Sun, 30 May 2021 21:42:01 -0700 Subject: [PATCH 2/5] remove Box from Arc Result<(), Box> { // this example we are creating an Azure Storage client // using the access token. - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let storage_client = StorageAccountClient::new_bearer_token( http_client.clone(), &storage_account_name, diff --git a/sdk/iothub/examples/device_identity.rs b/sdk/iothub/examples/device_identity.rs index 684ddffce0..4fb67163ba 100644 --- a/sdk/iothub/examples/device_identity.rs +++ b/sdk/iothub/examples/device_identity.rs @@ -15,7 +15,7 @@ async fn main() -> Result<(), Box> { .expect("Please pass the device id as the first parameter"); println!("Getting device twin for device '{}'", device_id); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let service_client = ServiceClient::from_connection_string(http_client, iothub_connection_string, 3600)?; let device = service_client diff --git a/sdk/iothub/examples/directmethod.rs b/sdk/iothub/examples/directmethod.rs index 49570fbd9e..ef1b93dcfb 100644 --- a/sdk/iothub/examples/directmethod.rs +++ b/sdk/iothub/examples/directmethod.rs @@ -26,7 +26,7 @@ async fn main() -> Result<(), Box> { .nth(4) .expect("Please pass the payload as the fourth parameter"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let service_client = ServiceClient::from_connection_string(http_client, iothub_connection_string, 3600)?; println!( diff --git a/sdk/iothub/examples/gettwin.rs b/sdk/iothub/examples/gettwin.rs index fdb06fb177..1c3ecd8f26 100644 --- a/sdk/iothub/examples/gettwin.rs +++ b/sdk/iothub/examples/gettwin.rs @@ -15,7 +15,7 @@ async fn main() -> Result<(), Box> { println!("Getting device twin for device: {}", device_id); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let service_client = ServiceClient::from_connection_string(http_client, iothub_connection_string, 3600)?; let twin = service_client.get_device_twin(device_id).await?; diff --git a/sdk/iothub/examples/module_identity.rs b/sdk/iothub/examples/module_identity.rs index b3bb287509..6bd3a9489c 100644 --- a/sdk/iothub/examples/module_identity.rs +++ b/sdk/iothub/examples/module_identity.rs @@ -18,7 +18,7 @@ async fn main() -> Result<(), Box> { .nth(2) .expect("Please pass the module id as the second parameter"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let service_client = ServiceClient::from_connection_string(http_client, iothub_connection_string, 3600)?; let module = service_client diff --git a/sdk/iothub/examples/updatetwin.rs b/sdk/iothub/examples/updatetwin.rs index 30adabab54..2d0889c651 100644 --- a/sdk/iothub/examples/updatetwin.rs +++ b/sdk/iothub/examples/updatetwin.rs @@ -18,7 +18,7 @@ async fn main() -> Result<(), Box> { .expect("Please pass the payload as the second parameter"); println!("Updating device twin for device: {}", device_id); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let service_client = ServiceClient::from_connection_string(http_client, iothub_connection_string, 3600)?; diff --git a/sdk/iothub/src/service/mod.rs b/sdk/iothub/src/service/mod.rs index 57188dc735..b8aaa94b43 100644 --- a/sdk/iothub/src/service/mod.rs +++ b/sdk/iothub/src/service/mod.rs @@ -35,7 +35,7 @@ pub const API_VERSION: &str = "2020-05-31-preview"; /// The IoTHubService then uses the provided information to create a SAS token that it will /// use to communicate with the IoT Hub. pub struct ServiceClient { - http_client: Arc>, + http_client: Arc, /// The name of the IoT Hub. pub iothub_name: String, /// The SAS token that is used for authentication. @@ -77,14 +77,14 @@ impl ServiceClient { /// use azure_core::HttpClient; /// use iothub::service::ServiceClient; /// - /// let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + /// let http_client: Arc = Arc::new(reqwest::Client::new()); /// let iothub_name = "cool-iot-hub"; /// let sas_token = ""; /// /// let iothub = ServiceClient::from_sas_token(http_client, iothub_name, sas_token); /// ``` pub fn from_sas_token( - http_client: Arc>, + http_client: Arc, iothub_name: S, sas_token: T, ) -> Self @@ -141,7 +141,7 @@ impl ServiceClient { /// use azure_core::HttpClient; /// use iothub::service::ServiceClient; /// - /// let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + /// let http_client: Arc = Arc::new(reqwest::Client::new()); /// /// let iothub_name = "iot-hub"; /// let key_name = "iothubowner"; @@ -151,7 +151,7 @@ impl ServiceClient { /// assert!(result.is_ok(), true); /// ``` pub fn from_private_key( - http_client: Arc>, + http_client: Arc, iothub_name: S, key_name: T, private_key: U, @@ -186,14 +186,14 @@ impl ServiceClient { /// use azure_core::HttpClient; /// use iothub::service::ServiceClient; /// - /// let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + /// let http_client: Arc = Arc::new(reqwest::Client::new()); /// let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// /// let result = ServiceClient::from_connection_string(http_client, connection_string, 3600); /// assert!(result.is_ok(), true); /// ``` pub fn from_connection_string( - http_client: Arc>, + http_client: Arc, connection_string: S, expires_in_seconds: i64, ) -> Result @@ -260,7 +260,7 @@ impl ServiceClient { /// use azure_core::HttpClient; /// use iothub::service::ServiceClient; /// - /// # let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + /// # let http_client: Arc = Arc::new(reqwest::Client::new()); /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the service client!"); /// let device_method = iothub.create_device_method("some-device", "hello-world", 30, 30); @@ -293,7 +293,7 @@ impl ServiceClient { /// use azure_core::HttpClient; /// use iothub::service::ServiceClient; /// - /// # let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + /// # let http_client: Arc = Arc::new(reqwest::Client::new()); /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let device_method = iothub.create_module_method("some-device", "some-module", "hello-world", 30, 30); @@ -328,7 +328,7 @@ impl ServiceClient { /// use azure_core::HttpClient; /// use iothub::service::ServiceClient; /// - /// # let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + /// # let http_client: Arc = Arc::new(reqwest::Client::new()); /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let twin = iothub.get_module_twin("some-device", "some-module"); @@ -357,7 +357,7 @@ impl ServiceClient { /// use azure_core::HttpClient; /// use iothub::service::ServiceClient; /// - /// # let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + /// # let http_client: Arc = Arc::new(reqwest::Client::new()); /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let twin = iothub.get_device_twin("some-device"); @@ -376,7 +376,7 @@ impl ServiceClient { /// use azure_core::HttpClient; /// use iothub::service::ServiceClient; /// - /// # let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + /// # let http_client: Arc = Arc::new(reqwest::Client::new()); /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let twin = iothub.update_module_twin("some-device", "some-module") @@ -408,7 +408,7 @@ impl ServiceClient { /// use azure_core::HttpClient; /// use iothub::service::ServiceClient; /// - /// # let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + /// # let http_client: Arc = Arc::new(reqwest::Client::new()); /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let twin = iothub.replace_module_twin("some-device", "some-module") @@ -440,7 +440,7 @@ impl ServiceClient { /// use azure_core::HttpClient; /// use iothub::service::ServiceClient; /// - /// # let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + /// # let http_client: Arc = Arc::new(reqwest::Client::new()); /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let twin = iothub.update_device_twin("some-device") @@ -465,7 +465,7 @@ impl ServiceClient { /// use azure_core::HttpClient; /// use iothub::service::ServiceClient; /// - /// # let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + /// # let http_client: Arc = Arc::new(reqwest::Client::new()); /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let twin = iothub.replace_device_twin("some-device") @@ -490,7 +490,7 @@ impl ServiceClient { /// use azure_core::HttpClient; /// use iothub::service::ServiceClient; /// - /// # let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + /// # let http_client: Arc = Arc::new(reqwest::Client::new()); /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let device = iothub.get_device_identity("some-device"); @@ -513,7 +513,7 @@ impl ServiceClient { /// use iothub::service::ServiceClient; /// use iothub::service::resources::{Status, AuthenticationMechanism}; /// - /// # let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + /// # let http_client: Arc = Arc::new(reqwest::Client::new()); /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let device = iothub.create_device_identity() @@ -531,7 +531,7 @@ impl ServiceClient { /// use iothub::service::ServiceClient; /// use iothub::service::resources::{Status, AuthenticationMechanism}; /// - /// # let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + /// # let http_client: Arc = Arc::new(reqwest::Client::new()); /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let device = iothub.update_device_identity("etag-of-device-to-update") @@ -558,7 +558,7 @@ impl ServiceClient { /// use azure_core::HttpClient; /// use iothub::service::ServiceClient; /// - /// # let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + /// # let http_client: Arc = Arc::new(reqwest::Client::new()); /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let device = iothub.delete_device_identity("some-device-id", "some-etag"); @@ -582,7 +582,7 @@ impl ServiceClient { /// use azure_core::HttpClient; /// use iothub::service::ServiceClient; /// - /// # let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + /// # let http_client: Arc = Arc::new(reqwest::Client::new()); /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let device = iothub.get_module_identity("some-device", "some-module"); @@ -607,7 +607,7 @@ impl ServiceClient { /// use iothub::service::ServiceClient; /// use iothub::service::resources::{Status, AuthenticationMechanism}; /// - /// # let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + /// # let http_client: Arc = Arc::new(reqwest::Client::new()); /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let device = iothub.create_module_identity() @@ -625,7 +625,7 @@ impl ServiceClient { /// use iothub::service::ServiceClient; /// use iothub::service::resources::{Status, AuthenticationMechanism}; /// - /// # let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + /// # let http_client: Arc = Arc::new(reqwest::Client::new()); /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let device = iothub.update_module_identity("etag-of-device-to-update") @@ -652,7 +652,7 @@ impl ServiceClient { /// use azure_core::HttpClient; /// use iothub::service::ServiceClient; /// - /// # let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + /// # let http_client: Arc = Arc::new(reqwest::Client::new()); /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let device = iothub.delete_module_identity("some-device-id", "some-module-id", "some-etag"); @@ -695,7 +695,7 @@ mod tests { fn from_connectionstring_success() -> Result<(), Box> { use crate::service::ServiceClient; - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; let _ = ServiceClient::from_connection_string(http_client, connection_string, 3600)?; Ok(()) @@ -706,7 +706,7 @@ mod tests { ) -> Result<(), Box> { use crate::service::ServiceClient; - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let connection_string = "HostName==cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; let _ = ServiceClient::from_connection_string(http_client.clone(), connection_string, 3600) .is_err(); @@ -721,7 +721,7 @@ mod tests { fn from_connectionstring_should_fail_on_empty_connection_string( ) -> Result<(), Box> { use crate::service::ServiceClient; - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let _ = ServiceClient::from_connection_string(http_client, "", 3600).is_err(); Ok(()) @@ -731,7 +731,7 @@ mod tests { fn from_connectionstring_should_fail_on_incomplete_connection_string( ) -> Result<(), Box> { use crate::service::ServiceClient; - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let _ = ServiceClient::from_connection_string(http_client, "HostName=cool-iot-hub.azure-devices.net;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg==", 3600).is_err(); Ok(()) @@ -740,7 +740,7 @@ mod tests { #[test] fn update_module_twin_should_create_builder() -> Result<(), Box> { use crate::service::ServiceClient; - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; let service_client = @@ -757,7 +757,7 @@ mod tests { #[test] fn replace_module_twin_should_create_builder() -> Result<(), Box> { use crate::service::ServiceClient; - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; let service_client = @@ -774,7 +774,7 @@ mod tests { #[test] fn update_device_twin_should_create_builder() -> Result<(), Box> { use crate::service::ServiceClient; - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; let service_client = @@ -791,7 +791,7 @@ mod tests { #[test] fn replace_device_twin_should_create_builder() -> Result<(), Box> { use crate::service::ServiceClient; - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; let service_client = diff --git a/sdk/iothub/src/service/requests/invoke_method_builder.rs b/sdk/iothub/src/service/requests/invoke_method_builder.rs index d4c2387c99..a59aa1fc2e 100644 --- a/sdk/iothub/src/service/requests/invoke_method_builder.rs +++ b/sdk/iothub/src/service/requests/invoke_method_builder.rs @@ -49,7 +49,7 @@ impl<'a> InvokeMethodBuilder<'a> { /// # use std::sync::Arc; /// # use azure_core::HttpClient; /// use iothub::service::ServiceClient; - /// # let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + /// # let http_client: Arc = Arc::new(reqwest::Client::new()); /// /// let service = ServiceClient::from_sas_token(http_client, "some-iot-hub", "sas_token"); /// let great_method = service.create_device_method( @@ -117,7 +117,7 @@ mod tests { use azure_core::HttpClient; use std::sync::Arc; - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let service: ServiceClient = ServiceClient::from_sas_token(http_client, "test", "test"); let direct_method = InvokeMethodBuilder::new( &service, diff --git a/sdk/iothub/src/service/requests/update_or_replace_twin_builder.rs b/sdk/iothub/src/service/requests/update_or_replace_twin_builder.rs index 2c479ca6c8..a3382eaea5 100644 --- a/sdk/iothub/src/service/requests/update_or_replace_twin_builder.rs +++ b/sdk/iothub/src/service/requests/update_or_replace_twin_builder.rs @@ -59,7 +59,7 @@ where /// use iothub::service::ServiceClient; /// # use azure_core::HttpClient; /// # use std::sync::Arc; - /// # let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + /// # let http_client: Arc = Arc::new(reqwest::Client::new()); /// /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let twin = iothub.update_device_twin("some-device") @@ -82,7 +82,7 @@ where /// use iothub::service::ServiceClient; /// # use azure_core::HttpClient; /// # use std::sync::Arc; - /// # let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + /// # let http_client: Arc = Arc::new(reqwest::Client::new()); /// /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); @@ -106,7 +106,7 @@ where /// use iothub::service::ServiceClient; /// /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; - /// # let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + /// # let http_client: Arc = Arc::new(reqwest::Client::new()); /// /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let twin = iothub.update_device_twin("some-device") @@ -128,7 +128,7 @@ where /// use iothub::service::ServiceClient; /// /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; - /// # let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + /// # let http_client: Arc = Arc::new(reqwest::Client::new()); /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let twin = iothub.update_device_twin("some-device") /// .tag("TagName", "TagValue") diff --git a/sdk/storage/examples/account00.rs b/sdk/storage/examples/account00.rs index 7aca84b327..e415fb35ad 100644 --- a/sdk/storage/examples/account00.rs +++ b/sdk/storage/examples/account00.rs @@ -11,7 +11,7 @@ async fn main() -> Result<(), Box> { let master_key = std::env::var("STORAGE_MASTER_KEY").expect("Set env variable STORAGE_MASTER_KEY first!"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let storage_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) diff --git a/sdk/storage/examples/blob_00.rs b/sdk/storage/examples/blob_00.rs index 1d6bf5c08c..26ddd7caa2 100644 --- a/sdk/storage/examples/blob_00.rs +++ b/sdk/storage/examples/blob_00.rs @@ -22,7 +22,7 @@ async fn main() -> Result<(), Box> { .nth(2) .expect("please specify blob name as command line parameter"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let storage_account_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key); diff --git a/sdk/storage/examples/blob_01.rs b/sdk/storage/examples/blob_01.rs index 9c9c099a99..a1bc2ce401 100644 --- a/sdk/storage/examples/blob_01.rs +++ b/sdk/storage/examples/blob_01.rs @@ -18,7 +18,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("please specify container name as command line parameter"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let storage_account = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) .as_storage_client(); diff --git a/sdk/storage/examples/blob_02_bearer_token.rs b/sdk/storage/examples/blob_02_bearer_token.rs index d37ad1ca3f..198175861a 100644 --- a/sdk/storage/examples/blob_02_bearer_token.rs +++ b/sdk/storage/examples/blob_02_bearer_token.rs @@ -24,7 +24,7 @@ async fn main() -> Result<(), Box> { .nth(4) .expect("please specify the bearer token as fourth command line parameter"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let storage_account_client = StorageAccountClient::new_bearer_token(http_client.clone(), &account, bearer_token); diff --git a/sdk/storage/examples/blob_04.rs b/sdk/storage/examples/blob_04.rs index 3a4d577bab..ec9736e21c 100644 --- a/sdk/storage/examples/blob_04.rs +++ b/sdk/storage/examples/blob_04.rs @@ -19,7 +19,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("please specify container name as command line parameter"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let storage_account_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key); diff --git a/sdk/storage/examples/blob_05_default_credential.rs b/sdk/storage/examples/blob_05_default_credential.rs index 1dcfb4784e..cd09a13906 100644 --- a/sdk/storage/examples/blob_05_default_credential.rs +++ b/sdk/storage/examples/blob_05_default_credential.rs @@ -28,7 +28,7 @@ async fn main() -> Result<(), Box> { .get_token("https://storage.azure.com/") .await?; - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let storage_account_client = StorageAccountClient::new_bearer_token( http_client.clone(), diff --git a/sdk/storage/examples/blob_range.rs b/sdk/storage/examples/blob_range.rs index 1389ece4f4..8b0a918ae3 100644 --- a/sdk/storage/examples/blob_range.rs +++ b/sdk/storage/examples/blob_range.rs @@ -20,7 +20,7 @@ async fn main() -> Result<(), Box> { .nth(2) .expect("please specify blob name as command line parameter"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let storage_account_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key); diff --git a/sdk/storage/examples/connection_string.rs b/sdk/storage/examples/connection_string.rs index 99a5128b50..c4f40e323c 100644 --- a/sdk/storage/examples/connection_string.rs +++ b/sdk/storage/examples/connection_string.rs @@ -17,7 +17,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("please specify container name as command line parameter"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let storage_account = StorageAccountClient::new_connection_string(http_client.clone(), &connection_string)? .as_storage_client(); diff --git a/sdk/storage/examples/container_00.rs b/sdk/storage/examples/container_00.rs index b0dd5ee78d..ad3a2c7243 100644 --- a/sdk/storage/examples/container_00.rs +++ b/sdk/storage/examples/container_00.rs @@ -17,7 +17,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("please specify container name as command line parameter"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let storage_account = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) .as_storage_client(); diff --git a/sdk/storage/examples/container_01.rs b/sdk/storage/examples/container_01.rs index e1e1e95e5b..ed7378be9a 100644 --- a/sdk/storage/examples/container_01.rs +++ b/sdk/storage/examples/container_01.rs @@ -19,7 +19,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("please specify container name as command line parameter"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let storage_account = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) .as_storage_client(); diff --git a/sdk/storage/examples/container_and_blob.rs b/sdk/storage/examples/container_and_blob.rs index c450b1e8f0..7520f06efb 100644 --- a/sdk/storage/examples/container_and_blob.rs +++ b/sdk/storage/examples/container_and_blob.rs @@ -18,7 +18,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("please specify container name as command line parameter"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let storage_account = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) .as_storage_client(); diff --git a/sdk/storage/examples/copy_blob.rs b/sdk/storage/examples/copy_blob.rs index 4629544acf..6f7a55f50f 100644 --- a/sdk/storage/examples/copy_blob.rs +++ b/sdk/storage/examples/copy_blob.rs @@ -31,7 +31,7 @@ async fn main() -> Result<(), Box> { .nth(4) .expect("please specify destination blob name as fourth command line parameter"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let source_storage_account_client = StorageAccountClient::new_access_key( http_client.clone(), diff --git a/sdk/storage/examples/copy_blob_from_url.rs b/sdk/storage/examples/copy_blob_from_url.rs index fd548696f2..217ca5411a 100644 --- a/sdk/storage/examples/copy_blob_from_url.rs +++ b/sdk/storage/examples/copy_blob_from_url.rs @@ -25,7 +25,7 @@ async fn main() -> Result<(), Box> { .nth(4) .expect("please specify destination blob name as fourth command line parameter"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let storage_account_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key); diff --git a/sdk/storage/examples/count_blobs.rs b/sdk/storage/examples/count_blobs.rs index 5354e4b6cf..3c2a4b62d7 100644 --- a/sdk/storage/examples/count_blobs.rs +++ b/sdk/storage/examples/count_blobs.rs @@ -16,7 +16,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("please specify container name as command line parameter"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let container = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) .as_storage_client() diff --git a/sdk/storage/examples/data_lake_00.rs b/sdk/storage/examples/data_lake_00.rs index bdfbcef2e9..6eab453017 100644 --- a/sdk/storage/examples/data_lake_00.rs +++ b/sdk/storage/examples/data_lake_00.rs @@ -18,7 +18,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("please specify the file system name as first parameter"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let storage_account_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key); diff --git a/sdk/storage/examples/delete_message.rs b/sdk/storage/examples/delete_message.rs index e50d6edff3..cf472fe804 100644 --- a/sdk/storage/examples/delete_message.rs +++ b/sdk/storage/examples/delete_message.rs @@ -19,7 +19,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("Please pass the queue name as first parameter"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let queue = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) .as_storage_client() diff --git a/sdk/storage/examples/emulator_00.rs b/sdk/storage/examples/emulator_00.rs index 4292df496c..65801416b5 100644 --- a/sdk/storage/examples/emulator_00.rs +++ b/sdk/storage/examples/emulator_00.rs @@ -13,7 +13,7 @@ async fn main() -> Result<(), Box> { let blob_storage_url = Url::parse("http://127.0.0.1:10000")?; let table_storage_url = Url::parse("http://127.0.0.1:10002")?; - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let storage_account = StorageAccountClient::new_emulator(http_client, &blob_storage_url, &table_storage_url) .as_storage_client(); diff --git a/sdk/storage/examples/get_messages.rs b/sdk/storage/examples/get_messages.rs index 7e8a97ad83..2d83525daa 100644 --- a/sdk/storage/examples/get_messages.rs +++ b/sdk/storage/examples/get_messages.rs @@ -19,7 +19,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("Please pass the queue name as first parameter"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let queue = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) .as_storage_client() diff --git a/sdk/storage/examples/list_blobs_00.rs b/sdk/storage/examples/list_blobs_00.rs index 6e7e3784e9..82148231fd 100644 --- a/sdk/storage/examples/list_blobs_00.rs +++ b/sdk/storage/examples/list_blobs_00.rs @@ -19,7 +19,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("please specify container name as command line parameter"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let storage_account = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) .as_storage_client(); diff --git a/sdk/storage/examples/list_blobs_01.rs b/sdk/storage/examples/list_blobs_01.rs index 1aa2887816..8c3179320d 100644 --- a/sdk/storage/examples/list_blobs_01.rs +++ b/sdk/storage/examples/list_blobs_01.rs @@ -19,7 +19,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("please specify container name as command line parameter"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let storage_account = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) .as_storage_client(); diff --git a/sdk/storage/examples/list_containers2.rs b/sdk/storage/examples/list_containers2.rs index ee0e9e8c96..cba3722308 100644 --- a/sdk/storage/examples/list_containers2.rs +++ b/sdk/storage/examples/list_containers2.rs @@ -19,7 +19,7 @@ async fn main() -> Result<(), Box> { let master_key = std::env::var("STORAGE_MASTER_KEY").expect("Set env variable STORAGE_MASTER_KEY first!"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let storage_account_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key); diff --git a/sdk/storage/examples/list_queues.rs b/sdk/storage/examples/list_queues.rs index e728485170..c4596679d1 100644 --- a/sdk/storage/examples/list_queues.rs +++ b/sdk/storage/examples/list_queues.rs @@ -13,7 +13,7 @@ async fn main() -> Result<(), Box> { let master_key = std::env::var("STORAGE_MASTER_KEY").expect("Set env variable STORAGE_MASTER_KEY first!"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let storage_account_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key); diff --git a/sdk/storage/examples/peek_messages.rs b/sdk/storage/examples/peek_messages.rs index b840111e12..627d84ef72 100644 --- a/sdk/storage/examples/peek_messages.rs +++ b/sdk/storage/examples/peek_messages.rs @@ -18,7 +18,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("Please pass the queue name as first parameter"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let queue = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) .as_storage_client() diff --git a/sdk/storage/examples/put_append_blob_00.rs b/sdk/storage/examples/put_append_blob_00.rs index be6735cfe5..989542a3bd 100644 --- a/sdk/storage/examples/put_append_blob_00.rs +++ b/sdk/storage/examples/put_append_blob_00.rs @@ -24,7 +24,7 @@ async fn main() -> Result<(), Box> { .nth(2) .expect("please specify blob name as command line parameter"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let storage_account_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key); diff --git a/sdk/storage/examples/put_block_blob_00.rs b/sdk/storage/examples/put_block_blob_00.rs index 0bcbc2ff0c..4c28ee907f 100644 --- a/sdk/storage/examples/put_block_blob_00.rs +++ b/sdk/storage/examples/put_block_blob_00.rs @@ -26,7 +26,7 @@ async fn main() -> Result<(), Box> { .nth(2) .expect("please specify blob name as command line parameter"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let storage_account_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key); diff --git a/sdk/storage/examples/put_message.rs b/sdk/storage/examples/put_message.rs index 68279dc4aa..843c3ead2e 100644 --- a/sdk/storage/examples/put_message.rs +++ b/sdk/storage/examples/put_message.rs @@ -18,7 +18,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("Please pass the queue name as first parameter"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let queue = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) .as_storage_client() diff --git a/sdk/storage/examples/put_page_blob_00.rs b/sdk/storage/examples/put_page_blob_00.rs index 3b49758746..3c00ff9edb 100644 --- a/sdk/storage/examples/put_page_blob_00.rs +++ b/sdk/storage/examples/put_page_blob_00.rs @@ -25,7 +25,7 @@ async fn main() -> Result<(), Box> { .nth(2) .expect("please specify blob name as command line parameter"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let container = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) diff --git a/sdk/storage/examples/queue_create.rs b/sdk/storage/examples/queue_create.rs index de5a172593..01ab133041 100644 --- a/sdk/storage/examples/queue_create.rs +++ b/sdk/storage/examples/queue_create.rs @@ -19,7 +19,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("Please pass the queue name as first parameter"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let storage_account_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key); diff --git a/sdk/storage/examples/shared_access_signature.rs b/sdk/storage/examples/shared_access_signature.rs index a6a1e98bf8..a83208bf07 100644 --- a/sdk/storage/examples/shared_access_signature.rs +++ b/sdk/storage/examples/shared_access_signature.rs @@ -24,7 +24,7 @@ fn code() -> Result<(), Box> { .nth(2) .expect("please specify blob name as command line parameter"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let storage_account_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key); diff --git a/sdk/storage/examples/stream_blob_00.rs b/sdk/storage/examples/stream_blob_00.rs index e6ce745c2e..c53bd44e5f 100644 --- a/sdk/storage/examples/stream_blob_00.rs +++ b/sdk/storage/examples/stream_blob_00.rs @@ -26,7 +26,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("please specify container name as first command line parameter"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let storage_account_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key); diff --git a/sdk/storage/examples/stream_blob_01.rs b/sdk/storage/examples/stream_blob_01.rs index 5315129fd5..79a90ceca6 100644 --- a/sdk/storage/examples/stream_blob_01.rs +++ b/sdk/storage/examples/stream_blob_01.rs @@ -25,7 +25,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("please specify container name as first command line parameter"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let storage_account_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key); diff --git a/sdk/storage/examples/table_00.rs b/sdk/storage/examples/table_00.rs index 6503a8ae3d..69c3f09b61 100644 --- a/sdk/storage/examples/table_00.rs +++ b/sdk/storage/examples/table_00.rs @@ -27,7 +27,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("please specify the table name as first command line parameter"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let storage_account_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key); diff --git a/sdk/storage/src/core/clients/storage_account_client.rs b/sdk/storage/src/core/clients/storage_account_client.rs index 67dc3f7a13..33deef4dc4 100644 --- a/sdk/storage/src/core/clients/storage_account_client.rs +++ b/sdk/storage/src/core/clients/storage_account_client.rs @@ -36,7 +36,7 @@ pub enum ServiceType { #[derive(Debug, Clone)] pub struct StorageAccountClient { storage_credentials: StorageCredentials, - http_client: Arc>, + http_client: Arc, blob_storage_url: Url, table_storage_url: Url, queue_storage_url: Url, @@ -66,11 +66,7 @@ fn get_sas_token_parms(sas_token: &str) -> Result, url::Pa } impl StorageAccountClient { - pub fn new_access_key( - http_client: Arc>, - account: A, - key: K, - ) -> Arc + pub fn new_access_key(http_client: Arc, account: A, key: K) -> Arc where A: Into, K: Into, @@ -97,7 +93,7 @@ impl StorageAccountClient { } pub fn new_emulator( - http_client: Arc>, + http_client: Arc, blob_storage_url: &Url, table_storage_url: &Url, ) -> Arc { @@ -125,7 +121,7 @@ impl StorageAccountClient { } pub fn new_sas_token( - http_client: Arc>, + http_client: Arc, account: A, sas_token: S, ) -> Result, url::ParseError> @@ -152,7 +148,7 @@ impl StorageAccountClient { } pub fn new_bearer_token( - http_client: Arc>, + http_client: Arc, account: A, bearer_token: BT, ) -> Arc @@ -183,7 +179,7 @@ impl StorageAccountClient { } pub fn new_connection_string( - http_client: Arc>, + http_client: Arc, connection_string: &str, ) -> Result, AzureStorageError> { match ConnectionString::new(connection_string)? { diff --git a/sdk/storage/tests/account.rs b/sdk/storage/tests/account.rs index d91b6340b6..0f46021af9 100644 --- a/sdk/storage/tests/account.rs +++ b/sdk/storage/tests/account.rs @@ -10,7 +10,7 @@ async fn get_account_information() { let master_key = std::env::var("STORAGE_MASTER_KEY").expect("Set env variable STORAGE_MASTER_KEY first!"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let storage_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) diff --git a/sdk/storage/tests/append_blob.rs b/sdk/storage/tests/append_blob.rs index 4da274fa64..299c9c8dd0 100644 --- a/sdk/storage/tests/append_blob.rs +++ b/sdk/storage/tests/append_blob.rs @@ -20,7 +20,7 @@ async fn put_append_blob() { let container_name: &'static str = "rust-upload-test"; let _data = b"abcdef"; - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let storage = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) .as_storage_client(); diff --git a/sdk/storage/tests/blob.rs b/sdk/storage/tests/blob.rs index b942c49302..f255daea63 100644 --- a/sdk/storage/tests/blob.rs +++ b/sdk/storage/tests/blob.rs @@ -399,7 +399,7 @@ fn initialize() -> Arc { let master_key = std::env::var("STORAGE_MASTER_KEY").expect("Set env variable STORAGE_MASTER_KEY first!"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) } diff --git a/sdk/storage/tests/container.rs b/sdk/storage/tests/container.rs index 7e7f1b4081..9053ad2c88 100644 --- a/sdk/storage/tests/container.rs +++ b/sdk/storage/tests/container.rs @@ -74,7 +74,7 @@ fn initialize() -> Arc { let master_key = std::env::var("STORAGE_MASTER_KEY").expect("Set env variable STORAGE_MASTER_KEY first!"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) } diff --git a/sdk/storage/tests/data_lake.rs b/sdk/storage/tests/data_lake.rs index 4b8927cfa2..25815ca3f7 100644 --- a/sdk/storage/tests/data_lake.rs +++ b/sdk/storage/tests/data_lake.rs @@ -17,7 +17,7 @@ async fn test_data_lake_file_system_functions() -> Result<(), Box> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let storage_account_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key); diff --git a/sdk/storage/tests/page_blob.rs b/sdk/storage/tests/page_blob.rs index 20da53ec1e..9ddc5e7f16 100644 --- a/sdk/storage/tests/page_blob.rs +++ b/sdk/storage/tests/page_blob.rs @@ -53,7 +53,7 @@ fn initialize() -> Arc { let master_key = std::env::var("STORAGE_MASTER_KEY").expect("Set env variable STORAGE_MASTER_KEY first!"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) } diff --git a/sdk/storage/tests/queue.rs b/sdk/storage/tests/queue.rs index 4e3beab615..b200608601 100644 --- a/sdk/storage/tests/queue.rs +++ b/sdk/storage/tests/queue.rs @@ -15,7 +15,7 @@ async fn queue_create_put_and_get() -> Result<(), Box> std::env::var("STORAGE_MASTER_KEY").expect("Set env variable STORAGE_MASTER_KEY first!"); let queue_name = "rustazuree2e"; - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let storage_account_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key); diff --git a/sdk/storage/tests/stream_blob00.rs b/sdk/storage/tests/stream_blob00.rs index 51b133d34c..1f8543a7ca 100644 --- a/sdk/storage/tests/stream_blob00.rs +++ b/sdk/storage/tests/stream_blob00.rs @@ -20,7 +20,7 @@ async fn code() -> Result<(), Box> { let master_key = std::env::var("STORAGE_MASTER_KEY").expect("Set env variable STORAGE_MASTER_KEY first!"); - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let storage = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) .as_storage_client(); diff --git a/sdk/storage/tests/stream_list_blobs.rs b/sdk/storage/tests/stream_list_blobs.rs index 0ad494618b..5c871055fa 100644 --- a/sdk/storage/tests/stream_list_blobs.rs +++ b/sdk/storage/tests/stream_list_blobs.rs @@ -16,7 +16,7 @@ async fn stream_list_blobs() { let container_name = "streamlistblobs235xx752zdve"; - let http_client: Arc> = Arc::new(Box::new(reqwest::Client::new())); + let http_client: Arc = Arc::new(reqwest::Client::new()); let storage = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) .as_storage_client(); From 4a7e26f0abd82274344e10c9ae456f67b7fcc923 Mon Sep 17 00:00:00 2001 From: Cameron Taggart Date: Mon, 31 May 2021 08:17:25 -0700 Subject: [PATCH 3/5] add new_http_client --- .github/workflows/build.yml | 4 +- sdk/core/src/http_client.rs | 11 ++++ sdk/core/src/lib.rs | 2 +- sdk/core/src/prelude.rs | 4 +- sdk/cosmos/examples/attachments_00.rs | 4 +- sdk/cosmos/examples/collection.rs | 4 +- sdk/cosmos/examples/create_delete_database.rs | 3 +- sdk/cosmos/examples/database_00.rs | 4 +- sdk/cosmos/examples/database_01.rs | 4 +- sdk/cosmos/examples/document_00.rs | 3 +- sdk/cosmos/examples/document_entries_00.rs | 3 +- sdk/cosmos/examples/document_entries_01.rs | 4 +- sdk/cosmos/examples/get_database.rs | 4 +- sdk/cosmos/examples/key_ranges_00.rs | 4 +- sdk/cosmos/examples/permission_00.rs | 5 +- sdk/cosmos/examples/query_document_00.rs | 4 +- sdk/cosmos/examples/readme.rs | 4 +- sdk/cosmos/examples/remove_all_documents.rs | 4 +- sdk/cosmos/examples/stored_proc_00.rs | 4 +- sdk/cosmos/examples/stored_proc_01.rs | 4 +- sdk/cosmos/examples/trigger_00.rs | 4 +- sdk/cosmos/examples/user_00.rs | 4 +- .../examples/user_defined_function_00.rs | 4 +- sdk/cosmos/examples/user_permission_token.rs | 4 +- sdk/cosmos/src/clients/mod.rs | 4 +- sdk/cosmos/src/lib.rs | 6 +- sdk/cosmos/tests/setup.rs | 4 +- sdk/identity/examples/device_code_flow.rs | 3 +- sdk/iothub/examples/device_identity.rs | 5 +- sdk/iothub/examples/directmethod.rs | 7 +-- sdk/iothub/examples/gettwin.rs | 5 +- sdk/iothub/examples/module_identity.rs | 5 +- sdk/iothub/examples/updatetwin.rs | 4 +- sdk/iothub/src/service/mod.rs | 58 +++++++++---------- .../service/requests/invoke_method_builder.rs | 6 +- .../update_or_replace_twin_builder.rs | 16 ++--- sdk/storage/examples/account00.rs | 3 +- sdk/storage/examples/blob_00.rs | 3 +- sdk/storage/examples/blob_01.rs | 3 +- sdk/storage/examples/blob_02_bearer_token.rs | 3 +- sdk/storage/examples/blob_04.rs | 3 +- .../examples/blob_05_default_credential.rs | 3 +- sdk/storage/examples/blob_range.rs | 3 +- sdk/storage/examples/connection_string.rs | 3 +- sdk/storage/examples/container_00.rs | 3 +- sdk/storage/examples/container_01.rs | 3 +- sdk/storage/examples/container_and_blob.rs | 3 +- sdk/storage/examples/copy_blob.rs | 3 +- sdk/storage/examples/copy_blob_from_url.rs | 3 +- sdk/storage/examples/count_blobs.rs | 3 +- sdk/storage/examples/data_lake_00.rs | 3 +- sdk/storage/examples/delete_message.rs | 3 +- sdk/storage/examples/emulator_00.rs | 3 +- sdk/storage/examples/get_messages.rs | 3 +- sdk/storage/examples/list_blobs_00.rs | 3 +- sdk/storage/examples/list_blobs_01.rs | 3 +- sdk/storage/examples/list_containers2.rs | 4 +- sdk/storage/examples/list_queues.rs | 3 +- sdk/storage/examples/peek_messages.rs | 3 +- sdk/storage/examples/put_append_blob_00.rs | 3 +- sdk/storage/examples/put_block_blob_00.rs | 3 +- sdk/storage/examples/put_message.rs | 3 +- sdk/storage/examples/put_page_blob_00.rs | 3 +- sdk/storage/examples/queue_create.rs | 3 +- .../examples/shared_access_signature.rs | 3 +- sdk/storage/examples/stream_blob_00.rs | 3 +- sdk/storage/examples/stream_blob_01.rs | 3 +- sdk/storage/examples/table_00.rs | 4 +- .../core/clients/storage_account_client.rs | 2 +- sdk/storage/tests/account.rs | 3 +- sdk/storage/tests/append_blob.rs | 3 +- sdk/storage/tests/blob.rs | 2 +- sdk/storage/tests/container.rs | 2 +- sdk/storage/tests/data_lake.rs | 3 +- sdk/storage/tests/page_blob.rs | 2 +- sdk/storage/tests/queue.rs | 3 +- sdk/storage/tests/stream_blob00.rs | 3 +- sdk/storage/tests/stream_list_blobs.rs | 3 +- 78 files changed, 124 insertions(+), 222 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7f6c878cdd..7866d42570 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,8 +34,8 @@ jobs: - name: check core for wasm run: cargo check -p azure_core --target=wasm32-unknown-unknown - - name: check core for hyper - run: cargo check -p azure_core --no-default-features --features enable_hyper + # - name: check core for hyper + # run: cargo check -p azure_core --no-default-features --features enable_hyper - name: sdk tests run: cargo test --all diff --git a/sdk/core/src/http_client.rs b/sdk/core/src/http_client.rs index b8edd3163e..7f5244a6bb 100644 --- a/sdk/core/src/http_client.rs +++ b/sdk/core/src/http_client.rs @@ -10,6 +10,17 @@ use http::{Request, Response, StatusCode}; #[allow(unused_imports)] use hyper_rustls::HttpsConnector; use serde::Serialize; +use std::sync::Arc; + +#[cfg(feature = "enable_reqwest")] +pub fn new_http_client() -> Arc { + Arc::new(reqwest::Client::new()) +} + +#[cfg(feature = "enable_hyper")] +pub fn new_http_client() -> Arc { + Arc::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots())) +} #[cfg_attr(target_arch = "wasm32", async_trait(?Send))] #[cfg_attr(not(target_arch = "wasm32"), async_trait)] diff --git a/sdk/core/src/lib.rs b/sdk/core/src/lib.rs index 266d846bf9..39564186d6 100644 --- a/sdk/core/src/lib.rs +++ b/sdk/core/src/lib.rs @@ -37,7 +37,7 @@ pub use bytes_stream::*; pub use context::Context; pub use errors::*; pub use headers::AddAsHeader; -pub use http_client::{to_json, HttpClient}; +pub use http_client::{new_http_client, to_json, HttpClient}; pub use models::*; pub use request::*; pub use response::*; diff --git a/sdk/core/src/prelude.rs b/sdk/core/src/prelude.rs index 8a943266da..14b8a5b710 100644 --- a/sdk/core/src/prelude.rs +++ b/sdk/core/src/prelude.rs @@ -1,3 +1,5 @@ pub use crate::etag::Etag; pub use crate::request_options::*; -pub use crate::{AddAsHeader, AppendToUrlQuery, HttpClient, RequestId, SessionToken, EMPTY_BODY}; +pub use crate::{ + new_http_client, AddAsHeader, AppendToUrlQuery, HttpClient, RequestId, SessionToken, EMPTY_BODY, +}; diff --git a/sdk/cosmos/examples/attachments_00.rs b/sdk/cosmos/examples/attachments_00.rs index 027f3ce898..a3c9d80c50 100644 --- a/sdk/cosmos/examples/attachments_00.rs +++ b/sdk/cosmos/examples/attachments_00.rs @@ -1,9 +1,7 @@ -use azure_core::HttpClient; use azure_cosmos::prelude::*; use serde::{Deserialize, Serialize}; use std::borrow::Cow; use std::error::Error; -use std::sync::Arc; // Now we create a sample struct. The Cow trick // allows us to use the same struct for serializing @@ -44,7 +42,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let client = CosmosClient::new(http_client, account, authorization_token); let client = client.into_database_client(database_name); let client = client.into_collection_client(collection_name); diff --git a/sdk/cosmos/examples/collection.rs b/sdk/cosmos/examples/collection.rs index 6596bf74d5..fe9235b0dd 100644 --- a/sdk/cosmos/examples/collection.rs +++ b/sdk/cosmos/examples/collection.rs @@ -1,7 +1,5 @@ -use azure_core::HttpClient; use azure_cosmos::prelude::*; use std::error::Error; -use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), Box> { @@ -25,7 +23,7 @@ async fn main() -> Result<(), Box> { // authorization token at later time if you need, for example, to escalate the privileges for a // single operation. // Here we are using reqwest but other clients are supported (check the documentation). - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let client = CosmosClient::new(http_client, account.clone(), authorization_token); // The Cosmos' client exposes a lot of methods. This one lists the databases in the specified diff --git a/sdk/cosmos/examples/create_delete_database.rs b/sdk/cosmos/examples/create_delete_database.rs index cbc0b65b2c..74371db2bc 100644 --- a/sdk/cosmos/examples/create_delete_database.rs +++ b/sdk/cosmos/examples/create_delete_database.rs @@ -1,4 +1,3 @@ -use azure_core::HttpClient; use azure_cosmos::prelude::*; use collection::*; use futures::stream::StreamExt; @@ -30,7 +29,7 @@ async fn main() -> Result<(), Box> { // Once we have an authorization token you can create a client instance. You can change the // authorization token at later time if you need, for example, to escalate the privileges for a // single operation. - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let client = CosmosClient::new( http_client.clone(), account.clone(), diff --git a/sdk/cosmos/examples/database_00.rs b/sdk/cosmos/examples/database_00.rs index 0171755900..04c6346067 100644 --- a/sdk/cosmos/examples/database_00.rs +++ b/sdk/cosmos/examples/database_00.rs @@ -1,8 +1,6 @@ -use azure_core::HttpClient; use azure_cosmos::prelude::*; use serde_json::Value; use std::error::Error; -use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), Box> { @@ -14,7 +12,7 @@ async fn main() -> Result<(), Box> { let authorization_token = permission::AuthorizationToken::primary_from_base64(&master_key)?; - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let client = CosmosClient::new(http_client, account, authorization_token); let dbs = client.list_databases().execute().await?; diff --git a/sdk/cosmos/examples/database_01.rs b/sdk/cosmos/examples/database_01.rs index 24388f0d71..00d33a76e2 100644 --- a/sdk/cosmos/examples/database_01.rs +++ b/sdk/cosmos/examples/database_01.rs @@ -1,7 +1,5 @@ -use azure_core::HttpClient; use azure_cosmos::prelude::*; use std::error::Error; -use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), Box> { @@ -13,7 +11,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let client = CosmosClient::new(http_client, account, authorization_token); let database_client = client.into_database_client("pollo"); diff --git a/sdk/cosmos/examples/document_00.rs b/sdk/cosmos/examples/document_00.rs index a963377506..dc967fc423 100644 --- a/sdk/cosmos/examples/document_00.rs +++ b/sdk/cosmos/examples/document_00.rs @@ -2,7 +2,6 @@ use serde::{Deserialize, Serialize}; // Using the prelude module of the Cosmos crate makes easier to use the Rust Azure SDK for Cosmos // DB. use azure_core::prelude::*; -use azure_core::HttpClient; use azure_cosmos::prelude::*; use azure_cosmos::resources::collection::*; use azure_cosmos::responses::GetDocumentResponse; @@ -50,7 +49,7 @@ async fn main() -> Result<(), Box> { // Next we will create a Cosmos client. You need an authorization_token but you can later // change it if needed. - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let client = CosmosClient::new( http_client.clone(), account.clone(), diff --git a/sdk/cosmos/examples/document_entries_00.rs b/sdk/cosmos/examples/document_entries_00.rs index c254a8580d..8b3cbe635a 100644 --- a/sdk/cosmos/examples/document_entries_00.rs +++ b/sdk/cosmos/examples/document_entries_00.rs @@ -5,7 +5,6 @@ use futures::stream::StreamExt; use serde::{Deserialize, Serialize}; use std::borrow::Cow; use std::error::Error; -use std::sync::Arc; // Now we create a sample struct. The Cow trick // allows us to use the same struct for serializing @@ -46,7 +45,7 @@ async fn main() -> Result<(), Box> { let authorization_token = permission::AuthorizationToken::primary_from_base64(&master_key)?; - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let client = CosmosClient::new(http_client, account, authorization_token); let client = client.into_database_client(database_name); let client = client.into_collection_client(collection_name); diff --git a/sdk/cosmos/examples/document_entries_01.rs b/sdk/cosmos/examples/document_entries_01.rs index dd6e6f27e0..873be6190b 100644 --- a/sdk/cosmos/examples/document_entries_01.rs +++ b/sdk/cosmos/examples/document_entries_01.rs @@ -1,9 +1,7 @@ -use azure_core::HttpClient; use azure_cosmos::prelude::*; use serde::{Deserialize, Serialize}; use std::borrow::Cow; use std::error::Error; -use std::sync::Arc; #[derive(Serialize, Deserialize, Clone, Debug)] struct MySampleStruct<'a> { @@ -38,7 +36,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let client = CosmosClient::new(http_client, account, authorization_token); let client = client.into_database_client(database_name); let client = client.into_collection_client(collection_name); diff --git a/sdk/cosmos/examples/get_database.rs b/sdk/cosmos/examples/get_database.rs index 2110c9b542..f17b962baa 100644 --- a/sdk/cosmos/examples/get_database.rs +++ b/sdk/cosmos/examples/get_database.rs @@ -1,7 +1,5 @@ -use azure_core::HttpClient; use azure_cosmos::prelude::*; use std::error::Error; -use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), Box> { @@ -17,7 +15,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let client = CosmosClient::new(http_client, account.clone(), authorization_token); let database_client = client.into_database_client(database_name.clone()); diff --git a/sdk/cosmos/examples/key_ranges_00.rs b/sdk/cosmos/examples/key_ranges_00.rs index ae5c5bf84c..cdaac496a0 100644 --- a/sdk/cosmos/examples/key_ranges_00.rs +++ b/sdk/cosmos/examples/key_ranges_00.rs @@ -1,7 +1,5 @@ -use azure_core::HttpClient; use azure_cosmos::prelude::*; use std::error::Error; -use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), Box> { @@ -18,7 +16,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let client = CosmosClient::new(http_client, account.clone(), authorization_token); let client = client.into_database_client(database); diff --git a/sdk/cosmos/examples/permission_00.rs b/sdk/cosmos/examples/permission_00.rs index bc9f41a706..c6f646afb9 100644 --- a/sdk/cosmos/examples/permission_00.rs +++ b/sdk/cosmos/examples/permission_00.rs @@ -1,7 +1,6 @@ -use azure_core::HttpClient; +use azure_core::new_http_client; use azure_cosmos::prelude::*; use std::error::Error; -use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), Box> { @@ -26,7 +25,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let client = CosmosClient::new(http_client, account.clone(), authorization_token); let database_client = client.into_database_client(database_name); diff --git a/sdk/cosmos/examples/query_document_00.rs b/sdk/cosmos/examples/query_document_00.rs index 2f915436a3..a44207ac12 100644 --- a/sdk/cosmos/examples/query_document_00.rs +++ b/sdk/cosmos/examples/query_document_00.rs @@ -1,9 +1,7 @@ -use azure_core::HttpClient; use azure_cosmos::prelude::*; use azure_cosmos::responses::QueryDocumentsResponse; use serde::{Deserialize, Serialize}; use std::error::Error; -use std::sync::Arc; #[derive(Serialize, Deserialize, Debug)] struct MySampleStructOwned { @@ -39,7 +37,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let client = CosmosClient::new(http_client, account.clone(), authorization_token); let client = client.into_database_client(database_name); diff --git a/sdk/cosmos/examples/readme.rs b/sdk/cosmos/examples/readme.rs index e5d63868d6..492bf7392e 100644 --- a/sdk/cosmos/examples/readme.rs +++ b/sdk/cosmos/examples/readme.rs @@ -1,11 +1,9 @@ use serde::{Deserialize, Serialize}; // Using the prelude module of the Cosmos crate makes easier to use the Rust Azure SDK for Cosmos. -use azure_core::HttpClient; use azure_cosmos::prelude::*; use futures::stream::StreamExt; use std::borrow::Cow; use std::error::Error; -use std::sync::Arc; // This is the stuct we want to use in our sample. // Make sure to have a collection with partition key "a_number" for this example to @@ -55,7 +53,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; // Next we will create a Cosmos client. - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let client = CosmosClient::new(http_client, account.clone(), authorization_token); // We know the database so we can obtain a database client. diff --git a/sdk/cosmos/examples/remove_all_documents.rs b/sdk/cosmos/examples/remove_all_documents.rs index 3e1945376a..2c8a064b74 100644 --- a/sdk/cosmos/examples/remove_all_documents.rs +++ b/sdk/cosmos/examples/remove_all_documents.rs @@ -1,9 +1,7 @@ -use azure_core::HttpClient; use azure_cosmos::prelude::*; use futures::stream::StreamExt; use serde_json::Value; use std::error::Error; -use std::sync::Arc; // This example expects you to have created a collection // with partitionKey on "id". @@ -26,7 +24,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; // Next we will create a Cosmos client. - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let client = CosmosClient::new(http_client, account.clone(), authorization_token); let client = client.into_database_client(database_name); diff --git a/sdk/cosmos/examples/stored_proc_00.rs b/sdk/cosmos/examples/stored_proc_00.rs index d1699c960f..9e52bfec82 100644 --- a/sdk/cosmos/examples/stored_proc_00.rs +++ b/sdk/cosmos/examples/stored_proc_00.rs @@ -1,4 +1,3 @@ -use azure_core::HttpClient; /// This sample showcases execution of stored procedure /// Create stored procedure called test_proc, like so: /// function f(personToGreet) { @@ -8,7 +7,6 @@ use azure_core::HttpClient; /// } use azure_cosmos::prelude::*; use std::error::Error; -use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), Box> { @@ -25,7 +23,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let client = CosmosClient::new(http_client, account.clone(), authorization_token); let ret = client diff --git a/sdk/cosmos/examples/stored_proc_01.rs b/sdk/cosmos/examples/stored_proc_01.rs index 52174cfed0..a2c2bd9612 100644 --- a/sdk/cosmos/examples/stored_proc_01.rs +++ b/sdk/cosmos/examples/stored_proc_01.rs @@ -1,4 +1,3 @@ -use azure_core::HttpClient; /// This sample showcases execution of stored procedure /// Create stored procedure called test_proc, like so: /// function f(personToGreet) { @@ -8,7 +7,6 @@ use azure_core::HttpClient; /// } use azure_cosmos::prelude::*; use std::error::Error; -use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), Box> { @@ -36,7 +34,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let client = CosmosClient::new(http_client, account.clone(), authorization_token); let database_client = client.into_database_client(database_name); diff --git a/sdk/cosmos/examples/trigger_00.rs b/sdk/cosmos/examples/trigger_00.rs index 4f5da4b8a1..0219f014d1 100644 --- a/sdk/cosmos/examples/trigger_00.rs +++ b/sdk/cosmos/examples/trigger_00.rs @@ -1,9 +1,7 @@ -use azure_core::HttpClient; use azure_cosmos::prelude::*; use azure_cosmos::resources::trigger::{TriggerOperation, TriggerType}; use futures::stream::StreamExt; use std::error::Error; -use std::sync::Arc; const TRIGGER_BODY: &str = r#" function updateMetadata() { @@ -53,7 +51,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let client = CosmosClient::new(http_client, account.clone(), authorization_token); let database_client = client.into_database_client(database); diff --git a/sdk/cosmos/examples/user_00.rs b/sdk/cosmos/examples/user_00.rs index 22d1cb9aff..962a457bd0 100644 --- a/sdk/cosmos/examples/user_00.rs +++ b/sdk/cosmos/examples/user_00.rs @@ -1,7 +1,5 @@ -use azure_core::HttpClient; use azure_cosmos::prelude::*; use std::error::Error; -use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), Box> { @@ -20,7 +18,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let client = CosmosClient::new(http_client, account.clone(), authorization_token); let database_client = client.into_database_client(database_name); diff --git a/sdk/cosmos/examples/user_defined_function_00.rs b/sdk/cosmos/examples/user_defined_function_00.rs index d97f6543b4..8e4e02664c 100644 --- a/sdk/cosmos/examples/user_defined_function_00.rs +++ b/sdk/cosmos/examples/user_defined_function_00.rs @@ -1,8 +1,6 @@ -use azure_core::HttpClient; use azure_cosmos::prelude::*; use futures::stream::StreamExt; use std::error::Error; -use std::sync::Arc; const FN_BODY: &str = r#" function tax(income) { @@ -31,7 +29,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let client = CosmosClient::new(http_client, account.clone(), authorization_token); let database_client = client.into_database_client(database); diff --git a/sdk/cosmos/examples/user_permission_token.rs b/sdk/cosmos/examples/user_permission_token.rs index febd23bcdb..e2391b9e69 100644 --- a/sdk/cosmos/examples/user_permission_token.rs +++ b/sdk/cosmos/examples/user_permission_token.rs @@ -1,7 +1,5 @@ -use azure_core::HttpClient; use azure_cosmos::prelude::*; use std::error::Error; -use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), Box> { @@ -23,7 +21,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let client = CosmosClient::new(http_client, account.clone(), authorization_token); let database_client = client.clone().into_database_client(database_name.clone()); diff --git a/sdk/cosmos/src/clients/mod.rs b/sdk/cosmos/src/clients/mod.rs index 98cd7e7011..23a89738f2 100644 --- a/sdk/cosmos/src/clients/mod.rs +++ b/sdk/cosmos/src/clients/mod.rs @@ -7,15 +7,13 @@ //! //! ```no_run //! use azure_cosmos::prelude::*; -//! use azure_core::HttpClient; -//! use std::sync::Arc; //! //! let account = todo!("Get Cosmos account name from the Azure Portal"); //! let authorization_token = todo!("Get Cosmos authorization token from the Azure Portal"); //! let database_name: String = todo!("Think of some database name"); //! //! // Create an http client, then a `CosmosClient`, and then a `DatabaseClient` -//! let http_client: Arc = Arc::new(reqwest::Client::new()); +//! let http_client = azure_core::new_http_client(); //! let client = CosmosClient::new(http_client, account, authorization_token); //! let client = client.into_database_client(database_name); //! ``` diff --git a/sdk/cosmos/src/lib.rs b/sdk/cosmos/src/lib.rs index c10e4c9a88..817bf91b45 100644 --- a/sdk/cosmos/src/lib.rs +++ b/sdk/cosmos/src/lib.rs @@ -10,12 +10,8 @@ should also be possible with this crate. ```no_run // Using the prelude module of the Cosmos crate makes easier to use the Rust Azure SDK for Cosmos DB. use azure_cosmos::prelude::*; -use azure_core::HttpClient; - use serde::{Deserialize, Serialize}; - use std::error::Error; -use std::sync::Arc; // This is the stuct we want to use in our sample. // Make sure to have a collection with partition key "a_number" for this example to @@ -59,7 +55,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; // Next we will create a Cosmos client. - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let client = CosmosClient::new(http_client, account.clone(), authorization_token); // We know the database so we can obtain a database client. diff --git a/sdk/cosmos/tests/setup.rs b/sdk/cosmos/tests/setup.rs index 358d62d66a..ee57bde01d 100644 --- a/sdk/cosmos/tests/setup.rs +++ b/sdk/cosmos/tests/setup.rs @@ -1,6 +1,4 @@ -use azure_core::HttpClient; use azure_cosmos::prelude::*; -use std::sync::Arc; pub fn initialize() -> Result { let account = std::env::var("COSMOS_ACCOUNT").expect("Set env variable COSMOS_ACCOUNT first!"); @@ -8,7 +6,7 @@ pub fn initialize() -> Result { std::env::var("COSMOS_MASTER_KEY").expect("Set env variable COSMOS_MASTER_KEY first!"); let authorization_token = AuthorizationToken::primary_from_base64(&key)?; - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let client = CosmosClient::new(http_client, account, authorization_token); Ok(client) diff --git a/sdk/identity/examples/device_code_flow.rs b/sdk/identity/examples/device_code_flow.rs index 8315bb6e90..62eff059e4 100644 --- a/sdk/identity/examples/device_code_flow.rs +++ b/sdk/identity/examples/device_code_flow.rs @@ -6,7 +6,6 @@ use futures::stream::StreamExt; use oauth2::ClientId; use std::env; use std::error::Error; -use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), Box> { @@ -78,7 +77,7 @@ async fn main() -> Result<(), Box> { // this example we are creating an Azure Storage client // using the access token. - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let storage_client = StorageAccountClient::new_bearer_token( http_client.clone(), &storage_account_name, diff --git a/sdk/iothub/examples/device_identity.rs b/sdk/iothub/examples/device_identity.rs index 4fb67163ba..5dfa308938 100644 --- a/sdk/iothub/examples/device_identity.rs +++ b/sdk/iothub/examples/device_identity.rs @@ -1,6 +1,3 @@ -use std::sync::Arc; - -use azure_core::HttpClient; use iothub::service::resources::{AuthenticationMechanism, DesiredCapability, Status}; use iothub::service::ServiceClient; use std::error::Error; @@ -15,7 +12,7 @@ async fn main() -> Result<(), Box> { .expect("Please pass the device id as the first parameter"); println!("Getting device twin for device '{}'", device_id); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let service_client = ServiceClient::from_connection_string(http_client, iothub_connection_string, 3600)?; let device = service_client diff --git a/sdk/iothub/examples/directmethod.rs b/sdk/iothub/examples/directmethod.rs index ef1b93dcfb..5dfde9db63 100644 --- a/sdk/iothub/examples/directmethod.rs +++ b/sdk/iothub/examples/directmethod.rs @@ -1,9 +1,6 @@ -use std::error::Error; -use std::sync::Arc; - -use azure_core::HttpClient; use iothub::service::ServiceClient; use serde_json; +use std::error::Error; #[tokio::main] async fn main() -> Result<(), Box> { @@ -26,7 +23,7 @@ async fn main() -> Result<(), Box> { .nth(4) .expect("Please pass the payload as the fourth parameter"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let service_client = ServiceClient::from_connection_string(http_client, iothub_connection_string, 3600)?; println!( diff --git a/sdk/iothub/examples/gettwin.rs b/sdk/iothub/examples/gettwin.rs index 1c3ecd8f26..ae5013d3d4 100644 --- a/sdk/iothub/examples/gettwin.rs +++ b/sdk/iothub/examples/gettwin.rs @@ -1,6 +1,3 @@ -use std::sync::Arc; - -use azure_core::HttpClient; use iothub::service::ServiceClient; use std::error::Error; @@ -15,7 +12,7 @@ async fn main() -> Result<(), Box> { println!("Getting device twin for device: {}", device_id); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let service_client = ServiceClient::from_connection_string(http_client, iothub_connection_string, 3600)?; let twin = service_client.get_device_twin(device_id).await?; diff --git a/sdk/iothub/examples/module_identity.rs b/sdk/iothub/examples/module_identity.rs index 6bd3a9489c..9bfb5ea666 100644 --- a/sdk/iothub/examples/module_identity.rs +++ b/sdk/iothub/examples/module_identity.rs @@ -1,6 +1,3 @@ -use std::sync::Arc; - -use azure_core::HttpClient; use iothub::service::resources::AuthenticationMechanism; use iothub::service::ServiceClient; use std::error::Error; @@ -18,7 +15,7 @@ async fn main() -> Result<(), Box> { .nth(2) .expect("Please pass the module id as the second parameter"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let service_client = ServiceClient::from_connection_string(http_client, iothub_connection_string, 3600)?; let module = service_client diff --git a/sdk/iothub/examples/updatetwin.rs b/sdk/iothub/examples/updatetwin.rs index 2d0889c651..8071e48b5c 100644 --- a/sdk/iothub/examples/updatetwin.rs +++ b/sdk/iothub/examples/updatetwin.rs @@ -1,8 +1,6 @@ -use azure_core::HttpClient; use iothub::service::ServiceClient; use serde_json; use std::error::Error; -use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), Box> { @@ -18,7 +16,7 @@ async fn main() -> Result<(), Box> { .expect("Please pass the payload as the second parameter"); println!("Updating device twin for device: {}", device_id); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let service_client = ServiceClient::from_connection_string(http_client, iothub_connection_string, 3600)?; diff --git a/sdk/iothub/src/service/mod.rs b/sdk/iothub/src/service/mod.rs index b8aaa94b43..4c7fe728f1 100644 --- a/sdk/iothub/src/service/mod.rs +++ b/sdk/iothub/src/service/mod.rs @@ -77,7 +77,7 @@ impl ServiceClient { /// use azure_core::HttpClient; /// use iothub::service::ServiceClient; /// - /// let http_client: Arc = Arc::new(reqwest::Client::new()); + /// let http_client = azure_core::new_http_client(); /// let iothub_name = "cool-iot-hub"; /// let sas_token = ""; /// @@ -141,7 +141,7 @@ impl ServiceClient { /// use azure_core::HttpClient; /// use iothub::service::ServiceClient; /// - /// let http_client: Arc = Arc::new(reqwest::Client::new()); + /// let http_client = azure_core::new_http_client(); /// /// let iothub_name = "iot-hub"; /// let key_name = "iothubowner"; @@ -186,7 +186,7 @@ impl ServiceClient { /// use azure_core::HttpClient; /// use iothub::service::ServiceClient; /// - /// let http_client: Arc = Arc::new(reqwest::Client::new()); + /// let http_client = azure_core::new_http_client(); /// let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// /// let result = ServiceClient::from_connection_string(http_client, connection_string, 3600); @@ -260,7 +260,7 @@ impl ServiceClient { /// use azure_core::HttpClient; /// use iothub::service::ServiceClient; /// - /// # let http_client: Arc = Arc::new(reqwest::Client::new()); + /// # let http_client = azure_core::new_http_client(); /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the service client!"); /// let device_method = iothub.create_device_method("some-device", "hello-world", 30, 30); @@ -293,7 +293,7 @@ impl ServiceClient { /// use azure_core::HttpClient; /// use iothub::service::ServiceClient; /// - /// # let http_client: Arc = Arc::new(reqwest::Client::new()); + /// # let http_client = azure_core::new_http_client(); /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let device_method = iothub.create_module_method("some-device", "some-module", "hello-world", 30, 30); @@ -328,7 +328,7 @@ impl ServiceClient { /// use azure_core::HttpClient; /// use iothub::service::ServiceClient; /// - /// # let http_client: Arc = Arc::new(reqwest::Client::new()); + /// # let http_client = azure_core::new_http_client(); /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let twin = iothub.get_module_twin("some-device", "some-module"); @@ -347,7 +347,7 @@ impl ServiceClient { /// Get the HttpClient of the IoTHub service pub(crate) fn http_client(&self) -> &dyn HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } /// Get the device twin of a given device @@ -357,7 +357,7 @@ impl ServiceClient { /// use azure_core::HttpClient; /// use iothub::service::ServiceClient; /// - /// # let http_client: Arc = Arc::new(reqwest::Client::new()); + /// # let http_client = azure_core::new_http_client(); /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let twin = iothub.get_device_twin("some-device"); @@ -376,7 +376,7 @@ impl ServiceClient { /// use azure_core::HttpClient; /// use iothub::service::ServiceClient; /// - /// # let http_client: Arc = Arc::new(reqwest::Client::new()); + /// # let http_client = azure_core::new_http_client(); /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let twin = iothub.update_module_twin("some-device", "some-module") @@ -408,7 +408,7 @@ impl ServiceClient { /// use azure_core::HttpClient; /// use iothub::service::ServiceClient; /// - /// # let http_client: Arc = Arc::new(reqwest::Client::new()); + /// # let http_client = azure_core::new_http_client(); /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let twin = iothub.replace_module_twin("some-device", "some-module") @@ -440,7 +440,7 @@ impl ServiceClient { /// use azure_core::HttpClient; /// use iothub::service::ServiceClient; /// - /// # let http_client: Arc = Arc::new(reqwest::Client::new()); + /// # let http_client = azure_core::new_http_client(); /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let twin = iothub.update_device_twin("some-device") @@ -465,7 +465,7 @@ impl ServiceClient { /// use azure_core::HttpClient; /// use iothub::service::ServiceClient; /// - /// # let http_client: Arc = Arc::new(reqwest::Client::new()); + /// # let http_client = azure_core::new_http_client(); /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let twin = iothub.replace_device_twin("some-device") @@ -490,7 +490,7 @@ impl ServiceClient { /// use azure_core::HttpClient; /// use iothub::service::ServiceClient; /// - /// # let http_client: Arc = Arc::new(reqwest::Client::new()); + /// # let http_client = azure_core::new_http_client(); /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let device = iothub.get_device_identity("some-device"); @@ -513,7 +513,7 @@ impl ServiceClient { /// use iothub::service::ServiceClient; /// use iothub::service::resources::{Status, AuthenticationMechanism}; /// - /// # let http_client: Arc = Arc::new(reqwest::Client::new()); + /// # let http_client = azure_core::new_http_client(); /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let device = iothub.create_device_identity() @@ -531,7 +531,7 @@ impl ServiceClient { /// use iothub::service::ServiceClient; /// use iothub::service::resources::{Status, AuthenticationMechanism}; /// - /// # let http_client: Arc = Arc::new(reqwest::Client::new()); + /// # let http_client = azure_core::new_http_client(); /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let device = iothub.update_device_identity("etag-of-device-to-update") @@ -558,7 +558,7 @@ impl ServiceClient { /// use azure_core::HttpClient; /// use iothub::service::ServiceClient; /// - /// # let http_client: Arc = Arc::new(reqwest::Client::new()); + /// # let http_client = azure_core::new_http_client(); /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let device = iothub.delete_device_identity("some-device-id", "some-etag"); @@ -582,7 +582,7 @@ impl ServiceClient { /// use azure_core::HttpClient; /// use iothub::service::ServiceClient; /// - /// # let http_client: Arc = Arc::new(reqwest::Client::new()); + /// # let http_client = azure_core::new_http_client(); /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let device = iothub.get_module_identity("some-device", "some-module"); @@ -607,7 +607,7 @@ impl ServiceClient { /// use iothub::service::ServiceClient; /// use iothub::service::resources::{Status, AuthenticationMechanism}; /// - /// # let http_client: Arc = Arc::new(reqwest::Client::new()); + /// # let http_client = azure_core::new_http_client(); /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let device = iothub.create_module_identity() @@ -625,7 +625,7 @@ impl ServiceClient { /// use iothub::service::ServiceClient; /// use iothub::service::resources::{Status, AuthenticationMechanism}; /// - /// # let http_client: Arc = Arc::new(reqwest::Client::new()); + /// # let http_client = azure_core::new_http_client(); /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let device = iothub.update_module_identity("etag-of-device-to-update") @@ -652,7 +652,7 @@ impl ServiceClient { /// use azure_core::HttpClient; /// use iothub::service::ServiceClient; /// - /// # let http_client: Arc = Arc::new(reqwest::Client::new()); + /// # let http_client = azure_core::new_http_client(); /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let device = iothub.delete_module_identity("some-device-id", "some-module-id", "some-etag"); @@ -688,14 +688,12 @@ impl ServiceClient { #[cfg(test)] mod tests { - use azure_core::HttpClient; - use std::sync::Arc; #[test] fn from_connectionstring_success() -> Result<(), Box> { use crate::service::ServiceClient; - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; let _ = ServiceClient::from_connection_string(http_client, connection_string, 3600)?; Ok(()) @@ -706,7 +704,7 @@ mod tests { ) -> Result<(), Box> { use crate::service::ServiceClient; - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let connection_string = "HostName==cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; let _ = ServiceClient::from_connection_string(http_client.clone(), connection_string, 3600) .is_err(); @@ -721,7 +719,7 @@ mod tests { fn from_connectionstring_should_fail_on_empty_connection_string( ) -> Result<(), Box> { use crate::service::ServiceClient; - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let _ = ServiceClient::from_connection_string(http_client, "", 3600).is_err(); Ok(()) @@ -731,7 +729,7 @@ mod tests { fn from_connectionstring_should_fail_on_incomplete_connection_string( ) -> Result<(), Box> { use crate::service::ServiceClient; - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let _ = ServiceClient::from_connection_string(http_client, "HostName=cool-iot-hub.azure-devices.net;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg==", 3600).is_err(); Ok(()) @@ -740,7 +738,7 @@ mod tests { #[test] fn update_module_twin_should_create_builder() -> Result<(), Box> { use crate::service::ServiceClient; - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; let service_client = @@ -757,7 +755,7 @@ mod tests { #[test] fn replace_module_twin_should_create_builder() -> Result<(), Box> { use crate::service::ServiceClient; - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; let service_client = @@ -774,7 +772,7 @@ mod tests { #[test] fn update_device_twin_should_create_builder() -> Result<(), Box> { use crate::service::ServiceClient; - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; let service_client = @@ -791,7 +789,7 @@ mod tests { #[test] fn replace_device_twin_should_create_builder() -> Result<(), Box> { use crate::service::ServiceClient; - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; let service_client = diff --git a/sdk/iothub/src/service/requests/invoke_method_builder.rs b/sdk/iothub/src/service/requests/invoke_method_builder.rs index a59aa1fc2e..a637aed99f 100644 --- a/sdk/iothub/src/service/requests/invoke_method_builder.rs +++ b/sdk/iothub/src/service/requests/invoke_method_builder.rs @@ -49,7 +49,7 @@ impl<'a> InvokeMethodBuilder<'a> { /// # use std::sync::Arc; /// # use azure_core::HttpClient; /// use iothub::service::ServiceClient; - /// # let http_client: Arc = Arc::new(reqwest::Client::new()); + /// # let http_client = azure_core::new_http_client(); /// /// let service = ServiceClient::from_sas_token(http_client, "some-iot-hub", "sas_token"); /// let great_method = service.create_device_method( @@ -114,10 +114,8 @@ mod tests { #[test] fn directmethod_new_should_succeed() { use crate::service::InvokeMethodBuilder; - use azure_core::HttpClient; - use std::sync::Arc; - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let service: ServiceClient = ServiceClient::from_sas_token(http_client, "test", "test"); let direct_method = InvokeMethodBuilder::new( &service, diff --git a/sdk/iothub/src/service/requests/update_or_replace_twin_builder.rs b/sdk/iothub/src/service/requests/update_or_replace_twin_builder.rs index a3382eaea5..dc31dc73bd 100644 --- a/sdk/iothub/src/service/requests/update_or_replace_twin_builder.rs +++ b/sdk/iothub/src/service/requests/update_or_replace_twin_builder.rs @@ -57,9 +57,7 @@ where /// ``` /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// use iothub::service::ServiceClient; - /// # use azure_core::HttpClient; - /// # use std::sync::Arc; - /// # let http_client: Arc = Arc::new(reqwest::Client::new()); + /// # let http_client = azure_core::new_http_client(); /// /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let twin = iothub.update_device_twin("some-device") @@ -80,9 +78,7 @@ where /// # Example /// ``` /// use iothub::service::ServiceClient; - /// # use azure_core::HttpClient; - /// # use std::sync::Arc; - /// # let http_client: Arc = Arc::new(reqwest::Client::new()); + /// # let http_client = azure_core::new_http_client(); /// /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); @@ -101,12 +97,10 @@ where /// Set the ETag for the twin /// /// ``` - /// # use azure_core::HttpClient; - /// # use std::sync::Arc; /// use iothub::service::ServiceClient; /// /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; - /// # let http_client: Arc = Arc::new(reqwest::Client::new()); + /// # let http_client = azure_core::new_http_client(); /// /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let twin = iothub.update_device_twin("some-device") @@ -123,12 +117,10 @@ where /// Updates the twin with the desired settings /// /// ``` - /// # use azure_core::HttpClient; - /// # use std::sync::Arc; /// use iothub::service::ServiceClient; /// /// # let connection_string = "HostName=cool-iot-hub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=YSB2ZXJ5IHNlY3VyZSBrZXkgaXMgaW1wb3J0YW50Cg=="; - /// # let http_client: Arc = Arc::new(reqwest::Client::new()); + /// # let http_client = azure_core::new_http_client(); /// let iothub = ServiceClient::from_connection_string(http_client, connection_string, 3600).expect("Failed to create the ServiceClient!"); /// let twin = iothub.update_device_twin("some-device") /// .tag("TagName", "TagValue") diff --git a/sdk/storage/examples/account00.rs b/sdk/storage/examples/account00.rs index e415fb35ad..739e458d48 100644 --- a/sdk/storage/examples/account00.rs +++ b/sdk/storage/examples/account00.rs @@ -1,7 +1,6 @@ use azure_core::prelude::*; use azure_storage::core::prelude::*; use std::error::Error; -use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), Box> { @@ -11,7 +10,7 @@ async fn main() -> Result<(), Box> { let master_key = std::env::var("STORAGE_MASTER_KEY").expect("Set env variable STORAGE_MASTER_KEY first!"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let storage_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) diff --git a/sdk/storage/examples/blob_00.rs b/sdk/storage/examples/blob_00.rs index 26ddd7caa2..c0c4df83b6 100644 --- a/sdk/storage/examples/blob_00.rs +++ b/sdk/storage/examples/blob_00.rs @@ -5,7 +5,6 @@ use azure_storage::blob::prelude::*; use azure_storage::core::prelude::*; use futures::stream::StreamExt; use std::error::Error; -use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), Box> { @@ -22,7 +21,7 @@ async fn main() -> Result<(), Box> { .nth(2) .expect("please specify blob name as command line parameter"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let storage_account_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key); diff --git a/sdk/storage/examples/blob_01.rs b/sdk/storage/examples/blob_01.rs index a1bc2ce401..976f4e2165 100644 --- a/sdk/storage/examples/blob_01.rs +++ b/sdk/storage/examples/blob_01.rs @@ -2,7 +2,6 @@ use azure_core::prelude::*; use azure_storage::blob::prelude::*; use azure_storage::core::prelude::*; use std::error::Error; -use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), Box> { @@ -18,7 +17,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("please specify container name as command line parameter"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let storage_account = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) .as_storage_client(); diff --git a/sdk/storage/examples/blob_02_bearer_token.rs b/sdk/storage/examples/blob_02_bearer_token.rs index 198175861a..f5fdc52a14 100644 --- a/sdk/storage/examples/blob_02_bearer_token.rs +++ b/sdk/storage/examples/blob_02_bearer_token.rs @@ -5,7 +5,6 @@ use azure_core::prelude::*; use azure_storage::blob::prelude::*; use azure_storage::core::prelude::*; use std::error::Error; -use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), Box> { @@ -24,7 +23,7 @@ async fn main() -> Result<(), Box> { .nth(4) .expect("please specify the bearer token as fourth command line parameter"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let storage_account_client = StorageAccountClient::new_bearer_token(http_client.clone(), &account, bearer_token); diff --git a/sdk/storage/examples/blob_04.rs b/sdk/storage/examples/blob_04.rs index ec9736e21c..a33dc6bcf3 100644 --- a/sdk/storage/examples/blob_04.rs +++ b/sdk/storage/examples/blob_04.rs @@ -3,7 +3,6 @@ use azure_storage::blob::prelude::*; use azure_storage::core::prelude::*; use bytes::{BufMut, Bytes}; use std::error::Error; -use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), Box> { @@ -19,7 +18,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("please specify container name as command line parameter"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let storage_account_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key); diff --git a/sdk/storage/examples/blob_05_default_credential.rs b/sdk/storage/examples/blob_05_default_credential.rs index cd09a13906..8b2352b3d4 100644 --- a/sdk/storage/examples/blob_05_default_credential.rs +++ b/sdk/storage/examples/blob_05_default_credential.rs @@ -7,7 +7,6 @@ use azure_identity::token_credentials::TokenCredential; use azure_storage::blob::prelude::*; use azure_storage::core::prelude::*; use std::error::Error; -use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), Box> { @@ -28,7 +27,7 @@ async fn main() -> Result<(), Box> { .get_token("https://storage.azure.com/") .await?; - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let storage_account_client = StorageAccountClient::new_bearer_token( http_client.clone(), diff --git a/sdk/storage/examples/blob_range.rs b/sdk/storage/examples/blob_range.rs index 8b0a918ae3..0f5efd5a8c 100644 --- a/sdk/storage/examples/blob_range.rs +++ b/sdk/storage/examples/blob_range.rs @@ -3,7 +3,6 @@ use azure_storage::blob::prelude::*; use azure_storage::core::prelude::*; use futures::stream::StreamExt; use std::error::Error; -use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), Box> { @@ -20,7 +19,7 @@ async fn main() -> Result<(), Box> { .nth(2) .expect("please specify blob name as command line parameter"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let storage_account_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key); diff --git a/sdk/storage/examples/connection_string.rs b/sdk/storage/examples/connection_string.rs index c4f40e323c..337fd5fa86 100644 --- a/sdk/storage/examples/connection_string.rs +++ b/sdk/storage/examples/connection_string.rs @@ -4,7 +4,6 @@ use azure_storage::core::prelude::*; use futures::stream::StreamExt; use std::error::Error; use std::num::NonZeroU32; -use std::sync::Arc; use std::time::Duration; #[tokio::main] @@ -17,7 +16,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("please specify container name as command line parameter"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let storage_account = StorageAccountClient::new_connection_string(http_client.clone(), &connection_string)? .as_storage_client(); diff --git a/sdk/storage/examples/container_00.rs b/sdk/storage/examples/container_00.rs index ad3a2c7243..3a2f871755 100644 --- a/sdk/storage/examples/container_00.rs +++ b/sdk/storage/examples/container_00.rs @@ -3,7 +3,6 @@ use azure_storage::blob::prelude::*; use azure_storage::core::prelude::*; use std::error::Error; use std::num::NonZeroU32; -use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), Box> { @@ -17,7 +16,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("please specify container name as command line parameter"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let storage_account = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) .as_storage_client(); diff --git a/sdk/storage/examples/container_01.rs b/sdk/storage/examples/container_01.rs index ed7378be9a..a708208a64 100644 --- a/sdk/storage/examples/container_01.rs +++ b/sdk/storage/examples/container_01.rs @@ -4,7 +4,6 @@ use azure_storage::core::prelude::*; use chrono::{FixedOffset, Utc}; use std::error::Error; use std::ops::Add; -use std::sync::Arc; use std::time::Duration; #[tokio::main] @@ -19,7 +18,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("please specify container name as command line parameter"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let storage_account = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) .as_storage_client(); diff --git a/sdk/storage/examples/container_and_blob.rs b/sdk/storage/examples/container_and_blob.rs index 7520f06efb..e2e1e519e1 100644 --- a/sdk/storage/examples/container_and_blob.rs +++ b/sdk/storage/examples/container_and_blob.rs @@ -3,7 +3,6 @@ use azure_storage::blob::prelude::*; use azure_storage::core::prelude::*; use bytes::Bytes; use std::error::Error; -use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), Box> { @@ -18,7 +17,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("please specify container name as command line parameter"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let storage_account = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) .as_storage_client(); diff --git a/sdk/storage/examples/copy_blob.rs b/sdk/storage/examples/copy_blob.rs index 6f7a55f50f..90e8e62e2b 100644 --- a/sdk/storage/examples/copy_blob.rs +++ b/sdk/storage/examples/copy_blob.rs @@ -3,7 +3,6 @@ use azure_storage::blob::prelude::*; use azure_storage::core::prelude::*; use chrono::{Duration, Utc}; use std::error::Error; -use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), Box> { @@ -31,7 +30,7 @@ async fn main() -> Result<(), Box> { .nth(4) .expect("please specify destination blob name as fourth command line parameter"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let source_storage_account_client = StorageAccountClient::new_access_key( http_client.clone(), diff --git a/sdk/storage/examples/copy_blob_from_url.rs b/sdk/storage/examples/copy_blob_from_url.rs index 217ca5411a..153a615958 100644 --- a/sdk/storage/examples/copy_blob_from_url.rs +++ b/sdk/storage/examples/copy_blob_from_url.rs @@ -2,7 +2,6 @@ use azure_core::prelude::*; use azure_storage::blob::prelude::*; use azure_storage::core::prelude::*; use std::error::Error; -use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), Box> { @@ -25,7 +24,7 @@ async fn main() -> Result<(), Box> { .nth(4) .expect("please specify destination blob name as fourth command line parameter"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let storage_account_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key); diff --git a/sdk/storage/examples/count_blobs.rs b/sdk/storage/examples/count_blobs.rs index 3c2a4b62d7..45d3167b1e 100644 --- a/sdk/storage/examples/count_blobs.rs +++ b/sdk/storage/examples/count_blobs.rs @@ -3,7 +3,6 @@ use azure_storage::blob::prelude::*; use azure_storage::core::prelude::*; use futures::stream::StreamExt; use std::error::Error; -use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), Box> { @@ -16,7 +15,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("please specify container name as command line parameter"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let container = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) .as_storage_client() diff --git a/sdk/storage/examples/data_lake_00.rs b/sdk/storage/examples/data_lake_00.rs index 6eab453017..b356fc3d7b 100644 --- a/sdk/storage/examples/data_lake_00.rs +++ b/sdk/storage/examples/data_lake_00.rs @@ -4,7 +4,6 @@ use azure_storage::data_lake::prelude::*; use futures::stream::StreamExt; use std::error::Error; use std::num::NonZeroU32; -use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), Box> { @@ -18,7 +17,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("please specify the file system name as first parameter"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let storage_account_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key); diff --git a/sdk/storage/examples/delete_message.rs b/sdk/storage/examples/delete_message.rs index cf472fe804..ae0d84538d 100644 --- a/sdk/storage/examples/delete_message.rs +++ b/sdk/storage/examples/delete_message.rs @@ -4,7 +4,6 @@ use azure_core::prelude::*; use azure_storage::core::prelude::*; use azure_storage::queue::prelude::*; use std::error::Error; -use std::sync::Arc; use std::time::Duration; #[tokio::main] @@ -19,7 +18,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("Please pass the queue name as first parameter"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let queue = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) .as_storage_client() diff --git a/sdk/storage/examples/emulator_00.rs b/sdk/storage/examples/emulator_00.rs index 65801416b5..ec6acd0291 100644 --- a/sdk/storage/examples/emulator_00.rs +++ b/sdk/storage/examples/emulator_00.rs @@ -2,7 +2,6 @@ use azure_core::prelude::*; use azure_storage::blob::prelude::*; use azure_storage::core::prelude::*; use std::error::Error; -use std::sync::Arc; use url::Url; #[tokio::main] @@ -13,7 +12,7 @@ async fn main() -> Result<(), Box> { let blob_storage_url = Url::parse("http://127.0.0.1:10000")?; let table_storage_url = Url::parse("http://127.0.0.1:10002")?; - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let storage_account = StorageAccountClient::new_emulator(http_client, &blob_storage_url, &table_storage_url) .as_storage_client(); diff --git a/sdk/storage/examples/get_messages.rs b/sdk/storage/examples/get_messages.rs index 2d83525daa..0b728a86af 100644 --- a/sdk/storage/examples/get_messages.rs +++ b/sdk/storage/examples/get_messages.rs @@ -4,7 +4,6 @@ use azure_core::prelude::*; use azure_storage::core::prelude::*; use azure_storage::queue::prelude::*; use std::error::Error; -use std::sync::Arc; use std::time::Duration; #[tokio::main] @@ -19,7 +18,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("Please pass the queue name as first parameter"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let queue = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) .as_storage_client() diff --git a/sdk/storage/examples/list_blobs_00.rs b/sdk/storage/examples/list_blobs_00.rs index 82148231fd..3df0d50ff8 100644 --- a/sdk/storage/examples/list_blobs_00.rs +++ b/sdk/storage/examples/list_blobs_00.rs @@ -4,7 +4,6 @@ use azure_storage::core::prelude::*; use futures::stream::StreamExt; use std::error::Error; use std::num::NonZeroU32; -use std::sync::Arc; use std::time::Duration; #[tokio::main] @@ -19,7 +18,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("please specify container name as command line parameter"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let storage_account = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) .as_storage_client(); diff --git a/sdk/storage/examples/list_blobs_01.rs b/sdk/storage/examples/list_blobs_01.rs index 8c3179320d..03143dade2 100644 --- a/sdk/storage/examples/list_blobs_01.rs +++ b/sdk/storage/examples/list_blobs_01.rs @@ -4,7 +4,6 @@ use azure_storage::core::prelude::*; use futures::stream::StreamExt; use std::error::Error; use std::num::NonZeroU32; -use std::sync::Arc; use std::time::Duration; #[tokio::main] @@ -19,7 +18,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("please specify container name as command line parameter"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let storage_account = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) .as_storage_client(); diff --git a/sdk/storage/examples/list_containers2.rs b/sdk/storage/examples/list_containers2.rs index cba3722308..c08304816a 100644 --- a/sdk/storage/examples/list_containers2.rs +++ b/sdk/storage/examples/list_containers2.rs @@ -1,9 +1,7 @@ -use azure_core::HttpClient; use azure_storage::blob::prelude::*; use azure_storage::core::prelude::*; use serde::Serialize; use std::error::Error; -use std::sync::Arc; #[derive(Debug, Clone, Serialize)] #[serde(rename_all = "snake_case")] @@ -19,7 +17,7 @@ async fn main() -> Result<(), Box> { let master_key = std::env::var("STORAGE_MASTER_KEY").expect("Set env variable STORAGE_MASTER_KEY first!"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let storage_account_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key); diff --git a/sdk/storage/examples/list_queues.rs b/sdk/storage/examples/list_queues.rs index c4596679d1..d73f3d1598 100644 --- a/sdk/storage/examples/list_queues.rs +++ b/sdk/storage/examples/list_queues.rs @@ -3,7 +3,6 @@ use azure_storage::core::prelude::*; use futures::stream::StreamExt; use std::error::Error; use std::num::NonZeroU32; -use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), Box> { @@ -13,7 +12,7 @@ async fn main() -> Result<(), Box> { let master_key = std::env::var("STORAGE_MASTER_KEY").expect("Set env variable STORAGE_MASTER_KEY first!"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let storage_account_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key); diff --git a/sdk/storage/examples/peek_messages.rs b/sdk/storage/examples/peek_messages.rs index 627d84ef72..a92d121f2b 100644 --- a/sdk/storage/examples/peek_messages.rs +++ b/sdk/storage/examples/peek_messages.rs @@ -4,7 +4,6 @@ use azure_core::prelude::*; use azure_storage::core::prelude::*; use azure_storage::queue::prelude::*; use std::error::Error; -use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), Box> { @@ -18,7 +17,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("Please pass the queue name as first parameter"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let queue = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) .as_storage_client() diff --git a/sdk/storage/examples/put_append_blob_00.rs b/sdk/storage/examples/put_append_blob_00.rs index 989542a3bd..db5805645b 100644 --- a/sdk/storage/examples/put_append_blob_00.rs +++ b/sdk/storage/examples/put_append_blob_00.rs @@ -5,7 +5,6 @@ use azure_core::prelude::*; use azure_storage::blob::prelude::*; use azure_storage::core::prelude::*; use std::error::Error; -use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), Box> { @@ -24,7 +23,7 @@ async fn main() -> Result<(), Box> { .nth(2) .expect("please specify blob name as command line parameter"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let storage_account_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key); diff --git a/sdk/storage/examples/put_block_blob_00.rs b/sdk/storage/examples/put_block_blob_00.rs index 4c28ee907f..0032624ccf 100644 --- a/sdk/storage/examples/put_block_blob_00.rs +++ b/sdk/storage/examples/put_block_blob_00.rs @@ -6,7 +6,6 @@ use azure_storage::blob::prelude::*; use azure_storage::core::prelude::*; use bytes::Bytes; use std::error::Error; -use std::sync::Arc; use std::time::Duration; #[tokio::main] @@ -26,7 +25,7 @@ async fn main() -> Result<(), Box> { .nth(2) .expect("please specify blob name as command line parameter"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let storage_account_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key); diff --git a/sdk/storage/examples/put_message.rs b/sdk/storage/examples/put_message.rs index 843c3ead2e..5663e455df 100644 --- a/sdk/storage/examples/put_message.rs +++ b/sdk/storage/examples/put_message.rs @@ -4,7 +4,6 @@ use azure_core::prelude::*; use azure_storage::core::prelude::*; use azure_storage::queue::prelude::*; use std::error::Error; -use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), Box> { @@ -18,7 +17,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("Please pass the queue name as first parameter"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let queue = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) .as_storage_client() diff --git a/sdk/storage/examples/put_page_blob_00.rs b/sdk/storage/examples/put_page_blob_00.rs index 3c00ff9edb..e6445a03b1 100644 --- a/sdk/storage/examples/put_page_blob_00.rs +++ b/sdk/storage/examples/put_page_blob_00.rs @@ -5,7 +5,6 @@ use azure_storage::blob::prelude::*; use azure_storage::core::prelude::*; use bytes::Bytes; use std::error::Error; -use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), Box> { @@ -25,7 +24,7 @@ async fn main() -> Result<(), Box> { .nth(2) .expect("please specify blob name as command line parameter"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let container = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) diff --git a/sdk/storage/examples/queue_create.rs b/sdk/storage/examples/queue_create.rs index 01ab133041..25c9e80296 100644 --- a/sdk/storage/examples/queue_create.rs +++ b/sdk/storage/examples/queue_create.rs @@ -5,7 +5,6 @@ use azure_storage::core::prelude::*; use azure_storage::queue::prelude::*; use chrono::{Duration, Utc}; use std::error::Error; -use std::sync::Arc; #[tokio::main] async fn main() -> Result<(), Box> { @@ -19,7 +18,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("Please pass the queue name as first parameter"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let storage_account_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key); diff --git a/sdk/storage/examples/shared_access_signature.rs b/sdk/storage/examples/shared_access_signature.rs index a83208bf07..0d4814d0a7 100644 --- a/sdk/storage/examples/shared_access_signature.rs +++ b/sdk/storage/examples/shared_access_signature.rs @@ -3,7 +3,6 @@ use azure_storage::blob::prelude::*; use azure_storage::core::prelude::*; use chrono::{Duration, Utc}; use std::error::Error; -use std::sync::Arc; fn main() { env_logger::init(); @@ -24,7 +23,7 @@ fn code() -> Result<(), Box> { .nth(2) .expect("please specify blob name as command line parameter"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let storage_account_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key); diff --git a/sdk/storage/examples/stream_blob_00.rs b/sdk/storage/examples/stream_blob_00.rs index c53bd44e5f..7975e52fd3 100644 --- a/sdk/storage/examples/stream_blob_00.rs +++ b/sdk/storage/examples/stream_blob_00.rs @@ -4,7 +4,6 @@ use azure_storage::core::prelude::*; use futures::stream::StreamExt; use std::cell::RefCell; use std::rc::Rc; -use std::sync::Arc; // This example shows how to stream data from a blob. We will create a simple blob first, the we // ask it back using streaming features of the future crate. In this simple example we just @@ -26,7 +25,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("please specify container name as first command line parameter"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let storage_account_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key); diff --git a/sdk/storage/examples/stream_blob_01.rs b/sdk/storage/examples/stream_blob_01.rs index 79a90ceca6..423b3845b4 100644 --- a/sdk/storage/examples/stream_blob_01.rs +++ b/sdk/storage/examples/stream_blob_01.rs @@ -3,7 +3,6 @@ use azure_storage::blob::blob::responses::GetBlobResponse; use azure_storage::blob::prelude::*; use azure_storage::core::prelude::*; use futures::stream::StreamExt; -use std::sync::Arc; // This example shows how to stream data from a blob. We will create a simple blob first, the we // ask it back using streaming features of the future crate. In this simple example we just @@ -25,7 +24,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("please specify container name as first command line parameter"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let storage_account_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key); diff --git a/sdk/storage/examples/table_00.rs b/sdk/storage/examples/table_00.rs index 69c3f09b61..a75eb6729e 100644 --- a/sdk/storage/examples/table_00.rs +++ b/sdk/storage/examples/table_00.rs @@ -1,10 +1,8 @@ -use azure_core::prelude::*; use azure_storage::core::prelude::*; use azure_storage::table::prelude::*; use futures::stream::StreamExt; use serde::{Deserialize, Serialize}; use std::error::Error; -use std::sync::Arc; #[derive(Debug, Clone, Serialize, Deserialize)] struct MyEntity { @@ -27,7 +25,7 @@ async fn main() -> Result<(), Box> { .nth(1) .expect("please specify the table name as first command line parameter"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = azure_core::new_http_client(); let storage_account_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key); diff --git a/sdk/storage/src/core/clients/storage_account_client.rs b/sdk/storage/src/core/clients/storage_account_client.rs index 33deef4dc4..3c23b66838 100644 --- a/sdk/storage/src/core/clients/storage_account_client.rs +++ b/sdk/storage/src/core/clients/storage_account_client.rs @@ -251,7 +251,7 @@ impl StorageAccountClient { } pub fn http_client(&self) -> &dyn HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn blob_storage_url(&self) -> &Url { diff --git a/sdk/storage/tests/account.rs b/sdk/storage/tests/account.rs index 0f46021af9..e1d9483ee3 100644 --- a/sdk/storage/tests/account.rs +++ b/sdk/storage/tests/account.rs @@ -1,7 +1,6 @@ #![cfg(all(test, feature = "test_e2e"))] use azure_core::prelude::*; use azure_storage::core::prelude::*; -use std::sync::Arc; #[tokio::test] async fn get_account_information() { @@ -10,7 +9,7 @@ async fn get_account_information() { let master_key = std::env::var("STORAGE_MASTER_KEY").expect("Set env variable STORAGE_MASTER_KEY first!"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let storage_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) diff --git a/sdk/storage/tests/append_blob.rs b/sdk/storage/tests/append_blob.rs index 299c9c8dd0..5566d4f01b 100644 --- a/sdk/storage/tests/append_blob.rs +++ b/sdk/storage/tests/append_blob.rs @@ -7,7 +7,6 @@ use azure_storage::blob::container::PublicAccess; use azure_storage::blob::prelude::*; use azure_storage::core::prelude::*; use bytes::Bytes; -use std::sync::Arc; #[tokio::test] async fn put_append_blob() { @@ -20,7 +19,7 @@ async fn put_append_blob() { let container_name: &'static str = "rust-upload-test"; let _data = b"abcdef"; - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let storage = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) .as_storage_client(); diff --git a/sdk/storage/tests/blob.rs b/sdk/storage/tests/blob.rs index f255daea63..67297483de 100644 --- a/sdk/storage/tests/blob.rs +++ b/sdk/storage/tests/blob.rs @@ -399,7 +399,7 @@ fn initialize() -> Arc { let master_key = std::env::var("STORAGE_MASTER_KEY").expect("Set env variable STORAGE_MASTER_KEY first!"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) } diff --git a/sdk/storage/tests/container.rs b/sdk/storage/tests/container.rs index 9053ad2c88..86bc29b564 100644 --- a/sdk/storage/tests/container.rs +++ b/sdk/storage/tests/container.rs @@ -74,7 +74,7 @@ fn initialize() -> Arc { let master_key = std::env::var("STORAGE_MASTER_KEY").expect("Set env variable STORAGE_MASTER_KEY first!"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) } diff --git a/sdk/storage/tests/data_lake.rs b/sdk/storage/tests/data_lake.rs index 25815ca3f7..274e33098b 100644 --- a/sdk/storage/tests/data_lake.rs +++ b/sdk/storage/tests/data_lake.rs @@ -5,7 +5,6 @@ use azure_storage::data_lake::prelude::*; use futures::stream::StreamExt; use std::error::Error; use std::num::NonZeroU32; -use std::sync::Arc; #[tokio::test] async fn test_data_lake_file_system_functions() -> Result<(), Box> { @@ -17,7 +16,7 @@ async fn test_data_lake_file_system_functions() -> Result<(), Box = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let storage_account_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key); diff --git a/sdk/storage/tests/page_blob.rs b/sdk/storage/tests/page_blob.rs index 9ddc5e7f16..68074567d6 100644 --- a/sdk/storage/tests/page_blob.rs +++ b/sdk/storage/tests/page_blob.rs @@ -53,7 +53,7 @@ fn initialize() -> Arc { let master_key = std::env::var("STORAGE_MASTER_KEY").expect("Set env variable STORAGE_MASTER_KEY first!"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) } diff --git a/sdk/storage/tests/queue.rs b/sdk/storage/tests/queue.rs index b200608601..2282f93182 100644 --- a/sdk/storage/tests/queue.rs +++ b/sdk/storage/tests/queue.rs @@ -4,7 +4,6 @@ use azure_storage::core::prelude::*; use azure_storage::queue::prelude::*; use chrono::Utc; use std::error::Error; -use std::sync::Arc; use std::time::Duration; #[tokio::test] @@ -15,7 +14,7 @@ async fn queue_create_put_and_get() -> Result<(), Box> std::env::var("STORAGE_MASTER_KEY").expect("Set env variable STORAGE_MASTER_KEY first!"); let queue_name = "rustazuree2e"; - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let storage_account_client = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key); diff --git a/sdk/storage/tests/stream_blob00.rs b/sdk/storage/tests/stream_blob00.rs index 1f8543a7ca..c0759f925f 100644 --- a/sdk/storage/tests/stream_blob00.rs +++ b/sdk/storage/tests/stream_blob00.rs @@ -3,7 +3,6 @@ use azure_core::prelude::*; use azure_storage::blob::prelude::*; use azure_storage::core::prelude::*; use futures::stream::StreamExt; -use std::sync::Arc; #[tokio::test] async fn create_blob_and_stream_back() { @@ -20,7 +19,7 @@ async fn code() -> Result<(), Box> { let master_key = std::env::var("STORAGE_MASTER_KEY").expect("Set env variable STORAGE_MASTER_KEY first!"); - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let storage = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) .as_storage_client(); diff --git a/sdk/storage/tests/stream_list_blobs.rs b/sdk/storage/tests/stream_list_blobs.rs index 5c871055fa..28d69a5a30 100644 --- a/sdk/storage/tests/stream_list_blobs.rs +++ b/sdk/storage/tests/stream_list_blobs.rs @@ -3,7 +3,6 @@ use azure_core::prelude::*; use azure_storage::blob::prelude::*; use azure_storage::core::prelude::*; use futures::stream::StreamExt; -use std::sync::Arc; use std::time::Duration; #[tokio::test] @@ -16,7 +15,7 @@ async fn stream_list_blobs() { let container_name = "streamlistblobs235xx752zdve"; - let http_client: Arc = Arc::new(reqwest::Client::new()); + let http_client = new_http_client(); let storage = StorageAccountClient::new_access_key(http_client.clone(), &account, &master_key) .as_storage_client(); From 316de9c8723dae56d7d33beda4bcbeb119b63f3b Mon Sep 17 00:00:00 2001 From: Cameron Taggart Date: Mon, 31 May 2021 10:16:36 -0700 Subject: [PATCH 4/5] update services --- services/autorust/codegen/src/lib_rs.rs | 8 +- services/mgmt/addons/src/lib.rs | 8 +- .../mgmt/adhybridhealthservice/src/lib.rs | 8 +- services/mgmt/adp/src/lib.rs | 8 +- services/mgmt/advisor/src/lib.rs | 8 +- services/mgmt/agfood/src/lib.rs | 8 +- services/mgmt/alertsmanagement/src/lib.rs | 8 +- services/mgmt/analysisservices/src/lib.rs | 8 +- services/mgmt/apimanagement/src/lib.rs | 8 +- services/mgmt/appconfiguration/src/lib.rs | 8 +- services/mgmt/applicationinsights/src/lib.rs | 8 +- services/mgmt/appplatform/src/lib.rs | 8 +- services/mgmt/attestation/src/lib.rs | 8 +- services/mgmt/authorization/src/lib.rs | 8 +- services/mgmt/automanage/src/lib.rs | 8 +- services/mgmt/azure_kusto/src/lib.rs | 8 +- services/mgmt/azureactivedirectory/src/lib.rs | 8 +- services/mgmt/azuredata/src/lib.rs | 8 +- services/mgmt/azurestack/src/lib.rs | 8 +- .../mgmt/baremetalinfrastructure/src/lib.rs | 8 +- services/mgmt/batch/src/lib.rs | 8 +- services/mgmt/batchai/src/lib.rs | 8 +- services/mgmt/billing/src/lib.rs | 8 +- services/mgmt/blockchain/src/lib.rs | 8 +- services/mgmt/blueprint/src/lib.rs | 8 +- services/mgmt/botservice/src/lib.rs | 8 +- services/mgmt/cdn/src/lib.rs | 8 +- services/mgmt/changeanalysis/src/lib.rs | 8 +- services/mgmt/cloudshell/src/lib.rs | 8 +- services/mgmt/cognitiveservices/src/lib.rs | 8 +- services/mgmt/commerce/src/lib.rs | 8 +- services/mgmt/communication/src/lib.rs | 8 +- services/mgmt/compute/examples/vm_list.rs | 6 +- services/mgmt/compute/src/lib.rs | 8 +- services/mgmt/confidentialledger/src/lib.rs | 8 +- services/mgmt/confluent/src/lib.rs | 8 +- services/mgmt/consumption/src/lib.rs | 8 +- services/mgmt/containerinstance/src/lib.rs | 8 +- services/mgmt/containerregistry/src/lib.rs | 8 +- services/mgmt/containerservice/src/lib.rs | 8 +- services/mgmt/cosmos_db/Cargo.toml | 3 +- services/mgmt/cosmos_db/src/lib.rs | 12 +- .../mgmt/cosmos_db/src/package_2021_05/mod.rs | 3 + .../cosmos_db/src/package_2021_05/models.rs | 1626 +++ .../src/package_2021_05/operations.rs | 10202 ++++++++++++++++ services/mgmt/cost_management/src/lib.rs | 8 +- services/mgmt/cpim/src/lib.rs | 8 +- services/mgmt/customer_insights/src/lib.rs | 8 +- services/mgmt/customerlockbox/src/lib.rs | 8 +- services/mgmt/customproviders/src/lib.rs | 8 +- services/mgmt/databox/src/lib.rs | 8 +- services/mgmt/databoxedge/src/lib.rs | 8 +- services/mgmt/databricks/src/lib.rs | 8 +- services/mgmt/datacatalog/src/lib.rs | 8 +- services/mgmt/datadog/src/lib.rs | 8 +- services/mgmt/datafactory/src/lib.rs | 8 +- services/mgmt/datalake_analytics/src/lib.rs | 8 +- services/mgmt/datalake_store/src/lib.rs | 8 +- services/mgmt/dataprotection/src/lib.rs | 8 +- services/mgmt/datashare/src/lib.rs | 8 +- .../mgmt/desktopvirtualization/src/lib.rs | 8 +- services/mgmt/deviceupdate/src/lib.rs | 8 +- .../src/package_2020_03_01_preview/models.rs | 2 + services/mgmt/devops/src/lib.rs | 8 +- services/mgmt/devspaces/src/lib.rs | 8 +- services/mgmt/devtestlabs/src/lib.rs | 8 +- services/mgmt/dfp/src/lib.rs | 8 +- services/mgmt/digitaltwins/src/lib.rs | 8 +- services/mgmt/dns/src/lib.rs | 8 +- services/mgmt/domainservices/src/lib.rs | 8 +- services/mgmt/edgeorder/src/lib.rs | 8 +- services/mgmt/edgeorderpartner/src/lib.rs | 8 +- services/mgmt/elastic/src/lib.rs | 8 +- services/mgmt/engagementfabric/src/lib.rs | 8 +- .../enterprise_knowledge_graph/src/lib.rs | 8 +- services/mgmt/eventgrid/src/lib.rs | 8 +- services/mgmt/eventhub/src/lib.rs | 8 +- services/mgmt/extendedlocation/src/lib.rs | 8 +- services/mgmt/frontdoor/src/lib.rs | 8 +- services/mgmt/guestconfiguration/src/lib.rs | 8 +- services/mgmt/hanaonazure/src/lib.rs | 8 +- .../mgmt/hardwaresecuritymodules/src/lib.rs | 8 +- services/mgmt/hdinsight/src/lib.rs | 8 +- services/mgmt/healthbot/src/lib.rs | 8 +- services/mgmt/healthcareapis/src/lib.rs | 8 +- services/mgmt/hybridcompute/Cargo.toml | 3 +- services/mgmt/hybridcompute/src/lib.rs | 12 +- .../hybridcompute/src/package_2021_05/mod.rs | 3 + .../src/package_2021_05/models.rs | 478 + .../src/package_2021_05/operations.rs | 2007 +++ services/mgmt/hybriddatamanager/src/lib.rs | 8 +- services/mgmt/hybridkubernetes/src/lib.rs | 8 +- services/mgmt/hybridnetwork/src/lib.rs | 8 +- services/mgmt/imagebuilder/src/lib.rs | 8 +- services/mgmt/intune/src/lib.rs | 8 +- services/mgmt/iotcentral/src/lib.rs | 8 +- services/mgmt/iothub/src/lib.rs | 8 +- services/mgmt/iotspaces/src/lib.rs | 8 +- services/mgmt/keyvault/src/lib.rs | 8 +- .../mgmt/kubernetesconfiguration/src/lib.rs | 8 +- services/mgmt/labservices/src/lib.rs | 8 +- services/mgmt/logic/src/lib.rs | 8 +- services/mgmt/logz/src/lib.rs | 8 +- services/mgmt/machinelearning/src/lib.rs | 8 +- .../mgmt/machinelearningcompute/src/lib.rs | 8 +- .../machinelearningexperimentation/src/lib.rs | 8 +- .../mgmt/machinelearningservices/src/lib.rs | 8 +- .../src/package_2021_03_01_preview/models.rs | 2116 ++-- .../package_2021_03_01_preview/operations.rs | 1776 +-- services/mgmt/maintenance/src/lib.rs | 8 +- services/mgmt/managednetwork/src/lib.rs | 8 +- services/mgmt/managedservices/src/lib.rs | 8 +- services/mgmt/managementgroups/src/lib.rs | 8 +- services/mgmt/managementpartner/src/lib.rs | 8 +- services/mgmt/maps/src/lib.rs | 8 +- services/mgmt/mariadb/src/lib.rs | 8 +- services/mgmt/marketplace/src/lib.rs | 8 +- .../mgmt/marketplacenotifications/Cargo.toml | 24 + .../mgmt/marketplacenotifications/src/lib.rs | 65 + .../src/package_2021_03_03/mod.rs | 3 + .../src/package_2021_03_03/models.rs | 125 + .../src/package_2021_03_03/operations.rs | 226 + .../src/package_composite_v1/mod.rs | 3 + .../src/package_composite_v1/models.rs | 125 + .../src/package_composite_v1/operations.rs | 226 + services/mgmt/marketplaceordering/src/lib.rs | 8 +- services/mgmt/mediaservices/src/lib.rs | 8 +- services/mgmt/migrate/src/lib.rs | 8 +- services/mgmt/migrateprojects/src/lib.rs | 8 +- services/mgmt/monitor/src/lib.rs | 8 +- services/mgmt/msi/src/lib.rs | 8 +- services/mgmt/mysql/src/lib.rs | 8 +- services/mgmt/notificationhubs/src/lib.rs | 8 +- services/mgmt/operationalinsights/src/lib.rs | 8 +- .../src/package_2020_10/models.rs | 14 +- .../src/package_2020_10_only/models.rs | 14 +- services/mgmt/operationsmanagement/src/lib.rs | 8 +- services/mgmt/peering/src/lib.rs | 8 +- services/mgmt/policyinsights/src/lib.rs | 8 +- services/mgmt/portal/src/lib.rs | 8 +- services/mgmt/postgresql/src/lib.rs | 8 +- services/mgmt/postgresqlhsc/src/lib.rs | 8 +- services/mgmt/powerbidedicated/src/lib.rs | 8 +- services/mgmt/powerbiembedded/src/lib.rs | 8 +- services/mgmt/privatedns/src/lib.rs | 8 +- services/mgmt/providerhub/src/lib.rs | 8 +- services/mgmt/purview/src/lib.rs | 8 +- services/mgmt/quantum/src/lib.rs | 8 +- services/mgmt/recoveryservices/src/lib.rs | 8 +- .../mgmt/recoveryservicesbackup/src/lib.rs | 8 +- .../recoveryservicessiterecovery/src/lib.rs | 8 +- services/mgmt/redhatopenshift/src/lib.rs | 8 +- services/mgmt/redis/src/lib.rs | 8 +- services/mgmt/redisenterprise/src/lib.rs | 8 +- services/mgmt/relay/src/lib.rs | 8 +- services/mgmt/reservations/src/lib.rs | 8 +- services/mgmt/resourcegraph/src/lib.rs | 8 +- services/mgmt/resourcehealth/src/lib.rs | 8 +- services/mgmt/resourcemover/src/lib.rs | 8 +- .../mgmt/resources/examples/group_create.rs | 6 +- services/mgmt/resources/src/lib.rs | 8 +- services/mgmt/saas/src/lib.rs | 8 +- services/mgmt/scheduler/src/lib.rs | 8 +- services/mgmt/search/src/lib.rs | 8 +- services/mgmt/security/src/lib.rs | 8 +- .../mgmt/securityandcompliance/src/lib.rs | 8 +- services/mgmt/securityinsights/src/lib.rs | 8 +- .../package_2021_03_preview_only/models.rs | 192 + .../operations.rs | 862 +- services/mgmt/serialconsole/src/lib.rs | 8 +- services/mgmt/servicebus/src/lib.rs | 8 +- services/mgmt/servicefabricmesh/src/lib.rs | 8 +- services/mgmt/signalr/src/lib.rs | 8 +- services/mgmt/softwareplan/src/lib.rs | 8 +- services/mgmt/sql/src/lib.rs | 8 +- services/mgmt/sqlvirtualmachine/src/lib.rs | 8 +- .../mgmt/stor_simple1200_series/src/lib.rs | 8 +- .../storage/examples/storage_account_list.rs | 6 +- services/mgmt/storage/src/lib.rs | 8 +- services/mgmt/storagecache/src/lib.rs | 8 +- services/mgmt/storageimportexport/src/lib.rs | 8 +- services/mgmt/storagepool/src/lib.rs | 8 +- services/mgmt/storagesync/src/lib.rs | 8 +- services/mgmt/storsimple8000series/src/lib.rs | 8 +- services/mgmt/streamanalytics/src/lib.rs | 8 +- services/mgmt/subscription/src/lib.rs | 8 +- services/mgmt/support/src/lib.rs | 8 +- services/mgmt/testbase/src/lib.rs | 8 +- services/mgmt/timeseriesinsights/src/lib.rs | 8 +- services/mgmt/trafficmanager/src/lib.rs | 8 +- services/mgmt/videoanalyzer/src/lib.rs | 8 +- services/mgmt/visualstudio/src/lib.rs | 8 +- .../examples/vmware_private_cloud_list.rs | 6 +- services/mgmt/vmware/src/lib.rs | 8 +- .../vmware/src/package_2021_06_01/models.rs | 8 +- services/mgmt/vmwarecloudsimple/src/lib.rs | 8 +- services/mgmt/webpubsub/src/lib.rs | 8 +- services/mgmt/windowsesu/src/lib.rs | 8 +- services/mgmt/windowsiot/src/lib.rs | 8 +- services/mgmt/workloadmonitor/src/lib.rs | 8 +- 200 files changed, 18768 insertions(+), 2746 deletions(-) create mode 100644 services/mgmt/cosmos_db/src/package_2021_05/mod.rs create mode 100644 services/mgmt/cosmos_db/src/package_2021_05/models.rs create mode 100644 services/mgmt/cosmos_db/src/package_2021_05/operations.rs create mode 100644 services/mgmt/hybridcompute/src/package_2021_05/mod.rs create mode 100644 services/mgmt/hybridcompute/src/package_2021_05/models.rs create mode 100644 services/mgmt/hybridcompute/src/package_2021_05/operations.rs create mode 100644 services/mgmt/marketplacenotifications/Cargo.toml create mode 100644 services/mgmt/marketplacenotifications/src/lib.rs create mode 100644 services/mgmt/marketplacenotifications/src/package_2021_03_03/mod.rs create mode 100644 services/mgmt/marketplacenotifications/src/package_2021_03_03/models.rs create mode 100644 services/mgmt/marketplacenotifications/src/package_2021_03_03/operations.rs create mode 100644 services/mgmt/marketplacenotifications/src/package_composite_v1/mod.rs create mode 100644 services/mgmt/marketplacenotifications/src/package_composite_v1/models.rs create mode 100644 services/mgmt/marketplacenotifications/src/package_composite_v1/operations.rs diff --git a/services/autorust/codegen/src/lib_rs.rs b/services/autorust/codegen/src/lib_rs.rs index 18ee6f2ce0..4e7fe8ee41 100644 --- a/services/autorust/codegen/src/lib_rs.rs +++ b/services/autorust/codegen/src/lib_rs.rs @@ -45,7 +45,7 @@ fn create_body(feature_mod_names: &Vec<(String, String)>) -> Result use azure_core::setters; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -59,7 +59,7 @@ fn create_body(feature_mod_names: &Vec<(String, String)>) -> Result pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -85,7 +85,7 @@ fn create_body(feature_mod_names: &Vec<(String, String)>) -> Result pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -96,7 +96,7 @@ fn create_body(feature_mod_names: &Vec<(String, String)>) -> Result self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/addons/src/lib.rs b/services/mgmt/addons/src/lib.rs index 171fd9c067..9a97c08a4f 100644 --- a/services/mgmt/addons/src/lib.rs +++ b/services/mgmt/addons/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2017-05")] pub use package_2017_05::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/adhybridhealthservice/src/lib.rs b/services/mgmt/adhybridhealthservice/src/lib.rs index 1d0ed0c337..76769d111e 100644 --- a/services/mgmt/adhybridhealthservice/src/lib.rs +++ b/services/mgmt/adhybridhealthservice/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2014-01")] pub use package_2014_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/adp/src/lib.rs b/services/mgmt/adp/src/lib.rs index bd8b4cf6a3..24c1c7bd5b 100644 --- a/services/mgmt/adp/src/lib.rs +++ b/services/mgmt/adp/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2021-02-01-preview")] pub use package_2021_02_01_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/advisor/src/lib.rs b/services/mgmt/advisor/src/lib.rs index aff0d4978d..1b8fed11d9 100644 --- a/services/mgmt/advisor/src/lib.rs +++ b/services/mgmt/advisor/src/lib.rs @@ -21,7 +21,7 @@ use azure_core::setters; #[cfg(feature = "package-2016-07-preview")] pub use package_2016_07_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -34,7 +34,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -53,7 +53,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -63,7 +63,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/agfood/src/lib.rs b/services/mgmt/agfood/src/lib.rs index c5f3fba524..e3f8d5a76a 100644 --- a/services/mgmt/agfood/src/lib.rs +++ b/services/mgmt/agfood/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-05-12-preview")] pub use package_2020_05_12_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/alertsmanagement/src/lib.rs b/services/mgmt/alertsmanagement/src/lib.rs index af5c347447..a6b63d63d3 100644 --- a/services/mgmt/alertsmanagement/src/lib.rs +++ b/services/mgmt/alertsmanagement/src/lib.rs @@ -37,7 +37,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-08-04-preview")] pub use package_2020_08_04_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -50,7 +50,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -69,7 +69,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -79,7 +79,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/analysisservices/src/lib.rs b/services/mgmt/analysisservices/src/lib.rs index 97c25f7a1d..52a6359c12 100644 --- a/services/mgmt/analysisservices/src/lib.rs +++ b/services/mgmt/analysisservices/src/lib.rs @@ -13,7 +13,7 @@ use azure_core::setters; #[cfg(feature = "package-2016-05")] pub use package_2016_05::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -26,7 +26,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -45,7 +45,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -55,7 +55,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/apimanagement/src/lib.rs b/services/mgmt/apimanagement/src/lib.rs index 61e5a0e752..380e9fee6d 100644 --- a/services/mgmt/apimanagement/src/lib.rs +++ b/services/mgmt/apimanagement/src/lib.rs @@ -29,7 +29,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-06-preview")] pub use package_2018_06_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -42,7 +42,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -61,7 +61,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -71,7 +71,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/appconfiguration/src/lib.rs b/services/mgmt/appconfiguration/src/lib.rs index eb4e4703e4..654c15eae8 100644 --- a/services/mgmt/appconfiguration/src/lib.rs +++ b/services/mgmt/appconfiguration/src/lib.rs @@ -25,7 +25,7 @@ use azure_core::setters; #[cfg(feature = "package-2019-10-01")] pub use package_2019_10_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -38,7 +38,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -57,7 +57,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -67,7 +67,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/applicationinsights/src/lib.rs b/services/mgmt/applicationinsights/src/lib.rs index 7e205aa103..bc1675d27c 100644 --- a/services/mgmt/applicationinsights/src/lib.rs +++ b/services/mgmt/applicationinsights/src/lib.rs @@ -65,7 +65,7 @@ use azure_core::setters; #[cfg(feature = "package-2015-05")] pub use package_2015_05::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -78,7 +78,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -97,7 +97,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -107,7 +107,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/appplatform/src/lib.rs b/services/mgmt/appplatform/src/lib.rs index ee82c9c018..df1209e4aa 100644 --- a/services/mgmt/appplatform/src/lib.rs +++ b/services/mgmt/appplatform/src/lib.rs @@ -17,7 +17,7 @@ use azure_core::setters; #[cfg(feature = "package-2019-05-01-preview")] pub use package_2019_05_01_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -30,7 +30,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -49,7 +49,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -59,7 +59,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/attestation/src/lib.rs b/services/mgmt/attestation/src/lib.rs index 6ce37db001..f371e07229 100644 --- a/services/mgmt/attestation/src/lib.rs +++ b/services/mgmt/attestation/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-10-01")] pub use package_2020_10_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/authorization/src/lib.rs b/services/mgmt/authorization/src/lib.rs index eeddc1640e..0bb7bf381d 100644 --- a/services/mgmt/authorization/src/lib.rs +++ b/services/mgmt/authorization/src/lib.rs @@ -73,7 +73,7 @@ use azure_core::setters; #[cfg(feature = "package-2021-01-01-preview-only")] pub use package_2021_01_01_preview_only::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -86,7 +86,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -105,7 +105,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -115,7 +115,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/automanage/src/lib.rs b/services/mgmt/automanage/src/lib.rs index 3a543ac9b2..10e8105051 100644 --- a/services/mgmt/automanage/src/lib.rs +++ b/services/mgmt/automanage/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-06-30-preview")] pub use package_2020_06_30_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/azure_kusto/src/lib.rs b/services/mgmt/azure_kusto/src/lib.rs index 8bfda80e10..2b8d5529dc 100644 --- a/services/mgmt/azure_kusto/src/lib.rs +++ b/services/mgmt/azure_kusto/src/lib.rs @@ -61,7 +61,7 @@ use azure_core::setters; #[cfg(feature = "schema-2017-09-07-privatepreview")] pub use schema_2017_09_07_privatepreview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -74,7 +74,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -93,7 +93,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -103,7 +103,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/azureactivedirectory/src/lib.rs b/services/mgmt/azureactivedirectory/src/lib.rs index e78d3f3e2c..ec0f4034be 100644 --- a/services/mgmt/azureactivedirectory/src/lib.rs +++ b/services/mgmt/azureactivedirectory/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2017-04-01")] pub use package_2017_04_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/azuredata/src/lib.rs b/services/mgmt/azuredata/src/lib.rs index 6229e12192..c1b806c80f 100644 --- a/services/mgmt/azuredata/src/lib.rs +++ b/services/mgmt/azuredata/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2017-03-01-preview")] pub use package_2017_03_01_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/azurestack/src/lib.rs b/services/mgmt/azurestack/src/lib.rs index 415d1eabd6..7437e9a7d2 100644 --- a/services/mgmt/azurestack/src/lib.rs +++ b/services/mgmt/azurestack/src/lib.rs @@ -13,7 +13,7 @@ use azure_core::setters; #[cfg(feature = "package-preview-2020-06")] pub use package_preview_2020_06::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -26,7 +26,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -45,7 +45,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -55,7 +55,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/baremetalinfrastructure/src/lib.rs b/services/mgmt/baremetalinfrastructure/src/lib.rs index 5e128eb315..b845ffdffe 100644 --- a/services/mgmt/baremetalinfrastructure/src/lib.rs +++ b/services/mgmt/baremetalinfrastructure/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-08-06-preview")] pub use package_2020_08_06_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/batch/src/lib.rs b/services/mgmt/batch/src/lib.rs index 1f394cdf18..7eea016199 100644 --- a/services/mgmt/batch/src/lib.rs +++ b/services/mgmt/batch/src/lib.rs @@ -33,7 +33,7 @@ use azure_core::setters; #[cfg(feature = "package-2017-09")] pub use package_2017_09::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -46,7 +46,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -65,7 +65,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -75,7 +75,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/batchai/src/lib.rs b/services/mgmt/batchai/src/lib.rs index cdafecc1b0..a41dcc6ccf 100644 --- a/services/mgmt/batchai/src/lib.rs +++ b/services/mgmt/batchai/src/lib.rs @@ -13,7 +13,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-05")] pub use package_2018_05::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -26,7 +26,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -45,7 +45,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -55,7 +55,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/billing/src/lib.rs b/services/mgmt/billing/src/lib.rs index 73c3171688..8a84905010 100644 --- a/services/mgmt/billing/src/lib.rs +++ b/services/mgmt/billing/src/lib.rs @@ -29,7 +29,7 @@ use azure_core::setters; #[cfg(feature = "package-2017-02-preview")] pub use package_2017_02_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -42,7 +42,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -61,7 +61,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -71,7 +71,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/blockchain/src/lib.rs b/services/mgmt/blockchain/src/lib.rs index 29265f8087..8dbcd8f05e 100644 --- a/services/mgmt/blockchain/src/lib.rs +++ b/services/mgmt/blockchain/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-06-01-preview")] pub use package_2018_06_01_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/blueprint/src/lib.rs b/services/mgmt/blueprint/src/lib.rs index b37072f42f..935c29f47f 100644 --- a/services/mgmt/blueprint/src/lib.rs +++ b/services/mgmt/blueprint/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-11-preview")] pub use package_2018_11_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/botservice/src/lib.rs b/services/mgmt/botservice/src/lib.rs index 5e7de822f9..c6570b54bd 100644 --- a/services/mgmt/botservice/src/lib.rs +++ b/services/mgmt/botservice/src/lib.rs @@ -21,7 +21,7 @@ use azure_core::setters; #[cfg(feature = "package-2017-12-01")] pub use package_2017_12_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -34,7 +34,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -53,7 +53,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -63,7 +63,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/cdn/src/lib.rs b/services/mgmt/cdn/src/lib.rs index 4bc546d783..5952a6463f 100644 --- a/services/mgmt/cdn/src/lib.rs +++ b/services/mgmt/cdn/src/lib.rs @@ -45,7 +45,7 @@ use azure_core::setters; #[cfg(feature = "package-2015-06")] pub use package_2015_06::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -58,7 +58,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -77,7 +77,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -87,7 +87,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/changeanalysis/src/lib.rs b/services/mgmt/changeanalysis/src/lib.rs index 9003fdd230..15fd309774 100644 --- a/services/mgmt/changeanalysis/src/lib.rs +++ b/services/mgmt/changeanalysis/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2021-04-01")] pub use package_2021_04_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/cloudshell/src/lib.rs b/services/mgmt/cloudshell/src/lib.rs index 9803b4d69b..dcba17f273 100644 --- a/services/mgmt/cloudshell/src/lib.rs +++ b/services/mgmt/cloudshell/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-10-01")] pub use package_2018_10_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/cognitiveservices/src/lib.rs b/services/mgmt/cognitiveservices/src/lib.rs index f5aaa0dc1b..96c1b8641e 100644 --- a/services/mgmt/cognitiveservices/src/lib.rs +++ b/services/mgmt/cognitiveservices/src/lib.rs @@ -13,7 +13,7 @@ use azure_core::setters; #[cfg(feature = "package-2016-02-preview")] pub use package_2016_02_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -26,7 +26,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -45,7 +45,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -55,7 +55,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/commerce/src/lib.rs b/services/mgmt/commerce/src/lib.rs index 17d9b2b436..3707028fee 100644 --- a/services/mgmt/commerce/src/lib.rs +++ b/services/mgmt/commerce/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "profile-hybrid-2020-09-01")] pub use profile_hybrid_2020_09_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/communication/src/lib.rs b/services/mgmt/communication/src/lib.rs index 23766fbadc..992a5ffb2f 100644 --- a/services/mgmt/communication/src/lib.rs +++ b/services/mgmt/communication/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-08-20-preview")] pub use package_2020_08_20_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/compute/examples/vm_list.rs b/services/mgmt/compute/examples/vm_list.rs index 46f8cc1e89..2456d259c4 100644 --- a/services/mgmt/compute/examples/vm_list.rs +++ b/services/mgmt/compute/examples/vm_list.rs @@ -8,11 +8,9 @@ cargo run --example vm_list use azure_identity::token_credentials::AzureCliCredential; use azure_mgmt_compute::operations::virtual_machines; -type Result = std::result::Result>; - #[tokio::main] -async fn main() -> Result<()> { - let http_client: std::sync::Arc> = std::sync::Arc::new(Box::new(reqwest::Client::new())); +async fn main() -> Result<(), Box> { + let http_client = azure_core::new_http_client(); let token_credential = AzureCliCredential {}; let subscription_id = &AzureCliCredential::get_subscription()?; let config = &azure_mgmt_compute::config(http_client, Box::new(token_credential)).build(); diff --git a/services/mgmt/compute/src/lib.rs b/services/mgmt/compute/src/lib.rs index eede07a666..e68d307e75 100644 --- a/services/mgmt/compute/src/lib.rs +++ b/services/mgmt/compute/src/lib.rs @@ -193,7 +193,7 @@ use azure_core::setters; #[cfg(feature = "package-2015-06-preview")] pub use package_2015_06_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -206,7 +206,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -225,7 +225,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -235,7 +235,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/confidentialledger/src/lib.rs b/services/mgmt/confidentialledger/src/lib.rs index 920e33bbfd..eee4dd1197 100644 --- a/services/mgmt/confidentialledger/src/lib.rs +++ b/services/mgmt/confidentialledger/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-12-01-preview")] pub use package_2020_12_01_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/confluent/src/lib.rs b/services/mgmt/confluent/src/lib.rs index d23087c58b..1b4721222e 100644 --- a/services/mgmt/confluent/src/lib.rs +++ b/services/mgmt/confluent/src/lib.rs @@ -13,7 +13,7 @@ use azure_core::setters; #[cfg(feature = "package-2021-03-01-preview")] pub use package_2021_03_01_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -26,7 +26,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -45,7 +45,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -55,7 +55,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/consumption/src/lib.rs b/services/mgmt/consumption/src/lib.rs index 67e6abbd12..8e688f1431 100644 --- a/services/mgmt/consumption/src/lib.rs +++ b/services/mgmt/consumption/src/lib.rs @@ -57,7 +57,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-10")] pub use package_2018_10::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -70,7 +70,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -89,7 +89,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -99,7 +99,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/containerinstance/src/lib.rs b/services/mgmt/containerinstance/src/lib.rs index 303704007e..e050132a52 100644 --- a/services/mgmt/containerinstance/src/lib.rs +++ b/services/mgmt/containerinstance/src/lib.rs @@ -45,7 +45,7 @@ use azure_core::setters; #[cfg(feature = "package-2017-08-preview")] pub use package_2017_08_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -58,7 +58,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -77,7 +77,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -87,7 +87,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/containerregistry/src/lib.rs b/services/mgmt/containerregistry/src/lib.rs index b362e0cd31..16c7ed297e 100644 --- a/services/mgmt/containerregistry/src/lib.rs +++ b/services/mgmt/containerregistry/src/lib.rs @@ -81,7 +81,7 @@ use azure_core::setters; #[cfg(feature = "package-2016-06-preview")] pub use package_2016_06_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -94,7 +94,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -113,7 +113,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -123,7 +123,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/containerservice/src/lib.rs b/services/mgmt/containerservice/src/lib.rs index 8e2139728b..cbcfeb4f48 100644 --- a/services/mgmt/containerservice/src/lib.rs +++ b/services/mgmt/containerservice/src/lib.rs @@ -217,7 +217,7 @@ use azure_core::setters; #[cfg(feature = "package-2016-03-only")] pub use package_2016_03_only::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -230,7 +230,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -249,7 +249,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -259,7 +259,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/cosmos_db/Cargo.toml b/services/mgmt/cosmos_db/Cargo.toml index 19b892f104..c4af94c742 100644 --- a/services/mgmt/cosmos_db/Cargo.toml +++ b/services/mgmt/cosmos_db/Cargo.toml @@ -19,7 +19,8 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1.0" } tokio = { version = "1.0", features = ["macros"] } [features] -default = ["package-2021-04"] +default = ["package-2021-05"] +"package-2021-05" = [] "package-2021-04" = [] "package-2021-04-preview" = [] "package-2021-03" = [] diff --git a/services/mgmt/cosmos_db/src/lib.rs b/services/mgmt/cosmos_db/src/lib.rs index 175eb2d055..0205ce2de6 100644 --- a/services/mgmt/cosmos_db/src/lib.rs +++ b/services/mgmt/cosmos_db/src/lib.rs @@ -1,4 +1,8 @@ #![doc = "generated by AutoRust 0.1.0"] +#[cfg(feature = "package-2021-05")] +mod package_2021_05; +#[cfg(feature = "package-2021-05")] +pub use package_2021_05::{models, operations, API_VERSION}; #[cfg(feature = "package-2021-04")] mod package_2021_04; #[cfg(feature = "package-2021-04")] @@ -73,7 +77,7 @@ use azure_core::setters; #[cfg(feature = "package-2016-03-31")] pub use package_2016_03_31::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -86,7 +90,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -105,7 +109,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -115,7 +119,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/cosmos_db/src/package_2021_05/mod.rs b/services/mgmt/cosmos_db/src/package_2021_05/mod.rs new file mode 100644 index 0000000000..fd3232e674 --- /dev/null +++ b/services/mgmt/cosmos_db/src/package_2021_05/mod.rs @@ -0,0 +1,3 @@ +pub mod models; +pub mod operations; +pub const API_VERSION: &str = "2021-05-15"; diff --git a/services/mgmt/cosmos_db/src/package_2021_05/models.rs b/services/mgmt/cosmos_db/src/package_2021_05/models.rs new file mode 100644 index 0000000000..e800442f0c --- /dev/null +++ b/services/mgmt/cosmos_db/src/package_2021_05/models.rs @@ -0,0 +1,1626 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatabaseAccountsListResult { + #[serde(skip_serializing)] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlDatabaseListResult { + #[serde(skip_serializing)] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlContainerListResult { + #[serde(skip_serializing)] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlStoredProcedureListResult { + #[serde(skip_serializing)] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlUserDefinedFunctionListResult { + #[serde(skip_serializing)] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlTriggerListResult { + #[serde(skip_serializing)] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbDatabaseListResult { + #[serde(skip_serializing)] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbCollectionListResult { + #[serde(skip_serializing)] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TableListResult { + #[serde(skip_serializing)] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CassandraKeyspaceListResult { + #[serde(skip_serializing)] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CassandraTableListResult { + #[serde(skip_serializing)] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GremlinDatabaseListResult { + #[serde(skip_serializing)] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GremlinGraphListResult { + #[serde(skip_serializing)] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorResponse { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CloudError { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FailoverPolicies { + #[serde(rename = "failoverPolicies")] + pub failover_policies: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FailoverPolicy { + #[serde(skip_serializing)] + pub id: Option, + #[serde(rename = "locationName", default, skip_serializing_if = "Option::is_none")] + pub location_name: Option, + #[serde(rename = "failoverPriority", default, skip_serializing_if = "Option::is_none")] + pub failover_priority: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RegionForOnlineOffline { + pub region: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Location { + #[serde(skip_serializing)] + pub id: Option, + #[serde(rename = "locationName", default, skip_serializing_if = "Option::is_none")] + pub location_name: Option, + #[serde(rename = "documentEndpoint", skip_serializing)] + pub document_endpoint: Option, + #[serde(rename = "provisioningState", skip_serializing)] + pub provisioning_state: Option, + #[serde(rename = "failoverPriority", default, skip_serializing_if = "Option::is_none")] + pub failover_priority: Option, + #[serde(rename = "isZoneRedundant", default, skip_serializing_if = "Option::is_none")] + pub is_zone_redundant: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ArmResourceProperties { + #[serde(skip_serializing)] + pub id: Option, + #[serde(skip_serializing)] + pub name: Option, + #[serde(rename = "type", skip_serializing)] + pub type_: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ArmProxyResource { + #[serde(skip_serializing)] + pub id: Option, + #[serde(skip_serializing)] + pub name: Option, + #[serde(rename = "type", skip_serializing)] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatabaseAccountGetResults { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kind: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +pub mod database_account_get_results { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Kind { + #[serde(rename = "GlobalDocumentDB")] + GlobalDocumentDb, + #[serde(rename = "MongoDB")] + MongoDb, + Parse, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExtendedResourceProperties { + #[serde(rename = "_rid", skip_serializing)] + pub rid: Option, + #[serde(rename = "_ts", skip_serializing)] + pub ts: Option, + #[serde(rename = "_etag", skip_serializing)] + pub etag: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ThroughputSettingsGetResults { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ThroughputSettingsGetProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlDatabaseGetResults { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlDatabaseGetProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +pub mod sql_database_get_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Resource { + #[serde(flatten)] + pub sql_database_resource: SqlDatabaseResource, + #[serde(flatten)] + pub extended_resource_properties: ExtendedResourceProperties, + #[serde(rename = "_colls", default, skip_serializing_if = "Option::is_none")] + pub colls: Option, + #[serde(rename = "_users", default, skip_serializing_if = "Option::is_none")] + pub users: Option, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlContainerGetResults { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlContainerGetProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlStoredProcedureGetResults { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlStoredProcedureGetProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlUserDefinedFunctionGetResults { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlUserDefinedFunctionGetProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlTriggerGetResults { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlTriggerGetProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbDatabaseGetResults { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbDatabaseGetProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbCollectionGetResults { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbCollectionGetProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TableGetResults { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TableGetProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CassandraKeyspaceGetResults { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CassandraKeyspaceGetProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CassandraTableGetResults { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CassandraTableGetProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GremlinDatabaseGetResults { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GremlinDatabaseGetProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GremlinGraphGetResults { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GremlinGraphGetProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConsistencyPolicy { + #[serde(rename = "defaultConsistencyLevel")] + pub default_consistency_level: consistency_policy::DefaultConsistencyLevel, + #[serde(rename = "maxStalenessPrefix", default, skip_serializing_if = "Option::is_none")] + pub max_staleness_prefix: Option, + #[serde(rename = "maxIntervalInSeconds", default, skip_serializing_if = "Option::is_none")] + pub max_interval_in_seconds: Option, +} +pub mod consistency_policy { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DefaultConsistencyLevel { + Eventual, + Session, + BoundedStaleness, + Strong, + ConsistentPrefix, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CorsPolicy { + #[serde(rename = "allowedOrigins")] + pub allowed_origins: String, + #[serde(rename = "allowedMethods", default, skip_serializing_if = "Option::is_none")] + pub allowed_methods: Option, + #[serde(rename = "allowedHeaders", default, skip_serializing_if = "Option::is_none")] + pub allowed_headers: Option, + #[serde(rename = "exposedHeaders", default, skip_serializing_if = "Option::is_none")] + pub exposed_headers: Option, + #[serde(rename = "maxAgeInSeconds", default, skip_serializing_if = "Option::is_none")] + pub max_age_in_seconds: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatabaseAccountGetProperties { + #[serde(rename = "provisioningState", skip_serializing)] + pub provisioning_state: Option, + #[serde(rename = "documentEndpoint", skip_serializing)] + pub document_endpoint: Option, + #[serde(rename = "databaseAccountOfferType", default, skip_serializing_if = "Option::is_none")] + pub database_account_offer_type: Option, + #[serde(rename = "ipRules", default, skip_serializing_if = "Option::is_none")] + pub ip_rules: Option, + #[serde(rename = "isVirtualNetworkFilterEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_virtual_network_filter_enabled: Option, + #[serde(rename = "enableAutomaticFailover", default, skip_serializing_if = "Option::is_none")] + pub enable_automatic_failover: Option, + #[serde(rename = "consistencyPolicy", default, skip_serializing_if = "Option::is_none")] + pub consistency_policy: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub capabilities: Vec, + #[serde(rename = "writeLocations", skip_serializing)] + pub write_locations: Vec, + #[serde(rename = "readLocations", skip_serializing)] + pub read_locations: Vec, + #[serde(skip_serializing)] + pub locations: Vec, + #[serde(rename = "failoverPolicies", skip_serializing)] + pub failover_policies: Vec, + #[serde(rename = "virtualNetworkRules", default, skip_serializing_if = "Vec::is_empty")] + pub virtual_network_rules: Vec, + #[serde(rename = "privateEndpointConnections", skip_serializing)] + pub private_endpoint_connections: Vec, + #[serde(rename = "enableMultipleWriteLocations", default, skip_serializing_if = "Option::is_none")] + pub enable_multiple_write_locations: Option, + #[serde(rename = "enableCassandraConnector", default, skip_serializing_if = "Option::is_none")] + pub enable_cassandra_connector: Option, + #[serde(rename = "connectorOffer", default, skip_serializing_if = "Option::is_none")] + pub connector_offer: Option, + #[serde(rename = "disableKeyBasedMetadataWriteAccess", default, skip_serializing_if = "Option::is_none")] + pub disable_key_based_metadata_write_access: Option, + #[serde(rename = "keyVaultKeyUri", default, skip_serializing_if = "Option::is_none")] + pub key_vault_key_uri: Option, + #[serde(rename = "defaultIdentity", default, skip_serializing_if = "Option::is_none")] + pub default_identity: Option, + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, + #[serde(rename = "enableFreeTier", default, skip_serializing_if = "Option::is_none")] + pub enable_free_tier: Option, + #[serde(rename = "apiProperties", default, skip_serializing_if = "Option::is_none")] + pub api_properties: Option, + #[serde(rename = "enableAnalyticalStorage", default, skip_serializing_if = "Option::is_none")] + pub enable_analytical_storage: Option, + #[serde(rename = "analyticalStorageConfiguration", default, skip_serializing_if = "Option::is_none")] + pub analytical_storage_configuration: Option, + #[serde(rename = "backupPolicy", default, skip_serializing_if = "Option::is_none")] + pub backup_policy: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub cors: Vec, + #[serde(rename = "networkAclBypass", default, skip_serializing_if = "Option::is_none")] + pub network_acl_bypass: Option, + #[serde(rename = "networkAclBypassResourceIds", default, skip_serializing_if = "Vec::is_empty")] + pub network_acl_bypass_resource_ids: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatabaseAccountCreateUpdateProperties { + #[serde(rename = "consistencyPolicy", default, skip_serializing_if = "Option::is_none")] + pub consistency_policy: Option, + pub locations: Vec, + #[serde(rename = "databaseAccountOfferType")] + pub database_account_offer_type: DatabaseAccountOfferType, + #[serde(rename = "ipRules", default, skip_serializing_if = "Option::is_none")] + pub ip_rules: Option, + #[serde(rename = "isVirtualNetworkFilterEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_virtual_network_filter_enabled: Option, + #[serde(rename = "enableAutomaticFailover", default, skip_serializing_if = "Option::is_none")] + pub enable_automatic_failover: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub capabilities: Vec, + #[serde(rename = "virtualNetworkRules", default, skip_serializing_if = "Vec::is_empty")] + pub virtual_network_rules: Vec, + #[serde(rename = "enableMultipleWriteLocations", default, skip_serializing_if = "Option::is_none")] + pub enable_multiple_write_locations: Option, + #[serde(rename = "enableCassandraConnector", default, skip_serializing_if = "Option::is_none")] + pub enable_cassandra_connector: Option, + #[serde(rename = "connectorOffer", default, skip_serializing_if = "Option::is_none")] + pub connector_offer: Option, + #[serde(rename = "disableKeyBasedMetadataWriteAccess", default, skip_serializing_if = "Option::is_none")] + pub disable_key_based_metadata_write_access: Option, + #[serde(rename = "keyVaultKeyUri", default, skip_serializing_if = "Option::is_none")] + pub key_vault_key_uri: Option, + #[serde(rename = "defaultIdentity", default, skip_serializing_if = "Option::is_none")] + pub default_identity: Option, + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, + #[serde(rename = "enableFreeTier", default, skip_serializing_if = "Option::is_none")] + pub enable_free_tier: Option, + #[serde(rename = "apiProperties", default, skip_serializing_if = "Option::is_none")] + pub api_properties: Option, + #[serde(rename = "enableAnalyticalStorage", default, skip_serializing_if = "Option::is_none")] + pub enable_analytical_storage: Option, + #[serde(rename = "analyticalStorageConfiguration", default, skip_serializing_if = "Option::is_none")] + pub analytical_storage_configuration: Option, + #[serde(rename = "backupPolicy", default, skip_serializing_if = "Option::is_none")] + pub backup_policy: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub cors: Vec, + #[serde(rename = "networkAclBypass", default, skip_serializing_if = "Option::is_none")] + pub network_acl_bypass: Option, + #[serde(rename = "networkAclBypassResourceIds", default, skip_serializing_if = "Vec::is_empty")] + pub network_acl_bypass_resource_ids: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatabaseAccountCreateUpdateParameters { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kind: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + pub properties: DatabaseAccountCreateUpdateProperties, +} +pub mod database_account_create_update_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Kind { + #[serde(rename = "GlobalDocumentDB")] + GlobalDocumentDb, + #[serde(rename = "MongoDB")] + MongoDb, + Parse, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatabaseAccountUpdateProperties { + #[serde(rename = "consistencyPolicy", default, skip_serializing_if = "Option::is_none")] + pub consistency_policy: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub locations: Vec, + #[serde(rename = "ipRules", default, skip_serializing_if = "Option::is_none")] + pub ip_rules: Option, + #[serde(rename = "isVirtualNetworkFilterEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_virtual_network_filter_enabled: Option, + #[serde(rename = "enableAutomaticFailover", default, skip_serializing_if = "Option::is_none")] + pub enable_automatic_failover: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub capabilities: Vec, + #[serde(rename = "virtualNetworkRules", default, skip_serializing_if = "Vec::is_empty")] + pub virtual_network_rules: Vec, + #[serde(rename = "enableMultipleWriteLocations", default, skip_serializing_if = "Option::is_none")] + pub enable_multiple_write_locations: Option, + #[serde(rename = "enableCassandraConnector", default, skip_serializing_if = "Option::is_none")] + pub enable_cassandra_connector: Option, + #[serde(rename = "connectorOffer", default, skip_serializing_if = "Option::is_none")] + pub connector_offer: Option, + #[serde(rename = "disableKeyBasedMetadataWriteAccess", default, skip_serializing_if = "Option::is_none")] + pub disable_key_based_metadata_write_access: Option, + #[serde(rename = "keyVaultKeyUri", default, skip_serializing_if = "Option::is_none")] + pub key_vault_key_uri: Option, + #[serde(rename = "defaultIdentity", default, skip_serializing_if = "Option::is_none")] + pub default_identity: Option, + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, + #[serde(rename = "enableFreeTier", default, skip_serializing_if = "Option::is_none")] + pub enable_free_tier: Option, + #[serde(rename = "apiProperties", default, skip_serializing_if = "Option::is_none")] + pub api_properties: Option, + #[serde(rename = "enableAnalyticalStorage", default, skip_serializing_if = "Option::is_none")] + pub enable_analytical_storage: Option, + #[serde(rename = "analyticalStorageConfiguration", default, skip_serializing_if = "Option::is_none")] + pub analytical_storage_configuration: Option, + #[serde(rename = "backupPolicy", default, skip_serializing_if = "Option::is_none")] + pub backup_policy: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub cors: Vec, + #[serde(rename = "networkAclBypass", default, skip_serializing_if = "Option::is_none")] + pub network_acl_bypass: Option, + #[serde(rename = "networkAclBypassResourceIds", default, skip_serializing_if = "Vec::is_empty")] + pub network_acl_bypass_resource_ids: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatabaseAccountUpdateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatabaseAccountListReadOnlyKeysResult { + #[serde(rename = "primaryReadonlyMasterKey", skip_serializing)] + pub primary_readonly_master_key: Option, + #[serde(rename = "secondaryReadonlyMasterKey", skip_serializing)] + pub secondary_readonly_master_key: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatabaseAccountListKeysResult { + #[serde(flatten)] + pub database_account_list_read_only_keys_result: DatabaseAccountListReadOnlyKeysResult, + #[serde(rename = "primaryMasterKey", skip_serializing)] + pub primary_master_key: Option, + #[serde(rename = "secondaryMasterKey", skip_serializing)] + pub secondary_master_key: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatabaseAccountConnectionString { + #[serde(rename = "connectionString", skip_serializing)] + pub connection_string: Option, + #[serde(skip_serializing)] + pub description: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatabaseAccountListConnectionStringsResult { + #[serde(rename = "connectionStrings", default, skip_serializing_if = "Vec::is_empty")] + pub connection_strings: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DatabaseAccountRegenerateKeyParameters { + #[serde(rename = "keyKind")] + pub key_kind: database_account_regenerate_key_parameters::KeyKind, +} +pub mod database_account_regenerate_key_parameters { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum KeyKind { + #[serde(rename = "primary")] + Primary, + #[serde(rename = "secondary")] + Secondary, + #[serde(rename = "primaryReadonly")] + PrimaryReadonly, + #[serde(rename = "secondaryReadonly")] + SecondaryReadonly, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum DatabaseAccountOfferType { + Standard, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ThroughputSettingsUpdateParameters { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + pub properties: ThroughputSettingsUpdateProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ThroughputSettingsUpdateProperties { + pub resource: ThroughputSettingsResource, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlDatabaseCreateUpdateParameters { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + pub properties: SqlDatabaseCreateUpdateProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlDatabaseCreateUpdateProperties { + pub resource: SqlDatabaseResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlContainerCreateUpdateParameters { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + pub properties: SqlContainerCreateUpdateProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlContainerCreateUpdateProperties { + pub resource: SqlContainerResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlStoredProcedureCreateUpdateParameters { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + pub properties: SqlStoredProcedureCreateUpdateProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlStoredProcedureCreateUpdateProperties { + pub resource: SqlStoredProcedureResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlUserDefinedFunctionCreateUpdateParameters { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + pub properties: SqlUserDefinedFunctionCreateUpdateProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlUserDefinedFunctionCreateUpdateProperties { + pub resource: SqlUserDefinedFunctionResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlTriggerCreateUpdateParameters { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + pub properties: SqlTriggerCreateUpdateProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlTriggerCreateUpdateProperties { + pub resource: SqlTriggerResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbDatabaseCreateUpdateParameters { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + pub properties: MongoDbDatabaseCreateUpdateProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbDatabaseCreateUpdateProperties { + pub resource: MongoDbDatabaseResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbCollectionCreateUpdateParameters { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + pub properties: MongoDbCollectionCreateUpdateProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbCollectionCreateUpdateProperties { + pub resource: MongoDbCollectionResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TableCreateUpdateParameters { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + pub properties: TableCreateUpdateProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TableCreateUpdateProperties { + pub resource: TableResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CassandraKeyspaceCreateUpdateParameters { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + pub properties: CassandraKeyspaceCreateUpdateProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CassandraKeyspaceCreateUpdateProperties { + pub resource: CassandraKeyspaceResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CassandraTableCreateUpdateParameters { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + pub properties: CassandraTableCreateUpdateProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CassandraTableCreateUpdateProperties { + pub resource: CassandraTableResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GremlinDatabaseCreateUpdateParameters { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + pub properties: GremlinDatabaseCreateUpdateProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GremlinDatabaseCreateUpdateProperties { + pub resource: GremlinDatabaseResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GremlinGraphCreateUpdateParameters { + #[serde(flatten)] + pub arm_resource_properties: ArmResourceProperties, + pub properties: GremlinGraphCreateUpdateProperties, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GremlinGraphCreateUpdateProperties { + pub resource: GremlinGraphResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ThroughputSettingsResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub throughput: Option, + #[serde(rename = "autoscaleSettings", default, skip_serializing_if = "Option::is_none")] + pub autoscale_settings: Option, + #[serde(rename = "minimumThroughput", skip_serializing)] + pub minimum_throughput: Option, + #[serde(rename = "offerReplacePending", skip_serializing)] + pub offer_replace_pending: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AutoscaleSettingsResource { + #[serde(rename = "maxThroughput")] + pub max_throughput: i64, + #[serde(rename = "autoUpgradePolicy", default, skip_serializing_if = "Option::is_none")] + pub auto_upgrade_policy: Option, + #[serde(rename = "targetMaxThroughput", skip_serializing)] + pub target_max_throughput: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AutoUpgradePolicyResource { + #[serde(rename = "throughputPolicy", default, skip_serializing_if = "Option::is_none")] + pub throughput_policy: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ThroughputPolicyResource { + #[serde(rename = "isEnabled", default, skip_serializing_if = "Option::is_none")] + pub is_enabled: Option, + #[serde(rename = "incrementPercent", default, skip_serializing_if = "Option::is_none")] + pub increment_percent: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OptionsResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub throughput: Option, + #[serde(rename = "autoscaleSettings", default, skip_serializing_if = "Option::is_none")] + pub autoscale_settings: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlDatabaseResource { + pub id: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlContainerResource { + pub id: String, + #[serde(rename = "indexingPolicy", default, skip_serializing_if = "Option::is_none")] + pub indexing_policy: Option, + #[serde(rename = "partitionKey", default, skip_serializing_if = "Option::is_none")] + pub partition_key: Option, + #[serde(rename = "defaultTtl", default, skip_serializing_if = "Option::is_none")] + pub default_ttl: Option, + #[serde(rename = "uniqueKeyPolicy", default, skip_serializing_if = "Option::is_none")] + pub unique_key_policy: Option, + #[serde(rename = "conflictResolutionPolicy", default, skip_serializing_if = "Option::is_none")] + pub conflict_resolution_policy: Option, + #[serde(rename = "analyticalStorageTtl", default, skip_serializing_if = "Option::is_none")] + pub analytical_storage_ttl: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IndexingPolicy { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub automatic: Option, + #[serde(rename = "indexingMode", default, skip_serializing_if = "Option::is_none")] + pub indexing_mode: Option, + #[serde(rename = "includedPaths", default, skip_serializing_if = "Vec::is_empty")] + pub included_paths: Vec, + #[serde(rename = "excludedPaths", default, skip_serializing_if = "Vec::is_empty")] + pub excluded_paths: Vec, + #[serde(rename = "compositeIndexes", default, skip_serializing_if = "Vec::is_empty")] + pub composite_indexes: Vec, + #[serde(rename = "spatialIndexes", default, skip_serializing_if = "Vec::is_empty")] + pub spatial_indexes: Vec, +} +pub mod indexing_policy { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum IndexingMode { + #[serde(rename = "consistent")] + Consistent, + #[serde(rename = "lazy")] + Lazy, + #[serde(rename = "none")] + None, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExcludedPath { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IncludedPath { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub indexes: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Indexes { + #[serde(rename = "dataType", default, skip_serializing_if = "Option::is_none")] + pub data_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub precision: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kind: Option, +} +pub mod indexes { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum DataType { + String, + Number, + Point, + Polygon, + LineString, + MultiPolygon, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Kind { + Hash, + Range, + Spatial, + } +} +pub type CompositePathList = Vec; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CompositePath { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub order: Option, +} +pub mod composite_path { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Order { + #[serde(rename = "ascending")] + Ascending, + #[serde(rename = "descending")] + Descending, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SpatialSpec { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub types: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum SpatialType { + Point, + LineString, + Polygon, + MultiPolygon, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContainerPartitionKey { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub paths: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kind: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(rename = "systemKey", skip_serializing)] + pub system_key: Option, +} +pub mod container_partition_key { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Kind { + Hash, + Range, + MultiHash, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Path {} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UniqueKeyPolicy { + #[serde(rename = "uniqueKeys", default, skip_serializing_if = "Vec::is_empty")] + pub unique_keys: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UniqueKey { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub paths: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConflictResolutionPolicy { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub mode: Option, + #[serde(rename = "conflictResolutionPath", default, skip_serializing_if = "Option::is_none")] + pub conflict_resolution_path: Option, + #[serde(rename = "conflictResolutionProcedure", default, skip_serializing_if = "Option::is_none")] + pub conflict_resolution_procedure: Option, +} +pub mod conflict_resolution_policy { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Mode { + LastWriterWins, + Custom, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlStoredProcedureResource { + pub id: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub body: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlUserDefinedFunctionResource { + pub id: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub body: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlTriggerResource { + pub id: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub body: Option, + #[serde(rename = "triggerType", default, skip_serializing_if = "Option::is_none")] + pub trigger_type: Option, + #[serde(rename = "triggerOperation", default, skip_serializing_if = "Option::is_none")] + pub trigger_operation: Option, +} +pub mod sql_trigger_resource { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TriggerType { + Pre, + Post, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum TriggerOperation { + All, + Create, + Update, + Delete, + Replace, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbDatabaseResource { + pub id: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoDbCollectionResource { + pub id: String, + #[serde(rename = "shardKey", default, skip_serializing_if = "Option::is_none")] + pub shard_key: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub indexes: Vec, + #[serde(rename = "analyticalStorageTtl", default, skip_serializing_if = "Option::is_none")] + pub analytical_storage_ttl: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ShardKeys {} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoIndex { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub key: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub options: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoIndexKeys { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub keys: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Key {} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MongoIndexOptions { + #[serde(rename = "expireAfterSeconds", default, skip_serializing_if = "Option::is_none")] + pub expire_after_seconds: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub unique: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TableResource { + pub id: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CassandraKeyspaceResource { + pub id: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CassandraTableResource { + pub id: String, + #[serde(rename = "defaultTtl", default, skip_serializing_if = "Option::is_none")] + pub default_ttl: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[serde(rename = "analyticalStorageTtl", default, skip_serializing_if = "Option::is_none")] + pub analytical_storage_ttl: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CassandraSchema { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub columns: Vec, + #[serde(rename = "partitionKeys", default, skip_serializing_if = "Vec::is_empty")] + pub partition_keys: Vec, + #[serde(rename = "clusterKeys", default, skip_serializing_if = "Vec::is_empty")] + pub cluster_keys: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Column { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CassandraPartitionKey { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ClusterKey { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "orderBy", default, skip_serializing_if = "Option::is_none")] + pub order_by: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GremlinDatabaseResource { + pub id: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GremlinGraphResource { + pub id: String, + #[serde(rename = "indexingPolicy", default, skip_serializing_if = "Option::is_none")] + pub indexing_policy: Option, + #[serde(rename = "partitionKey", default, skip_serializing_if = "Option::is_none")] + pub partition_key: Option, + #[serde(rename = "defaultTtl", default, skip_serializing_if = "Option::is_none")] + pub default_ttl: Option, + #[serde(rename = "uniqueKeyPolicy", default, skip_serializing_if = "Option::is_none")] + pub unique_key_policy: Option, + #[serde(rename = "conflictResolutionPolicy", default, skip_serializing_if = "Option::is_none")] + pub conflict_resolution_policy: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CreateUpdateOptions { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub throughput: Option, + #[serde(rename = "autoscaleSettings", default, skip_serializing_if = "Option::is_none")] + pub autoscale_settings: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AutoscaleSettings { + #[serde(rename = "maxThroughput", default, skip_serializing_if = "Option::is_none")] + pub max_throughput: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Capability { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Tags {} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ManagedServiceIdentity { + #[serde(rename = "principalId", skip_serializing)] + pub principal_id: Option, + #[serde(rename = "tenantId", skip_serializing)] + pub tenant_id: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Option::is_none")] + pub user_assigned_identities: Option, +} +pub mod managed_service_identity { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SystemAssigned, + UserAssigned, + #[serde(rename = "SystemAssigned,UserAssigned")] + SystemAssignedUserAssigned, + None, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProvisioningState {} +pub type IpRules = Vec; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IpAddressOrRange { + #[serde(rename = "ipAddressOrRange", default, skip_serializing_if = "Option::is_none")] + pub ip_address_or_range: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct VirtualNetworkRule { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "ignoreMissingVNetServiceEndpoint", default, skip_serializing_if = "Option::is_none")] + pub ignore_missing_v_net_service_endpoint: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum NetworkAclBypass { + None, + AzureServices, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Operation { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, +} +pub mod operation { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Display { + #[serde(rename = "Provider", default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[serde(rename = "Resource", default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(rename = "Operation", default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(rename = "Description", default, skip_serializing_if = "Option::is_none")] + pub description: Option, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct UsagesResult { + #[serde(skip_serializing)] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Usage { + #[serde(skip_serializing)] + pub unit: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "quotaPeriod", skip_serializing)] + pub quota_period: Option, + #[serde(skip_serializing)] + pub limit: Option, + #[serde(rename = "currentValue", skip_serializing)] + pub current_value: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PartitionUsagesResult { + #[serde(skip_serializing)] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PartitionUsage { + #[serde(flatten)] + pub usage: Usage, + #[serde(rename = "partitionId", skip_serializing)] + pub partition_id: Option, + #[serde(rename = "partitionKeyRangeId", skip_serializing)] + pub partition_key_range_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MetricDefinitionsListResult { + #[serde(skip_serializing)] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MetricDefinition { + #[serde(rename = "metricAvailabilities", skip_serializing)] + pub metric_availabilities: Vec, + #[serde(rename = "primaryAggregationType", skip_serializing)] + pub primary_aggregation_type: Option, + #[serde(skip_serializing)] + pub unit: Option, + #[serde(rename = "resourceUri", skip_serializing)] + pub resource_uri: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, +} +pub mod metric_definition { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum PrimaryAggregationType { + None, + Average, + Total, + Minimum, + Maximum, + Last, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MetricAvailability { + #[serde(rename = "timeGrain", skip_serializing)] + pub time_grain: Option, + #[serde(skip_serializing)] + pub retention: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MetricListResult { + #[serde(skip_serializing)] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Metric { + #[serde(rename = "startTime", skip_serializing)] + pub start_time: Option, + #[serde(rename = "endTime", skip_serializing)] + pub end_time: Option, + #[serde(rename = "timeGrain", skip_serializing)] + pub time_grain: Option, + #[serde(skip_serializing)] + pub unit: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "metricValues", skip_serializing)] + pub metric_values: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MetricName { + #[serde(skip_serializing)] + pub value: Option, + #[serde(rename = "localizedValue", skip_serializing)] + pub localized_value: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MetricValue { + #[serde(rename = "_count", skip_serializing)] + pub count: Option, + #[serde(skip_serializing)] + pub average: Option, + #[serde(skip_serializing)] + pub maximum: Option, + #[serde(skip_serializing)] + pub minimum: Option, + #[serde(skip_serializing)] + pub timestamp: Option, + #[serde(skip_serializing)] + pub total: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PercentileMetricListResult { + #[serde(skip_serializing)] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PercentileMetric { + #[serde(rename = "startTime", skip_serializing)] + pub start_time: Option, + #[serde(rename = "endTime", skip_serializing)] + pub end_time: Option, + #[serde(rename = "timeGrain", skip_serializing)] + pub time_grain: Option, + #[serde(skip_serializing)] + pub unit: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "metricValues", skip_serializing)] + pub metric_values: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PercentileMetricValue { + #[serde(flatten)] + pub metric_value: MetricValue, + #[serde(rename = "P10", skip_serializing)] + pub p10: Option, + #[serde(rename = "P25", skip_serializing)] + pub p25: Option, + #[serde(rename = "P50", skip_serializing)] + pub p50: Option, + #[serde(rename = "P75", skip_serializing)] + pub p75: Option, + #[serde(rename = "P90", skip_serializing)] + pub p90: Option, + #[serde(rename = "P95", skip_serializing)] + pub p95: Option, + #[serde(rename = "P99", skip_serializing)] + pub p99: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PartitionMetricListResult { + #[serde(skip_serializing)] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PartitionMetric { + #[serde(flatten)] + pub metric: Metric, + #[serde(rename = "partitionId", skip_serializing)] + pub partition_id: Option, + #[serde(rename = "partitionKeyRangeId", skip_serializing)] + pub partition_key_range_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum UnitType { + Count, + Bytes, + Seconds, + Percent, + CountPerSecond, + BytesPerSecond, + Milliseconds, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ConnectorOffer { + Small, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum PublicNetworkAccess { + Enabled, + Disabled, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ApiProperties { + #[serde(rename = "serverVersion", default, skip_serializing_if = "Option::is_none")] + pub server_version: Option, +} +pub mod api_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum ServerVersion { + #[serde(rename = "3.2")] + _3_2, + #[serde(rename = "3.6")] + _3_6, + #[serde(rename = "4.0")] + _4_0, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AnalyticalStorageConfiguration { + #[serde(rename = "schemaType", default, skip_serializing_if = "Option::is_none")] + pub schema_type: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum AnalyticalStorageSchemaType { + WellDefined, + FullFidelity, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BackupPolicy { + #[serde(rename = "type")] + pub type_: BackupPolicyType, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum BackupPolicyType { + Periodic, + Continuous, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PeriodicModeBackupPolicy { + #[serde(flatten)] + pub backup_policy: BackupPolicy, + #[serde(rename = "periodicModeProperties", default, skip_serializing_if = "Option::is_none")] + pub periodic_mode_properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContinuousModeBackupPolicy { + #[serde(flatten)] + pub backup_policy: BackupPolicy, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PeriodicModeProperties { + #[serde(rename = "backupIntervalInMinutes", default, skip_serializing_if = "Option::is_none")] + pub backup_interval_in_minutes: Option, + #[serde(rename = "backupRetentionIntervalInHours", default, skip_serializing_if = "Option::is_none")] + pub backup_retention_interval_in_hours: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnectionListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnection { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnectionProperties { + #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + #[serde(rename = "privateLinkServiceConnectionState", default, skip_serializing_if = "Option::is_none")] + pub private_link_service_connection_state: Option, + #[serde(rename = "groupId", default, skip_serializing_if = "Option::is_none")] + pub group_id: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointProperty { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkServiceConnectionStateProperty { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "actionsRequired", skip_serializing)] + pub actions_required: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NotebookWorkspaceCreateUpdateParameters { + #[serde(flatten)] + pub arm_proxy_resource: ArmProxyResource, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NotebookWorkspaceListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NotebookWorkspace { + #[serde(flatten)] + pub arm_proxy_resource: ArmProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NotebookWorkspaceProperties { + #[serde(rename = "notebookServerEndpoint", skip_serializing)] + pub notebook_server_endpoint: Option, + #[serde(skip_serializing)] + pub status: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NotebookWorkspaceConnectionInfoResult { + #[serde(rename = "authToken", skip_serializing)] + pub auth_token: Option, + #[serde(rename = "notebookServerEndpoint", skip_serializing)] + pub notebook_server_endpoint: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlRoleDefinitionResource { + #[serde(rename = "roleName", default, skip_serializing_if = "Option::is_none")] + pub role_name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "assignableScopes", default, skip_serializing_if = "Vec::is_empty")] + pub assignable_scopes: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub permissions: Vec, +} +pub mod sql_role_definition_resource { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + BuiltInRole, + CustomRole, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlRoleDefinitionCreateUpdateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlRoleDefinitionGetResults { + #[serde(flatten)] + pub arm_proxy_resource: ArmProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Permission { + #[serde(rename = "dataActions", default, skip_serializing_if = "Vec::is_empty")] + pub data_actions: Vec, + #[serde(rename = "notDataActions", default, skip_serializing_if = "Vec::is_empty")] + pub not_data_actions: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlRoleDefinitionListResult { + #[serde(skip_serializing)] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlRoleAssignmentResource { + #[serde(rename = "roleDefinitionId", default, skip_serializing_if = "Option::is_none")] + pub role_definition_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub scope: Option, + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlRoleAssignmentCreateUpdateParameters { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlRoleAssignmentGetResults { + #[serde(flatten)] + pub arm_proxy_resource: ArmProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SqlRoleAssignmentListResult { + #[serde(skip_serializing)] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkResourceListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkResource { + #[serde(flatten)] + pub arm_proxy_resource: ArmProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkResourceProperties { + #[serde(rename = "groupId", skip_serializing)] + pub group_id: Option, + #[serde(rename = "requiredMembers", skip_serializing)] + pub required_members: Vec, + #[serde(rename = "requiredZoneNames", skip_serializing)] + pub required_zone_names: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProxyResource { + #[serde(flatten)] + pub resource: Resource, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Resource { + #[serde(skip_serializing)] + pub id: Option, + #[serde(skip_serializing)] + pub name: Option, + #[serde(rename = "type", skip_serializing)] + pub type_: Option, +} diff --git a/services/mgmt/cosmos_db/src/package_2021_05/operations.rs b/services/mgmt/cosmos_db/src/package_2021_05/operations.rs new file mode 100644 index 0000000000..ed99661c3b --- /dev/null +++ b/services/mgmt/cosmos_db/src/package_2021_05/operations.rs @@ -0,0 +1,10202 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use crate::models::*; +pub mod database_accounts { + use crate::models::*; + pub async fn get( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name + ); + let mut url = url::Url::parse(url_str).map_err(get::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(get::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(get::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: DatabaseAccountGetResults = + serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(get::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod get { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn create_or_update( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + create_update_parameters: &DatabaseAccountCreateUpdateParameters, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name + ); + let mut url = url::Url::parse(url_str).map_err(create_or_update::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(create_or_update::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = azure_core::to_json(create_update_parameters).map_err(create_or_update::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(create_or_update::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(create_or_update::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: DatabaseAccountGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(create_or_update::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod create_or_update { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn update( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + update_parameters: &DatabaseAccountUpdateParameters, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name + ); + let mut url = url::Url::parse(url_str).map_err(update::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(update::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = azure_core::to_json(update_parameters).map_err(update::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(update::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(update::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: DatabaseAccountGetResults = + serde_json::from_slice(rsp_body).map_err(|source| update::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(update::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod update { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn delete( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name + ); + let mut url = url::Url::parse(url_str).map_err(delete::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(delete::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(delete::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(delete::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(delete::Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(delete::Response::NoContent204), + status_code => { + let rsp_body = rsp.body(); + Err(delete::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod delete { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn failover_priority_change( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + failover_parameters: &FailoverPolicies, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/failoverPriorityChange", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name + ); + let mut url = url::Url::parse(url_str).map_err(failover_priority_change::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(failover_priority_change::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = azure_core::to_json(failover_parameters).map_err(failover_priority_change::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(failover_priority_change::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(failover_priority_change::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(failover_priority_change::Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(failover_priority_change::Response::NoContent204), + status_code => { + let rsp_body = rsp.body(); + Err(failover_priority_change::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod failover_priority_change { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn list( + operation_config: &crate::OperationConfig, + subscription_id: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.DocumentDB/databaseAccounts", + operation_config.base_path(), + subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(list::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(list::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: DatabaseAccountsListResult = + serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn list_by_resource_group( + operation_config: &crate::OperationConfig, + resource_group_name: &str, + subscription_id: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts", + operation_config.base_path(), + subscription_id, + resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(list_by_resource_group::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_by_resource_group::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(list_by_resource_group::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_by_resource_group::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: DatabaseAccountsListResult = serde_json::from_slice(rsp_body) + .map_err(|source| list_by_resource_group::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_by_resource_group::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_by_resource_group { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn list_keys( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/listKeys", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name + ); + let mut url = url::Url::parse(url_str).map_err(list_keys::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_keys::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list_keys::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_keys::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: DatabaseAccountListKeysResult = + serde_json::from_slice(rsp_body).map_err(|source| list_keys::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_keys::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_keys { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn list_connection_strings( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/listConnectionStrings", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name + ); + let mut url = url::Url::parse(url_str).map_err(list_connection_strings::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_connection_strings::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(list_connection_strings::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_connection_strings::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: DatabaseAccountListConnectionStringsResult = serde_json::from_slice(rsp_body) + .map_err(|source| list_connection_strings::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_connection_strings::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_connection_strings { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn offline_region( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + region_parameter_for_offline: &RegionForOnlineOffline, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/offlineRegion", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name + ); + let mut url = url::Url::parse(url_str).map_err(offline_region::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(offline_region::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = azure_core::to_json(region_parameter_for_offline).map_err(offline_region::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(offline_region::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(offline_region::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => Ok(offline_region::Response::Ok200), + http::StatusCode::ACCEPTED => Ok(offline_region::Response::Accepted202), + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = + serde_json::from_slice(rsp_body).map_err(|source| offline_region::Error::DeserializeError(source, rsp_body.clone()))?; + Err(offline_region::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod offline_region { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn online_region( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + region_parameter_for_online: &RegionForOnlineOffline, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/onlineRegion", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name + ); + let mut url = url::Url::parse(url_str).map_err(online_region::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(online_region::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = azure_core::to_json(region_parameter_for_online).map_err(online_region::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(online_region::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(online_region::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => Ok(online_region::Response::Ok200), + http::StatusCode::ACCEPTED => Ok(online_region::Response::Accepted202), + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = + serde_json::from_slice(rsp_body).map_err(|source| online_region::Error::DeserializeError(source, rsp_body.clone()))?; + Err(online_region::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod online_region { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get_read_only_keys( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/readonlykeys", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name + ); + let mut url = url::Url::parse(url_str).map_err(get_read_only_keys::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get_read_only_keys::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(get_read_only_keys::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_read_only_keys::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: DatabaseAccountListReadOnlyKeysResult = serde_json::from_slice(rsp_body) + .map_err(|source| get_read_only_keys::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(get_read_only_keys::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod get_read_only_keys { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn list_read_only_keys( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/readonlykeys", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name + ); + let mut url = url::Url::parse(url_str).map_err(list_read_only_keys::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_read_only_keys::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list_read_only_keys::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_read_only_keys::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: DatabaseAccountListReadOnlyKeysResult = serde_json::from_slice(rsp_body) + .map_err(|source| list_read_only_keys::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_read_only_keys::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_read_only_keys { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn regenerate_key( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + key_to_regenerate: &DatabaseAccountRegenerateKeyParameters, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/regenerateKey", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name + ); + let mut url = url::Url::parse(url_str).map_err(regenerate_key::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(regenerate_key::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = azure_core::to_json(key_to_regenerate).map_err(regenerate_key::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(regenerate_key::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(regenerate_key::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => Ok(regenerate_key::Response::Ok200), + http::StatusCode::ACCEPTED => Ok(regenerate_key::Response::Accepted202), + status_code => { + let rsp_body = rsp.body(); + Err(regenerate_key::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod regenerate_key { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn check_name_exists( + operation_config: &crate::OperationConfig, + account_name: &str, + ) -> std::result::Result<(), check_name_exists::Error> { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/providers/Microsoft.DocumentDB/databaseAccountNames/{}", + operation_config.base_path(), + account_name + ); + let mut url = url::Url::parse(url_str).map_err(check_name_exists::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::HEAD); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(check_name_exists::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(check_name_exists::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(check_name_exists::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => Ok(()), + http::StatusCode::NOT_FOUND => Err(check_name_exists::Error::NotFound404 {}), + status_code => { + let rsp_body = rsp.body(); + Err(check_name_exists::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod check_name_exists { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Error response #response_type")] + NotFound404 {}, + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn list_metrics( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + filter: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/metrics", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name + ); + let mut url = url::Url::parse(url_str).map_err(list_metrics::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_metrics::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + url.query_pairs_mut().append_pair("$filter", filter); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list_metrics::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_metrics::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: MetricListResult = + serde_json::from_slice(rsp_body).map_err(|source| list_metrics::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_metrics::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_metrics { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn list_usages( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + filter: Option<&str>, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/usages", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name + ); + let mut url = url::Url::parse(url_str).map_err(list_usages::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_usages::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + if let Some(filter) = filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list_usages::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_usages::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: UsagesResult = + serde_json::from_slice(rsp_body).map_err(|source| list_usages::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_usages::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_usages { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn list_metric_definitions( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/metricDefinitions", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name + ); + let mut url = url::Url::parse(url_str).map_err(list_metric_definitions::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_metric_definitions::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(list_metric_definitions::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_metric_definitions::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: MetricDefinitionsListResult = serde_json::from_slice(rsp_body) + .map_err(|source| list_metric_definitions::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_metric_definitions::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_metric_definitions { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} +pub mod operations { + use crate::models::*; + pub async fn list(operation_config: &crate::OperationConfig) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!("{}/providers/Microsoft.DocumentDB/operations", operation_config.base_path(),); + let mut url = url::Url::parse(url_str).map_err(list::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(list::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: OperationListResult = + serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} +pub mod database { + use crate::models::*; + pub async fn list_metrics( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_rid: &str, + filter: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/databases/{}/metrics", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + database_rid + ); + let mut url = url::Url::parse(url_str).map_err(list_metrics::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_metrics::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + url.query_pairs_mut().append_pair("$filter", filter); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list_metrics::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_metrics::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: MetricListResult = + serde_json::from_slice(rsp_body).map_err(|source| list_metrics::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_metrics::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_metrics { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn list_usages( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_rid: &str, + filter: Option<&str>, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/databases/{}/usages", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + database_rid + ); + let mut url = url::Url::parse(url_str).map_err(list_usages::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_usages::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + if let Some(filter) = filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list_usages::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_usages::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: UsagesResult = + serde_json::from_slice(rsp_body).map_err(|source| list_usages::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_usages::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_usages { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn list_metric_definitions( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_rid: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/databases/{}/metricDefinitions", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + database_rid + ); + let mut url = url::Url::parse(url_str).map_err(list_metric_definitions::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_metric_definitions::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(list_metric_definitions::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_metric_definitions::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: MetricDefinitionsListResult = serde_json::from_slice(rsp_body) + .map_err(|source| list_metric_definitions::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_metric_definitions::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_metric_definitions { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} +pub mod collection { + use crate::models::*; + pub async fn list_metrics( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_rid: &str, + collection_rid: &str, + filter: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/databases/{}/collections/{}/metrics", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + database_rid, + collection_rid + ); + let mut url = url::Url::parse(url_str).map_err(list_metrics::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_metrics::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + url.query_pairs_mut().append_pair("$filter", filter); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list_metrics::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_metrics::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: MetricListResult = + serde_json::from_slice(rsp_body).map_err(|source| list_metrics::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_metrics::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_metrics { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn list_usages( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_rid: &str, + collection_rid: &str, + filter: Option<&str>, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/databases/{}/collections/{}/usages", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + database_rid, + collection_rid + ); + let mut url = url::Url::parse(url_str).map_err(list_usages::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_usages::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + if let Some(filter) = filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list_usages::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_usages::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: UsagesResult = + serde_json::from_slice(rsp_body).map_err(|source| list_usages::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_usages::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_usages { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn list_metric_definitions( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_rid: &str, + collection_rid: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/databases/{}/collections/{}/metricDefinitions" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_rid , collection_rid) ; + let mut url = url::Url::parse(url_str).map_err(list_metric_definitions::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_metric_definitions::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(list_metric_definitions::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_metric_definitions::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: MetricDefinitionsListResult = serde_json::from_slice(rsp_body) + .map_err(|source| list_metric_definitions::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_metric_definitions::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_metric_definitions { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} +pub mod collection_region { + use crate::models::*; + pub async fn list_metrics( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + region: &str, + database_rid: &str, + collection_rid: &str, + filter: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/region/{}/databases/{}/collections/{}/metrics" , operation_config . base_path () , subscription_id , resource_group_name , account_name , region , database_rid , collection_rid) ; + let mut url = url::Url::parse(url_str).map_err(list_metrics::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_metrics::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + url.query_pairs_mut().append_pair("$filter", filter); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list_metrics::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_metrics::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: MetricListResult = + serde_json::from_slice(rsp_body).map_err(|source| list_metrics::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_metrics::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_metrics { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} +pub mod database_account_region { + use crate::models::*; + pub async fn list_metrics( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + region: &str, + filter: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/region/{}/metrics", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + region + ); + let mut url = url::Url::parse(url_str).map_err(list_metrics::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_metrics::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + url.query_pairs_mut().append_pair("$filter", filter); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list_metrics::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_metrics::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: MetricListResult = + serde_json::from_slice(rsp_body).map_err(|source| list_metrics::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_metrics::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_metrics { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} +pub mod percentile_source_target { + use crate::models::*; + pub async fn list_metrics( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + source_region: &str, + target_region: &str, + filter: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sourceRegion/{}/targetRegion/{}/percentile/metrics" , operation_config . base_path () , subscription_id , resource_group_name , account_name , source_region , target_region) ; + let mut url = url::Url::parse(url_str).map_err(list_metrics::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_metrics::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + url.query_pairs_mut().append_pair("$filter", filter); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list_metrics::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_metrics::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: PercentileMetricListResult = + serde_json::from_slice(rsp_body).map_err(|source| list_metrics::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_metrics::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_metrics { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} +pub mod percentile_target { + use crate::models::*; + pub async fn list_metrics( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + target_region: &str, + filter: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/targetRegion/{}/percentile/metrics", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + target_region + ); + let mut url = url::Url::parse(url_str).map_err(list_metrics::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_metrics::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + url.query_pairs_mut().append_pair("$filter", filter); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list_metrics::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_metrics::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: PercentileMetricListResult = + serde_json::from_slice(rsp_body).map_err(|source| list_metrics::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_metrics::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_metrics { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} +pub mod percentile { + use crate::models::*; + pub async fn list_metrics( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + filter: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/percentile/metrics", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name + ); + let mut url = url::Url::parse(url_str).map_err(list_metrics::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_metrics::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + url.query_pairs_mut().append_pair("$filter", filter); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list_metrics::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_metrics::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: PercentileMetricListResult = + serde_json::from_slice(rsp_body).map_err(|source| list_metrics::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_metrics::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_metrics { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} +pub mod collection_partition_region { + use crate::models::*; + pub async fn list_metrics( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + region: &str, + database_rid: &str, + collection_rid: &str, + filter: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/region/{}/databases/{}/collections/{}/partitions/metrics" , operation_config . base_path () , subscription_id , resource_group_name , account_name , region , database_rid , collection_rid) ; + let mut url = url::Url::parse(url_str).map_err(list_metrics::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_metrics::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + url.query_pairs_mut().append_pair("$filter", filter); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list_metrics::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_metrics::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: PartitionMetricListResult = + serde_json::from_slice(rsp_body).map_err(|source| list_metrics::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_metrics::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_metrics { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} +pub mod collection_partition { + use crate::models::*; + pub async fn list_metrics( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_rid: &str, + collection_rid: &str, + filter: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/databases/{}/collections/{}/partitions/metrics" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_rid , collection_rid) ; + let mut url = url::Url::parse(url_str).map_err(list_metrics::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_metrics::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + url.query_pairs_mut().append_pair("$filter", filter); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list_metrics::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_metrics::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: PartitionMetricListResult = + serde_json::from_slice(rsp_body).map_err(|source| list_metrics::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_metrics::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_metrics { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn list_usages( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_rid: &str, + collection_rid: &str, + filter: Option<&str>, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/databases/{}/collections/{}/partitions/usages" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_rid , collection_rid) ; + let mut url = url::Url::parse(url_str).map_err(list_usages::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_usages::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + if let Some(filter) = filter { + url.query_pairs_mut().append_pair("$filter", filter); + } + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list_usages::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_usages::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: PartitionUsagesResult = + serde_json::from_slice(rsp_body).map_err(|source| list_usages::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_usages::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_usages { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} +pub mod partition_key_range_id { + use crate::models::*; + pub async fn list_metrics( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_rid: &str, + collection_rid: &str, + partition_key_range_id: &str, + filter: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/databases/{}/collections/{}/partitionKeyRangeId/{}/metrics" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_rid , collection_rid , partition_key_range_id) ; + let mut url = url::Url::parse(url_str).map_err(list_metrics::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_metrics::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + url.query_pairs_mut().append_pair("$filter", filter); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list_metrics::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_metrics::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: PartitionMetricListResult = + serde_json::from_slice(rsp_body).map_err(|source| list_metrics::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_metrics::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_metrics { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} +pub mod partition_key_range_id_region { + use crate::models::*; + pub async fn list_metrics( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + region: &str, + database_rid: &str, + collection_rid: &str, + partition_key_range_id: &str, + filter: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/region/{}/databases/{}/collections/{}/partitionKeyRangeId/{}/metrics" , operation_config . base_path () , subscription_id , resource_group_name , account_name , region , database_rid , collection_rid , partition_key_range_id) ; + let mut url = url::Url::parse(url_str).map_err(list_metrics::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_metrics::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + url.query_pairs_mut().append_pair("$filter", filter); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list_metrics::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_metrics::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: PartitionMetricListResult = + serde_json::from_slice(rsp_body).map_err(|source| list_metrics::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_metrics::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_metrics { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} +pub mod sql_resources { + use crate::models::*; + pub async fn list_sql_databases( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name + ); + let mut url = url::Url::parse(url_str).map_err(list_sql_databases::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_sql_databases::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list_sql_databases::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_sql_databases::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: SqlDatabaseListResult = serde_json::from_slice(rsp_body) + .map_err(|source| list_sql_databases::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_sql_databases::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_sql_databases { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get_sql_database( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + database_name + ); + let mut url = url::Url::parse(url_str).map_err(get_sql_database::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get_sql_database::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(get_sql_database::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_sql_database::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: SqlDatabaseGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| get_sql_database::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(get_sql_database::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod get_sql_database { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn create_update_sql_database( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + create_update_sql_database_parameters: &SqlDatabaseCreateUpdateParameters, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + database_name + ); + let mut url = url::Url::parse(url_str).map_err(create_update_sql_database::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(create_update_sql_database::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = + azure_core::to_json(create_update_sql_database_parameters).map_err(create_update_sql_database::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(create_update_sql_database::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(create_update_sql_database::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(create_update_sql_database::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: SqlDatabaseGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| create_update_sql_database::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(create_update_sql_database::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + Err(create_update_sql_database::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod create_update_sql_database { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(SqlDatabaseGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn delete_sql_database( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + database_name + ); + let mut url = url::Url::parse(url_str).map_err(delete_sql_database::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(delete_sql_database::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(delete_sql_database::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(delete_sql_database::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(delete_sql_database::Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(delete_sql_database::Response::NoContent204), + status_code => { + let rsp_body = rsp.body(); + Err(delete_sql_database::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod delete_sql_database { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get_sql_database_throughput( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/throughputSettings/default" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name) ; + let mut url = url::Url::parse(url_str).map_err(get_sql_database_throughput::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get_sql_database_throughput::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(get_sql_database_throughput::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_sql_database_throughput::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| get_sql_database_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(get_sql_database_throughput::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod get_sql_database_throughput { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn update_sql_database_throughput( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + update_throughput_parameters: &ThroughputSettingsUpdateParameters, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/throughputSettings/default" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name) ; + let mut url = url::Url::parse(url_str).map_err(update_sql_database_throughput::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(update_sql_database_throughput::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = azure_core::to_json(update_throughput_parameters).map_err(update_sql_database_throughput::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(update_sql_database_throughput::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(update_sql_database_throughput::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(update_sql_database_throughput::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| update_sql_database_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(update_sql_database_throughput::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + Err(update_sql_database_throughput::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod update_sql_database_throughput { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn migrate_sql_database_to_autoscale( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/throughputSettings/default/migrateToAutoscale" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name) ; + let mut url = url::Url::parse(url_str).map_err(migrate_sql_database_to_autoscale::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(migrate_sql_database_to_autoscale::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(migrate_sql_database_to_autoscale::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(migrate_sql_database_to_autoscale::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(migrate_sql_database_to_autoscale::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_sql_database_to_autoscale::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(migrate_sql_database_to_autoscale::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_sql_database_to_autoscale::Error::DeserializeError(source, rsp_body.clone()))?; + Err(migrate_sql_database_to_autoscale::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod migrate_sql_database_to_autoscale { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn migrate_sql_database_to_manual_throughput( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/throughputSettings/default/migrateToManualThroughput" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name) ; + let mut url = url::Url::parse(url_str).map_err(migrate_sql_database_to_manual_throughput::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(migrate_sql_database_to_manual_throughput::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(migrate_sql_database_to_manual_throughput::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(migrate_sql_database_to_manual_throughput::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(migrate_sql_database_to_manual_throughput::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_sql_database_to_manual_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(migrate_sql_database_to_manual_throughput::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_sql_database_to_manual_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Err(migrate_sql_database_to_manual_throughput::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod migrate_sql_database_to_manual_throughput { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn list_sql_containers( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + database_name + ); + let mut url = url::Url::parse(url_str).map_err(list_sql_containers::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_sql_containers::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list_sql_containers::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_sql_containers::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: SqlContainerListResult = serde_json::from_slice(rsp_body) + .map_err(|source| list_sql_containers::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_sql_containers::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_sql_containers { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get_sql_container( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + container_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + database_name, + container_name + ); + let mut url = url::Url::parse(url_str).map_err(get_sql_container::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get_sql_container::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(get_sql_container::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_sql_container::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: SqlContainerGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| get_sql_container::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(get_sql_container::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod get_sql_container { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn create_update_sql_container( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + container_name: &str, + create_update_sql_container_parameters: &SqlContainerCreateUpdateParameters, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + database_name, + container_name + ); + let mut url = url::Url::parse(url_str).map_err(create_update_sql_container::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(create_update_sql_container::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = + azure_core::to_json(create_update_sql_container_parameters).map_err(create_update_sql_container::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(create_update_sql_container::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(create_update_sql_container::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(create_update_sql_container::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: SqlContainerGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| create_update_sql_container::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(create_update_sql_container::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + Err(create_update_sql_container::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod create_update_sql_container { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(SqlContainerGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn delete_sql_container( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + container_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + database_name, + container_name + ); + let mut url = url::Url::parse(url_str).map_err(delete_sql_container::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(delete_sql_container::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(delete_sql_container::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(delete_sql_container::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(delete_sql_container::Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(delete_sql_container::Response::NoContent204), + status_code => { + let rsp_body = rsp.body(); + Err(delete_sql_container::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod delete_sql_container { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get_sql_container_throughput( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + container_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/throughputSettings/default" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name , container_name) ; + let mut url = url::Url::parse(url_str).map_err(get_sql_container_throughput::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get_sql_container_throughput::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(get_sql_container_throughput::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_sql_container_throughput::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| get_sql_container_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(get_sql_container_throughput::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod get_sql_container_throughput { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn update_sql_container_throughput( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + container_name: &str, + update_throughput_parameters: &ThroughputSettingsUpdateParameters, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/throughputSettings/default" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name , container_name) ; + let mut url = url::Url::parse(url_str).map_err(update_sql_container_throughput::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(update_sql_container_throughput::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = azure_core::to_json(update_throughput_parameters).map_err(update_sql_container_throughput::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(update_sql_container_throughput::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(update_sql_container_throughput::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(update_sql_container_throughput::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| update_sql_container_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(update_sql_container_throughput::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + Err(update_sql_container_throughput::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod update_sql_container_throughput { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn migrate_sql_container_to_autoscale( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + container_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/throughputSettings/default/migrateToAutoscale" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name , container_name) ; + let mut url = url::Url::parse(url_str).map_err(migrate_sql_container_to_autoscale::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(migrate_sql_container_to_autoscale::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(migrate_sql_container_to_autoscale::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(migrate_sql_container_to_autoscale::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(migrate_sql_container_to_autoscale::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_sql_container_to_autoscale::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(migrate_sql_container_to_autoscale::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_sql_container_to_autoscale::Error::DeserializeError(source, rsp_body.clone()))?; + Err(migrate_sql_container_to_autoscale::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod migrate_sql_container_to_autoscale { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn migrate_sql_container_to_manual_throughput( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + container_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/throughputSettings/default/migrateToManualThroughput" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name , container_name) ; + let mut url = url::Url::parse(url_str).map_err(migrate_sql_container_to_manual_throughput::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(migrate_sql_container_to_manual_throughput::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(migrate_sql_container_to_manual_throughput::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(migrate_sql_container_to_manual_throughput::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(migrate_sql_container_to_manual_throughput::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_sql_container_to_manual_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(migrate_sql_container_to_manual_throughput::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_sql_container_to_manual_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Err(migrate_sql_container_to_manual_throughput::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod migrate_sql_container_to_manual_throughput { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn list_sql_stored_procedures( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + container_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/storedProcedures" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name , container_name) ; + let mut url = url::Url::parse(url_str).map_err(list_sql_stored_procedures::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_sql_stored_procedures::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(list_sql_stored_procedures::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_sql_stored_procedures::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: SqlStoredProcedureListResult = serde_json::from_slice(rsp_body) + .map_err(|source| list_sql_stored_procedures::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = serde_json::from_slice(rsp_body) + .map_err(|source| list_sql_stored_procedures::Error::DeserializeError(source, rsp_body.clone()))?; + Err(list_sql_stored_procedures::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod list_sql_stored_procedures { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get_sql_stored_procedure( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + container_name: &str, + stored_procedure_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/storedProcedures/{}" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name , container_name , stored_procedure_name) ; + let mut url = url::Url::parse(url_str).map_err(get_sql_stored_procedure::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get_sql_stored_procedure::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(get_sql_stored_procedure::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_sql_stored_procedure::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: SqlStoredProcedureGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| get_sql_stored_procedure::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(get_sql_stored_procedure::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod get_sql_stored_procedure { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn create_update_sql_stored_procedure( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + container_name: &str, + stored_procedure_name: &str, + create_update_sql_stored_procedure_parameters: &SqlStoredProcedureCreateUpdateParameters, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/storedProcedures/{}" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name , container_name , stored_procedure_name) ; + let mut url = url::Url::parse(url_str).map_err(create_update_sql_stored_procedure::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(create_update_sql_stored_procedure::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = azure_core::to_json(create_update_sql_stored_procedure_parameters) + .map_err(create_update_sql_stored_procedure::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(create_update_sql_stored_procedure::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(create_update_sql_stored_procedure::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(create_update_sql_stored_procedure::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: SqlStoredProcedureGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| create_update_sql_stored_procedure::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(create_update_sql_stored_procedure::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + Err(create_update_sql_stored_procedure::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod create_update_sql_stored_procedure { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(SqlStoredProcedureGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn delete_sql_stored_procedure( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + container_name: &str, + stored_procedure_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/storedProcedures/{}" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name , container_name , stored_procedure_name) ; + let mut url = url::Url::parse(url_str).map_err(delete_sql_stored_procedure::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(delete_sql_stored_procedure::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(delete_sql_stored_procedure::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(delete_sql_stored_procedure::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(delete_sql_stored_procedure::Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(delete_sql_stored_procedure::Response::NoContent204), + status_code => { + let rsp_body = rsp.body(); + Err(delete_sql_stored_procedure::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod delete_sql_stored_procedure { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn list_sql_user_defined_functions( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + container_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/userDefinedFunctions" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name , container_name) ; + let mut url = url::Url::parse(url_str).map_err(list_sql_user_defined_functions::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_sql_user_defined_functions::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(list_sql_user_defined_functions::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_sql_user_defined_functions::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: SqlUserDefinedFunctionListResult = serde_json::from_slice(rsp_body) + .map_err(|source| list_sql_user_defined_functions::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_sql_user_defined_functions::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_sql_user_defined_functions { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get_sql_user_defined_function( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + container_name: &str, + user_defined_function_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/userDefinedFunctions/{}" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name , container_name , user_defined_function_name) ; + let mut url = url::Url::parse(url_str).map_err(get_sql_user_defined_function::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get_sql_user_defined_function::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(get_sql_user_defined_function::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_sql_user_defined_function::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: SqlUserDefinedFunctionGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| get_sql_user_defined_function::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(get_sql_user_defined_function::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod get_sql_user_defined_function { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn create_update_sql_user_defined_function( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + container_name: &str, + user_defined_function_name: &str, + create_update_sql_user_defined_function_parameters: &SqlUserDefinedFunctionCreateUpdateParameters, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/userDefinedFunctions/{}" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name , container_name , user_defined_function_name) ; + let mut url = url::Url::parse(url_str).map_err(create_update_sql_user_defined_function::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(create_update_sql_user_defined_function::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = azure_core::to_json(create_update_sql_user_defined_function_parameters) + .map_err(create_update_sql_user_defined_function::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(create_update_sql_user_defined_function::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(create_update_sql_user_defined_function::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(create_update_sql_user_defined_function::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: SqlUserDefinedFunctionGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| create_update_sql_user_defined_function::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(create_update_sql_user_defined_function::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + Err(create_update_sql_user_defined_function::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod create_update_sql_user_defined_function { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(SqlUserDefinedFunctionGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn delete_sql_user_defined_function( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + container_name: &str, + user_defined_function_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/userDefinedFunctions/{}" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name , container_name , user_defined_function_name) ; + let mut url = url::Url::parse(url_str).map_err(delete_sql_user_defined_function::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(delete_sql_user_defined_function::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(delete_sql_user_defined_function::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(delete_sql_user_defined_function::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(delete_sql_user_defined_function::Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(delete_sql_user_defined_function::Response::NoContent204), + status_code => { + let rsp_body = rsp.body(); + Err(delete_sql_user_defined_function::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod delete_sql_user_defined_function { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn list_sql_triggers( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + container_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/triggers" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name , container_name) ; + let mut url = url::Url::parse(url_str).map_err(list_sql_triggers::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_sql_triggers::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list_sql_triggers::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_sql_triggers::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: SqlTriggerListResult = serde_json::from_slice(rsp_body) + .map_err(|source| list_sql_triggers::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_sql_triggers::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_sql_triggers { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get_sql_trigger( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + container_name: &str, + trigger_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/triggers/{}" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name , container_name , trigger_name) ; + let mut url = url::Url::parse(url_str).map_err(get_sql_trigger::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get_sql_trigger::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(get_sql_trigger::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_sql_trigger::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: SqlTriggerGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| get_sql_trigger::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(get_sql_trigger::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod get_sql_trigger { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn create_update_sql_trigger( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + container_name: &str, + trigger_name: &str, + create_update_sql_trigger_parameters: &SqlTriggerCreateUpdateParameters, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/triggers/{}" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name , container_name , trigger_name) ; + let mut url = url::Url::parse(url_str).map_err(create_update_sql_trigger::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(create_update_sql_trigger::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = + azure_core::to_json(create_update_sql_trigger_parameters).map_err(create_update_sql_trigger::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(create_update_sql_trigger::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(create_update_sql_trigger::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(create_update_sql_trigger::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: SqlTriggerGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| create_update_sql_trigger::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(create_update_sql_trigger::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + Err(create_update_sql_trigger::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod create_update_sql_trigger { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(SqlTriggerGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn delete_sql_trigger( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + container_name: &str, + trigger_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlDatabases/{}/containers/{}/triggers/{}" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name , container_name , trigger_name) ; + let mut url = url::Url::parse(url_str).map_err(delete_sql_trigger::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(delete_sql_trigger::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(delete_sql_trigger::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(delete_sql_trigger::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(delete_sql_trigger::Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(delete_sql_trigger::Response::NoContent204), + status_code => { + let rsp_body = rsp.body(); + Err(delete_sql_trigger::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod delete_sql_trigger { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get_sql_role_definition( + operation_config: &crate::OperationConfig, + role_definition_id: &str, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlRoleDefinitions/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + role_definition_id + ); + let mut url = url::Url::parse(url_str).map_err(get_sql_role_definition::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get_sql_role_definition::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(get_sql_role_definition::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_sql_role_definition::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: SqlRoleDefinitionGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| get_sql_role_definition::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = serde_json::from_slice(rsp_body) + .map_err(|source| get_sql_role_definition::Error::DeserializeError(source, rsp_body.clone()))?; + Err(get_sql_role_definition::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod get_sql_role_definition { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn create_update_sql_role_definition( + operation_config: &crate::OperationConfig, + role_definition_id: &str, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + create_update_sql_role_definition_parameters: &SqlRoleDefinitionCreateUpdateParameters, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlRoleDefinitions/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + role_definition_id + ); + let mut url = url::Url::parse(url_str).map_err(create_update_sql_role_definition::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(create_update_sql_role_definition::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = azure_core::to_json(create_update_sql_role_definition_parameters) + .map_err(create_update_sql_role_definition::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(create_update_sql_role_definition::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(create_update_sql_role_definition::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: SqlRoleDefinitionGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| create_update_sql_role_definition::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(create_update_sql_role_definition::Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(create_update_sql_role_definition::Response::Accepted202), + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = serde_json::from_slice(rsp_body) + .map_err(|source| create_update_sql_role_definition::Error::DeserializeError(source, rsp_body.clone()))?; + Err(create_update_sql_role_definition::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod create_update_sql_role_definition { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Ok200(SqlRoleDefinitionGetResults), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn delete_sql_role_definition( + operation_config: &crate::OperationConfig, + role_definition_id: &str, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlRoleDefinitions/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + role_definition_id + ); + let mut url = url::Url::parse(url_str).map_err(delete_sql_role_definition::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(delete_sql_role_definition::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(delete_sql_role_definition::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(delete_sql_role_definition::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => Ok(delete_sql_role_definition::Response::Ok200), + http::StatusCode::ACCEPTED => Ok(delete_sql_role_definition::Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(delete_sql_role_definition::Response::NoContent204), + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = serde_json::from_slice(rsp_body) + .map_err(|source| delete_sql_role_definition::Error::DeserializeError(source, rsp_body.clone()))?; + Err(delete_sql_role_definition::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod delete_sql_role_definition { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn list_sql_role_definitions( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlRoleDefinitions", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name + ); + let mut url = url::Url::parse(url_str).map_err(list_sql_role_definitions::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_sql_role_definitions::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(list_sql_role_definitions::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_sql_role_definitions::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: SqlRoleDefinitionListResult = serde_json::from_slice(rsp_body) + .map_err(|source| list_sql_role_definitions::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = serde_json::from_slice(rsp_body) + .map_err(|source| list_sql_role_definitions::Error::DeserializeError(source, rsp_body.clone()))?; + Err(list_sql_role_definitions::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod list_sql_role_definitions { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get_sql_role_assignment( + operation_config: &crate::OperationConfig, + role_assignment_id: &str, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlRoleAssignments/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + role_assignment_id + ); + let mut url = url::Url::parse(url_str).map_err(get_sql_role_assignment::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get_sql_role_assignment::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(get_sql_role_assignment::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_sql_role_assignment::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: SqlRoleAssignmentGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| get_sql_role_assignment::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = serde_json::from_slice(rsp_body) + .map_err(|source| get_sql_role_assignment::Error::DeserializeError(source, rsp_body.clone()))?; + Err(get_sql_role_assignment::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod get_sql_role_assignment { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn create_update_sql_role_assignment( + operation_config: &crate::OperationConfig, + role_assignment_id: &str, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + create_update_sql_role_assignment_parameters: &SqlRoleAssignmentCreateUpdateParameters, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlRoleAssignments/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + role_assignment_id + ); + let mut url = url::Url::parse(url_str).map_err(create_update_sql_role_assignment::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(create_update_sql_role_assignment::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = azure_core::to_json(create_update_sql_role_assignment_parameters) + .map_err(create_update_sql_role_assignment::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(create_update_sql_role_assignment::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(create_update_sql_role_assignment::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: SqlRoleAssignmentGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| create_update_sql_role_assignment::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(create_update_sql_role_assignment::Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(create_update_sql_role_assignment::Response::Accepted202), + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = serde_json::from_slice(rsp_body) + .map_err(|source| create_update_sql_role_assignment::Error::DeserializeError(source, rsp_body.clone()))?; + Err(create_update_sql_role_assignment::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod create_update_sql_role_assignment { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Ok200(SqlRoleAssignmentGetResults), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn delete_sql_role_assignment( + operation_config: &crate::OperationConfig, + role_assignment_id: &str, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlRoleAssignments/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + role_assignment_id + ); + let mut url = url::Url::parse(url_str).map_err(delete_sql_role_assignment::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(delete_sql_role_assignment::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(delete_sql_role_assignment::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(delete_sql_role_assignment::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => Ok(delete_sql_role_assignment::Response::Ok200), + http::StatusCode::ACCEPTED => Ok(delete_sql_role_assignment::Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(delete_sql_role_assignment::Response::NoContent204), + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = serde_json::from_slice(rsp_body) + .map_err(|source| delete_sql_role_assignment::Error::DeserializeError(source, rsp_body.clone()))?; + Err(delete_sql_role_assignment::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod delete_sql_role_assignment { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn list_sql_role_assignments( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/sqlRoleAssignments", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name + ); + let mut url = url::Url::parse(url_str).map_err(list_sql_role_assignments::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_sql_role_assignments::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(list_sql_role_assignments::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_sql_role_assignments::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: SqlRoleAssignmentListResult = serde_json::from_slice(rsp_body) + .map_err(|source| list_sql_role_assignments::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = serde_json::from_slice(rsp_body) + .map_err(|source| list_sql_role_assignments::Error::DeserializeError(source, rsp_body.clone()))?; + Err(list_sql_role_assignments::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod list_sql_role_assignments { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} +pub mod mongo_db_resources { + use crate::models::*; + pub async fn list_mongo_db_databases( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name + ); + let mut url = url::Url::parse(url_str).map_err(list_mongo_db_databases::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_mongo_db_databases::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(list_mongo_db_databases::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_mongo_db_databases::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: MongoDbDatabaseListResult = serde_json::from_slice(rsp_body) + .map_err(|source| list_mongo_db_databases::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_mongo_db_databases::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_mongo_db_databases { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get_mongo_db_database( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + database_name + ); + let mut url = url::Url::parse(url_str).map_err(get_mongo_db_database::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get_mongo_db_database::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(get_mongo_db_database::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_mongo_db_database::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: MongoDbDatabaseGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| get_mongo_db_database::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(get_mongo_db_database::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod get_mongo_db_database { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn create_update_mongo_db_database( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + create_update_mongo_db_database_parameters: &MongoDbDatabaseCreateUpdateParameters, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + database_name + ); + let mut url = url::Url::parse(url_str).map_err(create_update_mongo_db_database::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(create_update_mongo_db_database::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = azure_core::to_json(create_update_mongo_db_database_parameters) + .map_err(create_update_mongo_db_database::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(create_update_mongo_db_database::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(create_update_mongo_db_database::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(create_update_mongo_db_database::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: MongoDbDatabaseGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| create_update_mongo_db_database::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(create_update_mongo_db_database::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + Err(create_update_mongo_db_database::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod create_update_mongo_db_database { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(MongoDbDatabaseGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn delete_mongo_db_database( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + database_name + ); + let mut url = url::Url::parse(url_str).map_err(delete_mongo_db_database::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(delete_mongo_db_database::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(delete_mongo_db_database::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(delete_mongo_db_database::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(delete_mongo_db_database::Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(delete_mongo_db_database::Response::NoContent204), + status_code => { + let rsp_body = rsp.body(); + Err(delete_mongo_db_database::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod delete_mongo_db_database { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get_mongo_db_database_throughput( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}/throughputSettings/default" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name) ; + let mut url = url::Url::parse(url_str).map_err(get_mongo_db_database_throughput::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get_mongo_db_database_throughput::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(get_mongo_db_database_throughput::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_mongo_db_database_throughput::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| get_mongo_db_database_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(get_mongo_db_database_throughput::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod get_mongo_db_database_throughput { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn update_mongo_db_database_throughput( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + update_throughput_parameters: &ThroughputSettingsUpdateParameters, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}/throughputSettings/default" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name) ; + let mut url = url::Url::parse(url_str).map_err(update_mongo_db_database_throughput::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(update_mongo_db_database_throughput::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = + azure_core::to_json(update_throughput_parameters).map_err(update_mongo_db_database_throughput::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(update_mongo_db_database_throughput::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(update_mongo_db_database_throughput::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(update_mongo_db_database_throughput::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| update_mongo_db_database_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(update_mongo_db_database_throughput::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = serde_json::from_slice(rsp_body) + .map_err(|source| update_mongo_db_database_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Err(update_mongo_db_database_throughput::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod update_mongo_db_database_throughput { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn migrate_mongo_db_database_to_autoscale( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}/throughputSettings/default/migrateToAutoscale" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name) ; + let mut url = url::Url::parse(url_str).map_err(migrate_mongo_db_database_to_autoscale::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(migrate_mongo_db_database_to_autoscale::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(migrate_mongo_db_database_to_autoscale::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(migrate_mongo_db_database_to_autoscale::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(migrate_mongo_db_database_to_autoscale::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_mongo_db_database_to_autoscale::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(migrate_mongo_db_database_to_autoscale::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_mongo_db_database_to_autoscale::Error::DeserializeError(source, rsp_body.clone()))?; + Err(migrate_mongo_db_database_to_autoscale::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod migrate_mongo_db_database_to_autoscale { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn migrate_mongo_db_database_to_manual_throughput( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + ) -> std::result::Result + { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}/throughputSettings/default/migrateToManualThroughput" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name) ; + let mut url = url::Url::parse(url_str).map_err(migrate_mongo_db_database_to_manual_throughput::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(migrate_mongo_db_database_to_manual_throughput::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(migrate_mongo_db_database_to_manual_throughput::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(migrate_mongo_db_database_to_manual_throughput::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(migrate_mongo_db_database_to_manual_throughput::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_mongo_db_database_to_manual_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(migrate_mongo_db_database_to_manual_throughput::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_mongo_db_database_to_manual_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Err(migrate_mongo_db_database_to_manual_throughput::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod migrate_mongo_db_database_to_manual_throughput { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn list_mongo_db_collections( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}/collections", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + database_name + ); + let mut url = url::Url::parse(url_str).map_err(list_mongo_db_collections::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_mongo_db_collections::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(list_mongo_db_collections::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_mongo_db_collections::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: MongoDbCollectionListResult = serde_json::from_slice(rsp_body) + .map_err(|source| list_mongo_db_collections::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_mongo_db_collections::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_mongo_db_collections { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get_mongo_db_collection( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + collection_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}/collections/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + database_name, + collection_name + ); + let mut url = url::Url::parse(url_str).map_err(get_mongo_db_collection::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get_mongo_db_collection::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(get_mongo_db_collection::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_mongo_db_collection::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: MongoDbCollectionGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| get_mongo_db_collection::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(get_mongo_db_collection::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod get_mongo_db_collection { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn create_update_mongo_db_collection( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + collection_name: &str, + create_update_mongo_db_collection_parameters: &MongoDbCollectionCreateUpdateParameters, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}/collections/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + database_name, + collection_name + ); + let mut url = url::Url::parse(url_str).map_err(create_update_mongo_db_collection::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(create_update_mongo_db_collection::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = azure_core::to_json(create_update_mongo_db_collection_parameters) + .map_err(create_update_mongo_db_collection::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(create_update_mongo_db_collection::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(create_update_mongo_db_collection::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(create_update_mongo_db_collection::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: MongoDbCollectionGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| create_update_mongo_db_collection::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(create_update_mongo_db_collection::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + Err(create_update_mongo_db_collection::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod create_update_mongo_db_collection { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(MongoDbCollectionGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn delete_mongo_db_collection( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + collection_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}/collections/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + database_name, + collection_name + ); + let mut url = url::Url::parse(url_str).map_err(delete_mongo_db_collection::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(delete_mongo_db_collection::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(delete_mongo_db_collection::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(delete_mongo_db_collection::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(delete_mongo_db_collection::Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(delete_mongo_db_collection::Response::NoContent204), + status_code => { + let rsp_body = rsp.body(); + Err(delete_mongo_db_collection::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod delete_mongo_db_collection { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get_mongo_db_collection_throughput( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + collection_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}/collections/{}/throughputSettings/default" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name , collection_name) ; + let mut url = url::Url::parse(url_str).map_err(get_mongo_db_collection_throughput::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get_mongo_db_collection_throughput::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(get_mongo_db_collection_throughput::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_mongo_db_collection_throughput::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| get_mongo_db_collection_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(get_mongo_db_collection_throughput::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod get_mongo_db_collection_throughput { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn update_mongo_db_collection_throughput( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + collection_name: &str, + update_throughput_parameters: &ThroughputSettingsUpdateParameters, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}/collections/{}/throughputSettings/default" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name , collection_name) ; + let mut url = url::Url::parse(url_str).map_err(update_mongo_db_collection_throughput::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(update_mongo_db_collection_throughput::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = + azure_core::to_json(update_throughput_parameters).map_err(update_mongo_db_collection_throughput::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(update_mongo_db_collection_throughput::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(update_mongo_db_collection_throughput::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(update_mongo_db_collection_throughput::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| update_mongo_db_collection_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(update_mongo_db_collection_throughput::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + Err(update_mongo_db_collection_throughput::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod update_mongo_db_collection_throughput { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn migrate_mongo_db_collection_to_autoscale( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + collection_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}/collections/{}/throughputSettings/default/migrateToAutoscale" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name , collection_name) ; + let mut url = url::Url::parse(url_str).map_err(migrate_mongo_db_collection_to_autoscale::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(migrate_mongo_db_collection_to_autoscale::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(migrate_mongo_db_collection_to_autoscale::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(migrate_mongo_db_collection_to_autoscale::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(migrate_mongo_db_collection_to_autoscale::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_mongo_db_collection_to_autoscale::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(migrate_mongo_db_collection_to_autoscale::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_mongo_db_collection_to_autoscale::Error::DeserializeError(source, rsp_body.clone()))?; + Err(migrate_mongo_db_collection_to_autoscale::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod migrate_mongo_db_collection_to_autoscale { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn migrate_mongo_db_collection_to_manual_throughput( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + collection_name: &str, + ) -> std::result::Result< + migrate_mongo_db_collection_to_manual_throughput::Response, + migrate_mongo_db_collection_to_manual_throughput::Error, + > { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/mongodbDatabases/{}/collections/{}/throughputSettings/default/migrateToManualThroughput" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name , collection_name) ; + let mut url = url::Url::parse(url_str).map_err(migrate_mongo_db_collection_to_manual_throughput::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(migrate_mongo_db_collection_to_manual_throughput::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(migrate_mongo_db_collection_to_manual_throughput::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(migrate_mongo_db_collection_to_manual_throughput::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(migrate_mongo_db_collection_to_manual_throughput::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body).map_err(|source| { + migrate_mongo_db_collection_to_manual_throughput::Error::DeserializeError(source, rsp_body.clone()) + })?; + Ok(migrate_mongo_db_collection_to_manual_throughput::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = serde_json::from_slice(rsp_body).map_err(|source| { + migrate_mongo_db_collection_to_manual_throughput::Error::DeserializeError(source, rsp_body.clone()) + })?; + Err(migrate_mongo_db_collection_to_manual_throughput::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod migrate_mongo_db_collection_to_manual_throughput { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} +pub mod table_resources { + use crate::models::*; + pub async fn list_tables( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/tables", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name + ); + let mut url = url::Url::parse(url_str).map_err(list_tables::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_tables::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list_tables::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_tables::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: TableListResult = + serde_json::from_slice(rsp_body).map_err(|source| list_tables::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_tables::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_tables { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get_table( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + table_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/tables/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + table_name + ); + let mut url = url::Url::parse(url_str).map_err(get_table::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get_table::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(get_table::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_table::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: TableGetResults = + serde_json::from_slice(rsp_body).map_err(|source| get_table::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(get_table::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod get_table { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn create_update_table( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + table_name: &str, + create_update_table_parameters: &TableCreateUpdateParameters, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/tables/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + table_name + ); + let mut url = url::Url::parse(url_str).map_err(create_update_table::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(create_update_table::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = azure_core::to_json(create_update_table_parameters).map_err(create_update_table::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(create_update_table::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(create_update_table::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(create_update_table::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: TableGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| create_update_table::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(create_update_table::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + Err(create_update_table::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod create_update_table { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(TableGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn delete_table( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + table_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/tables/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + table_name + ); + let mut url = url::Url::parse(url_str).map_err(delete_table::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(delete_table::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(delete_table::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(delete_table::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(delete_table::Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(delete_table::Response::NoContent204), + status_code => { + let rsp_body = rsp.body(); + Err(delete_table::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod delete_table { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get_table_throughput( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + table_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/tables/{}/throughputSettings/default", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + table_name + ); + let mut url = url::Url::parse(url_str).map_err(get_table_throughput::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get_table_throughput::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(get_table_throughput::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_table_throughput::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| get_table_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(get_table_throughput::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod get_table_throughput { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn update_table_throughput( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + table_name: &str, + update_throughput_parameters: &ThroughputSettingsUpdateParameters, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/tables/{}/throughputSettings/default", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + table_name + ); + let mut url = url::Url::parse(url_str).map_err(update_table_throughput::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(update_table_throughput::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = azure_core::to_json(update_throughput_parameters).map_err(update_table_throughput::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(update_table_throughput::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(update_table_throughput::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(update_table_throughput::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| update_table_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(update_table_throughput::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + Err(update_table_throughput::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod update_table_throughput { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn migrate_table_to_autoscale( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + table_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/tables/{}/throughputSettings/default/migrateToAutoscale" , operation_config . base_path () , subscription_id , resource_group_name , account_name , table_name) ; + let mut url = url::Url::parse(url_str).map_err(migrate_table_to_autoscale::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(migrate_table_to_autoscale::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(migrate_table_to_autoscale::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(migrate_table_to_autoscale::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(migrate_table_to_autoscale::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_table_to_autoscale::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(migrate_table_to_autoscale::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_table_to_autoscale::Error::DeserializeError(source, rsp_body.clone()))?; + Err(migrate_table_to_autoscale::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod migrate_table_to_autoscale { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn migrate_table_to_manual_throughput( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + table_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/tables/{}/throughputSettings/default/migrateToManualThroughput" , operation_config . base_path () , subscription_id , resource_group_name , account_name , table_name) ; + let mut url = url::Url::parse(url_str).map_err(migrate_table_to_manual_throughput::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(migrate_table_to_manual_throughput::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(migrate_table_to_manual_throughput::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(migrate_table_to_manual_throughput::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(migrate_table_to_manual_throughput::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_table_to_manual_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(migrate_table_to_manual_throughput::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_table_to_manual_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Err(migrate_table_to_manual_throughput::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod migrate_table_to_manual_throughput { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} +pub mod cassandra_resources { + use crate::models::*; + pub async fn list_cassandra_keyspaces( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name + ); + let mut url = url::Url::parse(url_str).map_err(list_cassandra_keyspaces::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_cassandra_keyspaces::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(list_cassandra_keyspaces::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_cassandra_keyspaces::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: CassandraKeyspaceListResult = serde_json::from_slice(rsp_body) + .map_err(|source| list_cassandra_keyspaces::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_cassandra_keyspaces::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_cassandra_keyspaces { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get_cassandra_keyspace( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + keyspace_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + keyspace_name + ); + let mut url = url::Url::parse(url_str).map_err(get_cassandra_keyspace::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get_cassandra_keyspace::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(get_cassandra_keyspace::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_cassandra_keyspace::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: CassandraKeyspaceGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| get_cassandra_keyspace::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(get_cassandra_keyspace::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod get_cassandra_keyspace { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn create_update_cassandra_keyspace( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + keyspace_name: &str, + create_update_cassandra_keyspace_parameters: &CassandraKeyspaceCreateUpdateParameters, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + keyspace_name + ); + let mut url = url::Url::parse(url_str).map_err(create_update_cassandra_keyspace::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(create_update_cassandra_keyspace::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = azure_core::to_json(create_update_cassandra_keyspace_parameters) + .map_err(create_update_cassandra_keyspace::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(create_update_cassandra_keyspace::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(create_update_cassandra_keyspace::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(create_update_cassandra_keyspace::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: CassandraKeyspaceGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| create_update_cassandra_keyspace::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(create_update_cassandra_keyspace::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + Err(create_update_cassandra_keyspace::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod create_update_cassandra_keyspace { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(CassandraKeyspaceGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn delete_cassandra_keyspace( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + keyspace_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + keyspace_name + ); + let mut url = url::Url::parse(url_str).map_err(delete_cassandra_keyspace::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(delete_cassandra_keyspace::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(delete_cassandra_keyspace::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(delete_cassandra_keyspace::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(delete_cassandra_keyspace::Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(delete_cassandra_keyspace::Response::NoContent204), + status_code => { + let rsp_body = rsp.body(); + Err(delete_cassandra_keyspace::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod delete_cassandra_keyspace { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get_cassandra_keyspace_throughput( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + keyspace_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}/throughputSettings/default" , operation_config . base_path () , subscription_id , resource_group_name , account_name , keyspace_name) ; + let mut url = url::Url::parse(url_str).map_err(get_cassandra_keyspace_throughput::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get_cassandra_keyspace_throughput::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(get_cassandra_keyspace_throughput::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_cassandra_keyspace_throughput::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| get_cassandra_keyspace_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(get_cassandra_keyspace_throughput::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod get_cassandra_keyspace_throughput { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn update_cassandra_keyspace_throughput( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + keyspace_name: &str, + update_throughput_parameters: &ThroughputSettingsUpdateParameters, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}/throughputSettings/default" , operation_config . base_path () , subscription_id , resource_group_name , account_name , keyspace_name) ; + let mut url = url::Url::parse(url_str).map_err(update_cassandra_keyspace_throughput::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(update_cassandra_keyspace_throughput::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = + azure_core::to_json(update_throughput_parameters).map_err(update_cassandra_keyspace_throughput::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(update_cassandra_keyspace_throughput::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(update_cassandra_keyspace_throughput::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(update_cassandra_keyspace_throughput::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| update_cassandra_keyspace_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(update_cassandra_keyspace_throughput::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + Err(update_cassandra_keyspace_throughput::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod update_cassandra_keyspace_throughput { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn migrate_cassandra_keyspace_to_autoscale( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + keyspace_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}/throughputSettings/default/migrateToAutoscale" , operation_config . base_path () , subscription_id , resource_group_name , account_name , keyspace_name) ; + let mut url = url::Url::parse(url_str).map_err(migrate_cassandra_keyspace_to_autoscale::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(migrate_cassandra_keyspace_to_autoscale::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(migrate_cassandra_keyspace_to_autoscale::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(migrate_cassandra_keyspace_to_autoscale::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(migrate_cassandra_keyspace_to_autoscale::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_cassandra_keyspace_to_autoscale::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(migrate_cassandra_keyspace_to_autoscale::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_cassandra_keyspace_to_autoscale::Error::DeserializeError(source, rsp_body.clone()))?; + Err(migrate_cassandra_keyspace_to_autoscale::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod migrate_cassandra_keyspace_to_autoscale { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn migrate_cassandra_keyspace_to_manual_throughput( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + keyspace_name: &str, + ) -> std::result::Result< + migrate_cassandra_keyspace_to_manual_throughput::Response, + migrate_cassandra_keyspace_to_manual_throughput::Error, + > { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}/throughputSettings/default/migrateToManualThroughput" , operation_config . base_path () , subscription_id , resource_group_name , account_name , keyspace_name) ; + let mut url = url::Url::parse(url_str).map_err(migrate_cassandra_keyspace_to_manual_throughput::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(migrate_cassandra_keyspace_to_manual_throughput::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(migrate_cassandra_keyspace_to_manual_throughput::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(migrate_cassandra_keyspace_to_manual_throughput::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(migrate_cassandra_keyspace_to_manual_throughput::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_cassandra_keyspace_to_manual_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(migrate_cassandra_keyspace_to_manual_throughput::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_cassandra_keyspace_to_manual_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Err(migrate_cassandra_keyspace_to_manual_throughput::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod migrate_cassandra_keyspace_to_manual_throughput { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn list_cassandra_tables( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + keyspace_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}/tables", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + keyspace_name + ); + let mut url = url::Url::parse(url_str).map_err(list_cassandra_tables::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_cassandra_tables::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(list_cassandra_tables::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_cassandra_tables::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: CassandraTableListResult = serde_json::from_slice(rsp_body) + .map_err(|source| list_cassandra_tables::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_cassandra_tables::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_cassandra_tables { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get_cassandra_table( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + keyspace_name: &str, + table_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}/tables/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + keyspace_name, + table_name + ); + let mut url = url::Url::parse(url_str).map_err(get_cassandra_table::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get_cassandra_table::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(get_cassandra_table::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_cassandra_table::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: CassandraTableGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| get_cassandra_table::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(get_cassandra_table::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod get_cassandra_table { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn create_update_cassandra_table( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + keyspace_name: &str, + table_name: &str, + create_update_cassandra_table_parameters: &CassandraTableCreateUpdateParameters, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}/tables/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + keyspace_name, + table_name + ); + let mut url = url::Url::parse(url_str).map_err(create_update_cassandra_table::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(create_update_cassandra_table::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = + azure_core::to_json(create_update_cassandra_table_parameters).map_err(create_update_cassandra_table::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(create_update_cassandra_table::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(create_update_cassandra_table::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(create_update_cassandra_table::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: CassandraTableGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| create_update_cassandra_table::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(create_update_cassandra_table::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + Err(create_update_cassandra_table::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod create_update_cassandra_table { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(CassandraTableGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn delete_cassandra_table( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + keyspace_name: &str, + table_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}/tables/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + keyspace_name, + table_name + ); + let mut url = url::Url::parse(url_str).map_err(delete_cassandra_table::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(delete_cassandra_table::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(delete_cassandra_table::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(delete_cassandra_table::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(delete_cassandra_table::Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(delete_cassandra_table::Response::NoContent204), + status_code => { + let rsp_body = rsp.body(); + Err(delete_cassandra_table::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod delete_cassandra_table { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get_cassandra_table_throughput( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + keyspace_name: &str, + table_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}/tables/{}/throughputSettings/default" , operation_config . base_path () , subscription_id , resource_group_name , account_name , keyspace_name , table_name) ; + let mut url = url::Url::parse(url_str).map_err(get_cassandra_table_throughput::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get_cassandra_table_throughput::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(get_cassandra_table_throughput::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_cassandra_table_throughput::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| get_cassandra_table_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(get_cassandra_table_throughput::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod get_cassandra_table_throughput { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn update_cassandra_table_throughput( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + keyspace_name: &str, + table_name: &str, + update_throughput_parameters: &ThroughputSettingsUpdateParameters, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}/tables/{}/throughputSettings/default" , operation_config . base_path () , subscription_id , resource_group_name , account_name , keyspace_name , table_name) ; + let mut url = url::Url::parse(url_str).map_err(update_cassandra_table_throughput::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(update_cassandra_table_throughput::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = + azure_core::to_json(update_throughput_parameters).map_err(update_cassandra_table_throughput::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(update_cassandra_table_throughput::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(update_cassandra_table_throughput::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(update_cassandra_table_throughput::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| update_cassandra_table_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(update_cassandra_table_throughput::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + Err(update_cassandra_table_throughput::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod update_cassandra_table_throughput { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn migrate_cassandra_table_to_autoscale( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + keyspace_name: &str, + table_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}/tables/{}/throughputSettings/default/migrateToAutoscale" , operation_config . base_path () , subscription_id , resource_group_name , account_name , keyspace_name , table_name) ; + let mut url = url::Url::parse(url_str).map_err(migrate_cassandra_table_to_autoscale::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(migrate_cassandra_table_to_autoscale::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(migrate_cassandra_table_to_autoscale::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(migrate_cassandra_table_to_autoscale::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(migrate_cassandra_table_to_autoscale::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_cassandra_table_to_autoscale::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(migrate_cassandra_table_to_autoscale::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_cassandra_table_to_autoscale::Error::DeserializeError(source, rsp_body.clone()))?; + Err(migrate_cassandra_table_to_autoscale::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod migrate_cassandra_table_to_autoscale { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn migrate_cassandra_table_to_manual_throughput( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + keyspace_name: &str, + table_name: &str, + ) -> std::result::Result + { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/cassandraKeyspaces/{}/tables/{}/throughputSettings/default/migrateToManualThroughput" , operation_config . base_path () , subscription_id , resource_group_name , account_name , keyspace_name , table_name) ; + let mut url = url::Url::parse(url_str).map_err(migrate_cassandra_table_to_manual_throughput::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(migrate_cassandra_table_to_manual_throughput::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(migrate_cassandra_table_to_manual_throughput::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(migrate_cassandra_table_to_manual_throughput::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(migrate_cassandra_table_to_manual_throughput::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_cassandra_table_to_manual_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(migrate_cassandra_table_to_manual_throughput::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_cassandra_table_to_manual_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Err(migrate_cassandra_table_to_manual_throughput::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod migrate_cassandra_table_to_manual_throughput { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} +pub mod gremlin_resources { + use crate::models::*; + pub async fn list_gremlin_databases( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name + ); + let mut url = url::Url::parse(url_str).map_err(list_gremlin_databases::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_gremlin_databases::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(list_gremlin_databases::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_gremlin_databases::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: GremlinDatabaseListResult = serde_json::from_slice(rsp_body) + .map_err(|source| list_gremlin_databases::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_gremlin_databases::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_gremlin_databases { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get_gremlin_database( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + database_name + ); + let mut url = url::Url::parse(url_str).map_err(get_gremlin_database::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get_gremlin_database::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(get_gremlin_database::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_gremlin_database::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: GremlinDatabaseGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| get_gremlin_database::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(get_gremlin_database::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod get_gremlin_database { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn create_update_gremlin_database( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + create_update_gremlin_database_parameters: &GremlinDatabaseCreateUpdateParameters, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + database_name + ); + let mut url = url::Url::parse(url_str).map_err(create_update_gremlin_database::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(create_update_gremlin_database::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = azure_core::to_json(create_update_gremlin_database_parameters) + .map_err(create_update_gremlin_database::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(create_update_gremlin_database::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(create_update_gremlin_database::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(create_update_gremlin_database::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: GremlinDatabaseGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| create_update_gremlin_database::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(create_update_gremlin_database::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + Err(create_update_gremlin_database::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod create_update_gremlin_database { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(GremlinDatabaseGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn delete_gremlin_database( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + database_name + ); + let mut url = url::Url::parse(url_str).map_err(delete_gremlin_database::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(delete_gremlin_database::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(delete_gremlin_database::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(delete_gremlin_database::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(delete_gremlin_database::Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(delete_gremlin_database::Response::NoContent204), + status_code => { + let rsp_body = rsp.body(); + Err(delete_gremlin_database::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod delete_gremlin_database { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get_gremlin_database_throughput( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases/{}/throughputSettings/default" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name) ; + let mut url = url::Url::parse(url_str).map_err(get_gremlin_database_throughput::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get_gremlin_database_throughput::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(get_gremlin_database_throughput::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_gremlin_database_throughput::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| get_gremlin_database_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(get_gremlin_database_throughput::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod get_gremlin_database_throughput { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn update_gremlin_database_throughput( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + update_throughput_parameters: &ThroughputSettingsUpdateParameters, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases/{}/throughputSettings/default" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name) ; + let mut url = url::Url::parse(url_str).map_err(update_gremlin_database_throughput::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(update_gremlin_database_throughput::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = + azure_core::to_json(update_throughput_parameters).map_err(update_gremlin_database_throughput::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(update_gremlin_database_throughput::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(update_gremlin_database_throughput::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(update_gremlin_database_throughput::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| update_gremlin_database_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(update_gremlin_database_throughput::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + Err(update_gremlin_database_throughput::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod update_gremlin_database_throughput { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn migrate_gremlin_database_to_autoscale( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases/{}/throughputSettings/default/migrateToAutoscale" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name) ; + let mut url = url::Url::parse(url_str).map_err(migrate_gremlin_database_to_autoscale::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(migrate_gremlin_database_to_autoscale::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(migrate_gremlin_database_to_autoscale::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(migrate_gremlin_database_to_autoscale::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(migrate_gremlin_database_to_autoscale::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_gremlin_database_to_autoscale::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(migrate_gremlin_database_to_autoscale::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_gremlin_database_to_autoscale::Error::DeserializeError(source, rsp_body.clone()))?; + Err(migrate_gremlin_database_to_autoscale::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod migrate_gremlin_database_to_autoscale { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn migrate_gremlin_database_to_manual_throughput( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + ) -> std::result::Result + { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases/{}/throughputSettings/default/migrateToManualThroughput" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name) ; + let mut url = url::Url::parse(url_str).map_err(migrate_gremlin_database_to_manual_throughput::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(migrate_gremlin_database_to_manual_throughput::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(migrate_gremlin_database_to_manual_throughput::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(migrate_gremlin_database_to_manual_throughput::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(migrate_gremlin_database_to_manual_throughput::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_gremlin_database_to_manual_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(migrate_gremlin_database_to_manual_throughput::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_gremlin_database_to_manual_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Err(migrate_gremlin_database_to_manual_throughput::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod migrate_gremlin_database_to_manual_throughput { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn list_gremlin_graphs( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases/{}/graphs", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + database_name + ); + let mut url = url::Url::parse(url_str).map_err(list_gremlin_graphs::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_gremlin_graphs::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list_gremlin_graphs::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_gremlin_graphs::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: GremlinGraphListResult = serde_json::from_slice(rsp_body) + .map_err(|source| list_gremlin_graphs::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_gremlin_graphs::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_gremlin_graphs { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get_gremlin_graph( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + graph_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases/{}/graphs/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + database_name, + graph_name + ); + let mut url = url::Url::parse(url_str).map_err(get_gremlin_graph::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get_gremlin_graph::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(get_gremlin_graph::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_gremlin_graph::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: GremlinGraphGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| get_gremlin_graph::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(get_gremlin_graph::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod get_gremlin_graph { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn create_update_gremlin_graph( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + graph_name: &str, + create_update_gremlin_graph_parameters: &GremlinGraphCreateUpdateParameters, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases/{}/graphs/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + database_name, + graph_name + ); + let mut url = url::Url::parse(url_str).map_err(create_update_gremlin_graph::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(create_update_gremlin_graph::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = + azure_core::to_json(create_update_gremlin_graph_parameters).map_err(create_update_gremlin_graph::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(create_update_gremlin_graph::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(create_update_gremlin_graph::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(create_update_gremlin_graph::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: GremlinGraphGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| create_update_gremlin_graph::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(create_update_gremlin_graph::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + Err(create_update_gremlin_graph::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod create_update_gremlin_graph { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(GremlinGraphGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn delete_gremlin_graph( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + graph_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases/{}/graphs/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + database_name, + graph_name + ); + let mut url = url::Url::parse(url_str).map_err(delete_gremlin_graph::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(delete_gremlin_graph::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(delete_gremlin_graph::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(delete_gremlin_graph::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(delete_gremlin_graph::Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(delete_gremlin_graph::Response::NoContent204), + status_code => { + let rsp_body = rsp.body(); + Err(delete_gremlin_graph::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod delete_gremlin_graph { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get_gremlin_graph_throughput( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + graph_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases/{}/graphs/{}/throughputSettings/default" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name , graph_name) ; + let mut url = url::Url::parse(url_str).map_err(get_gremlin_graph_throughput::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get_gremlin_graph_throughput::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(get_gremlin_graph_throughput::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_gremlin_graph_throughput::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| get_gremlin_graph_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(get_gremlin_graph_throughput::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod get_gremlin_graph_throughput { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn update_gremlin_graph_throughput( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + graph_name: &str, + update_throughput_parameters: &ThroughputSettingsUpdateParameters, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases/{}/graphs/{}/throughputSettings/default" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name , graph_name) ; + let mut url = url::Url::parse(url_str).map_err(update_gremlin_graph_throughput::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(update_gremlin_graph_throughput::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = azure_core::to_json(update_throughput_parameters).map_err(update_gremlin_graph_throughput::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(update_gremlin_graph_throughput::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(update_gremlin_graph_throughput::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(update_gremlin_graph_throughput::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| update_gremlin_graph_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(update_gremlin_graph_throughput::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + Err(update_gremlin_graph_throughput::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod update_gremlin_graph_throughput { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn migrate_gremlin_graph_to_autoscale( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + graph_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases/{}/graphs/{}/throughputSettings/default/migrateToAutoscale" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name , graph_name) ; + let mut url = url::Url::parse(url_str).map_err(migrate_gremlin_graph_to_autoscale::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(migrate_gremlin_graph_to_autoscale::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(migrate_gremlin_graph_to_autoscale::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(migrate_gremlin_graph_to_autoscale::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(migrate_gremlin_graph_to_autoscale::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_gremlin_graph_to_autoscale::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(migrate_gremlin_graph_to_autoscale::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_gremlin_graph_to_autoscale::Error::DeserializeError(source, rsp_body.clone()))?; + Err(migrate_gremlin_graph_to_autoscale::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod migrate_gremlin_graph_to_autoscale { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn migrate_gremlin_graph_to_manual_throughput( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + database_name: &str, + graph_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/gremlinDatabases/{}/graphs/{}/throughputSettings/default/migrateToManualThroughput" , operation_config . base_path () , subscription_id , resource_group_name , account_name , database_name , graph_name) ; + let mut url = url::Url::parse(url_str).map_err(migrate_gremlin_graph_to_manual_throughput::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(migrate_gremlin_graph_to_manual_throughput::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(migrate_gremlin_graph_to_manual_throughput::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(migrate_gremlin_graph_to_manual_throughput::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(migrate_gremlin_graph_to_manual_throughput::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: ThroughputSettingsGetResults = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_gremlin_graph_to_manual_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(migrate_gremlin_graph_to_manual_throughput::Response::Ok200(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = serde_json::from_slice(rsp_body) + .map_err(|source| migrate_gremlin_graph_to_manual_throughput::Error::DeserializeError(source, rsp_body.clone()))?; + Err(migrate_gremlin_graph_to_manual_throughput::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod migrate_gremlin_graph_to_manual_throughput { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + Ok200(ThroughputSettingsGetResults), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} +pub mod private_endpoint_connections { + use crate::models::*; + pub async fn list_by_database_account( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/privateEndpointConnections", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name + ); + let mut url = url::Url::parse(url_str).map_err(list_by_database_account::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_by_database_account::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(list_by_database_account::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_by_database_account::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: PrivateEndpointConnectionListResult = serde_json::from_slice(rsp_body) + .map_err(|source| list_by_database_account::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_by_database_account::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_by_database_account { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + private_endpoint_connection_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/privateEndpointConnections/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + private_endpoint_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(get::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(get::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(get::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: PrivateEndpointConnection = + serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(get::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod get { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn create_or_update( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + private_endpoint_connection_name: &str, + parameters: &PrivateEndpointConnection, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/privateEndpointConnections/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + private_endpoint_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(create_or_update::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(create_or_update::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = azure_core::to_json(parameters).map_err(create_or_update::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(create_or_update::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(create_or_update::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: PrivateEndpointConnection = serde_json::from_slice(rsp_body) + .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(create_or_update::Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(create_or_update::Response::Accepted202), + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = serde_json::from_slice(rsp_body) + .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; + Err(create_or_update::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod create_or_update { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Ok200(PrivateEndpointConnection), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn delete( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + private_endpoint_connection_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/privateEndpointConnections/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + private_endpoint_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(delete::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(delete::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(delete::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(delete::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(delete::Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(delete::Response::NoContent204), + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = + serde_json::from_slice(rsp_body).map_err(|source| delete::Error::DeserializeError(source, rsp_body.clone()))?; + Err(delete::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod delete { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} +pub mod notebook_workspaces { + use crate::models::*; + pub async fn list_by_database_account( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/notebookWorkspaces", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name + ); + let mut url = url::Url::parse(url_str).map_err(list_by_database_account::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_by_database_account::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(list_by_database_account::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_by_database_account::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: NotebookWorkspaceListResult = serde_json::from_slice(rsp_body) + .map_err(|source| list_by_database_account::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = serde_json::from_slice(rsp_body) + .map_err(|source| list_by_database_account::Error::DeserializeError(source, rsp_body.clone()))?; + Err(list_by_database_account::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod list_by_database_account { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + notebook_workspace_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/notebookWorkspaces/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + notebook_workspace_name + ); + let mut url = url::Url::parse(url_str).map_err(get::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(get::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(get::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: NotebookWorkspace = + serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = + serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; + Err(get::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod get { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn create_or_update( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + notebook_workspace_name: &str, + notebook_create_update_parameters: &NotebookWorkspaceCreateUpdateParameters, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/notebookWorkspaces/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + notebook_workspace_name + ); + let mut url = url::Url::parse(url_str).map_err(create_or_update::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(create_or_update::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = azure_core::to_json(notebook_create_update_parameters).map_err(create_or_update::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(create_or_update::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(create_or_update::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: NotebookWorkspace = serde_json::from_slice(rsp_body) + .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = serde_json::from_slice(rsp_body) + .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; + Err(create_or_update::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod create_or_update { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn delete( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + notebook_workspace_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/notebookWorkspaces/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + notebook_workspace_name + ); + let mut url = url::Url::parse(url_str).map_err(delete::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(delete::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(delete::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(delete::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(delete::Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(delete::Response::NoContent204), + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = + serde_json::from_slice(rsp_body).map_err(|source| delete::Error::DeserializeError(source, rsp_body.clone()))?; + Err(delete::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod delete { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn list_connection_info( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + notebook_workspace_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/notebookWorkspaces/{}/listConnectionInfo" , operation_config . base_path () , subscription_id , resource_group_name , account_name , notebook_workspace_name) ; + let mut url = url::Url::parse(url_str).map_err(list_connection_info::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_connection_info::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list_connection_info::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_connection_info::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: NotebookWorkspaceConnectionInfoResult = serde_json::from_slice(rsp_body) + .map_err(|source| list_connection_info::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = serde_json::from_slice(rsp_body) + .map_err(|source| list_connection_info::Error::DeserializeError(source, rsp_body.clone()))?; + Err(list_connection_info::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod list_connection_info { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn regenerate_auth_token( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + notebook_workspace_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/notebookWorkspaces/{}/regenerateAuthToken" , operation_config . base_path () , subscription_id , resource_group_name , account_name , notebook_workspace_name) ; + let mut url = url::Url::parse(url_str).map_err(regenerate_auth_token::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(regenerate_auth_token::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(regenerate_auth_token::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(regenerate_auth_token::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => Ok(regenerate_auth_token::Response::Ok200), + http::StatusCode::ACCEPTED => Ok(regenerate_auth_token::Response::Accepted202), + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = serde_json::from_slice(rsp_body) + .map_err(|source| regenerate_auth_token::Error::DeserializeError(source, rsp_body.clone()))?; + Err(regenerate_auth_token::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod regenerate_auth_token { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn start( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + notebook_workspace_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/notebookWorkspaces/{}/start", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + notebook_workspace_name + ); + let mut url = url::Url::parse(url_str).map_err(start::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(start::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(start::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(start::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => Ok(start::Response::Ok200), + http::StatusCode::ACCEPTED => Ok(start::Response::Accepted202), + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = + serde_json::from_slice(rsp_body).map_err(|source| start::Error::DeserializeError(source, rsp_body.clone()))?; + Err(start::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod start { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} +pub mod private_link_resources { + use crate::models::*; + pub async fn list_by_database_account( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/privateLinkResources", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name + ); + let mut url = url::Url::parse(url_str).map_err(list_by_database_account::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_by_database_account::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(list_by_database_account::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_by_database_account::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: PrivateLinkResourceListResult = serde_json::from_slice(rsp_body) + .map_err(|source| list_by_database_account::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(list_by_database_account::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod list_by_database_account { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + account_name: &str, + group_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DocumentDB/databaseAccounts/{}/privateLinkResources/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + account_name, + group_name + ); + let mut url = url::Url::parse(url_str).map_err(get::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(get::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(get::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: PrivateLinkResource = + serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + Err(get::Error::UnexpectedResponse { + status_code, + body: rsp_body.clone(), + }) + } + } + } + pub mod get { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("Unexpected HTTP status code {}", status_code)] + UnexpectedResponse { status_code: http::StatusCode, body: bytes::Bytes }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} diff --git a/services/mgmt/cost_management/src/lib.rs b/services/mgmt/cost_management/src/lib.rs index 63de908300..648f7db7da 100644 --- a/services/mgmt/cost_management/src/lib.rs +++ b/services/mgmt/cost_management/src/lib.rs @@ -45,7 +45,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-05")] pub use package_2018_05::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -58,7 +58,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -77,7 +77,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -87,7 +87,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/cpim/src/lib.rs b/services/mgmt/cpim/src/lib.rs index b015eb4f9b..421e5f496d 100644 --- a/services/mgmt/cpim/src/lib.rs +++ b/services/mgmt/cpim/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-05-01-preview")] pub use package_2020_05_01_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/customer_insights/src/lib.rs b/services/mgmt/customer_insights/src/lib.rs index 335fefb2ff..0e1b34e516 100644 --- a/services/mgmt/customer_insights/src/lib.rs +++ b/services/mgmt/customer_insights/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2017-01")] pub use package_2017_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/customerlockbox/src/lib.rs b/services/mgmt/customerlockbox/src/lib.rs index 979544e043..3e140fe628 100644 --- a/services/mgmt/customerlockbox/src/lib.rs +++ b/services/mgmt/customerlockbox/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-02-28-preview")] pub use package_2018_02_28_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/customproviders/src/lib.rs b/services/mgmt/customproviders/src/lib.rs index 4fde356fd9..1afca36896 100644 --- a/services/mgmt/customproviders/src/lib.rs +++ b/services/mgmt/customproviders/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-09-01-preview")] pub use package_2018_09_01_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/databox/src/lib.rs b/services/mgmt/databox/src/lib.rs index 27354349e7..7e51f68785 100644 --- a/services/mgmt/databox/src/lib.rs +++ b/services/mgmt/databox/src/lib.rs @@ -21,7 +21,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-01")] pub use package_2018_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -34,7 +34,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -53,7 +53,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -63,7 +63,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/databoxedge/src/lib.rs b/services/mgmt/databoxedge/src/lib.rs index 9e2a3a022b..ae401684d5 100644 --- a/services/mgmt/databoxedge/src/lib.rs +++ b/services/mgmt/databoxedge/src/lib.rs @@ -37,7 +37,7 @@ use azure_core::setters; #[cfg(feature = "profile-hybrid-2020-09-01")] pub use profile_hybrid_2020_09_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -50,7 +50,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -69,7 +69,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -79,7 +79,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/databricks/src/lib.rs b/services/mgmt/databricks/src/lib.rs index 554bd202e2..623fc59be8 100644 --- a/services/mgmt/databricks/src/lib.rs +++ b/services/mgmt/databricks/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-04-01")] pub use package_2018_04_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/datacatalog/src/lib.rs b/services/mgmt/datacatalog/src/lib.rs index c293288f2b..8a3470b52a 100644 --- a/services/mgmt/datacatalog/src/lib.rs +++ b/services/mgmt/datacatalog/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2016-03-30")] pub use package_2016_03_30::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/datadog/src/lib.rs b/services/mgmt/datadog/src/lib.rs index ddd6e864e7..32e9392af2 100644 --- a/services/mgmt/datadog/src/lib.rs +++ b/services/mgmt/datadog/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-02-preview")] pub use package_2020_02_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/datafactory/src/lib.rs b/services/mgmt/datafactory/src/lib.rs index 6cf49dcd5f..824b859141 100644 --- a/services/mgmt/datafactory/src/lib.rs +++ b/services/mgmt/datafactory/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2017-09-preview")] pub use package_2017_09_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/datalake_analytics/src/lib.rs b/services/mgmt/datalake_analytics/src/lib.rs index 03e8bc8b2c..5e465ebd5c 100644 --- a/services/mgmt/datalake_analytics/src/lib.rs +++ b/services/mgmt/datalake_analytics/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2015-10-preview")] pub use package_2015_10_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/datalake_store/src/lib.rs b/services/mgmt/datalake_store/src/lib.rs index 03e8bc8b2c..5e465ebd5c 100644 --- a/services/mgmt/datalake_store/src/lib.rs +++ b/services/mgmt/datalake_store/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2015-10-preview")] pub use package_2015_10_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/dataprotection/src/lib.rs b/services/mgmt/dataprotection/src/lib.rs index 965ce10d65..d449facbe6 100644 --- a/services/mgmt/dataprotection/src/lib.rs +++ b/services/mgmt/dataprotection/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2021-02-preview")] pub use package_2021_02_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/datashare/src/lib.rs b/services/mgmt/datashare/src/lib.rs index 6044a69d0c..cd80f00e45 100644 --- a/services/mgmt/datashare/src/lib.rs +++ b/services/mgmt/datashare/src/lib.rs @@ -17,7 +17,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-10-01-preview")] pub use package_2020_10_01_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -30,7 +30,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -49,7 +49,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -59,7 +59,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/desktopvirtualization/src/lib.rs b/services/mgmt/desktopvirtualization/src/lib.rs index b572a86cc9..410cc25d94 100644 --- a/services/mgmt/desktopvirtualization/src/lib.rs +++ b/services/mgmt/desktopvirtualization/src/lib.rs @@ -45,7 +45,7 @@ use azure_core::setters; #[cfg(feature = "package-2021-04-01-preview")] pub use package_2021_04_01_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -58,7 +58,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -77,7 +77,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -87,7 +87,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/deviceupdate/src/lib.rs b/services/mgmt/deviceupdate/src/lib.rs index 63328af16a..f5b3e645b6 100644 --- a/services/mgmt/deviceupdate/src/lib.rs +++ b/services/mgmt/deviceupdate/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-03-01-preview")] pub use package_2020_03_01_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/deviceupdate/src/package_2020_03_01_preview/models.rs b/services/mgmt/deviceupdate/src/package_2020_03_01_preview/models.rs index fd5627537a..799eff388c 100644 --- a/services/mgmt/deviceupdate/src/package_2020_03_01_preview/models.rs +++ b/services/mgmt/deviceupdate/src/package_2020_03_01_preview/models.rs @@ -60,6 +60,8 @@ pub mod instance { pub account_name: Option, #[serde(rename = "iotHubs", default, skip_serializing_if = "Vec::is_empty")] pub iot_hubs: Vec, + #[serde(rename = "enableDiagnostics", default, skip_serializing_if = "Option::is_none")] + pub enable_diagnostics: Option, } pub mod properties { use super::*; diff --git a/services/mgmt/devops/src/lib.rs b/services/mgmt/devops/src/lib.rs index d80d67fac4..e0e2f5fca6 100644 --- a/services/mgmt/devops/src/lib.rs +++ b/services/mgmt/devops/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2019-07-01-preview")] pub use package_2019_07_01_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/devspaces/src/lib.rs b/services/mgmt/devspaces/src/lib.rs index fc0f821fe5..ef5ce01339 100644 --- a/services/mgmt/devspaces/src/lib.rs +++ b/services/mgmt/devspaces/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2019-04-01")] pub use package_2019_04_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/devtestlabs/src/lib.rs b/services/mgmt/devtestlabs/src/lib.rs index 2229c373cb..c8f40aa40e 100644 --- a/services/mgmt/devtestlabs/src/lib.rs +++ b/services/mgmt/devtestlabs/src/lib.rs @@ -13,7 +13,7 @@ use azure_core::setters; #[cfg(feature = "package-2015-05-preview")] pub use package_2015_05_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -26,7 +26,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -45,7 +45,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -55,7 +55,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/dfp/src/lib.rs b/services/mgmt/dfp/src/lib.rs index 3c7551a6ee..a0275c8bbb 100644 --- a/services/mgmt/dfp/src/lib.rs +++ b/services/mgmt/dfp/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2021-02-01-preview")] pub use package_2021_02_01_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/digitaltwins/src/lib.rs b/services/mgmt/digitaltwins/src/lib.rs index fdb92c4714..b29c4ee793 100644 --- a/services/mgmt/digitaltwins/src/lib.rs +++ b/services/mgmt/digitaltwins/src/lib.rs @@ -13,7 +13,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-03-01-preview")] pub use package_2020_03_01_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -26,7 +26,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -45,7 +45,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -55,7 +55,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/dns/src/lib.rs b/services/mgmt/dns/src/lib.rs index 3a5b4eebef..09b311d639 100644 --- a/services/mgmt/dns/src/lib.rs +++ b/services/mgmt/dns/src/lib.rs @@ -29,7 +29,7 @@ use azure_core::setters; #[cfg(feature = "profile-hybrid-2020-09-01")] pub use profile_hybrid_2020_09_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -42,7 +42,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -61,7 +61,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -71,7 +71,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/domainservices/src/lib.rs b/services/mgmt/domainservices/src/lib.rs index 06b4c73d43..6c82121d6f 100644 --- a/services/mgmt/domainservices/src/lib.rs +++ b/services/mgmt/domainservices/src/lib.rs @@ -21,7 +21,7 @@ use azure_core::setters; #[cfg(feature = "package-2017-01")] pub use package_2017_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -34,7 +34,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -53,7 +53,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -63,7 +63,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/edgeorder/src/lib.rs b/services/mgmt/edgeorder/src/lib.rs index fc44e27fe5..a258a1c10f 100644 --- a/services/mgmt/edgeorder/src/lib.rs +++ b/services/mgmt/edgeorder/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-12-preview")] pub use package_2020_12_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/edgeorderpartner/src/lib.rs b/services/mgmt/edgeorderpartner/src/lib.rs index fc44e27fe5..a258a1c10f 100644 --- a/services/mgmt/edgeorderpartner/src/lib.rs +++ b/services/mgmt/edgeorderpartner/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-12-preview")] pub use package_2020_12_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/elastic/src/lib.rs b/services/mgmt/elastic/src/lib.rs index e1f22db210..5cfacd920a 100644 --- a/services/mgmt/elastic/src/lib.rs +++ b/services/mgmt/elastic/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-07-01-preview")] pub use package_2020_07_01_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/engagementfabric/src/lib.rs b/services/mgmt/engagementfabric/src/lib.rs index 638f915b56..a2860c7322 100644 --- a/services/mgmt/engagementfabric/src/lib.rs +++ b/services/mgmt/engagementfabric/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-09-preview")] pub use package_2018_09_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/enterprise_knowledge_graph/src/lib.rs b/services/mgmt/enterprise_knowledge_graph/src/lib.rs index 30850fc63d..20388ac51c 100644 --- a/services/mgmt/enterprise_knowledge_graph/src/lib.rs +++ b/services/mgmt/enterprise_knowledge_graph/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-12-03")] pub use package_2018_12_03::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/eventgrid/src/lib.rs b/services/mgmt/eventgrid/src/lib.rs index 4593f91fa1..8101ddec40 100644 --- a/services/mgmt/eventgrid/src/lib.rs +++ b/services/mgmt/eventgrid/src/lib.rs @@ -29,7 +29,7 @@ use azure_core::setters; #[cfg(feature = "package-2019-01")] pub use package_2019_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -42,7 +42,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -61,7 +61,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -71,7 +71,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/eventhub/src/lib.rs b/services/mgmt/eventhub/src/lib.rs index a3cafcd8d7..f13c2d56b6 100644 --- a/services/mgmt/eventhub/src/lib.rs +++ b/services/mgmt/eventhub/src/lib.rs @@ -25,7 +25,7 @@ use azure_core::setters; #[cfg(feature = "profile-hybrid-2020-09-01")] pub use profile_hybrid_2020_09_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -38,7 +38,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -57,7 +57,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -67,7 +67,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/extendedlocation/src/lib.rs b/services/mgmt/extendedlocation/src/lib.rs index 0ebf22527e..63866cdcb7 100644 --- a/services/mgmt/extendedlocation/src/lib.rs +++ b/services/mgmt/extendedlocation/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2021-03-15-preview")] pub use package_2021_03_15_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/frontdoor/src/lib.rs b/services/mgmt/frontdoor/src/lib.rs index 9470323457..3232d1cfff 100644 --- a/services/mgmt/frontdoor/src/lib.rs +++ b/services/mgmt/frontdoor/src/lib.rs @@ -41,7 +41,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-08-preview")] pub use package_2018_08_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -54,7 +54,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -73,7 +73,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -83,7 +83,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/guestconfiguration/src/lib.rs b/services/mgmt/guestconfiguration/src/lib.rs index a6924f30f1..572079704a 100644 --- a/services/mgmt/guestconfiguration/src/lib.rs +++ b/services/mgmt/guestconfiguration/src/lib.rs @@ -21,7 +21,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-01-20-preview")] pub use package_2018_01_20_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -34,7 +34,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -53,7 +53,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -63,7 +63,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/hanaonazure/src/lib.rs b/services/mgmt/hanaonazure/src/lib.rs index 34f71301b1..4c2b914765 100644 --- a/services/mgmt/hanaonazure/src/lib.rs +++ b/services/mgmt/hanaonazure/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-02-07-preview")] pub use package_2020_02_07_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/hardwaresecuritymodules/src/lib.rs b/services/mgmt/hardwaresecuritymodules/src/lib.rs index c6879a2268..7e318e5dca 100644 --- a/services/mgmt/hardwaresecuritymodules/src/lib.rs +++ b/services/mgmt/hardwaresecuritymodules/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-10")] pub use package_2018_10::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/hdinsight/src/lib.rs b/services/mgmt/hdinsight/src/lib.rs index 074c53d1c6..b9e49c8832 100644 --- a/services/mgmt/hdinsight/src/lib.rs +++ b/services/mgmt/hdinsight/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2015-03-preview")] pub use package_2015_03_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/healthbot/src/lib.rs b/services/mgmt/healthbot/src/lib.rs index af8347f92a..0be5c6958e 100644 --- a/services/mgmt/healthbot/src/lib.rs +++ b/services/mgmt/healthbot/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-10-20-preview")] pub use package_2020_10_20_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/healthcareapis/src/lib.rs b/services/mgmt/healthcareapis/src/lib.rs index 0b43d3e9c4..912ae3887c 100644 --- a/services/mgmt/healthcareapis/src/lib.rs +++ b/services/mgmt/healthcareapis/src/lib.rs @@ -21,7 +21,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-08-preview")] pub use package_2018_08_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -34,7 +34,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -53,7 +53,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -63,7 +63,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/hybridcompute/Cargo.toml b/services/mgmt/hybridcompute/Cargo.toml index a365b77fe7..04dd94e1d3 100644 --- a/services/mgmt/hybridcompute/Cargo.toml +++ b/services/mgmt/hybridcompute/Cargo.toml @@ -19,7 +19,8 @@ azure_identity = { path = "../../../sdk/identity", version = "0.1.0" } tokio = { version = "1.0", features = ["macros"] } [features] -default = ["package-2019-03"] +default = ["package-2021-05"] +"package-2021-05" = [] "package-preview-2021-04" = [] "package-preview-2021-03" = [] "package-preview-2021-01" = [] diff --git a/services/mgmt/hybridcompute/src/lib.rs b/services/mgmt/hybridcompute/src/lib.rs index cdfd622cde..cd6a6c4b92 100644 --- a/services/mgmt/hybridcompute/src/lib.rs +++ b/services/mgmt/hybridcompute/src/lib.rs @@ -1,4 +1,8 @@ #![doc = "generated by AutoRust 0.1.0"] +#[cfg(feature = "package-2021-05")] +mod package_2021_05; +#[cfg(feature = "package-2021-05")] +pub use package_2021_05::{models, operations, API_VERSION}; #[cfg(feature = "package-preview-2021-04")] mod package_preview_2021_04; #[cfg(feature = "package-preview-2021-04")] @@ -37,7 +41,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-08-02")] pub use package_2020_08_02::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -50,7 +54,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -69,7 +73,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -79,7 +83,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/hybridcompute/src/package_2021_05/mod.rs b/services/mgmt/hybridcompute/src/package_2021_05/mod.rs new file mode 100644 index 0000000000..96bf06ae68 --- /dev/null +++ b/services/mgmt/hybridcompute/src/package_2021_05/mod.rs @@ -0,0 +1,3 @@ +pub mod models; +pub mod operations; +pub const API_VERSION: &str = "2021-05-20"; diff --git a/services/mgmt/hybridcompute/src/package_2021_05/models.rs b/services/mgmt/hybridcompute/src/package_2021_05/models.rs new file mode 100644 index 0000000000..2dee192102 --- /dev/null +++ b/services/mgmt/hybridcompute/src/package_2021_05/models.rs @@ -0,0 +1,478 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationListResult { + #[serde(skip_serializing)] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationValue { + #[serde(skip_serializing)] + pub origin: Option, + #[serde(skip_serializing)] + pub name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationValueDisplay { + #[serde(skip_serializing)] + pub operation: Option, + #[serde(skip_serializing)] + pub resource: Option, + #[serde(skip_serializing)] + pub description: Option, + #[serde(skip_serializing)] + pub provider: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OsProfile { + #[serde(rename = "computerName", skip_serializing)] + pub computer_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DetectedProperties {} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MachineProperties { + #[serde(rename = "locationData", default, skip_serializing_if = "Option::is_none")] + pub location_data: Option, + #[serde(rename = "osProfile", skip_serializing)] + pub os_profile: Option, + #[serde(rename = "provisioningState", skip_serializing)] + pub provisioning_state: Option, + #[serde(skip_serializing)] + pub status: Option, + #[serde(rename = "lastStatusChange", skip_serializing)] + pub last_status_change: Option, + #[serde(rename = "errorDetails", skip_serializing)] + pub error_details: Vec, + #[serde(rename = "agentVersion", skip_serializing)] + pub agent_version: Option, + #[serde(rename = "vmId", default, skip_serializing_if = "Option::is_none")] + pub vm_id: Option, + #[serde(rename = "displayName", skip_serializing)] + pub display_name: Option, + #[serde(rename = "machineFqdn", skip_serializing)] + pub machine_fqdn: Option, + #[serde(rename = "clientPublicKey", default, skip_serializing_if = "Option::is_none")] + pub client_public_key: Option, + #[serde(rename = "osName", skip_serializing)] + pub os_name: Option, + #[serde(rename = "osVersion", skip_serializing)] + pub os_version: Option, + #[serde(rename = "vmUuid", skip_serializing)] + pub vm_uuid: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub extensions: Vec, + #[serde(rename = "osSku", skip_serializing)] + pub os_sku: Option, + #[serde(rename = "domainName", skip_serializing)] + pub domain_name: Option, + #[serde(rename = "adFqdn", skip_serializing)] + pub ad_fqdn: Option, + #[serde(rename = "dnsFqdn", skip_serializing)] + pub dns_fqdn: Option, + #[serde(rename = "privateLinkScopeResourceId", default, skip_serializing_if = "Option::is_none")] + pub private_link_scope_resource_id: Option, + #[serde(rename = "parentClusterResourceId", default, skip_serializing_if = "Option::is_none")] + pub parent_cluster_resource_id: Option, + #[serde(rename = "detectedProperties", skip_serializing)] + pub detected_properties: Option, +} +pub mod machine_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Status { + Connected, + Disconnected, + Error, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MachineUpdateProperties { + #[serde(rename = "locationData", default, skip_serializing_if = "Option::is_none")] + pub location_data: Option, + #[serde(rename = "parentClusterResourceId", default, skip_serializing_if = "Option::is_none")] + pub parent_cluster_resource_id: Option, + #[serde(rename = "privateLinkScopeResourceId", default, skip_serializing_if = "Option::is_none")] + pub private_link_scope_resource_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Machine { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MachineUpdate { + #[serde(flatten)] + pub resource_update: ResourceUpdate, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MachineListResult { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ResourceUpdate { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MachineExtension { + #[serde(flatten)] + pub tracked_resource: TrackedResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MachineExtensionUpdate { + #[serde(flatten)] + pub resource_update: ResourceUpdate, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MachineExtensionProperties { + #[serde(rename = "forceUpdateTag", default, skip_serializing_if = "Option::is_none")] + pub force_update_tag: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub publisher: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "typeHandlerVersion", default, skip_serializing_if = "Option::is_none")] + pub type_handler_version: Option, + #[serde(rename = "autoUpgradeMinorVersion", default, skip_serializing_if = "Option::is_none")] + pub auto_upgrade_minor_version: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub settings: Option, + #[serde(rename = "protectedSettings", default, skip_serializing_if = "Option::is_none")] + pub protected_settings: Option, + #[serde(rename = "provisioningState", skip_serializing)] + pub provisioning_state: Option, + #[serde(rename = "instanceView", default, skip_serializing_if = "Option::is_none")] + pub instance_view: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MachineExtensionUpdateProperties { + #[serde(rename = "forceUpdateTag", default, skip_serializing_if = "Option::is_none")] + pub force_update_tag: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub publisher: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "typeHandlerVersion", default, skip_serializing_if = "Option::is_none")] + pub type_handler_version: Option, + #[serde(rename = "autoUpgradeMinorVersion", default, skip_serializing_if = "Option::is_none")] + pub auto_upgrade_minor_version: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub settings: Option, + #[serde(rename = "protectedSettings", default, skip_serializing_if = "Option::is_none")] + pub protected_settings: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MachineExtensionInstanceView { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "typeHandlerVersion", default, skip_serializing_if = "Option::is_none")] + pub type_handler_version: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, +} +pub mod machine_extension_instance_view { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Status { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub level: Option, + #[serde(rename = "displayStatus", default, skip_serializing_if = "Option::is_none")] + pub display_status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub time: Option, + } + pub mod status { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Level { + Info, + Warning, + Error, + } + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MachineExtensionsListResult { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TargetVersion {} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExtensionTargetProperties { + #[serde(rename = "targetVersion", default, skip_serializing_if = "Option::is_none")] + pub target_version: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExtensionTarget {} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MachineExtensionUpgrade { + #[serde(rename = "extensionTargets", default, skip_serializing_if = "Option::is_none")] + pub extension_targets: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkScopesResource { + #[serde(skip_serializing)] + pub id: Option, + #[serde(skip_serializing)] + pub name: Option, + #[serde(rename = "type", skip_serializing)] + pub type_: Option, + pub location: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TagsResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HybridComputePrivateLinkScope { + #[serde(flatten)] + pub private_link_scopes_resource: PrivateLinkScopesResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkScopeValidationDetails { + #[serde(skip_serializing)] + pub id: Option, + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, + #[serde(rename = "connectionDetails", default, skip_serializing_if = "Vec::is_empty")] + pub connection_details: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ConnectionDetail { + #[serde(skip_serializing)] + pub id: Option, + #[serde(rename = "privateIpAddress", skip_serializing)] + pub private_ip_address: Option, + #[serde(rename = "linkIdentifier", skip_serializing)] + pub link_identifier: Option, + #[serde(rename = "groupId", skip_serializing)] + pub group_id: Option, + #[serde(rename = "memberName", skip_serializing)] + pub member_name: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HybridComputePrivateLinkScopeProperties { + #[serde(rename = "publicNetworkAccess", default, skip_serializing_if = "Option::is_none")] + pub public_network_access: Option, + #[serde(rename = "provisioningState", skip_serializing)] + pub provisioning_state: Option, + #[serde(rename = "privateLinkScopeId", skip_serializing)] + pub private_link_scope_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct HybridComputePrivateLinkScopeListResult { + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkResourceListResult { + #[serde(skip_serializing)] + pub value: Vec, + #[serde(rename = "nextLink", skip_serializing)] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkResource { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkResourceProperties { + #[serde(rename = "groupId", skip_serializing)] + pub group_id: Option, + #[serde(rename = "requiredMembers", skip_serializing)] + pub required_members: Vec, + #[serde(rename = "requiredZoneNames", skip_serializing)] + pub required_zone_names: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnectionProperties { + #[serde(rename = "privateEndpoint", default, skip_serializing_if = "Option::is_none")] + pub private_endpoint: Option, + #[serde(rename = "privateLinkServiceConnectionState", default, skip_serializing_if = "Option::is_none")] + pub private_link_service_connection_state: Option, + #[serde(rename = "provisioningState", skip_serializing)] + pub provisioning_state: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointProperty { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateLinkServiceConnectionStateProperty { + pub status: String, + pub description: String, + #[serde(rename = "actionsRequired", skip_serializing)] + pub actions_required: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnection { + #[serde(flatten)] + pub proxy_resource: ProxyResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct PrivateEndpointConnectionListResult { + #[serde(skip_serializing)] + pub value: Vec, + #[serde(rename = "nextLink", skip_serializing)] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum PublicNetworkAccessType { + Enabled, + Disabled, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorResponse { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorDetail { + #[serde(skip_serializing)] + pub code: Option, + #[serde(skip_serializing)] + pub message: Option, + #[serde(skip_serializing)] + pub target: Option, + #[serde(skip_serializing)] + pub details: Vec, + #[serde(rename = "additionalInfo", skip_serializing)] + pub additional_info: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorAdditionalInfo { + #[serde(rename = "type", skip_serializing)] + pub type_: Option, + #[serde(skip_serializing)] + pub info: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LocationData { + pub name: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub city: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub district: Option, + #[serde(rename = "countryOrRegion", default, skip_serializing_if = "Option::is_none")] + pub country_or_region: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Identity { + #[serde(rename = "principalId", skip_serializing)] + pub principal_id: Option, + #[serde(rename = "tenantId", skip_serializing)] + pub tenant_id: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, +} +pub mod identity { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum Type { + SystemAssigned, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SystemData { + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +pub mod system_data { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct TrackedResource { + #[serde(flatten)] + pub resource: Resource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, + pub location: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Resource { + #[serde(skip_serializing)] + pub id: Option, + #[serde(skip_serializing)] + pub name: Option, + #[serde(rename = "type", skip_serializing)] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProxyResource { + #[serde(flatten)] + pub resource: Resource, +} diff --git a/services/mgmt/hybridcompute/src/package_2021_05/operations.rs b/services/mgmt/hybridcompute/src/package_2021_05/operations.rs new file mode 100644 index 0000000000..bf484596af --- /dev/null +++ b/services/mgmt/hybridcompute/src/package_2021_05/operations.rs @@ -0,0 +1,2007 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use crate::models::*; +pub mod machines { + use crate::models::*; + pub async fn get( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + machine_name: &str, + expand: Option<&str>, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/machines/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + machine_name + ); + let mut url = url::Url::parse(url_str).map_err(get::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + if let Some(expand) = expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(get::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(get::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: Machine = + serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = + serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; + Err(get::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod get { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn create_or_update( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + machine_name: &str, + parameters: &Machine, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/machines/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + machine_name + ); + let mut url = url::Url::parse(url_str).map_err(create_or_update::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(create_or_update::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = azure_core::to_json(parameters).map_err(create_or_update::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(create_or_update::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(create_or_update::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: Machine = serde_json::from_slice(rsp_body) + .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = serde_json::from_slice(rsp_body) + .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; + Err(create_or_update::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod create_or_update { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn update( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + machine_name: &str, + parameters: &MachineUpdate, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/machines/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + machine_name + ); + let mut url = url::Url::parse(url_str).map_err(update::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(update::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = azure_core::to_json(parameters).map_err(update::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(update::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(update::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: Machine = + serde_json::from_slice(rsp_body).map_err(|source| update::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = + serde_json::from_slice(rsp_body).map_err(|source| update::Error::DeserializeError(source, rsp_body.clone()))?; + Err(update::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod update { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn delete( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + machine_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/machines/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + machine_name + ); + let mut url = url::Url::parse(url_str).map_err(delete::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(delete::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(delete::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(delete::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => Ok(delete::Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(delete::Response::NoContent204), + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = + serde_json::from_slice(rsp_body).map_err(|source| delete::Error::DeserializeError(source, rsp_body.clone()))?; + Err(delete::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod delete { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn list_by_resource_group( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/machines", + operation_config.base_path(), + subscription_id, + resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(list_by_resource_group::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_by_resource_group::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(list_by_resource_group::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_by_resource_group::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: MachineListResult = serde_json::from_slice(rsp_body) + .map_err(|source| list_by_resource_group::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = serde_json::from_slice(rsp_body) + .map_err(|source| list_by_resource_group::Error::DeserializeError(source, rsp_body.clone()))?; + Err(list_by_resource_group::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod list_by_resource_group { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn list_by_subscription( + operation_config: &crate::OperationConfig, + subscription_id: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.HybridCompute/machines", + operation_config.base_path(), + subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(list_by_subscription::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_by_subscription::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list_by_subscription::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_by_subscription::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: MachineListResult = serde_json::from_slice(rsp_body) + .map_err(|source| list_by_subscription::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = serde_json::from_slice(rsp_body) + .map_err(|source| list_by_subscription::Error::DeserializeError(source, rsp_body.clone()))?; + Err(list_by_subscription::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod list_by_subscription { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} +pub mod machine_extensions { + use crate::models::*; + pub async fn get( + operation_config: &crate::OperationConfig, + resource_group_name: &str, + machine_name: &str, + extension_name: &str, + subscription_id: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/machines/{}/extensions/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + machine_name, + extension_name + ); + let mut url = url::Url::parse(url_str).map_err(get::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(get::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(get::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: MachineExtension = + serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = + serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; + Err(get::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod get { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn create_or_update( + operation_config: &crate::OperationConfig, + resource_group_name: &str, + machine_name: &str, + extension_name: &str, + extension_parameters: &MachineExtension, + subscription_id: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/machines/{}/extensions/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + machine_name, + extension_name + ); + let mut url = url::Url::parse(url_str).map_err(create_or_update::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(create_or_update::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = azure_core::to_json(extension_parameters).map_err(create_or_update::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(create_or_update::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(create_or_update::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: MachineExtension = serde_json::from_slice(rsp_body) + .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(create_or_update::Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(create_or_update::Response::Accepted202), + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = serde_json::from_slice(rsp_body) + .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; + Err(create_or_update::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod create_or_update { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Ok200(MachineExtension), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn update( + operation_config: &crate::OperationConfig, + resource_group_name: &str, + machine_name: &str, + extension_name: &str, + extension_parameters: &MachineExtensionUpdate, + subscription_id: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/machines/{}/extensions/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + machine_name, + extension_name + ); + let mut url = url::Url::parse(url_str).map_err(update::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(update::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = azure_core::to_json(extension_parameters).map_err(update::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(update::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(update::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: MachineExtension = + serde_json::from_slice(rsp_body).map_err(|source| update::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(update::Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(update::Response::Accepted202), + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = + serde_json::from_slice(rsp_body).map_err(|source| update::Error::DeserializeError(source, rsp_body.clone()))?; + Err(update::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod update { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Ok200(MachineExtension), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn delete( + operation_config: &crate::OperationConfig, + resource_group_name: &str, + machine_name: &str, + extension_name: &str, + subscription_id: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/machines/{}/extensions/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + machine_name, + extension_name + ); + let mut url = url::Url::parse(url_str).map_err(delete::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(delete::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(delete::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(delete::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => Ok(delete::Response::Ok200), + http::StatusCode::ACCEPTED => Ok(delete::Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(delete::Response::NoContent204), + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = + serde_json::from_slice(rsp_body).map_err(|source| delete::Error::DeserializeError(source, rsp_body.clone()))?; + Err(delete::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod delete { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn list( + operation_config: &crate::OperationConfig, + resource_group_name: &str, + machine_name: &str, + expand: Option<&str>, + subscription_id: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/machines/{}/extensions", + operation_config.base_path(), + subscription_id, + resource_group_name, + machine_name + ); + let mut url = url::Url::parse(url_str).map_err(list::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + if let Some(expand) = expand { + url.query_pairs_mut().append_pair("$expand", expand); + } + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(list::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: MachineExtensionsListResult = + serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = + serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; + Err(list::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod list { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} +pub async fn upgrade_extensions( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + machine_name: &str, + extension_upgrade_parameters: &MachineExtensionUpgrade, +) -> std::result::Result<(), upgrade_extensions::Error> { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/machines/{}/upgradeExtensions", + operation_config.base_path(), + subscription_id, + resource_group_name, + machine_name + ); + let mut url = url::Url::parse(url_str).map_err(upgrade_extensions::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(upgrade_extensions::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = azure_core::to_json(extension_upgrade_parameters).map_err(upgrade_extensions::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(upgrade_extensions::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(upgrade_extensions::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::ACCEPTED => Ok(()), + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = + serde_json::from_slice(rsp_body).map_err(|source| upgrade_extensions::Error::DeserializeError(source, rsp_body.clone()))?; + Err(upgrade_extensions::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } +} +pub mod upgrade_extensions { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } +} +pub mod operations { + use crate::models::*; + pub async fn list(operation_config: &crate::OperationConfig) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!("{}/providers/Microsoft.HybridCompute/operations", operation_config.base_path(),); + let mut url = url::Url::parse(url_str).map_err(list::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(list::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: OperationListResult = + serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = + serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; + Err(list::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod list { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} +pub mod private_link_scopes { + use crate::models::*; + pub async fn list( + operation_config: &crate::OperationConfig, + subscription_id: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.HybridCompute/privateLinkScopes", + operation_config.base_path(), + subscription_id + ); + let mut url = url::Url::parse(url_str).map_err(list::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(list::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: HybridComputePrivateLinkScopeListResult = + serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = + serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; + Err(list::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod list { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn list_by_resource_group( + operation_config: &crate::OperationConfig, + resource_group_name: &str, + subscription_id: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/privateLinkScopes", + operation_config.base_path(), + subscription_id, + resource_group_name + ); + let mut url = url::Url::parse(url_str).map_err(list_by_resource_group::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_by_resource_group::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(list_by_resource_group::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_by_resource_group::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: HybridComputePrivateLinkScopeListResult = serde_json::from_slice(rsp_body) + .map_err(|source| list_by_resource_group::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = serde_json::from_slice(rsp_body) + .map_err(|source| list_by_resource_group::Error::DeserializeError(source, rsp_body.clone()))?; + Err(list_by_resource_group::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod list_by_resource_group { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get( + operation_config: &crate::OperationConfig, + resource_group_name: &str, + subscription_id: &str, + scope_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/privateLinkScopes/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + scope_name + ); + let mut url = url::Url::parse(url_str).map_err(get::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(get::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(get::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: HybridComputePrivateLinkScope = + serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = + serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; + Err(get::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod get { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn create_or_update( + operation_config: &crate::OperationConfig, + resource_group_name: &str, + subscription_id: &str, + scope_name: &str, + parameters: &HybridComputePrivateLinkScope, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/privateLinkScopes/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + scope_name + ); + let mut url = url::Url::parse(url_str).map_err(create_or_update::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(create_or_update::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = azure_core::to_json(parameters).map_err(create_or_update::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(create_or_update::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(create_or_update::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: HybridComputePrivateLinkScope = serde_json::from_slice(rsp_body) + .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(create_or_update::Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = rsp.body(); + let rsp_value: HybridComputePrivateLinkScope = serde_json::from_slice(rsp_body) + .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(create_or_update::Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = serde_json::from_slice(rsp_body) + .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; + Err(create_or_update::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod create_or_update { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Ok200(HybridComputePrivateLinkScope), + Created201(HybridComputePrivateLinkScope), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn update_tags( + operation_config: &crate::OperationConfig, + resource_group_name: &str, + subscription_id: &str, + scope_name: &str, + private_link_scope_tags: &TagsResource, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/privateLinkScopes/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + scope_name + ); + let mut url = url::Url::parse(url_str).map_err(update_tags::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PATCH); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(update_tags::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = azure_core::to_json(private_link_scope_tags).map_err(update_tags::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(update_tags::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(update_tags::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: HybridComputePrivateLinkScope = + serde_json::from_slice(rsp_body).map_err(|source| update_tags::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = + serde_json::from_slice(rsp_body).map_err(|source| update_tags::Error::DeserializeError(source, rsp_body.clone()))?; + Err(update_tags::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod update_tags { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn delete( + operation_config: &crate::OperationConfig, + resource_group_name: &str, + subscription_id: &str, + scope_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/privateLinkScopes/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + scope_name + ); + let mut url = url::Url::parse(url_str).map_err(delete::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(delete::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(delete::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(delete::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => Ok(delete::Response::Ok200), + http::StatusCode::ACCEPTED => Ok(delete::Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(delete::Response::NoContent204), + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = + serde_json::from_slice(rsp_body).map_err(|source| delete::Error::DeserializeError(source, rsp_body.clone()))?; + Err(delete::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod delete { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get_validation_details( + operation_config: &crate::OperationConfig, + location: &str, + subscription_id: &str, + private_link_scope_id: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.HybridCompute/locations/{}/privateLinkScopes/{}", + operation_config.base_path(), + subscription_id, + location, + private_link_scope_id + ); + let mut url = url::Url::parse(url_str).map_err(get_validation_details::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get_validation_details::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(get_validation_details::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_validation_details::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: PrivateLinkScopeValidationDetails = serde_json::from_slice(rsp_body) + .map_err(|source| get_validation_details::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = serde_json::from_slice(rsp_body) + .map_err(|source| get_validation_details::Error::DeserializeError(source, rsp_body.clone()))?; + Err(get_validation_details::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod get_validation_details { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get_validation_details_for_machine( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + machine_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/machines/{}/privateLinkScopes/current", + operation_config.base_path(), + subscription_id, + resource_group_name, + machine_name + ); + let mut url = url::Url::parse(url_str).map_err(get_validation_details_for_machine::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get_validation_details_for_machine::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(get_validation_details_for_machine::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_validation_details_for_machine::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: PrivateLinkScopeValidationDetails = serde_json::from_slice(rsp_body) + .map_err(|source| get_validation_details_for_machine::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = serde_json::from_slice(rsp_body) + .map_err(|source| get_validation_details_for_machine::Error::DeserializeError(source, rsp_body.clone()))?; + Err(get_validation_details_for_machine::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod get_validation_details_for_machine { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} +pub mod private_link_resources { + use crate::models::*; + pub async fn list_by_private_link_scope( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + scope_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/privateLinkScopes/{}/privateLinkResources", + operation_config.base_path(), + subscription_id, + resource_group_name, + scope_name + ); + let mut url = url::Url::parse(url_str).map_err(list_by_private_link_scope::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_by_private_link_scope::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(list_by_private_link_scope::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_by_private_link_scope::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: PrivateLinkResourceListResult = serde_json::from_slice(rsp_body) + .map_err(|source| list_by_private_link_scope::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = serde_json::from_slice(rsp_body) + .map_err(|source| list_by_private_link_scope::Error::DeserializeError(source, rsp_body.clone()))?; + Err(list_by_private_link_scope::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod list_by_private_link_scope { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + scope_name: &str, + group_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/privateLinkScopes/{}/privateLinkResources/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + scope_name, + group_name + ); + let mut url = url::Url::parse(url_str).map_err(get::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(get::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(get::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: PrivateLinkResource = + serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = + serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; + Err(get::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod get { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} +pub mod private_endpoint_connections { + use crate::models::*; + pub async fn get( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + scope_name: &str, + private_endpoint_connection_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/privateLinkScopes/{}/privateEndpointConnections/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + scope_name, + private_endpoint_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(get::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(get::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(get::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: PrivateEndpointConnection = + serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = + serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; + Err(get::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod get { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn create_or_update( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + scope_name: &str, + private_endpoint_connection_name: &str, + parameters: &PrivateEndpointConnection, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/privateLinkScopes/{}/privateEndpointConnections/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + scope_name, + private_endpoint_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(create_or_update::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(create_or_update::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = azure_core::to_json(parameters).map_err(create_or_update::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(create_or_update::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(create_or_update::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: PrivateEndpointConnection = serde_json::from_slice(rsp_body) + .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(create_or_update::Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(create_or_update::Response::Accepted202), + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = serde_json::from_slice(rsp_body) + .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; + Err(create_or_update::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod create_or_update { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Ok200(PrivateEndpointConnection), + Accepted202, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn delete( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + scope_name: &str, + private_endpoint_connection_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/privateLinkScopes/{}/privateEndpointConnections/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + scope_name, + private_endpoint_connection_name + ); + let mut url = url::Url::parse(url_str).map_err(delete::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(delete::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(delete::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(delete::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => Ok(delete::Response::Ok200), + http::StatusCode::ACCEPTED => Ok(delete::Response::Accepted202), + http::StatusCode::NO_CONTENT => Ok(delete::Response::NoContent204), + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = + serde_json::from_slice(rsp_body).map_err(|source| delete::Error::DeserializeError(source, rsp_body.clone()))?; + Err(delete::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod delete { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn list_by_private_link_scope( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + scope_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.HybridCompute/privateLinkScopes/{}/privateEndpointConnections", + operation_config.base_path(), + subscription_id, + resource_group_name, + scope_name + ); + let mut url = url::Url::parse(url_str).map_err(list_by_private_link_scope::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_by_private_link_scope::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(list_by_private_link_scope::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_by_private_link_scope::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: PrivateEndpointConnectionListResult = serde_json::from_slice(rsp_body) + .map_err(|source| list_by_private_link_scope::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = serde_json::from_slice(rsp_body) + .map_err(|source| list_by_private_link_scope::Error::DeserializeError(source, rsp_body.clone()))?; + Err(list_by_private_link_scope::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod list_by_private_link_scope { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} diff --git a/services/mgmt/hybriddatamanager/src/lib.rs b/services/mgmt/hybriddatamanager/src/lib.rs index 8f6200e677..0e16acf80a 100644 --- a/services/mgmt/hybriddatamanager/src/lib.rs +++ b/services/mgmt/hybriddatamanager/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2016-06")] pub use package_2016_06::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/hybridkubernetes/src/lib.rs b/services/mgmt/hybridkubernetes/src/lib.rs index cf5c1bd2b4..2de440574f 100644 --- a/services/mgmt/hybridkubernetes/src/lib.rs +++ b/services/mgmt/hybridkubernetes/src/lib.rs @@ -13,7 +13,7 @@ use azure_core::setters; #[cfg(feature = "package-2021-03-01")] pub use package_2021_03_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -26,7 +26,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -45,7 +45,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -55,7 +55,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/hybridnetwork/src/lib.rs b/services/mgmt/hybridnetwork/src/lib.rs index 28b71c3ba7..31860d728e 100644 --- a/services/mgmt/hybridnetwork/src/lib.rs +++ b/services/mgmt/hybridnetwork/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-01-01-preview")] pub use package_2020_01_01_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/imagebuilder/src/lib.rs b/services/mgmt/imagebuilder/src/lib.rs index d71dbd29fb..5250ed8df7 100644 --- a/services/mgmt/imagebuilder/src/lib.rs +++ b/services/mgmt/imagebuilder/src/lib.rs @@ -17,7 +17,7 @@ use azure_core::setters; #[cfg(feature = "package-2019-02")] pub use package_2019_02::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -30,7 +30,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -49,7 +49,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -59,7 +59,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/intune/src/lib.rs b/services/mgmt/intune/src/lib.rs index 5bb7dddf26..d679734d1e 100644 --- a/services/mgmt/intune/src/lib.rs +++ b/services/mgmt/intune/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2015-01-privatepreview")] pub use package_2015_01_privatepreview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/iotcentral/src/lib.rs b/services/mgmt/iotcentral/src/lib.rs index b7bd340385..e01c5772e8 100644 --- a/services/mgmt/iotcentral/src/lib.rs +++ b/services/mgmt/iotcentral/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2017-07-01-privatepreview")] pub use package_2017_07_01_privatepreview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/iothub/src/lib.rs b/services/mgmt/iothub/src/lib.rs index 4f85e80b69..9b0146d41c 100644 --- a/services/mgmt/iothub/src/lib.rs +++ b/services/mgmt/iothub/src/lib.rs @@ -85,7 +85,7 @@ use azure_core::setters; #[cfg(feature = "profile-hybrid-2020-09-01")] pub use profile_hybrid_2020_09_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -98,7 +98,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -117,7 +117,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -127,7 +127,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/iotspaces/src/lib.rs b/services/mgmt/iotspaces/src/lib.rs index d1f722eeea..afeb5886df 100644 --- a/services/mgmt/iotspaces/src/lib.rs +++ b/services/mgmt/iotspaces/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2017-10-preview")] pub use package_2017_10_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/keyvault/src/lib.rs b/services/mgmt/keyvault/src/lib.rs index 929e19e7c4..f4f1489d08 100644 --- a/services/mgmt/keyvault/src/lib.rs +++ b/services/mgmt/keyvault/src/lib.rs @@ -37,7 +37,7 @@ use azure_core::setters; #[cfg(feature = "profile-hybrid-2020-09-01")] pub use profile_hybrid_2020_09_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -50,7 +50,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -69,7 +69,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -79,7 +79,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/kubernetesconfiguration/src/lib.rs b/services/mgmt/kubernetesconfiguration/src/lib.rs index 9379747acc..5fd41d0dff 100644 --- a/services/mgmt/kubernetesconfiguration/src/lib.rs +++ b/services/mgmt/kubernetesconfiguration/src/lib.rs @@ -21,7 +21,7 @@ use azure_core::setters; #[cfg(feature = "package-2019-11-01-preview")] pub use package_2019_11_01_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -34,7 +34,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -53,7 +53,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -63,7 +63,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/labservices/src/lib.rs b/services/mgmt/labservices/src/lib.rs index c6879a2268..7e318e5dca 100644 --- a/services/mgmt/labservices/src/lib.rs +++ b/services/mgmt/labservices/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-10")] pub use package_2018_10::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/logic/src/lib.rs b/services/mgmt/logic/src/lib.rs index 68af1d9e29..692a6d3bd9 100644 --- a/services/mgmt/logic/src/lib.rs +++ b/services/mgmt/logic/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-07-preview")] pub use package_2018_07_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/logz/src/lib.rs b/services/mgmt/logz/src/lib.rs index 76efe546ba..5b47d12c43 100644 --- a/services/mgmt/logz/src/lib.rs +++ b/services/mgmt/logz/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-10-01-preview")] pub use package_2020_10_01_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/machinelearning/src/lib.rs b/services/mgmt/machinelearning/src/lib.rs index 594ffcf3bd..cbf4983df2 100644 --- a/services/mgmt/machinelearning/src/lib.rs +++ b/services/mgmt/machinelearning/src/lib.rs @@ -21,7 +21,7 @@ use azure_core::setters; #[cfg(feature = "package-webservices-2016-05-preview")] pub use package_webservices_2016_05_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -34,7 +34,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -53,7 +53,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -63,7 +63,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/machinelearningcompute/src/lib.rs b/services/mgmt/machinelearningcompute/src/lib.rs index 0895b1a6c2..4cd28a576e 100644 --- a/services/mgmt/machinelearningcompute/src/lib.rs +++ b/services/mgmt/machinelearningcompute/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2017-06-preview")] pub use package_2017_06_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/machinelearningexperimentation/src/lib.rs b/services/mgmt/machinelearningexperimentation/src/lib.rs index c3878cb36b..e846c5ca38 100644 --- a/services/mgmt/machinelearningexperimentation/src/lib.rs +++ b/services/mgmt/machinelearningexperimentation/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2017-05-preview")] pub use package_2017_05_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/machinelearningservices/src/lib.rs b/services/mgmt/machinelearningservices/src/lib.rs index 4ee5f95581..a3a74a826e 100644 --- a/services/mgmt/machinelearningservices/src/lib.rs +++ b/services/mgmt/machinelearningservices/src/lib.rs @@ -73,7 +73,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-03-preview")] pub use package_2018_03_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -86,7 +86,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -105,7 +105,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -115,7 +115,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/machinelearningservices/src/package_2021_03_01_preview/models.rs b/services/mgmt/machinelearningservices/src/package_2021_03_01_preview/models.rs index 9df399645f..04859b1eaa 100644 --- a/services/mgmt/machinelearningservices/src/package_2021_03_01_preview/models.rs +++ b/services/mgmt/machinelearningservices/src/package_2021_03_01_preview/models.rs @@ -1259,194 +1259,166 @@ pub struct ComputeSchedules { pub compute_start_stop: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum ResourceIdentityAssignment { - SystemAssigned, - UserAssigned, - #[serde(rename = "SystemAssigned,UserAssigned")] - SystemAssignedUserAssigned, - None, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct UserAssignedIdentityMeta { - #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] - pub principal_id: Option, - #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] - pub client_id: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ResourceIdentity { - #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] - pub type_: Option, - #[serde(rename = "principalId", skip_serializing)] - pub principal_id: Option, - #[serde(rename = "tenantId", skip_serializing)] - pub tenant_id: Option, - #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Option::is_none")] - pub user_assigned_identities: Option, +pub struct AccountKeyDatastoreCredentials { + #[serde(flatten)] + pub datastore_credentials: DatastoreCredentials, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub secrets: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ComputeConfiguration { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub target: Option, - #[serde(rename = "instanceCount", default, skip_serializing_if = "Option::is_none")] - pub instance_count: Option, - #[serde(rename = "isLocal", default, skip_serializing_if = "Option::is_none")] - pub is_local: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub location: Option, - #[serde(rename = "instanceType", default, skip_serializing_if = "Option::is_none")] - pub instance_type: Option, +pub struct AccountKeyDatastoreSecrets { + #[serde(flatten)] + pub datastore_secrets: DatastoreSecrets, #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, + pub key: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BatchRetrySettings { - #[serde(rename = "maxRetries", default, skip_serializing_if = "Option::is_none")] - pub max_retries: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub timeout: Option, +pub struct AmlToken { + #[serde(flatten)] + pub identity_configuration: IdentityConfiguration, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum BatchLoggingLevel { - Info, - Warning, - Debug, +pub struct AssetReferenceBase { + #[serde(rename = "referenceType")] + pub reference_type: ReferenceType, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum BatchOutputAction { - SummaryOnly, - AppendRow, +pub struct AutoScaleSettings { + #[serde(flatten)] + pub online_scale_settings: OnlineScaleSettings, + #[serde(rename = "pollingInterval", default, skip_serializing_if = "Option::is_none")] + pub polling_interval: Option, + #[serde(rename = "targetUtilizationPercentage", default, skip_serializing_if = "Option::is_none")] + pub target_utilization_percentage: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BatchOutputConfiguration { - #[serde(rename = "outputAction", default, skip_serializing_if = "Option::is_none")] - pub output_action: Option, - #[serde(rename = "appendRowFileName", default, skip_serializing_if = "Option::is_none")] - pub append_row_file_name: Option, +pub struct AzureBlobContents { + #[serde(flatten)] + pub datastore_contents: DatastoreContents, + #[serde(rename = "accountName")] + pub account_name: String, + #[serde(rename = "containerName")] + pub container_name: String, + pub credentials: DatastoreCredentials, + pub endpoint: String, + pub protocol: String, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum ReferenceType { - Id, - DataPath, - OutputPath, +pub struct AzureDataLakeGen1Contents { + #[serde(flatten)] + pub datastore_contents: DatastoreContents, + pub credentials: DatastoreCredentials, + #[serde(rename = "storeName")] + pub store_name: String, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AssetReferenceBase { - #[serde(rename = "referenceType")] - pub reference_type: ReferenceType, +pub struct AzureDataLakeGen2Contents { + #[serde(flatten)] + pub datastore_contents: DatastoreContents, + #[serde(rename = "accountName")] + pub account_name: String, + #[serde(rename = "containerName")] + pub container_name: String, + pub credentials: DatastoreCredentials, + pub endpoint: String, + pub protocol: String, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IdAssetReference { +pub struct AzureFileContents { #[serde(flatten)] - pub asset_reference_base: AssetReferenceBase, - #[serde(rename = "assetId")] - pub asset_id: String, + pub datastore_contents: DatastoreContents, + #[serde(rename = "accountName")] + pub account_name: String, + #[serde(rename = "containerName")] + pub container_name: String, + pub credentials: DatastoreCredentials, + pub endpoint: String, + pub protocol: String, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DataPathAssetReference { +pub struct AzurePostgreSqlContents { #[serde(flatten)] - pub asset_reference_base: AssetReferenceBase, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub path: Option, - #[serde(rename = "datastoreId", default, skip_serializing_if = "Option::is_none")] - pub datastore_id: Option, + pub datastore_contents: DatastoreContents, + pub credentials: DatastoreCredentials, + #[serde(rename = "databaseName")] + pub database_name: String, + #[serde(rename = "enableSSL", default, skip_serializing_if = "Option::is_none")] + pub enable_ssl: Option, + pub endpoint: String, + #[serde(rename = "portNumber")] + pub port_number: i32, + #[serde(rename = "serverName")] + pub server_name: String, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OutputPathAssetReference { +pub struct AzureSqlDatabaseContents { #[serde(flatten)] - pub asset_reference_base: AssetReferenceBase, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub path: Option, - #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] - pub job_id: Option, + pub datastore_contents: DatastoreContents, + pub credentials: DatastoreCredentials, + #[serde(rename = "databaseName")] + pub database_name: String, + pub endpoint: String, + #[serde(rename = "portNumber")] + pub port_number: i32, + #[serde(rename = "serverName")] + pub server_name: String, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CodeConfiguration { - #[serde(rename = "codeId", default, skip_serializing_if = "Option::is_none")] - pub code_id: Option, - #[serde(rename = "scoringScript")] - pub scoring_script: String, +pub struct BanditPolicy { + #[serde(flatten)] + pub early_termination_policy: EarlyTerminationPolicy, + #[serde(rename = "slackAmount", default, skip_serializing_if = "Option::is_none")] + pub slack_amount: Option, + #[serde(rename = "slackFactor", default, skip_serializing_if = "Option::is_none")] + pub slack_factor: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct BatchDeployment { + #[serde(rename = "codeConfiguration", default, skip_serializing_if = "Option::is_none")] + pub code_configuration: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub compute: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "environmentId", default, skip_serializing_if = "Option::is_none")] + pub environment_id: Option, + #[serde(rename = "environmentVariables", default, skip_serializing_if = "Option::is_none")] + pub environment_variables: Option, #[serde(rename = "errorThreshold", default, skip_serializing_if = "Option::is_none")] pub error_threshold: Option, - #[serde(rename = "retrySettings", default, skip_serializing_if = "Option::is_none")] - pub retry_settings: Option, - #[serde(rename = "partitionKeys", default, skip_serializing_if = "Vec::is_empty")] - pub partition_keys: Vec, - #[serde(rename = "miniBatchSize", default, skip_serializing_if = "Option::is_none")] - pub mini_batch_size: Option, #[serde(rename = "loggingLevel", default, skip_serializing_if = "Option::is_none")] pub logging_level: Option, + #[serde(rename = "miniBatchSize", default, skip_serializing_if = "Option::is_none")] + pub mini_batch_size: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub model: Option, #[serde(rename = "outputConfiguration", default, skip_serializing_if = "Option::is_none")] pub output_configuration: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, + #[serde(rename = "partitionKeys", default, skip_serializing_if = "Vec::is_empty")] + pub partition_keys: Vec, #[serde(default, skip_serializing_if = "Option::is_none")] pub properties: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub model: Option, - #[serde(rename = "codeConfiguration", default, skip_serializing_if = "Option::is_none")] - pub code_configuration: Option, - #[serde(rename = "environmentId", default, skip_serializing_if = "Option::is_none")] - pub environment_id: Option, - #[serde(rename = "environmentVariables", default, skip_serializing_if = "Option::is_none")] - pub environment_variables: Option, + #[serde(rename = "retrySettings", default, skip_serializing_if = "Option::is_none")] + pub retry_settings: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct BatchDeploymentTrackedResource { #[serde(flatten)] pub tracked_resource: TrackedResource, #[serde(default, skip_serializing_if = "Option::is_none")] - pub kind: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] pub identity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kind: Option, pub properties: BatchDeployment, #[serde(rename = "systemData", skip_serializing)] pub system_data: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct PartialBatchDeployment { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct PartialBatchDeploymentPartialTrackedResource { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub tags: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub location: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub kind: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub identity: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct BatchDeploymentTrackedResourceArmPaginatedResult { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] pub next_link: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum EndpointAuthMode { - #[serde(rename = "AMLToken")] - AmlToken, - Key, - #[serde(rename = "AADToken")] - AadToken, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct EndpointAuthKeys { - #[serde(rename = "primaryKey", default, skip_serializing_if = "Option::is_none")] - pub primary_key: Option, - #[serde(rename = "secondaryKey", default, skip_serializing_if = "Option::is_none")] - pub secondary_key: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct BatchEndpoint { @@ -1455,61 +1427,107 @@ pub struct BatchEndpoint { #[serde(default, skip_serializing_if = "Option::is_none")] pub description: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, + pub keys: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub traffic: Option, + pub properties: Option, #[serde(rename = "scoringUri", skip_serializing)] pub scoring_uri: Option, #[serde(rename = "swaggerUri", skip_serializing)] pub swagger_uri: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub keys: Option, + pub traffic: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct BatchEndpointTrackedResource { #[serde(flatten)] pub tracked_resource: TrackedResource, #[serde(default, skip_serializing_if = "Option::is_none")] - pub kind: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] pub identity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kind: Option, pub properties: BatchEndpoint, #[serde(rename = "systemData", skip_serializing)] pub system_data: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct PartialBatchEndpoint { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub traffic: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct PartialBatchEndpointPartialTrackedResource { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub tags: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub location: Option, +pub struct BatchEndpointTrackedResourceArmPaginatedResult { + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum BatchLoggingLevel { + Info, + Warning, + Debug, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum BatchOutputAction { + SummaryOnly, + AppendRow, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BatchOutputConfiguration { + #[serde(rename = "appendRowFileName", default, skip_serializing_if = "Option::is_none")] + pub append_row_file_name: Option, + #[serde(rename = "outputAction", default, skip_serializing_if = "Option::is_none")] + pub output_action: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct BatchRetrySettings { + #[serde(rename = "maxRetries", default, skip_serializing_if = "Option::is_none")] + pub max_retries: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub kind: Option, + pub timeout: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CertificateDatastoreCredentials { + #[serde(flatten)] + pub datastore_credentials: DatastoreCredentials, + #[serde(rename = "authorityUrl", default, skip_serializing_if = "Option::is_none")] + pub authority_url: Option, + #[serde(rename = "clientId")] + pub client_id: String, + #[serde(rename = "resourceUri", default, skip_serializing_if = "Option::is_none")] + pub resource_uri: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub identity: Option, + pub secrets: Option, + #[serde(rename = "tenantId")] + pub tenant_id: String, + pub thumbprint: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CertificateDatastoreSecrets { + #[serde(flatten)] + pub datastore_secrets: DatastoreSecrets, #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, + pub certificate: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BatchEndpointTrackedResourceArmPaginatedResult { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, - #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] - pub next_link: Option, +pub struct CocoExportSummary { + #[serde(flatten)] + pub export_summary: ExportSummary, + #[serde(rename = "containerName", skip_serializing)] + pub container_name: Option, + #[serde(rename = "snapshotPath", skip_serializing)] + pub snapshot_path: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CodeConfiguration { + #[serde(rename = "codeId", default, skip_serializing_if = "Option::is_none")] + pub code_id: Option, + #[serde(rename = "scoringScript")] + pub scoring_script: String, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct CodeContainer { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub properties: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub tags: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct CodeContainerResource { @@ -1521,24 +1539,24 @@ pub struct CodeContainerResource { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct CodeContainerResourceArmPaginatedResult { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] pub next_link: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct CodeVersion { #[serde(rename = "datastoreId", default, skip_serializing_if = "Option::is_none")] pub datastore_id: Option, - pub path: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, #[serde(rename = "isAnonymous", default, skip_serializing_if = "Option::is_none")] pub is_anonymous: Option, + pub path: String, #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, + pub properties: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub tags: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct CodeVersionResource { @@ -1550,34 +1568,63 @@ pub struct CodeVersionResource { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct CodeVersionResourceArmPaginatedResult { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] pub next_link: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DataContainer { +pub struct CommandJob { + #[serde(flatten)] + pub job_base: JobBase, + #[serde(rename = "codeId", default, skip_serializing_if = "Option::is_none")] + pub code_id: Option, + pub command: String, + pub compute: ComputeConfiguration, #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, + pub distribution: Option, + #[serde(rename = "environmentId", default, skip_serializing_if = "Option::is_none")] + pub environment_id: Option, + #[serde(rename = "environmentVariables", default, skip_serializing_if = "Option::is_none")] + pub environment_variables: Option, + #[serde(rename = "experimentName", default, skip_serializing_if = "Option::is_none")] + pub experiment_name: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub tags: Option, + pub identity: Option, + #[serde(rename = "inputDataBindings", default, skip_serializing_if = "Option::is_none")] + pub input_data_bindings: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, + pub output: Option, + #[serde(rename = "outputDataBindings", default, skip_serializing_if = "Option::is_none")] + pub output_data_bindings: Option, + #[serde(skip_serializing)] + pub parameters: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub priority: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timeout: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DataContainerResource { - #[serde(flatten)] - pub resource: Resource, - pub properties: DataContainer, - #[serde(rename = "systemData", skip_serializing)] - pub system_data: Option, +pub struct ComputeConfiguration { + #[serde(rename = "instanceCount", default, skip_serializing_if = "Option::is_none")] + pub instance_count: Option, + #[serde(rename = "instanceType", default, skip_serializing_if = "Option::is_none")] + pub instance_type: Option, + #[serde(rename = "isLocal", default, skip_serializing_if = "Option::is_none")] + pub is_local: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub target: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DataContainerResourceArmPaginatedResult { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, - #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] - pub next_link: Option, +pub enum ContainerType { + StorageInitializer, + InferenceServer, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum ContentsType { @@ -1600,124 +1647,95 @@ pub enum CredentialsType { SqlAdmin, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum SecretsType { - AccountKey, - Certificate, - None, - Sas, - ServicePrincipal, - SqlAdmin, +pub struct CsvExportSummary { + #[serde(flatten)] + pub export_summary: ExportSummary, + #[serde(rename = "containerName", skip_serializing)] + pub container_name: Option, + #[serde(rename = "snapshotPath", skip_serializing)] + pub snapshot_path: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DatastoreSecrets { - #[serde(rename = "secretsType")] - pub secrets_type: SecretsType, +pub enum DataBindingMode { + Mount, + Download, + Upload, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AccountKeyDatastoreSecrets { - #[serde(flatten)] - pub datastore_secrets: DatastoreSecrets, +pub struct DataContainer { #[serde(default, skip_serializing_if = "Option::is_none")] - pub key: Option, + pub description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DatastoreCredentials { - #[serde(rename = "credentialsType")] - pub credentials_type: CredentialsType, +pub struct DataContainerResource { + #[serde(flatten)] + pub resource: Resource, + pub properties: DataContainer, + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AccountKeyDatastoreCredentials { - #[serde(flatten)] - pub datastore_credentials: DatastoreCredentials, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub secrets: Option, +pub struct DataContainerResourceArmPaginatedResult { + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CertificateDatastoreSecrets { +pub struct DataPathAssetReference { #[serde(flatten)] - pub datastore_secrets: DatastoreSecrets, + pub asset_reference_base: AssetReferenceBase, + #[serde(rename = "datastoreId", default, skip_serializing_if = "Option::is_none")] + pub datastore_id: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub certificate: Option, + pub path: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CertificateDatastoreCredentials { - #[serde(flatten)] - pub datastore_credentials: DatastoreCredentials, - #[serde(rename = "authorityUrl", default, skip_serializing_if = "Option::is_none")] - pub authority_url: Option, - #[serde(rename = "resourceUri", default, skip_serializing_if = "Option::is_none")] - pub resource_uri: Option, - #[serde(rename = "tenantId")] - pub tenant_id: String, - #[serde(rename = "clientId")] - pub client_id: String, - pub thumbprint: String, +pub struct DataVersion { + #[serde(rename = "datasetType", default, skip_serializing_if = "Option::is_none")] + pub dataset_type: Option, + #[serde(rename = "datastoreId", default, skip_serializing_if = "Option::is_none")] + pub datastore_id: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub secrets: Option, + pub description: Option, + #[serde(rename = "isAnonymous", default, skip_serializing_if = "Option::is_none")] + pub is_anonymous: Option, + pub path: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct NoneDatastoreSecrets { +pub struct DataVersionResource { #[serde(flatten)] - pub datastore_secrets: DatastoreSecrets, + pub resource: Resource, + pub properties: DataVersion, + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct NoneDatastoreCredentials { - #[serde(flatten)] - pub datastore_credentials: DatastoreCredentials, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub secrets: Option, +pub struct DataVersionResourceArmPaginatedResult { + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct SasDatastoreSecrets { - #[serde(flatten)] - pub datastore_secrets: DatastoreSecrets, - #[serde(rename = "sasToken", default, skip_serializing_if = "Option::is_none")] - pub sas_token: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct SasDatastoreCredentials { - #[serde(flatten)] - pub datastore_credentials: DatastoreCredentials, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub secrets: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ServicePrincipalDatastoreSecrets { - #[serde(flatten)] - pub datastore_secrets: DatastoreSecrets, - #[serde(rename = "clientSecret", default, skip_serializing_if = "Option::is_none")] - pub client_secret: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ServicePrincipalDatastoreCredentials { - #[serde(flatten)] - pub datastore_credentials: DatastoreCredentials, - #[serde(rename = "authorityUrl", default, skip_serializing_if = "Option::is_none")] - pub authority_url: Option, - #[serde(rename = "resourceUri", default, skip_serializing_if = "Option::is_none")] - pub resource_uri: Option, - #[serde(rename = "tenantId")] - pub tenant_id: String, - #[serde(rename = "clientId")] - pub client_id: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub secrets: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct SqlAdminDatastoreSecrets { +pub struct DatasetExportSummary { #[serde(flatten)] - pub datastore_secrets: DatastoreSecrets, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub password: Option, + pub export_summary: ExportSummary, + #[serde(rename = "labeledAssetName", skip_serializing)] + pub labeled_asset_name: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct SqlAdminDatastoreCredentials { - #[serde(flatten)] - pub datastore_credentials: DatastoreCredentials, - #[serde(rename = "userId")] - pub user_id: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub secrets: Option, +pub enum DatasetType { + Simple, + Dataflow, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct DatastoreContents { @@ -1725,102 +1743,15 @@ pub struct DatastoreContents { pub contents_type: ContentsType, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureBlobContents { - #[serde(flatten)] - pub datastore_contents: DatastoreContents, - #[serde(rename = "accountName")] - pub account_name: String, - #[serde(rename = "containerName")] - pub container_name: String, - pub endpoint: String, - pub protocol: String, - pub credentials: DatastoreCredentials, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureDataLakeGen1Contents { - #[serde(flatten)] - pub datastore_contents: DatastoreContents, - #[serde(rename = "storeName")] - pub store_name: String, - pub credentials: DatastoreCredentials, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureDataLakeGen2Contents { - #[serde(flatten)] - pub datastore_contents: DatastoreContents, - #[serde(rename = "accountName")] - pub account_name: String, - #[serde(rename = "containerName")] - pub container_name: String, - pub endpoint: String, - pub protocol: String, - pub credentials: DatastoreCredentials, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureFileContents { - #[serde(flatten)] - pub datastore_contents: DatastoreContents, - #[serde(rename = "accountName")] - pub account_name: String, - #[serde(rename = "containerName")] - pub container_name: String, - pub endpoint: String, - pub protocol: String, - pub credentials: DatastoreCredentials, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzurePostgreSqlContents { - #[serde(flatten)] - pub datastore_contents: DatastoreContents, - #[serde(rename = "enableSSL", default, skip_serializing_if = "Option::is_none")] - pub enable_ssl: Option, - #[serde(rename = "databaseName")] - pub database_name: String, - pub endpoint: String, - #[serde(rename = "portNumber")] - pub port_number: i32, - #[serde(rename = "serverName")] - pub server_name: String, - pub credentials: DatastoreCredentials, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AzureSqlDatabaseContents { - #[serde(flatten)] - pub datastore_contents: DatastoreContents, - #[serde(rename = "databaseName")] - pub database_name: String, - pub endpoint: String, - #[serde(rename = "portNumber")] - pub port_number: i32, - #[serde(rename = "serverName")] - pub server_name: String, - pub credentials: DatastoreCredentials, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct GlusterFsContents { - #[serde(flatten)] - pub datastore_contents: DatastoreContents, - #[serde(rename = "serverAddress")] - pub server_address: String, - #[serde(rename = "volumeName")] - pub volume_name: String, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum OriginType { - Synapse, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct LinkedInfo { - #[serde(rename = "linkedId", default, skip_serializing_if = "Option::is_none")] - pub linked_id: Option, - #[serde(rename = "linkedResourceName", default, skip_serializing_if = "Option::is_none")] - pub linked_resource_name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub origin: Option, +pub struct DatastoreCredentials { + #[serde(rename = "credentialsType")] + pub credentials_type: CredentialsType, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct DatastoreProperties { pub contents: DatastoreContents, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, #[serde(rename = "hasBeenValidated", skip_serializing)] pub has_been_validated: Option, #[serde(rename = "isDefault", default, skip_serializing_if = "Option::is_none")] @@ -1830,8 +1761,6 @@ pub struct DatastoreProperties { #[serde(default, skip_serializing_if = "Option::is_none")] pub properties: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] pub tags: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] @@ -1844,85 +1773,63 @@ pub struct DatastorePropertiesResource { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct DatastorePropertiesResourceArmPaginatedResult { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] pub next_link: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum DatasetType { - Simple, - Dataflow, +pub struct DatastoreSecrets { + #[serde(rename = "secretsType")] + pub secrets_type: SecretsType, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DataVersion { - #[serde(rename = "datasetType", default, skip_serializing_if = "Option::is_none")] - pub dataset_type: Option, - #[serde(rename = "datastoreId", default, skip_serializing_if = "Option::is_none")] - pub datastore_id: Option, - pub path: String, - #[serde(rename = "isAnonymous", default, skip_serializing_if = "Option::is_none")] - pub is_anonymous: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub tags: Option, +pub struct DeploymentLogs { #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DataVersionResource { - #[serde(flatten)] - pub resource: Resource, - pub properties: DataVersion, - #[serde(rename = "systemData", skip_serializing)] - pub system_data: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DataVersionResourceArmPaginatedResult { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, - #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] - pub next_link: Option, + pub content: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct EnvironmentContainer { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub tags: Option, +pub struct DeploymentLogsRequest { + #[serde(rename = "containerType", default, skip_serializing_if = "Option::is_none")] + pub container_type: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, + pub tail: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct EnvironmentContainerResource { - #[serde(flatten)] - pub resource: Resource, - pub properties: EnvironmentContainer, - #[serde(rename = "systemData", skip_serializing)] - pub system_data: Option, +pub enum DeploymentProvisioningState { + Creating, + Deleting, + Scaling, + Updating, + Succeeded, + Failed, + Canceled, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct EnvironmentContainerResourceArmPaginatedResult { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, - #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] - pub next_link: Option, +pub struct DistributionConfiguration { + #[serde(rename = "distributionType")] + pub distribution_type: DistributionType, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum EnvironmentSpecificationType { - Curated, - UserCreated, +pub enum DistributionType { + PyTorch, + TensorFlow, + Mpi, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum DockerSpecificationType { - Build, - Image, +pub struct DockerBuild { + #[serde(flatten)] + pub docker_specification: DockerSpecification, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub context: Option, + pub dockerfile: String, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum OperatingSystemType { - Linux, - Windows, +pub struct DockerImage { + #[serde(flatten)] + pub docker_specification: DockerSpecification, + #[serde(rename = "dockerImageUri")] + pub docker_image_uri: String, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct DockerImagePlatform { @@ -1937,52 +1844,115 @@ pub struct DockerSpecification { pub platform: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DockerImage { - #[serde(flatten)] - pub docker_specification: DockerSpecification, - #[serde(rename = "dockerImageUri")] - pub docker_image_uri: String, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DockerBuild { - #[serde(flatten)] - pub docker_specification: DockerSpecification, - pub dockerfile: String, +pub enum DockerSpecificationType { + Build, + Image, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EarlyTerminationPolicy { + #[serde(rename = "delayEvaluation", default, skip_serializing_if = "Option::is_none")] + pub delay_evaluation: Option, + #[serde(rename = "evaluationInterval", default, skip_serializing_if = "Option::is_none")] + pub evaluation_interval: Option, + #[serde(rename = "policyType")] + pub policy_type: EarlyTerminationPolicyType, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum EarlyTerminationPolicyType { + Bandit, + MedianStopping, + TruncationSelection, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EndpointAuthKeys { + #[serde(rename = "primaryKey", default, skip_serializing_if = "Option::is_none")] + pub primary_key: Option, + #[serde(rename = "secondaryKey", default, skip_serializing_if = "Option::is_none")] + pub secondary_key: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum EndpointAuthMode { + #[serde(rename = "AMLToken")] + AmlToken, + Key, + #[serde(rename = "AADToken")] + AadToken, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EndpointAuthToken { + #[serde(rename = "accessToken", default, skip_serializing_if = "Option::is_none")] + pub access_token: Option, + #[serde(rename = "expiryTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub expiry_time_utc: Option, + #[serde(rename = "refreshAfterTimeUtc", default, skip_serializing_if = "Option::is_none")] + pub refresh_after_time_utc: Option, + #[serde(rename = "tokenType", default, skip_serializing_if = "Option::is_none")] + pub token_type: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum EndpointComputeType { + Managed, + #[serde(rename = "K8S")] + K8s, + #[serde(rename = "AzureMLCompute")] + AzureMlCompute, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum EndpointProvisioningState { + Creating, + Deleting, + Succeeded, + Failed, + Updating, + Canceled, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EnvironmentContainer { #[serde(default, skip_serializing_if = "Option::is_none")] - pub context: Option, + pub description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct Route { - pub path: String, - pub port: i32, +pub struct EnvironmentContainerResource { + #[serde(flatten)] + pub resource: Resource, + pub properties: EnvironmentContainer, + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct InferenceContainerProperties { - #[serde(rename = "livenessRoute", default, skip_serializing_if = "Option::is_none")] - pub liveness_route: Option, - #[serde(rename = "readinessRoute", default, skip_serializing_if = "Option::is_none")] - pub readiness_route: Option, - #[serde(rename = "scoringRoute", default, skip_serializing_if = "Option::is_none")] - pub scoring_route: Option, +pub struct EnvironmentContainerResourceArmPaginatedResult { + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum EnvironmentSpecificationType { + Curated, + UserCreated, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct EnvironmentSpecificationVersion { - #[serde(rename = "environmentSpecificationType", default, skip_serializing_if = "Option::is_none")] - pub environment_specification_type: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub docker: Option, #[serde(rename = "condaFile", default, skip_serializing_if = "Option::is_none")] pub conda_file: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub docker: Option, + #[serde(rename = "environmentSpecificationType", default, skip_serializing_if = "Option::is_none")] + pub environment_specification_type: Option, #[serde(rename = "inferenceContainerProperties", default, skip_serializing_if = "Option::is_none")] pub inference_container_properties: Option, #[serde(rename = "isAnonymous", default, skip_serializing_if = "Option::is_none")] pub is_anonymous: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, + pub properties: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub tags: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct EnvironmentSpecificationVersionResource { @@ -1994,16 +1964,131 @@ pub struct EnvironmentSpecificationVersionResource { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct EnvironmentSpecificationVersionResourceArmPaginatedResult { + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, #[serde(default, skip_serializing_if = "Vec::is_empty")] pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ExportFormatType { + Dataset, + Coco, + #[serde(rename = "CSV")] + Csv, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExportSummary { + #[serde(rename = "endTimeUtc", skip_serializing)] + pub end_time_utc: Option, + #[serde(rename = "exportedRowCount", skip_serializing)] + pub exported_row_count: Option, + pub format: ExportFormatType, + #[serde(rename = "labelingJobId", skip_serializing)] + pub labeling_job_id: Option, + #[serde(rename = "startTimeUtc", skip_serializing)] + pub start_time_utc: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct FlavorData { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GlusterFsContents { + #[serde(flatten)] + pub datastore_contents: DatastoreContents, + #[serde(rename = "serverAddress")] + pub server_address: String, + #[serde(rename = "volumeName")] + pub volume_name: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum Goal { + Minimize, + Maximize, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IdAssetReference { + #[serde(flatten)] + pub asset_reference_base: AssetReferenceBase, + #[serde(rename = "assetId")] + pub asset_id: String, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct IdentityConfiguration { + #[serde(rename = "identityType")] + pub identity_type: IdentityConfigurationType, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum IdentityConfigurationType { + Managed, + #[serde(rename = "AMLToken")] + AmlToken, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ImageAnnotationType { + Classification, + BoundingBox, + InstanceSegmentation, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InferenceContainerProperties { + #[serde(rename = "livenessRoute", default, skip_serializing_if = "Option::is_none")] + pub liveness_route: Option, + #[serde(rename = "readinessRoute", default, skip_serializing_if = "Option::is_none")] + pub readiness_route: Option, + #[serde(rename = "scoringRoute", default, skip_serializing_if = "Option::is_none")] + pub scoring_route: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct InputDataBinding { + #[serde(rename = "dataId", default, skip_serializing_if = "Option::is_none")] + pub data_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub mode: Option, + #[serde(rename = "pathOnCompute", default, skip_serializing_if = "Option::is_none")] + pub path_on_compute: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobBase { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "interactionEndpoints", skip_serializing)] + pub interaction_endpoints: Option, + #[serde(rename = "jobType")] + pub job_type: JobType, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobBaseResource { + #[serde(flatten)] + pub resource: Resource, + pub properties: JobBase, + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct JobBaseResourceArmPaginatedResult { #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] pub next_link: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum JobType { - Command, - Sweep, - Labeling, +pub struct JobEndpoint { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub endpoint: Option, + #[serde(rename = "jobEndpointType", default, skip_serializing_if = "Option::is_none")] + pub job_endpoint_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub port: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct JobOutput { @@ -2013,6 +2098,13 @@ pub struct JobOutput { pub path: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum JobProvisioningState { + Succeeded, + Failed, + Canceled, + InProgress, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum JobStatus { NotStarted, Starting, @@ -2030,80 +2122,139 @@ pub enum JobStatus { Unknown, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum DataBindingMode { - Mount, - Download, - Upload, +pub enum JobType { + Command, + Sweep, + Labeling, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct InputDataBinding { - #[serde(rename = "dataId", default, skip_serializing_if = "Option::is_none")] - pub data_id: Option, - #[serde(rename = "pathOnCompute", default, skip_serializing_if = "Option::is_none")] - pub path_on_compute: Option, +pub struct K8sOnlineDeployment { + #[serde(flatten)] + pub online_deployment: OnlineDeployment, + #[serde(rename = "containerResourceRequirements", default, skip_serializing_if = "Option::is_none")] + pub container_resource_requirements: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum KeyType { + Primary, + Secondary, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LabelCategory { + #[serde(rename = "allowMultiSelect", default, skip_serializing_if = "Option::is_none")] + pub allow_multi_select: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub mode: Option, + pub classes: Option, + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OutputDataBinding { - #[serde(rename = "datastoreId", default, skip_serializing_if = "Option::is_none")] - pub datastore_id: Option, - #[serde(rename = "pathOnDatastore", default, skip_serializing_if = "Option::is_none")] - pub path_on_datastore: Option, - #[serde(rename = "pathOnCompute", default, skip_serializing_if = "Option::is_none")] - pub path_on_compute: Option, +pub struct LabelClass { + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub mode: Option, + pub subclasses: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum DistributionType { - PyTorch, - TensorFlow, - Mpi, +pub struct LabelingDatasetConfiguration { + #[serde(rename = "assetName", default, skip_serializing_if = "Option::is_none")] + pub asset_name: Option, + #[serde(rename = "datasetVersion", default, skip_serializing_if = "Option::is_none")] + pub dataset_version: Option, + #[serde(rename = "incrementalDatasetRefreshEnabled", default, skip_serializing_if = "Option::is_none")] + pub incremental_dataset_refresh_enabled: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DistributionConfiguration { - #[serde(rename = "distributionType")] - pub distribution_type: DistributionType, +pub struct LabelingJob { + #[serde(rename = "createdTimeUtc", skip_serializing)] + pub created_time_utc: Option, + #[serde(rename = "datasetConfiguration", default, skip_serializing_if = "Option::is_none")] + pub dataset_configuration: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "interactionEndpoints", skip_serializing)] + pub interaction_endpoints: Option, + #[serde(rename = "jobInstructions", default, skip_serializing_if = "Option::is_none")] + pub job_instructions: Option, + #[serde(rename = "jobType")] + pub job_type: JobType, + #[serde(rename = "labelCategories", default, skip_serializing_if = "Option::is_none")] + pub label_categories: Option, + #[serde(rename = "labelingJobMediaProperties", default, skip_serializing_if = "Option::is_none")] + pub labeling_job_media_properties: Option, + #[serde(rename = "mlAssistConfiguration", default, skip_serializing_if = "Option::is_none")] + pub ml_assist_configuration: Option, + #[serde(rename = "progressMetrics", default, skip_serializing_if = "Option::is_none")] + pub progress_metrics: Option, + #[serde(rename = "projectId", skip_serializing)] + pub project_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "statusMessages", skip_serializing)] + pub status_messages: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct TensorFlow { +pub struct LabelingJobImageProperties { #[serde(flatten)] - pub distribution_configuration: DistributionConfiguration, - #[serde(rename = "workerCount", default, skip_serializing_if = "Option::is_none")] - pub worker_count: Option, - #[serde(rename = "parameterServerCount", default, skip_serializing_if = "Option::is_none")] - pub parameter_server_count: Option, + pub labeling_job_media_properties: LabelingJobMediaProperties, + #[serde(rename = "annotationType", default, skip_serializing_if = "Option::is_none")] + pub annotation_type: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct Mpi { - #[serde(flatten)] - pub distribution_configuration: DistributionConfiguration, - #[serde(rename = "processCountPerInstance", default, skip_serializing_if = "Option::is_none")] - pub process_count_per_instance: Option, +pub struct LabelingJobInstructions { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub uri: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct PyTorch { - #[serde(flatten)] - pub distribution_configuration: DistributionConfiguration, - #[serde(rename = "processCount", default, skip_serializing_if = "Option::is_none")] - pub process_count: Option, +pub struct LabelingJobMediaProperties { + #[serde(rename = "mediaType")] + pub media_type: MediaType, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum IdentityConfigurationType { - Managed, - #[serde(rename = "AMLToken")] - AmlToken, +pub struct LabelingJobResource { + #[serde(flatten)] + pub resource: Resource, + pub properties: LabelingJob, + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct IdentityConfiguration { - #[serde(rename = "identityType")] - pub identity_type: IdentityConfigurationType, +pub struct LabelingJobResourceArmPaginatedResult { + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AmlToken { +pub struct LabelingJobTextProperties { #[serde(flatten)] - pub identity_configuration: IdentityConfiguration, + pub labeling_job_media_properties: LabelingJobMediaProperties, + #[serde(rename = "annotationType", default, skip_serializing_if = "Option::is_none")] + pub annotation_type: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct LinkedInfo { + #[serde(rename = "linkedId", default, skip_serializing_if = "Option::is_none")] + pub linked_id: Option, + #[serde(rename = "linkedResourceName", default, skip_serializing_if = "Option::is_none")] + pub linked_resource_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MlAssistConfiguration { + #[serde(rename = "inferencingComputeBinding", default, skip_serializing_if = "Option::is_none")] + pub inferencing_compute_binding: Option, + #[serde(rename = "mlAssistEnabled", default, skip_serializing_if = "Option::is_none")] + pub ml_assist_enabled: Option, + #[serde(rename = "trainingComputeBinding", default, skip_serializing_if = "Option::is_none")] + pub training_compute_binding: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ManagedIdentity { @@ -2117,727 +2268,576 @@ pub struct ManagedIdentity { pub resource_id: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum JobProvisioningState { - Succeeded, - Failed, - Canceled, - InProgress, +pub struct ManagedOnlineDeployment { + #[serde(flatten)] + pub online_deployment: OnlineDeployment, + #[serde(rename = "instanceType", default, skip_serializing_if = "Option::is_none")] + pub instance_type: Option, + #[serde(rename = "readinessProbe", default, skip_serializing_if = "Option::is_none")] + pub readiness_probe: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct JobEndpoint { - #[serde(rename = "jobEndpointType", default, skip_serializing_if = "Option::is_none")] - pub job_endpoint_type: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub port: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub endpoint: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, +pub struct ManualScaleSettings { + #[serde(flatten)] + pub online_scale_settings: OnlineScaleSettings, + #[serde(rename = "instanceCount", default, skip_serializing_if = "Option::is_none")] + pub instance_count: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct JobBase { - #[serde(rename = "jobType")] - pub job_type: JobType, - #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] - pub provisioning_state: Option, - #[serde(rename = "interactionEndpoints", skip_serializing)] - pub interaction_endpoints: Option, +pub enum MediaType { + Image, + Text, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct MedianStoppingPolicy { + #[serde(flatten)] + pub early_termination_policy: EarlyTerminationPolicy, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ModelContainer { #[serde(default, skip_serializing_if = "Option::is_none")] pub description: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub tags: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CommandJob { +pub struct ModelContainerResource { #[serde(flatten)] - pub job_base: JobBase, - pub compute: ComputeConfiguration, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub priority: Option, - #[serde(rename = "experimentName", default, skip_serializing_if = "Option::is_none")] - pub experiment_name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub output: Option, + pub resource: Resource, + pub properties: ModelContainer, + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ModelContainerResourceArmPaginatedResult { + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ModelVersion { + #[serde(rename = "datastoreId", default, skip_serializing_if = "Option::is_none")] + pub datastore_id: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, + pub description: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub timeout: Option, - #[serde(rename = "codeId", default, skip_serializing_if = "Option::is_none")] - pub code_id: Option, - pub command: String, - #[serde(rename = "environmentId", default, skip_serializing_if = "Option::is_none")] - pub environment_id: Option, - #[serde(rename = "inputDataBindings", default, skip_serializing_if = "Option::is_none")] - pub input_data_bindings: Option, - #[serde(rename = "outputDataBindings", default, skip_serializing_if = "Option::is_none")] - pub output_data_bindings: Option, + pub flavors: Option, + #[serde(rename = "isAnonymous", default, skip_serializing_if = "Option::is_none")] + pub is_anonymous: Option, + pub path: String, #[serde(default, skip_serializing_if = "Option::is_none")] - pub distribution: Option, - #[serde(rename = "environmentVariables", default, skip_serializing_if = "Option::is_none")] - pub environment_variables: Option, + pub properties: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub identity: Option, - #[serde(skip_serializing)] - pub parameters: Option, + pub tags: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum SamplingAlgorithm { - Grid, - Random, - Bayesian, +pub struct ModelVersionResource { + #[serde(flatten)] + pub resource: Resource, + pub properties: ModelVersion, + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum EarlyTerminationPolicyType { - Bandit, - MedianStopping, - TruncationSelection, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct EarlyTerminationPolicy { - #[serde(rename = "policyType")] - pub policy_type: EarlyTerminationPolicyType, - #[serde(rename = "evaluationInterval", default, skip_serializing_if = "Option::is_none")] - pub evaluation_interval: Option, - #[serde(rename = "delayEvaluation", default, skip_serializing_if = "Option::is_none")] - pub delay_evaluation: Option, +pub struct ModelVersionResourceArmPaginatedResult { + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct BanditPolicy { +pub struct Mpi { #[serde(flatten)] - pub early_termination_policy: EarlyTerminationPolicy, - #[serde(rename = "slackFactor", default, skip_serializing_if = "Option::is_none")] - pub slack_factor: Option, - #[serde(rename = "slackAmount", default, skip_serializing_if = "Option::is_none")] - pub slack_amount: Option, + pub distribution_configuration: DistributionConfiguration, + #[serde(rename = "processCountPerInstance", default, skip_serializing_if = "Option::is_none")] + pub process_count_per_instance: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct MedianStoppingPolicy { +pub struct NoneDatastoreCredentials { #[serde(flatten)] - pub early_termination_policy: EarlyTerminationPolicy, + pub datastore_credentials: DatastoreCredentials, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub secrets: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct TruncationSelectionPolicy { +pub struct NoneDatastoreSecrets { #[serde(flatten)] - pub early_termination_policy: EarlyTerminationPolicy, - #[serde(rename = "truncationPercentage", default, skip_serializing_if = "Option::is_none")] - pub truncation_percentage: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum Goal { - Minimize, - Maximize, + pub datastore_secrets: DatastoreSecrets, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Objective { + pub goal: Goal, #[serde(rename = "primaryMetric")] pub primary_metric: String, - pub goal: Goal, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct TrialComponent { +pub struct OnlineDeployment { + #[serde(rename = "appInsightsEnabled", default, skip_serializing_if = "Option::is_none")] + pub app_insights_enabled: Option, + #[serde(rename = "codeConfiguration", default, skip_serializing_if = "Option::is_none")] + pub code_configuration: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub timeout: Option, - #[serde(rename = "codeId", default, skip_serializing_if = "Option::is_none")] - pub code_id: Option, - pub command: String, + pub description: Option, + #[serde(rename = "endpointComputeType")] + pub endpoint_compute_type: EndpointComputeType, #[serde(rename = "environmentId", default, skip_serializing_if = "Option::is_none")] pub environment_id: Option, - #[serde(rename = "inputDataBindings", default, skip_serializing_if = "Option::is_none")] - pub input_data_bindings: Option, - #[serde(rename = "outputDataBindings", default, skip_serializing_if = "Option::is_none")] - pub output_data_bindings: Option, #[serde(rename = "environmentVariables", default, skip_serializing_if = "Option::is_none")] pub environment_variables: Option, + #[serde(rename = "livenessProbe", default, skip_serializing_if = "Option::is_none")] + pub liveness_probe: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub distribution: Option, + pub model: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "requestSettings", default, skip_serializing_if = "Option::is_none")] + pub request_settings: Option, + #[serde(rename = "scaleSettings", default, skip_serializing_if = "Option::is_none")] + pub scale_settings: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct SweepJob { +pub struct OnlineDeploymentTrackedResource { #[serde(flatten)] - pub job_base: JobBase, - pub compute: ComputeConfiguration, + pub tracked_resource: TrackedResource, #[serde(default, skip_serializing_if = "Option::is_none")] - pub priority: Option, - #[serde(rename = "experimentName", default, skip_serializing_if = "Option::is_none")] - pub experiment_name: Option, + pub identity: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub output: Option, + pub kind: Option, + pub properties: OnlineDeployment, + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OnlineDeploymentTrackedResourceArmPaginatedResult { + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OnlineEndpoint { + #[serde(rename = "authMode")] + pub auth_mode: EndpointAuthMode, #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "searchSpace")] - pub search_space: serde_json::Value, - pub algorithm: SamplingAlgorithm, - #[serde(rename = "maxTotalTrials", default, skip_serializing_if = "Option::is_none")] - pub max_total_trials: Option, - #[serde(rename = "maxConcurrentTrials", default, skip_serializing_if = "Option::is_none")] - pub max_concurrent_trials: Option, + pub description: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub timeout: Option, - #[serde(rename = "earlyTermination", default, skip_serializing_if = "Option::is_none")] - pub early_termination: Option, - pub objective: Objective, + pub keys: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub trial: Option, + pub properties: Option, + #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] + pub provisioning_state: Option, + #[serde(rename = "scoringUri", skip_serializing)] + pub scoring_uri: Option, + #[serde(rename = "swaggerUri", skip_serializing)] + pub swagger_uri: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub identity: Option, + pub target: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub traffic: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct JobBaseResource { +pub struct OnlineEndpointTrackedResource { #[serde(flatten)] - pub resource: Resource, - pub properties: JobBase, + pub tracked_resource: TrackedResource, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kind: Option, + pub properties: OnlineEndpoint, #[serde(rename = "systemData", skip_serializing)] pub system_data: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct JobBaseResourceArmPaginatedResult { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, +pub struct OnlineEndpointTrackedResourceArmPaginatedResult { #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] pub next_link: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct LabelClass { - #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] - pub display_name: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub subclasses: Option, +pub struct OnlineRequestSettings { + #[serde(rename = "maxConcurrentRequestsPerInstance", default, skip_serializing_if = "Option::is_none")] + pub max_concurrent_requests_per_instance: Option, + #[serde(rename = "maxQueueWait", default, skip_serializing_if = "Option::is_none")] + pub max_queue_wait: Option, + #[serde(rename = "requestTimeout", default, skip_serializing_if = "Option::is_none")] + pub request_timeout: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct LabelCategory { - #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] - pub display_name: Option, - #[serde(rename = "allowMultiSelect", default, skip_serializing_if = "Option::is_none")] - pub allow_multi_select: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub classes: Option, +pub struct OnlineScaleSettings { + #[serde(rename = "maxInstances", default, skip_serializing_if = "Option::is_none")] + pub max_instances: Option, + #[serde(rename = "minInstances", default, skip_serializing_if = "Option::is_none")] + pub min_instances: Option, + #[serde(rename = "scaleType")] + pub scale_type: ScaleType, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct LabelingJobInstructions { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub uri: Option, +pub enum OperatingSystemType { + Linux, + Windows, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct LabelingDatasetConfiguration { - #[serde(rename = "assetName", default, skip_serializing_if = "Option::is_none")] - pub asset_name: Option, - #[serde(rename = "incrementalDatasetRefreshEnabled", default, skip_serializing_if = "Option::is_none")] - pub incremental_dataset_refresh_enabled: Option, - #[serde(rename = "datasetVersion", default, skip_serializing_if = "Option::is_none")] - pub dataset_version: Option, +pub enum OrderString { + CreatedAtDesc, + CreatedAtAsc, + UpdatedAtDesc, + UpdatedAtAsc, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct MlAssistConfiguration { - #[serde(rename = "inferencingComputeBinding", default, skip_serializing_if = "Option::is_none")] - pub inferencing_compute_binding: Option, - #[serde(rename = "trainingComputeBinding", default, skip_serializing_if = "Option::is_none")] - pub training_compute_binding: Option, - #[serde(rename = "mlAssistEnabled", default, skip_serializing_if = "Option::is_none")] - pub ml_assist_enabled: Option, +pub enum OriginType { + Synapse, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum MediaType { - Image, - Text, +pub struct OutputDataBinding { + #[serde(rename = "datastoreId", default, skip_serializing_if = "Option::is_none")] + pub datastore_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub mode: Option, + #[serde(rename = "pathOnCompute", default, skip_serializing_if = "Option::is_none")] + pub path_on_compute: Option, + #[serde(rename = "pathOnDatastore", default, skip_serializing_if = "Option::is_none")] + pub path_on_datastore: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum ImageAnnotationType { - Classification, - BoundingBox, - InstanceSegmentation, +pub struct OutputPathAssetReference { + #[serde(flatten)] + pub asset_reference_base: AssetReferenceBase, + #[serde(rename = "jobId", default, skip_serializing_if = "Option::is_none")] + pub job_id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct LabelingJobMediaProperties { - #[serde(rename = "mediaType")] - pub media_type: MediaType, +pub struct PartialAksOnlineDeployment { + #[serde(flatten)] + pub partial_online_deployment: PartialOnlineDeployment, + #[serde(rename = "containerResourceRequirements", default, skip_serializing_if = "Option::is_none")] + pub container_resource_requirements: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct LabelingJobImageProperties { - #[serde(flatten)] - pub labeling_job_media_properties: LabelingJobMediaProperties, - #[serde(rename = "annotationType", default, skip_serializing_if = "Option::is_none")] - pub annotation_type: Option, +pub struct PartialBatchDeployment { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum TextAnnotationType { - Classification, +pub struct PartialBatchDeploymentPartialTrackedResource { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub identity: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kind: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct LabelingJobTextProperties { - #[serde(flatten)] - pub labeling_job_media_properties: LabelingJobMediaProperties, - #[serde(rename = "annotationType", default, skip_serializing_if = "Option::is_none")] - pub annotation_type: Option, +pub struct PartialBatchEndpoint { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub traffic: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProgressMetrics { - #[serde(rename = "totalDatapointCount", skip_serializing)] - pub total_datapoint_count: Option, - #[serde(rename = "completedDatapointCount", skip_serializing)] - pub completed_datapoint_count: Option, - #[serde(rename = "skippedDatapointCount", skip_serializing)] - pub skipped_datapoint_count: Option, - #[serde(rename = "incrementalDatasetLastRefreshTime", skip_serializing)] - pub incremental_dataset_last_refresh_time: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum StatusMessageLevel { - Error, - Information, - Warning, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct StatusMessage { +pub struct PartialBatchEndpointPartialTrackedResource { #[serde(default, skip_serializing_if = "Option::is_none")] - pub level: Option, - #[serde(skip_serializing)] - pub code: Option, - #[serde(skip_serializing)] - pub message: Option, - #[serde(rename = "createdTimeUtc", skip_serializing)] - pub created_time_utc: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct LabelingJob { - #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] - pub provisioning_state: Option, - #[serde(rename = "jobType")] - pub job_type: JobType, - #[serde(rename = "interactionEndpoints", skip_serializing)] - pub interaction_endpoints: Option, - #[serde(rename = "labelCategories", default, skip_serializing_if = "Option::is_none")] - pub label_categories: Option, - #[serde(rename = "jobInstructions", default, skip_serializing_if = "Option::is_none")] - pub job_instructions: Option, - #[serde(rename = "datasetConfiguration", default, skip_serializing_if = "Option::is_none")] - pub dataset_configuration: Option, - #[serde(rename = "mlAssistConfiguration", default, skip_serializing_if = "Option::is_none")] - pub ml_assist_configuration: Option, - #[serde(rename = "labelingJobMediaProperties", default, skip_serializing_if = "Option::is_none")] - pub labeling_job_media_properties: Option, - #[serde(rename = "projectId", skip_serializing)] - pub project_id: Option, + pub identity: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(rename = "progressMetrics", default, skip_serializing_if = "Option::is_none")] - pub progress_metrics: Option, - #[serde(rename = "statusMessages", skip_serializing)] - pub status_messages: Vec, - #[serde(rename = "createdTimeUtc", skip_serializing)] - pub created_time_utc: Option, + pub kind: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, + pub location: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub tags: Option, + pub properties: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct LabelingJobResource { - #[serde(flatten)] - pub resource: Resource, - pub properties: LabelingJob, - #[serde(rename = "systemData", skip_serializing)] - pub system_data: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct LabelingJobResourceArmPaginatedResult { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, - #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] - pub next_link: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum ExportFormatType { - Dataset, - Coco, - #[serde(rename = "CSV")] - Csv, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ExportSummary { - pub format: ExportFormatType, - #[serde(rename = "labelingJobId", skip_serializing)] - pub labeling_job_id: Option, - #[serde(rename = "exportedRowCount", skip_serializing)] - pub exported_row_count: Option, - #[serde(rename = "startTimeUtc", skip_serializing)] - pub start_time_utc: Option, - #[serde(rename = "endTimeUtc", skip_serializing)] - pub end_time_utc: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CocoExportSummary { - #[serde(flatten)] - pub export_summary: ExportSummary, - #[serde(rename = "snapshotPath", skip_serializing)] - pub snapshot_path: Option, - #[serde(rename = "containerName", skip_serializing)] - pub container_name: Option, + pub tags: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct CsvExportSummary { +pub struct PartialManagedOnlineDeployment { #[serde(flatten)] - pub export_summary: ExportSummary, - #[serde(rename = "snapshotPath", skip_serializing)] - pub snapshot_path: Option, - #[serde(rename = "containerName", skip_serializing)] - pub container_name: Option, + pub partial_online_deployment: PartialOnlineDeployment, + #[serde(rename = "readinessProbe", default, skip_serializing_if = "Option::is_none")] + pub readiness_probe: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DatasetExportSummary { - #[serde(flatten)] - pub export_summary: ExportSummary, - #[serde(rename = "labeledAssetName", skip_serializing)] - pub labeled_asset_name: Option, +pub struct PartialOnlineDeployment { + #[serde(rename = "appInsightsEnabled", default, skip_serializing_if = "Option::is_none")] + pub app_insights_enabled: Option, + #[serde(rename = "endpointComputeType")] + pub endpoint_compute_type: EndpointComputeType, + #[serde(rename = "livenessProbe", default, skip_serializing_if = "Option::is_none")] + pub liveness_probe: Option, + #[serde(rename = "requestSettings", default, skip_serializing_if = "Option::is_none")] + pub request_settings: Option, + #[serde(rename = "scaleSettings", default, skip_serializing_if = "Option::is_none")] + pub scale_settings: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ModelContainer { +pub struct PartialOnlineDeploymentPartialTrackedResource { #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, + pub identity: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub tags: Option, + pub kind: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ModelContainerResource { - #[serde(flatten)] - pub resource: Resource, - pub properties: ModelContainer, - #[serde(rename = "systemData", skip_serializing)] - pub system_data: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ModelContainerResourceArmPaginatedResult { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, - #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] - pub next_link: Option, + pub location: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct FlavorData { +pub struct PartialOnlineEndpoint { #[serde(default, skip_serializing_if = "Option::is_none")] - pub data: Option, + pub traffic: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ModelVersion { +pub struct PartialOnlineEndpointPartialTrackedResource { #[serde(default, skip_serializing_if = "Option::is_none")] - pub flavors: Option, - #[serde(rename = "datastoreId", default, skip_serializing_if = "Option::is_none")] - pub datastore_id: Option, - pub path: String, - #[serde(rename = "isAnonymous", default, skip_serializing_if = "Option::is_none")] - pub is_anonymous: Option, + pub identity: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, + pub kind: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub tags: Option, + pub location: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ModelVersionResource { - #[serde(flatten)] - pub resource: Resource, - pub properties: ModelVersion, - #[serde(rename = "systemData", skip_serializing)] - pub system_data: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ModelVersionResourceArmPaginatedResult { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, - #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] - pub next_link: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum EndpointComputeType { - Managed, - #[serde(rename = "K8S")] - K8s, - #[serde(rename = "AzureMLCompute")] - AzureMlCompute, + pub properties: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tags: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum ScaleType { - Auto, - Manual, +pub struct ProbeSettings { + #[serde(rename = "failureThreshold", default, skip_serializing_if = "Option::is_none")] + pub failure_threshold: Option, + #[serde(rename = "initialDelay", default, skip_serializing_if = "Option::is_none")] + pub initial_delay: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub period: Option, + #[serde(rename = "successThreshold", default, skip_serializing_if = "Option::is_none")] + pub success_threshold: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timeout: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OnlineScaleSettings { - #[serde(rename = "scaleType")] - pub scale_type: ScaleType, - #[serde(rename = "minInstances", default, skip_serializing_if = "Option::is_none")] - pub min_instances: Option, - #[serde(rename = "maxInstances", default, skip_serializing_if = "Option::is_none")] - pub max_instances: Option, +pub struct ProgressMetrics { + #[serde(rename = "completedDatapointCount", skip_serializing)] + pub completed_datapoint_count: Option, + #[serde(rename = "incrementalDatasetLastRefreshTime", skip_serializing)] + pub incremental_dataset_last_refresh_time: Option, + #[serde(rename = "skippedDatapointCount", skip_serializing)] + pub skipped_datapoint_count: Option, + #[serde(rename = "totalDatapointCount", skip_serializing)] + pub total_datapoint_count: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ManualScaleSettings { +pub struct PyTorch { #[serde(flatten)] - pub online_scale_settings: OnlineScaleSettings, - #[serde(rename = "instanceCount", default, skip_serializing_if = "Option::is_none")] - pub instance_count: Option, + pub distribution_configuration: DistributionConfiguration, + #[serde(rename = "processCount", default, skip_serializing_if = "Option::is_none")] + pub process_count: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct AutoScaleSettings { - #[serde(flatten)] - pub online_scale_settings: OnlineScaleSettings, - #[serde(rename = "pollingInterval", default, skip_serializing_if = "Option::is_none")] - pub polling_interval: Option, - #[serde(rename = "targetUtilizationPercentage", default, skip_serializing_if = "Option::is_none")] - pub target_utilization_percentage: Option, +pub enum ReferenceType { + Id, + DataPath, + OutputPath, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OnlineRequestSettings { - #[serde(rename = "maxQueueWait", default, skip_serializing_if = "Option::is_none")] - pub max_queue_wait: Option, - #[serde(rename = "requestTimeout", default, skip_serializing_if = "Option::is_none")] - pub request_timeout: Option, - #[serde(rename = "maxConcurrentRequestsPerInstance", default, skip_serializing_if = "Option::is_none")] - pub max_concurrent_requests_per_instance: Option, +pub struct RegenerateEndpointKeysRequest { + #[serde(rename = "keyType")] + pub key_type: KeyType, + #[serde(rename = "keyValue", default, skip_serializing_if = "Option::is_none")] + pub key_value: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ProbeSettings { - #[serde(rename = "failureThreshold", default, skip_serializing_if = "Option::is_none")] - pub failure_threshold: Option, - #[serde(rename = "successThreshold", default, skip_serializing_if = "Option::is_none")] - pub success_threshold: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub timeout: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub period: Option, - #[serde(rename = "initialDelay", default, skip_serializing_if = "Option::is_none")] - pub initial_delay: Option, +pub struct ResourceIdentity { + #[serde(rename = "principalId", skip_serializing)] + pub principal_id: Option, + #[serde(rename = "tenantId", skip_serializing)] + pub tenant_id: Option, + #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")] + pub type_: Option, + #[serde(rename = "userAssignedIdentities", default, skip_serializing_if = "Option::is_none")] + pub user_assigned_identities: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum DeploymentProvisioningState { - Creating, - Deleting, - Scaling, - Updating, - Succeeded, - Failed, - Canceled, +pub enum ResourceIdentityAssignment { + SystemAssigned, + UserAssigned, + #[serde(rename = "SystemAssigned,UserAssigned")] + SystemAssignedUserAssigned, + None, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OnlineDeployment { - #[serde(rename = "endpointComputeType")] - pub endpoint_compute_type: EndpointComputeType, - #[serde(rename = "scaleSettings", default, skip_serializing_if = "Option::is_none")] - pub scale_settings: Option, - #[serde(rename = "requestSettings", default, skip_serializing_if = "Option::is_none")] - pub request_settings: Option, - #[serde(rename = "appInsightsEnabled", default, skip_serializing_if = "Option::is_none")] - pub app_insights_enabled: Option, - #[serde(rename = "livenessProbe", default, skip_serializing_if = "Option::is_none")] - pub liveness_probe: Option, - #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] - pub provisioning_state: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub model: Option, - #[serde(rename = "codeConfiguration", default, skip_serializing_if = "Option::is_none")] - pub code_configuration: Option, - #[serde(rename = "environmentId", default, skip_serializing_if = "Option::is_none")] - pub environment_id: Option, - #[serde(rename = "environmentVariables", default, skip_serializing_if = "Option::is_none")] - pub environment_variables: Option, +pub struct Route { + pub path: String, + pub port: i32, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct K8sOnlineDeployment { - #[serde(flatten)] - pub online_deployment: OnlineDeployment, - #[serde(rename = "containerResourceRequirements", default, skip_serializing_if = "Option::is_none")] - pub container_resource_requirements: Option, +pub enum SamplingAlgorithm { + Grid, + Random, + Bayesian, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct ManagedOnlineDeployment { +pub struct SasDatastoreCredentials { #[serde(flatten)] - pub online_deployment: OnlineDeployment, - #[serde(rename = "instanceType", default, skip_serializing_if = "Option::is_none")] - pub instance_type: Option, - #[serde(rename = "readinessProbe", default, skip_serializing_if = "Option::is_none")] - pub readiness_probe: Option, + pub datastore_credentials: DatastoreCredentials, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub secrets: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OnlineDeploymentTrackedResource { +pub struct SasDatastoreSecrets { #[serde(flatten)] - pub tracked_resource: TrackedResource, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub kind: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub identity: Option, - pub properties: OnlineDeployment, - #[serde(rename = "systemData", skip_serializing)] - pub system_data: Option, + pub datastore_secrets: DatastoreSecrets, + #[serde(rename = "sasToken", default, skip_serializing_if = "Option::is_none")] + pub sas_token: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OnlineDeploymentTrackedResourceArmPaginatedResult { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, - #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] - pub next_link: Option, +pub enum ScaleType { + Auto, + Manual, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct PartialOnlineDeployment { - #[serde(rename = "endpointComputeType")] - pub endpoint_compute_type: EndpointComputeType, - #[serde(rename = "scaleSettings", default, skip_serializing_if = "Option::is_none")] - pub scale_settings: Option, - #[serde(rename = "requestSettings", default, skip_serializing_if = "Option::is_none")] - pub request_settings: Option, - #[serde(rename = "appInsightsEnabled", default, skip_serializing_if = "Option::is_none")] - pub app_insights_enabled: Option, - #[serde(rename = "livenessProbe", default, skip_serializing_if = "Option::is_none")] - pub liveness_probe: Option, +pub enum SecretsType { + AccountKey, + Certificate, + None, + Sas, + ServicePrincipal, + SqlAdmin, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct PartialAksOnlineDeployment { +pub struct ServicePrincipalDatastoreCredentials { #[serde(flatten)] - pub partial_online_deployment: PartialOnlineDeployment, - #[serde(rename = "containerResourceRequirements", default, skip_serializing_if = "Option::is_none")] - pub container_resource_requirements: Option, + pub datastore_credentials: DatastoreCredentials, + #[serde(rename = "authorityUrl", default, skip_serializing_if = "Option::is_none")] + pub authority_url: Option, + #[serde(rename = "clientId")] + pub client_id: String, + #[serde(rename = "resourceUri", default, skip_serializing_if = "Option::is_none")] + pub resource_uri: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub secrets: Option, + #[serde(rename = "tenantId")] + pub tenant_id: String, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct PartialManagedOnlineDeployment { +pub struct ServicePrincipalDatastoreSecrets { #[serde(flatten)] - pub partial_online_deployment: PartialOnlineDeployment, - #[serde(rename = "readinessProbe", default, skip_serializing_if = "Option::is_none")] - pub readiness_probe: Option, + pub datastore_secrets: DatastoreSecrets, + #[serde(rename = "clientSecret", default, skip_serializing_if = "Option::is_none")] + pub client_secret: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct PartialOnlineDeploymentPartialTrackedResource { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub tags: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub location: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub kind: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub identity: Option, +pub struct SqlAdminDatastoreCredentials { + #[serde(flatten)] + pub datastore_credentials: DatastoreCredentials, #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum ContainerType { - StorageInitializer, - InferenceServer, + pub secrets: Option, + #[serde(rename = "userId")] + pub user_id: String, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DeploymentLogsRequest { - #[serde(rename = "containerType", default, skip_serializing_if = "Option::is_none")] - pub container_type: Option, +pub struct SqlAdminDatastoreSecrets { + #[serde(flatten)] + pub datastore_secrets: DatastoreSecrets, #[serde(default, skip_serializing_if = "Option::is_none")] - pub tail: Option, + pub password: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct DeploymentLogs { +pub struct StatusMessage { + #[serde(skip_serializing)] + pub code: Option, + #[serde(rename = "createdTimeUtc", skip_serializing)] + pub created_time_utc: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub content: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum OrderString { - CreatedAtDesc, - CreatedAtAsc, - UpdatedAtDesc, - UpdatedAtAsc, + pub level: Option, + #[serde(skip_serializing)] + pub message: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum EndpointProvisioningState { - Creating, - Deleting, - Succeeded, - Failed, - Updating, - Canceled, +pub enum StatusMessageLevel { + Error, + Information, + Warning, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OnlineEndpoint { - #[serde(rename = "provisioningState", default, skip_serializing_if = "Option::is_none")] - pub provisioning_state: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub target: Option, +pub struct SweepJob { + #[serde(flatten)] + pub job_base: JobBase, + pub algorithm: SamplingAlgorithm, + pub compute: ComputeConfiguration, + #[serde(rename = "earlyTermination", default, skip_serializing_if = "Option::is_none")] + pub early_termination: Option, + #[serde(rename = "experimentName", default, skip_serializing_if = "Option::is_none")] + pub experiment_name: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub description: Option, + pub identity: Option, + #[serde(rename = "maxConcurrentTrials", default, skip_serializing_if = "Option::is_none")] + pub max_concurrent_trials: Option, + #[serde(rename = "maxTotalTrials", default, skip_serializing_if = "Option::is_none")] + pub max_total_trials: Option, + pub objective: Objective, #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, + pub output: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub traffic: Option, - #[serde(rename = "scoringUri", skip_serializing)] - pub scoring_uri: Option, - #[serde(rename = "swaggerUri", skip_serializing)] - pub swagger_uri: Option, - #[serde(rename = "authMode")] - pub auth_mode: EndpointAuthMode, + pub priority: Option, + #[serde(rename = "searchSpace")] + pub search_space: serde_json::Value, #[serde(default, skip_serializing_if = "Option::is_none")] - pub keys: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OnlineEndpointTrackedResource { - #[serde(flatten)] - pub tracked_resource: TrackedResource, + pub status: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub kind: Option, + pub timeout: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub identity: Option, - pub properties: OnlineEndpoint, - #[serde(rename = "systemData", skip_serializing)] - pub system_data: Option, + pub trial: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct OnlineEndpointTrackedResourceArmPaginatedResult { - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub value: Vec, - #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] - pub next_link: Option, +pub struct TensorFlow { + #[serde(flatten)] + pub distribution_configuration: DistributionConfiguration, + #[serde(rename = "parameterServerCount", default, skip_serializing_if = "Option::is_none")] + pub parameter_server_count: Option, + #[serde(rename = "workerCount", default, skip_serializing_if = "Option::is_none")] + pub worker_count: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct PartialOnlineEndpoint { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub traffic: Option, +pub enum TextAnnotationType { + Classification, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct PartialOnlineEndpointPartialTrackedResource { - #[serde(default, skip_serializing_if = "Option::is_none")] - pub tags: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub location: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub kind: Option, +pub struct TrialComponent { + #[serde(rename = "codeId", default, skip_serializing_if = "Option::is_none")] + pub code_id: Option, + pub command: String, #[serde(default, skip_serializing_if = "Option::is_none")] - pub identity: Option, + pub distribution: Option, + #[serde(rename = "environmentId", default, skip_serializing_if = "Option::is_none")] + pub environment_id: Option, + #[serde(rename = "environmentVariables", default, skip_serializing_if = "Option::is_none")] + pub environment_variables: Option, + #[serde(rename = "inputDataBindings", default, skip_serializing_if = "Option::is_none")] + pub input_data_bindings: Option, + #[serde(rename = "outputDataBindings", default, skip_serializing_if = "Option::is_none")] + pub output_data_bindings: Option, #[serde(default, skip_serializing_if = "Option::is_none")] - pub properties: Option, -} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum KeyType { - Primary, - Secondary, + pub timeout: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct RegenerateEndpointKeysRequest { - #[serde(rename = "keyType")] - pub key_type: KeyType, - #[serde(rename = "keyValue", default, skip_serializing_if = "Option::is_none")] - pub key_value: Option, +pub struct TruncationSelectionPolicy { + #[serde(flatten)] + pub early_termination_policy: EarlyTerminationPolicy, + #[serde(rename = "truncationPercentage", default, skip_serializing_if = "Option::is_none")] + pub truncation_percentage: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -pub struct EndpointAuthToken { - #[serde(rename = "accessToken", default, skip_serializing_if = "Option::is_none")] - pub access_token: Option, - #[serde(rename = "tokenType", default, skip_serializing_if = "Option::is_none")] - pub token_type: Option, - #[serde(rename = "expiryTimeUtc", default, skip_serializing_if = "Option::is_none")] - pub expiry_time_utc: Option, - #[serde(rename = "refreshAfterTimeUtc", default, skip_serializing_if = "Option::is_none")] - pub refresh_after_time_utc: Option, +pub struct UserAssignedIdentityMeta { + #[serde(rename = "clientId", default, skip_serializing_if = "Option::is_none")] + pub client_id: Option, + #[serde(rename = "principalId", default, skip_serializing_if = "Option::is_none")] + pub principal_id: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ServiceResource { diff --git a/services/mgmt/machinelearningservices/src/package_2021_03_01_preview/operations.rs b/services/mgmt/machinelearningservices/src/package_2021_03_01_preview/operations.rs index 91b8614ea6..00891afe8e 100644 --- a/services/mgmt/machinelearningservices/src/package_2021_03_01_preview/operations.rs +++ b/services/mgmt/machinelearningservices/src/package_2021_03_01_preview/operations.rs @@ -2732,18 +2732,102 @@ pub mod workspace_connections { } } } -pub mod batch_deployments { +pub mod batch_endpoints { use crate::models::*; + pub async fn list( + operation_config: &crate::OperationConfig, + count: Option, + skip: Option<&str>, + subscription_id: &str, + resource_group_name: &str, + workspace_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/batchEndpoints", + operation_config.base_path(), + subscription_id, + resource_group_name, + workspace_name + ); + let mut url = url::Url::parse(url_str).map_err(list::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + if let Some(count) = count { + url.query_pairs_mut().append_pair("count", count.to_string().as_str()); + } + if let Some(skip) = skip { + url.query_pairs_mut().append_pair("$skip", skip); + } + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(list::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: BatchEndpointTrackedResourceArmPaginatedResult = + serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = + serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; + Err(list::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod list { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } pub async fn get( operation_config: &crate::OperationConfig, endpoint_name: &str, - deployment_name: &str, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - ) -> std::result::Result { + ) -> std::result::Result { let http_client = operation_config.http_client(); - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/batchEndpoints/{}/deployments/{}" , operation_config . base_path () , subscription_id , resource_group_name , workspace_name , endpoint_name , deployment_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/batchEndpoints/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + workspace_name, + endpoint_name + ); let mut url = url::Url::parse(url_str).map_err(get::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::GET); @@ -2762,7 +2846,7 @@ pub mod batch_deployments { match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: BatchDeploymentTrackedResource = + let rsp_value: BatchEndpointTrackedResource = serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -2803,14 +2887,20 @@ pub mod batch_deployments { pub async fn create_or_update( operation_config: &crate::OperationConfig, endpoint_name: &str, - deployment_name: &str, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - body: &BatchDeploymentTrackedResource, + body: &BatchEndpointTrackedResource, ) -> std::result::Result { let http_client = operation_config.http_client(); - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/batchEndpoints/{}/deployments/{}" , operation_config . base_path () , subscription_id , resource_group_name , workspace_name , endpoint_name , deployment_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/batchEndpoints/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + workspace_name, + endpoint_name + ); let mut url = url::Url::parse(url_str).map_err(create_or_update::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::PUT); @@ -2832,13 +2922,13 @@ pub mod batch_deployments { match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: BatchDeploymentTrackedResource = serde_json::from_slice(rsp_body) + let rsp_value: BatchEndpointTrackedResource = serde_json::from_slice(rsp_body) .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; Ok(create_or_update::Response::Ok200(rsp_value)) } http::StatusCode::CREATED => { let rsp_body = rsp.body(); - let rsp_value: BatchDeploymentTrackedResource = serde_json::from_slice(rsp_body) + let rsp_value: BatchEndpointTrackedResource = serde_json::from_slice(rsp_body) .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; Ok(create_or_update::Response::Created201(rsp_value)) } @@ -2857,8 +2947,8 @@ pub mod batch_deployments { use crate::{models, models::*}; #[derive(Debug)] pub enum Response { - Ok200(BatchDeploymentTrackedResource), - Created201(BatchDeploymentTrackedResource), + Ok200(BatchEndpointTrackedResource), + Created201(BatchEndpointTrackedResource), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -2884,14 +2974,20 @@ pub mod batch_deployments { pub async fn update( operation_config: &crate::OperationConfig, endpoint_name: &str, - deployment_name: &str, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - body: &PartialBatchDeploymentPartialTrackedResource, - ) -> std::result::Result { + body: &PartialBatchEndpointPartialTrackedResource, + ) -> std::result::Result { let http_client = operation_config.http_client(); - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/batchEndpoints/{}/deployments/{}" , operation_config . base_path () , subscription_id , resource_group_name , workspace_name , endpoint_name , deployment_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/batchEndpoints/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + workspace_name, + endpoint_name + ); let mut url = url::Url::parse(url_str).map_err(update::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::PATCH); @@ -2910,7 +3006,7 @@ pub mod batch_deployments { match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: BatchDeploymentTrackedResource = + let rsp_value: BatchEndpointTrackedResource = serde_json::from_slice(rsp_body).map_err(|source| update::Error::DeserializeError(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -2951,13 +3047,19 @@ pub mod batch_deployments { pub async fn delete( operation_config: &crate::OperationConfig, endpoint_name: &str, - deployment_name: &str, subscription_id: &str, resource_group_name: &str, workspace_name: &str, ) -> std::result::Result { let http_client = operation_config.http_client(); - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/batchEndpoints/{}/deployments/{}" , operation_config . base_path () , subscription_id , resource_group_name , workspace_name , endpoint_name , deployment_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/batchEndpoints/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + workspace_name, + endpoint_name + ); let mut url = url::Url::parse(url_str).map_err(delete::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::DELETE); @@ -3015,6 +3117,85 @@ pub mod batch_deployments { GetTokenError(azure_core::Error), } } + pub async fn list_keys( + operation_config: &crate::OperationConfig, + endpoint_name: &str, + subscription_id: &str, + resource_group_name: &str, + workspace_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/batchEndpoints/{}/listkeys", + operation_config.base_path(), + subscription_id, + resource_group_name, + workspace_name, + endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(list_keys::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_keys::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list_keys::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_keys::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: EndpointAuthKeys = + serde_json::from_slice(rsp_body).map_err(|source| list_keys::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = + serde_json::from_slice(rsp_body).map_err(|source| list_keys::Error::DeserializeError(source, rsp_body.clone()))?; + Err(list_keys::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod list_keys { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} +pub mod batch_deployments { + use crate::models::*; pub async fn list( operation_config: &crate::OperationConfig, endpoint_name: &str, @@ -3099,25 +3280,16 @@ pub mod batch_deployments { GetTokenError(azure_core::Error), } } -} -pub mod batch_endpoints { - use crate::models::*; pub async fn get( operation_config: &crate::OperationConfig, endpoint_name: &str, + deployment_name: &str, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - ) -> std::result::Result { + ) -> std::result::Result { let http_client = operation_config.http_client(); - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/batchEndpoints/{}", - operation_config.base_path(), - subscription_id, - resource_group_name, - workspace_name, - endpoint_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/batchEndpoints/{}/deployments/{}" , operation_config . base_path () , subscription_id , resource_group_name , workspace_name , endpoint_name , deployment_name) ; let mut url = url::Url::parse(url_str).map_err(get::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::GET); @@ -3136,7 +3308,7 @@ pub mod batch_endpoints { match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: BatchEndpointTrackedResource = + let rsp_value: BatchDeploymentTrackedResource = serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -3177,20 +3349,14 @@ pub mod batch_endpoints { pub async fn create_or_update( operation_config: &crate::OperationConfig, endpoint_name: &str, + deployment_name: &str, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - body: &BatchEndpointTrackedResource, + body: &BatchDeploymentTrackedResource, ) -> std::result::Result { let http_client = operation_config.http_client(); - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/batchEndpoints/{}", - operation_config.base_path(), - subscription_id, - resource_group_name, - workspace_name, - endpoint_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/batchEndpoints/{}/deployments/{}" , operation_config . base_path () , subscription_id , resource_group_name , workspace_name , endpoint_name , deployment_name) ; let mut url = url::Url::parse(url_str).map_err(create_or_update::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::PUT); @@ -3212,13 +3378,13 @@ pub mod batch_endpoints { match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: BatchEndpointTrackedResource = serde_json::from_slice(rsp_body) + let rsp_value: BatchDeploymentTrackedResource = serde_json::from_slice(rsp_body) .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; Ok(create_or_update::Response::Ok200(rsp_value)) } http::StatusCode::CREATED => { let rsp_body = rsp.body(); - let rsp_value: BatchEndpointTrackedResource = serde_json::from_slice(rsp_body) + let rsp_value: BatchDeploymentTrackedResource = serde_json::from_slice(rsp_body) .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; Ok(create_or_update::Response::Created201(rsp_value)) } @@ -3237,8 +3403,8 @@ pub mod batch_endpoints { use crate::{models, models::*}; #[derive(Debug)] pub enum Response { - Ok200(BatchEndpointTrackedResource), - Created201(BatchEndpointTrackedResource), + Ok200(BatchDeploymentTrackedResource), + Created201(BatchDeploymentTrackedResource), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -3264,20 +3430,14 @@ pub mod batch_endpoints { pub async fn update( operation_config: &crate::OperationConfig, endpoint_name: &str, + deployment_name: &str, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - body: &PartialBatchEndpointPartialTrackedResource, - ) -> std::result::Result { + body: &PartialBatchDeploymentPartialTrackedResource, + ) -> std::result::Result { let http_client = operation_config.http_client(); - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/batchEndpoints/{}", - operation_config.base_path(), - subscription_id, - resource_group_name, - workspace_name, - endpoint_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/batchEndpoints/{}/deployments/{}" , operation_config . base_path () , subscription_id , resource_group_name , workspace_name , endpoint_name , deployment_name) ; let mut url = url::Url::parse(url_str).map_err(update::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::PATCH); @@ -3296,7 +3456,7 @@ pub mod batch_endpoints { match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: BatchEndpointTrackedResource = + let rsp_value: BatchDeploymentTrackedResource = serde_json::from_slice(rsp_body).map_err(|source| update::Error::DeserializeError(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -3337,19 +3497,13 @@ pub mod batch_endpoints { pub async fn delete( operation_config: &crate::OperationConfig, endpoint_name: &str, + deployment_name: &str, subscription_id: &str, resource_group_name: &str, workspace_name: &str, ) -> std::result::Result { let http_client = operation_config.http_client(); - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/batchEndpoints/{}", - operation_config.base_path(), - subscription_id, - resource_group_name, - workspace_name, - endpoint_name - ); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/batchEndpoints/{}/deployments/{}" , operation_config . base_path () , subscription_id , resource_group_name , workspace_name , endpoint_name , deployment_name) ; let mut url = url::Url::parse(url_str).map_err(delete::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::DELETE); @@ -3407,17 +3561,19 @@ pub mod batch_endpoints { GetTokenError(azure_core::Error), } } +} +pub mod code_containers { + use crate::models::*; pub async fn list( operation_config: &crate::OperationConfig, - count: Option, skip: Option<&str>, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - ) -> std::result::Result { + ) -> std::result::Result { let http_client = operation_config.http_client(); let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/batchEndpoints", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/codes", operation_config.base_path(), subscription_id, resource_group_name, @@ -3434,9 +3590,6 @@ pub mod batch_endpoints { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); } url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); - if let Some(count) = count { - url.query_pairs_mut().append_pair("count", count.to_string().as_str()); - } if let Some(skip) = skip { url.query_pairs_mut().append_pair("$skip", skip); } @@ -3447,7 +3600,7 @@ pub mod batch_endpoints { match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: BatchEndpointTrackedResourceArmPaginatedResult = + let rsp_value: CodeContainerResourceArmPaginatedResult = serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -3485,85 +3638,6 @@ pub mod batch_endpoints { GetTokenError(azure_core::Error), } } - pub async fn list_keys( - operation_config: &crate::OperationConfig, - endpoint_name: &str, - subscription_id: &str, - resource_group_name: &str, - workspace_name: &str, - ) -> std::result::Result { - let http_client = operation_config.http_client(); - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/batchEndpoints/{}/listkeys", - operation_config.base_path(), - subscription_id, - resource_group_name, - workspace_name, - endpoint_name - ); - let mut url = url::Url::parse(url_str).map_err(list_keys::Error::ParseUrlError)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - if let Some(token_credential) = operation_config.token_credential() { - let token_response = token_credential - .get_token(operation_config.token_credential_resource()) - .await - .map_err(list_keys::Error::GetTokenError)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - } - url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); - let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(list_keys::Error::BuildRequestError)?; - let rsp = http_client - .execute_request(req) - .await - .map_err(list_keys::Error::ExecuteRequestError)?; - match rsp.status() { - http::StatusCode::OK => { - let rsp_body = rsp.body(); - let rsp_value: EndpointAuthKeys = - serde_json::from_slice(rsp_body).map_err(|source| list_keys::Error::DeserializeError(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = rsp.body(); - let rsp_value: ErrorResponse = - serde_json::from_slice(rsp_body).map_err(|source| list_keys::Error::DeserializeError(source, rsp_body.clone()))?; - Err(list_keys::Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - } - pub mod list_keys { - use crate::{models, models::*}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::ErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrlError(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequestError(http::Error), - #[error("Failed to execute request: {0}")] - ExecuteRequestError(azure_core::HttpError), - #[error("Failed to serialize request body: {0}")] - SerializeError(serde_json::Error), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - DeserializeError(serde_json::Error, bytes::Bytes), - #[error("Failed to get access token: {0}")] - GetTokenError(azure_core::Error), - } - } -} -pub mod code_containers { - use crate::models::*; pub async fn get( operation_config: &crate::OperationConfig, name: &str, @@ -3796,20 +3870,27 @@ pub mod code_containers { GetTokenError(azure_core::Error), } } +} +pub mod code_versions { + use crate::models::*; pub async fn list( operation_config: &crate::OperationConfig, + name: &str, + order_by: Option<&str>, + top: Option, skip: Option<&str>, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - ) -> std::result::Result { + ) -> std::result::Result { let http_client = operation_config.http_client(); let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/codes", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/codes/{}/versions", operation_config.base_path(), subscription_id, resource_group_name, - workspace_name + workspace_name, + name ); let mut url = url::Url::parse(url_str).map_err(list::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); @@ -3822,6 +3903,12 @@ pub mod code_containers { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); } url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + if let Some(order_by) = order_by { + url.query_pairs_mut().append_pair("$orderBy", order_by); + } + if let Some(top) = top { + url.query_pairs_mut().append_pair("$top", top.to_string().as_str()); + } if let Some(skip) = skip { url.query_pairs_mut().append_pair("$skip", skip); } @@ -3832,7 +3919,7 @@ pub mod code_containers { match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: CodeContainerResourceArmPaginatedResult = + let rsp_value: CodeVersionResourceArmPaginatedResult = serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -3870,9 +3957,6 @@ pub mod code_containers { GetTokenError(azure_core::Error), } } -} -pub mod code_versions { - use crate::models::*; pub async fn get( operation_config: &crate::OperationConfig, name: &str, @@ -4111,24 +4195,23 @@ pub mod code_versions { GetTokenError(azure_core::Error), } } +} +pub mod data_containers { + use crate::models::*; pub async fn list( operation_config: &crate::OperationConfig, - name: &str, - order_by: Option<&str>, - top: Option, skip: Option<&str>, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - ) -> std::result::Result { + ) -> std::result::Result { let http_client = operation_config.http_client(); let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/codes/{}/versions", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/data", operation_config.base_path(), subscription_id, resource_group_name, - workspace_name, - name + workspace_name ); let mut url = url::Url::parse(url_str).map_err(list::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); @@ -4141,12 +4224,6 @@ pub mod code_versions { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); } url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); - if let Some(order_by) = order_by { - url.query_pairs_mut().append_pair("$orderBy", order_by); - } - if let Some(top) = top { - url.query_pairs_mut().append_pair("$top", top.to_string().as_str()); - } if let Some(skip) = skip { url.query_pairs_mut().append_pair("$skip", skip); } @@ -4157,7 +4234,7 @@ pub mod code_versions { match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: CodeVersionResourceArmPaginatedResult = + let rsp_value: DataContainerResourceArmPaginatedResult = serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -4195,9 +4272,6 @@ pub mod code_versions { GetTokenError(azure_core::Error), } } -} -pub mod data_containers { - use crate::models::*; pub async fn get( operation_config: &crate::OperationConfig, name: &str, @@ -4430,20 +4504,28 @@ pub mod data_containers { GetTokenError(azure_core::Error), } } +} +pub mod data_versions { + use crate::models::*; pub async fn list( operation_config: &crate::OperationConfig, + name: &str, + order_by: Option<&str>, + top: Option, skip: Option<&str>, + tags: Option<&str>, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - ) -> std::result::Result { + ) -> std::result::Result { let http_client = operation_config.http_client(); let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/data", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/data/{}/versions", operation_config.base_path(), subscription_id, resource_group_name, - workspace_name + workspace_name, + name ); let mut url = url::Url::parse(url_str).map_err(list::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); @@ -4456,9 +4538,18 @@ pub mod data_containers { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); } url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + if let Some(order_by) = order_by { + url.query_pairs_mut().append_pair("$orderBy", order_by); + } + if let Some(top) = top { + url.query_pairs_mut().append_pair("$top", top.to_string().as_str()); + } if let Some(skip) = skip { url.query_pairs_mut().append_pair("$skip", skip); } + if let Some(tags) = tags { + url.query_pairs_mut().append_pair("$tags", tags); + } let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(list::Error::BuildRequestError)?; @@ -4466,7 +4557,7 @@ pub mod data_containers { match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: DataContainerResourceArmPaginatedResult = + let rsp_value: DataVersionResourceArmPaginatedResult = serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -4504,82 +4595,58 @@ pub mod data_containers { GetTokenError(azure_core::Error), } } -} -pub mod datastores { - use crate::models::*; - pub async fn list( + pub async fn get( operation_config: &crate::OperationConfig, - skip: Option<&str>, - count: Option, - is_default: Option, - names: &Vec<&str>, - search_text: Option<&str>, - order_by: Option<&str>, - order_by_asc: Option, + name: &str, + version: &str, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - ) -> std::result::Result { + ) -> std::result::Result { let http_client = operation_config.http_client(); let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/datastores", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/data/{}/versions/{}", operation_config.base_path(), subscription_id, resource_group_name, - workspace_name + workspace_name, + name, + version ); - let mut url = url::Url::parse(url_str).map_err(list::Error::ParseUrlError)?; + let mut url = url::Url::parse(url_str).map_err(get::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::GET); if let Some(token_credential) = operation_config.token_credential() { let token_response = token_credential .get_token(operation_config.token_credential_resource()) .await - .map_err(list::Error::GetTokenError)?; + .map_err(get::Error::GetTokenError)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); } url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); - if let Some(skip) = skip { - url.query_pairs_mut().append_pair("$skip", skip); - } - if let Some(count) = count { - url.query_pairs_mut().append_pair("count", count.to_string().as_str()); - } - if let Some(is_default) = is_default { - url.query_pairs_mut().append_pair("isDefault", is_default.to_string().as_str()); - } - if let Some(search_text) = search_text { - url.query_pairs_mut().append_pair("searchText", search_text); - } - if let Some(order_by) = order_by { - url.query_pairs_mut().append_pair("orderBy", order_by); - } - if let Some(order_by_asc) = order_by_asc { - url.query_pairs_mut().append_pair("orderByAsc", order_by_asc.to_string().as_str()); - } let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(list::Error::BuildRequestError)?; - let rsp = http_client.execute_request(req).await.map_err(list::Error::ExecuteRequestError)?; + let req = req_builder.body(req_body).map_err(get::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(get::Error::ExecuteRequestError)?; match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: DatastorePropertiesResourceArmPaginatedResult = - serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; + let rsp_value: DataVersionResource = + serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; Ok(rsp_value) } status_code => { let rsp_body = rsp.body(); let rsp_value: ErrorResponse = - serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; - Err(list::Error::DefaultResponse { + serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; + Err(get::Error::DefaultResponse { status_code, value: rsp_value, }) } } } - pub mod list { + pub mod get { use crate::{models, models::*}; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -4602,95 +4669,24 @@ pub mod datastores { GetTokenError(azure_core::Error), } } - pub async fn get( + pub async fn create_or_update( operation_config: &crate::OperationConfig, name: &str, + version: &str, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - ) -> std::result::Result { + body: &DataVersionResource, + ) -> std::result::Result { let http_client = operation_config.http_client(); let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/datastores/{}", - operation_config.base_path(), - subscription_id, - resource_group_name, - workspace_name, - name - ); - let mut url = url::Url::parse(url_str).map_err(get::Error::ParseUrlError)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); - if let Some(token_credential) = operation_config.token_credential() { - let token_response = token_credential - .get_token(operation_config.token_credential_resource()) - .await - .map_err(get::Error::GetTokenError)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - } - url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); - let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(get::Error::BuildRequestError)?; - let rsp = http_client.execute_request(req).await.map_err(get::Error::ExecuteRequestError)?; - match rsp.status() { - http::StatusCode::OK => { - let rsp_body = rsp.body(); - let rsp_value: DatastorePropertiesResource = - serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = rsp.body(); - let rsp_value: ErrorResponse = - serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; - Err(get::Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - } - pub mod get { - use crate::{models, models::*}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::ErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrlError(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequestError(http::Error), - #[error("Failed to execute request: {0}")] - ExecuteRequestError(azure_core::HttpError), - #[error("Failed to serialize request body: {0}")] - SerializeError(serde_json::Error), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - DeserializeError(serde_json::Error, bytes::Bytes), - #[error("Failed to get access token: {0}")] - GetTokenError(azure_core::Error), - } - } - pub async fn create_or_update( - operation_config: &crate::OperationConfig, - name: &str, - skip_validation: Option, - subscription_id: &str, - resource_group_name: &str, - workspace_name: &str, - body: &DatastorePropertiesResource, - ) -> std::result::Result { - let http_client = operation_config.http_client(); - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/datastores/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/data/{}/versions/{}", operation_config.base_path(), subscription_id, resource_group_name, workspace_name, - name + name, + version ); let mut url = url::Url::parse(url_str).map_err(create_or_update::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); @@ -4703,10 +4699,6 @@ pub mod datastores { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); } url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); - if let Some(skip_validation) = skip_validation { - url.query_pairs_mut() - .append_pair("skipValidation", skip_validation.to_string().as_str()); - } let req_body = azure_core::to_json(body).map_err(create_or_update::Error::SerializeError)?; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(create_or_update::Error::BuildRequestError)?; @@ -4717,13 +4709,13 @@ pub mod datastores { match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: DatastorePropertiesResource = serde_json::from_slice(rsp_body) + let rsp_value: DataVersionResource = serde_json::from_slice(rsp_body) .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; Ok(create_or_update::Response::Ok200(rsp_value)) } http::StatusCode::CREATED => { let rsp_body = rsp.body(); - let rsp_value: DatastorePropertiesResource = serde_json::from_slice(rsp_body) + let rsp_value: DataVersionResource = serde_json::from_slice(rsp_body) .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; Ok(create_or_update::Response::Created201(rsp_value)) } @@ -4742,8 +4734,8 @@ pub mod datastores { use crate::{models, models::*}; #[derive(Debug)] pub enum Response { - Ok200(DatastorePropertiesResource), - Created201(DatastorePropertiesResource), + Ok200(DataVersionResource), + Created201(DataVersionResource), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -4769,18 +4761,20 @@ pub mod datastores { pub async fn delete( operation_config: &crate::OperationConfig, name: &str, + version: &str, subscription_id: &str, resource_group_name: &str, workspace_name: &str, ) -> std::result::Result { let http_client = operation_config.http_client(); let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/datastores/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/data/{}/versions/{}", operation_config.base_path(), subscription_id, resource_group_name, workspace_name, - name + name, + version ); let mut url = url::Url::parse(url_str).map_err(delete::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); @@ -4839,104 +4833,29 @@ pub mod datastores { GetTokenError(azure_core::Error), } } - pub async fn list_secrets( - operation_config: &crate::OperationConfig, - name: &str, - subscription_id: &str, - resource_group_name: &str, - workspace_name: &str, - ) -> std::result::Result { - let http_client = operation_config.http_client(); - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/datastores/{}/listSecrets", - operation_config.base_path(), - subscription_id, - resource_group_name, - workspace_name, - name - ); - let mut url = url::Url::parse(url_str).map_err(list_secrets::Error::ParseUrlError)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - if let Some(token_credential) = operation_config.token_credential() { - let token_response = token_credential - .get_token(operation_config.token_credential_resource()) - .await - .map_err(list_secrets::Error::GetTokenError)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - } - url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); - let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(list_secrets::Error::BuildRequestError)?; - let rsp = http_client - .execute_request(req) - .await - .map_err(list_secrets::Error::ExecuteRequestError)?; - match rsp.status() { - http::StatusCode::OK => { - let rsp_body = rsp.body(); - let rsp_value: DatastoreSecrets = - serde_json::from_slice(rsp_body).map_err(|source| list_secrets::Error::DeserializeError(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { - let rsp_body = rsp.body(); - let rsp_value: ErrorResponse = - serde_json::from_slice(rsp_body).map_err(|source| list_secrets::Error::DeserializeError(source, rsp_body.clone()))?; - Err(list_secrets::Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - } - pub mod list_secrets { - use crate::{models, models::*}; - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::ErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrlError(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequestError(http::Error), - #[error("Failed to execute request: {0}")] - ExecuteRequestError(azure_core::HttpError), - #[error("Failed to serialize request body: {0}")] - SerializeError(serde_json::Error), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - DeserializeError(serde_json::Error, bytes::Bytes), - #[error("Failed to get access token: {0}")] - GetTokenError(azure_core::Error), - } - } } -pub mod data_versions { +pub mod datastores { use crate::models::*; pub async fn list( operation_config: &crate::OperationConfig, - name: &str, - order_by: Option<&str>, - top: Option, skip: Option<&str>, - tags: Option<&str>, + count: Option, + is_default: Option, + names: &Vec<&str>, + search_text: Option<&str>, + order_by: Option<&str>, + order_by_asc: Option, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - ) -> std::result::Result { + ) -> std::result::Result { let http_client = operation_config.http_client(); let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/data/{}/versions", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/datastores", operation_config.base_path(), subscription_id, resource_group_name, - workspace_name, - name + workspace_name ); let mut url = url::Url::parse(url_str).map_err(list::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); @@ -4949,17 +4868,23 @@ pub mod data_versions { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); } url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); - if let Some(order_by) = order_by { - url.query_pairs_mut().append_pair("$orderBy", order_by); - } - if let Some(top) = top { - url.query_pairs_mut().append_pair("$top", top.to_string().as_str()); - } if let Some(skip) = skip { url.query_pairs_mut().append_pair("$skip", skip); } - if let Some(tags) = tags { - url.query_pairs_mut().append_pair("$tags", tags); + if let Some(count) = count { + url.query_pairs_mut().append_pair("count", count.to_string().as_str()); + } + if let Some(is_default) = is_default { + url.query_pairs_mut().append_pair("isDefault", is_default.to_string().as_str()); + } + if let Some(search_text) = search_text { + url.query_pairs_mut().append_pair("searchText", search_text); + } + if let Some(order_by) = order_by { + url.query_pairs_mut().append_pair("orderBy", order_by); + } + if let Some(order_by_asc) = order_by_asc { + url.query_pairs_mut().append_pair("orderByAsc", order_by_asc.to_string().as_str()); } let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); req_builder = req_builder.uri(url.as_str()); @@ -4968,7 +4893,7 @@ pub mod data_versions { match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: DataVersionResourceArmPaginatedResult = + let rsp_value: DatastorePropertiesResourceArmPaginatedResult = serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -5009,20 +4934,18 @@ pub mod data_versions { pub async fn get( operation_config: &crate::OperationConfig, name: &str, - version: &str, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - ) -> std::result::Result { + ) -> std::result::Result { let http_client = operation_config.http_client(); let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/data/{}/versions/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/datastores/{}", operation_config.base_path(), subscription_id, resource_group_name, workspace_name, - name, - version + name ); let mut url = url::Url::parse(url_str).map_err(get::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); @@ -5042,7 +4965,7 @@ pub mod data_versions { match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: DataVersionResource = + let rsp_value: DatastorePropertiesResource = serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -5083,21 +5006,20 @@ pub mod data_versions { pub async fn create_or_update( operation_config: &crate::OperationConfig, name: &str, - version: &str, + skip_validation: Option, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - body: &DataVersionResource, + body: &DatastorePropertiesResource, ) -> std::result::Result { let http_client = operation_config.http_client(); let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/data/{}/versions/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/datastores/{}", operation_config.base_path(), subscription_id, resource_group_name, workspace_name, - name, - version + name ); let mut url = url::Url::parse(url_str).map_err(create_or_update::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); @@ -5110,6 +5032,10 @@ pub mod data_versions { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); } url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + if let Some(skip_validation) = skip_validation { + url.query_pairs_mut() + .append_pair("skipValidation", skip_validation.to_string().as_str()); + } let req_body = azure_core::to_json(body).map_err(create_or_update::Error::SerializeError)?; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(create_or_update::Error::BuildRequestError)?; @@ -5120,13 +5046,13 @@ pub mod data_versions { match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: DataVersionResource = serde_json::from_slice(rsp_body) + let rsp_value: DatastorePropertiesResource = serde_json::from_slice(rsp_body) .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; Ok(create_or_update::Response::Ok200(rsp_value)) } http::StatusCode::CREATED => { let rsp_body = rsp.body(); - let rsp_value: DataVersionResource = serde_json::from_slice(rsp_body) + let rsp_value: DatastorePropertiesResource = serde_json::from_slice(rsp_body) .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; Ok(create_or_update::Response::Created201(rsp_value)) } @@ -5145,8 +5071,8 @@ pub mod data_versions { use crate::{models, models::*}; #[derive(Debug)] pub enum Response { - Ok200(DataVersionResource), - Created201(DataVersionResource), + Ok200(DatastorePropertiesResource), + Created201(DatastorePropertiesResource), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -5172,20 +5098,18 @@ pub mod data_versions { pub async fn delete( operation_config: &crate::OperationConfig, name: &str, - version: &str, subscription_id: &str, resource_group_name: &str, workspace_name: &str, ) -> std::result::Result { let http_client = operation_config.http_client(); let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/data/{}/versions/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/datastores/{}", operation_config.base_path(), subscription_id, resource_group_name, workspace_name, - name, - version + name ); let mut url = url::Url::parse(url_str).map_err(delete::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); @@ -5244,10 +5168,160 @@ pub mod data_versions { GetTokenError(azure_core::Error), } } -} -pub mod environment_containers { - use crate::models::*; - pub async fn get( + pub async fn list_secrets( + operation_config: &crate::OperationConfig, + name: &str, + subscription_id: &str, + resource_group_name: &str, + workspace_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/datastores/{}/listSecrets", + operation_config.base_path(), + subscription_id, + resource_group_name, + workspace_name, + name + ); + let mut url = url::Url::parse(url_str).map_err(list_secrets::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_secrets::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list_secrets::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_secrets::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: DatastoreSecrets = + serde_json::from_slice(rsp_body).map_err(|source| list_secrets::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = + serde_json::from_slice(rsp_body).map_err(|source| list_secrets::Error::DeserializeError(source, rsp_body.clone()))?; + Err(list_secrets::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod list_secrets { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} +pub mod environment_containers { + use crate::models::*; + pub async fn list( + operation_config: &crate::OperationConfig, + skip: Option<&str>, + subscription_id: &str, + resource_group_name: &str, + workspace_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/environments", + operation_config.base_path(), + subscription_id, + resource_group_name, + workspace_name + ); + let mut url = url::Url::parse(url_str).map_err(list::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + if let Some(skip) = skip { + url.query_pairs_mut().append_pair("$skip", skip); + } + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(list::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: EnvironmentContainerResourceArmPaginatedResult = + serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = + serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; + Err(list::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod list { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get( operation_config: &crate::OperationConfig, name: &str, subscription_id: &str, @@ -5479,20 +5553,27 @@ pub mod environment_containers { GetTokenError(azure_core::Error), } } +} +pub mod environment_specification_versions { + use crate::models::*; pub async fn list( operation_config: &crate::OperationConfig, + name: &str, + order_by: Option<&str>, + top: Option, skip: Option<&str>, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - ) -> std::result::Result { + ) -> std::result::Result { let http_client = operation_config.http_client(); let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/environments", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/environments/{}/versions", operation_config.base_path(), subscription_id, resource_group_name, - workspace_name + workspace_name, + name ); let mut url = url::Url::parse(url_str).map_err(list::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); @@ -5505,6 +5586,12 @@ pub mod environment_containers { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); } url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + if let Some(order_by) = order_by { + url.query_pairs_mut().append_pair("$orderBy", order_by); + } + if let Some(top) = top { + url.query_pairs_mut().append_pair("$top", top.to_string().as_str()); + } if let Some(skip) = skip { url.query_pairs_mut().append_pair("$skip", skip); } @@ -5515,7 +5602,7 @@ pub mod environment_containers { match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: EnvironmentContainerResourceArmPaginatedResult = + let rsp_value: EnvironmentSpecificationVersionResourceArmPaginatedResult = serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -5553,9 +5640,6 @@ pub mod environment_containers { GetTokenError(azure_core::Error), } } -} -pub mod environment_specification_versions { - use crate::models::*; pub async fn get( operation_config: &crate::OperationConfig, name: &str, @@ -5794,24 +5878,26 @@ pub mod environment_specification_versions { GetTokenError(azure_core::Error), } } +} +pub mod jobs { + use crate::models::*; pub async fn list( operation_config: &crate::OperationConfig, - name: &str, - order_by: Option<&str>, - top: Option, skip: Option<&str>, + job_type: Option<&str>, + tags: Option<&str>, + tag: Option<&str>, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - ) -> std::result::Result { + ) -> std::result::Result { let http_client = operation_config.http_client(); let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/environments/{}/versions", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/jobs", operation_config.base_path(), subscription_id, resource_group_name, - workspace_name, - name + workspace_name ); let mut url = url::Url::parse(url_str).map_err(list::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); @@ -5824,15 +5910,18 @@ pub mod environment_specification_versions { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); } url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); - if let Some(order_by) = order_by { - url.query_pairs_mut().append_pair("$orderBy", order_by); - } - if let Some(top) = top { - url.query_pairs_mut().append_pair("$top", top.to_string().as_str()); - } if let Some(skip) = skip { url.query_pairs_mut().append_pair("$skip", skip); } + if let Some(job_type) = job_type { + url.query_pairs_mut().append_pair("jobType", job_type); + } + if let Some(tags) = tags { + url.query_pairs_mut().append_pair("tags", tags); + } + if let Some(tag) = tag { + url.query_pairs_mut().append_pair("tag", tag); + } let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(list::Error::BuildRequestError)?; @@ -5840,7 +5929,7 @@ pub mod environment_specification_versions { match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: EnvironmentSpecificationVersionResourceArmPaginatedResult = + let rsp_value: JobBaseResourceArmPaginatedResult = serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -5878,9 +5967,6 @@ pub mod environment_specification_versions { GetTokenError(azure_core::Error), } } -} -pub mod jobs { - use crate::models::*; pub async fn get( operation_config: &crate::OperationConfig, id: &str, @@ -6115,70 +6201,52 @@ pub mod jobs { GetTokenError(azure_core::Error), } } - pub async fn list( + pub async fn cancel( operation_config: &crate::OperationConfig, - skip: Option<&str>, - job_type: Option<&str>, - tags: Option<&str>, - tag: Option<&str>, + id: &str, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - ) -> std::result::Result { + ) -> std::result::Result<(), cancel::Error> { let http_client = operation_config.http_client(); let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/jobs", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/jobs/{}/cancel", operation_config.base_path(), subscription_id, resource_group_name, - workspace_name + workspace_name, + id ); - let mut url = url::Url::parse(url_str).map_err(list::Error::ParseUrlError)?; + let mut url = url::Url::parse(url_str).map_err(cancel::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::POST); if let Some(token_credential) = operation_config.token_credential() { let token_response = token_credential .get_token(operation_config.token_credential_resource()) .await - .map_err(list::Error::GetTokenError)?; + .map_err(cancel::Error::GetTokenError)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); } url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); - if let Some(skip) = skip { - url.query_pairs_mut().append_pair("$skip", skip); - } - if let Some(job_type) = job_type { - url.query_pairs_mut().append_pair("jobType", job_type); - } - if let Some(tags) = tags { - url.query_pairs_mut().append_pair("tags", tags); - } - if let Some(tag) = tag { - url.query_pairs_mut().append_pair("tag", tag); - } let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(list::Error::BuildRequestError)?; - let rsp = http_client.execute_request(req).await.map_err(list::Error::ExecuteRequestError)?; + let req = req_builder.body(req_body).map_err(cancel::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(cancel::Error::ExecuteRequestError)?; match rsp.status() { - http::StatusCode::OK => { - let rsp_body = rsp.body(); - let rsp_value: JobBaseResourceArmPaginatedResult = - serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; - Ok(rsp_value) - } - status_code => { + http::StatusCode::OK => Ok(()), + status_code => { let rsp_body = rsp.body(); let rsp_value: ErrorResponse = - serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; - Err(list::Error::DefaultResponse { + serde_json::from_slice(rsp_body).map_err(|source| cancel::Error::DeserializeError(source, rsp_body.clone()))?; + Err(cancel::Error::DefaultResponse { status_code, value: rsp_value, }) } } } - pub mod list { + pub mod cancel { use crate::{models, models::*}; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -6201,52 +6269,65 @@ pub mod jobs { GetTokenError(azure_core::Error), } } - pub async fn cancel( +} +pub mod labeling_jobs { + use crate::models::*; + pub async fn list( operation_config: &crate::OperationConfig, - id: &str, + skip: Option<&str>, + count: Option, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - ) -> std::result::Result<(), cancel::Error> { + ) -> std::result::Result { let http_client = operation_config.http_client(); let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/jobs/{}/cancel", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/labelingJobs", operation_config.base_path(), subscription_id, resource_group_name, - workspace_name, - id + workspace_name ); - let mut url = url::Url::parse(url_str).map_err(cancel::Error::ParseUrlError)?; + let mut url = url::Url::parse(url_str).map_err(list::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); + req_builder = req_builder.method(http::Method::GET); if let Some(token_credential) = operation_config.token_credential() { let token_response = token_credential .get_token(operation_config.token_credential_resource()) .await - .map_err(cancel::Error::GetTokenError)?; + .map_err(list::Error::GetTokenError)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); } url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + if let Some(skip) = skip { + url.query_pairs_mut().append_pair("$skip", skip); + } + if let Some(count) = count { + url.query_pairs_mut().append_pair("count", count.to_string().as_str()); + } let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(cancel::Error::BuildRequestError)?; - let rsp = http_client.execute_request(req).await.map_err(cancel::Error::ExecuteRequestError)?; + let req = req_builder.body(req_body).map_err(list::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(list::Error::ExecuteRequestError)?; match rsp.status() { - http::StatusCode::OK => Ok(()), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: LabelingJobResourceArmPaginatedResult = + serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } status_code => { let rsp_body = rsp.body(); let rsp_value: ErrorResponse = - serde_json::from_slice(rsp_body).map_err(|source| cancel::Error::DeserializeError(source, rsp_body.clone()))?; - Err(cancel::Error::DefaultResponse { + serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; + Err(list::Error::DefaultResponse { status_code, value: rsp_value, }) } } } - pub mod cancel { + pub mod list { use crate::{models, models::*}; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -6269,9 +6350,6 @@ pub mod jobs { GetTokenError(azure_core::Error), } } -} -pub mod labeling_jobs { - use crate::models::*; pub async fn get( operation_config: &crate::OperationConfig, id: &str, @@ -6514,63 +6592,67 @@ pub mod labeling_jobs { GetTokenError(azure_core::Error), } } - pub async fn list( + pub async fn export_labels( operation_config: &crate::OperationConfig, - skip: Option<&str>, - count: Option, + id: &str, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - ) -> std::result::Result { + body: &ExportSummary, + ) -> std::result::Result { let http_client = operation_config.http_client(); let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/labelingJobs", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/labelingJobs/{}/exportLabels", operation_config.base_path(), subscription_id, resource_group_name, - workspace_name + workspace_name, + id ); - let mut url = url::Url::parse(url_str).map_err(list::Error::ParseUrlError)?; + let mut url = url::Url::parse(url_str).map_err(export_labels::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::POST); if let Some(token_credential) = operation_config.token_credential() { let token_response = token_credential .get_token(operation_config.token_credential_resource()) .await - .map_err(list::Error::GetTokenError)?; + .map_err(export_labels::Error::GetTokenError)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); } url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); - if let Some(skip) = skip { - url.query_pairs_mut().append_pair("$skip", skip); - } - if let Some(count) = count { - url.query_pairs_mut().append_pair("count", count.to_string().as_str()); - } - let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + let req_body = azure_core::to_json(body).map_err(export_labels::Error::SerializeError)?; req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(list::Error::BuildRequestError)?; - let rsp = http_client.execute_request(req).await.map_err(list::Error::ExecuteRequestError)?; + let req = req_builder.body(req_body).map_err(export_labels::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(export_labels::Error::ExecuteRequestError)?; match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: LabelingJobResourceArmPaginatedResult = - serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; - Ok(rsp_value) + let rsp_value: ExportSummary = + serde_json::from_slice(rsp_body).map_err(|source| export_labels::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(export_labels::Response::Ok200(rsp_value)) } + http::StatusCode::ACCEPTED => Ok(export_labels::Response::Accepted202), status_code => { let rsp_body = rsp.body(); let rsp_value: ErrorResponse = - serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; - Err(list::Error::DefaultResponse { + serde_json::from_slice(rsp_body).map_err(|source| export_labels::Error::DeserializeError(source, rsp_body.clone()))?; + Err(export_labels::Error::DefaultResponse { status_code, value: rsp_value, }) } } } - pub mod list { + pub mod export_labels { use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Ok200(ExportSummary), + Accepted202, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -6734,88 +6816,6 @@ pub mod labeling_jobs { GetTokenError(azure_core::Error), } } - pub async fn export_labels( - operation_config: &crate::OperationConfig, - id: &str, - subscription_id: &str, - resource_group_name: &str, - workspace_name: &str, - body: &ExportSummary, - ) -> std::result::Result { - let http_client = operation_config.http_client(); - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/labelingJobs/{}/exportLabels", - operation_config.base_path(), - subscription_id, - resource_group_name, - workspace_name, - id - ); - let mut url = url::Url::parse(url_str).map_err(export_labels::Error::ParseUrlError)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); - if let Some(token_credential) = operation_config.token_credential() { - let token_response = token_credential - .get_token(operation_config.token_credential_resource()) - .await - .map_err(export_labels::Error::GetTokenError)?; - req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); - } - url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); - let req_body = azure_core::to_json(body).map_err(export_labels::Error::SerializeError)?; - req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(export_labels::Error::BuildRequestError)?; - let rsp = http_client - .execute_request(req) - .await - .map_err(export_labels::Error::ExecuteRequestError)?; - match rsp.status() { - http::StatusCode::OK => { - let rsp_body = rsp.body(); - let rsp_value: ExportSummary = - serde_json::from_slice(rsp_body).map_err(|source| export_labels::Error::DeserializeError(source, rsp_body.clone()))?; - Ok(export_labels::Response::Ok200(rsp_value)) - } - http::StatusCode::ACCEPTED => Ok(export_labels::Response::Accepted202), - status_code => { - let rsp_body = rsp.body(); - let rsp_value: ErrorResponse = - serde_json::from_slice(rsp_body).map_err(|source| export_labels::Error::DeserializeError(source, rsp_body.clone()))?; - Err(export_labels::Error::DefaultResponse { - status_code, - value: rsp_value, - }) - } - } - } - pub mod export_labels { - use crate::{models, models::*}; - #[derive(Debug)] - pub enum Response { - Ok200(ExportSummary), - Accepted202, - } - #[derive(Debug, thiserror :: Error)] - pub enum Error { - #[error("HTTP status code {}", status_code)] - DefaultResponse { - status_code: http::StatusCode, - value: models::ErrorResponse, - }, - #[error("Failed to parse request URL: {0}")] - ParseUrlError(url::ParseError), - #[error("Failed to build request: {0}")] - BuildRequestError(http::Error), - #[error("Failed to execute request: {0}")] - ExecuteRequestError(azure_core::HttpError), - #[error("Failed to serialize request body: {0}")] - SerializeError(serde_json::Error), - #[error("Failed to deserialize response: {0}, body: {1:?}")] - DeserializeError(serde_json::Error, bytes::Bytes), - #[error("Failed to get access token: {0}")] - GetTokenError(azure_core::Error), - } - } } pub mod model_containers { use crate::models::*; @@ -7475,20 +7475,29 @@ pub mod model_versions { } } } -pub mod online_deployments { +pub mod online_endpoints { use crate::models::*; pub async fn list( operation_config: &crate::OperationConfig, - endpoint_name: &str, - order_by: Option<&str>, - top: Option, + name: Option<&str>, + count: Option, + compute_type: Option<&str>, skip: Option<&str>, + tags: Option<&str>, + properties: Option<&str>, + order_by: Option<&str>, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - ) -> std::result::Result { + ) -> std::result::Result { let http_client = operation_config.http_client(); - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/onlineEndpoints/{}/deployments" , operation_config . base_path () , subscription_id , resource_group_name , workspace_name , endpoint_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/onlineEndpoints", + operation_config.base_path(), + subscription_id, + resource_group_name, + workspace_name + ); let mut url = url::Url::parse(url_str).map_err(list::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::GET); @@ -7500,15 +7509,27 @@ pub mod online_deployments { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); } url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); - if let Some(order_by) = order_by { - url.query_pairs_mut().append_pair("$orderBy", order_by); + if let Some(name) = name { + url.query_pairs_mut().append_pair("name", name); } - if let Some(top) = top { - url.query_pairs_mut().append_pair("$top", top.to_string().as_str()); + if let Some(count) = count { + url.query_pairs_mut().append_pair("count", count.to_string().as_str()); + } + if let Some(compute_type) = compute_type { + url.query_pairs_mut().append_pair("computeType", compute_type); } if let Some(skip) = skip { url.query_pairs_mut().append_pair("$skip", skip); } + if let Some(tags) = tags { + url.query_pairs_mut().append_pair("tags", tags); + } + if let Some(properties) = properties { + url.query_pairs_mut().append_pair("properties", properties); + } + if let Some(order_by) = order_by { + url.query_pairs_mut().append_pair("orderBy", order_by); + } let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(list::Error::BuildRequestError)?; @@ -7516,7 +7537,7 @@ pub mod online_deployments { match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: OnlineDeploymentTrackedResourceArmPaginatedResult = + let rsp_value: OnlineEndpointTrackedResourceArmPaginatedResult = serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -7557,13 +7578,19 @@ pub mod online_deployments { pub async fn get( operation_config: &crate::OperationConfig, endpoint_name: &str, - deployment_name: &str, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - ) -> std::result::Result { + ) -> std::result::Result { let http_client = operation_config.http_client(); - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/onlineEndpoints/{}/deployments/{}" , operation_config . base_path () , subscription_id , resource_group_name , workspace_name , endpoint_name , deployment_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/onlineEndpoints/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + workspace_name, + endpoint_name + ); let mut url = url::Url::parse(url_str).map_err(get::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::GET); @@ -7582,7 +7609,7 @@ pub mod online_deployments { match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: OnlineDeploymentTrackedResource = + let rsp_value: OnlineEndpointTrackedResource = serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -7623,17 +7650,23 @@ pub mod online_deployments { pub async fn create_or_update( operation_config: &crate::OperationConfig, endpoint_name: &str, - deployment_name: &str, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - body: &OnlineDeploymentTrackedResource, + body: &OnlineEndpointTrackedResource, ) -> std::result::Result { let http_client = operation_config.http_client(); - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/onlineEndpoints/{}/deployments/{}" , operation_config . base_path () , subscription_id , resource_group_name , workspace_name , endpoint_name , deployment_name) ; - let mut url = url::Url::parse(url_str).map_err(create_or_update::Error::ParseUrlError)?; - let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PUT); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/onlineEndpoints/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + workspace_name, + endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(create_or_update::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); if let Some(token_credential) = operation_config.token_credential() { let token_response = token_credential .get_token(operation_config.token_credential_resource()) @@ -7652,13 +7685,13 @@ pub mod online_deployments { match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: OnlineDeploymentTrackedResource = serde_json::from_slice(rsp_body) + let rsp_value: OnlineEndpointTrackedResource = serde_json::from_slice(rsp_body) .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; Ok(create_or_update::Response::Ok200(rsp_value)) } http::StatusCode::CREATED => { let rsp_body = rsp.body(); - let rsp_value: OnlineDeploymentTrackedResource = serde_json::from_slice(rsp_body) + let rsp_value: OnlineEndpointTrackedResource = serde_json::from_slice(rsp_body) .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; Ok(create_or_update::Response::Created201(rsp_value)) } @@ -7677,8 +7710,8 @@ pub mod online_deployments { use crate::{models, models::*}; #[derive(Debug)] pub enum Response { - Ok200(OnlineDeploymentTrackedResource), - Created201(OnlineDeploymentTrackedResource), + Ok200(OnlineEndpointTrackedResource), + Created201(OnlineEndpointTrackedResource), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7704,14 +7737,20 @@ pub mod online_deployments { pub async fn update( operation_config: &crate::OperationConfig, endpoint_name: &str, - deployment_name: &str, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - body: &PartialOnlineDeploymentPartialTrackedResource, + body: &PartialOnlineEndpointPartialTrackedResource, ) -> std::result::Result { let http_client = operation_config.http_client(); - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/onlineEndpoints/{}/deployments/{}" , operation_config . base_path () , subscription_id , resource_group_name , workspace_name , endpoint_name , deployment_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/onlineEndpoints/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + workspace_name, + endpoint_name + ); let mut url = url::Url::parse(url_str).map_err(update::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::PATCH); @@ -7730,7 +7769,7 @@ pub mod online_deployments { match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: OnlineDeploymentTrackedResource = + let rsp_value: OnlineEndpointTrackedResource = serde_json::from_slice(rsp_body).map_err(|source| update::Error::DeserializeError(source, rsp_body.clone()))?; Ok(update::Response::Ok200(rsp_value)) } @@ -7750,7 +7789,7 @@ pub mod online_deployments { use crate::{models, models::*}; #[derive(Debug)] pub enum Response { - Ok200(OnlineDeploymentTrackedResource), + Ok200(OnlineEndpointTrackedResource), Accepted202, } #[derive(Debug, thiserror :: Error)] @@ -7777,13 +7816,19 @@ pub mod online_deployments { pub async fn delete( operation_config: &crate::OperationConfig, endpoint_name: &str, - deployment_name: &str, subscription_id: &str, resource_group_name: &str, workspace_name: &str, ) -> std::result::Result { let http_client = operation_config.http_client(); - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/onlineEndpoints/{}/deployments/{}" , operation_config . base_path () , subscription_id , resource_group_name , workspace_name , endpoint_name , deployment_name) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/onlineEndpoints/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + workspace_name, + endpoint_name + ); let mut url = url::Url::parse(url_str).map_err(delete::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::DELETE); @@ -7800,9 +7845,9 @@ pub mod online_deployments { let req = req_builder.body(req_body).map_err(delete::Error::BuildRequestError)?; let rsp = http_client.execute_request(req).await.map_err(delete::Error::ExecuteRequestError)?; match rsp.status() { - http::StatusCode::OK => Ok(delete::Response::Ok200), http::StatusCode::NO_CONTENT => Ok(delete::Response::NoContent204), http::StatusCode::ACCEPTED => Ok(delete::Response::Accepted202), + http::StatusCode::OK => Ok(delete::Response::Ok200), status_code => { let rsp_body = rsp.body(); let rsp_value: ErrorResponse = @@ -7818,9 +7863,9 @@ pub mod online_deployments { use crate::{models, models::*}; #[derive(Debug)] pub enum Response { - Ok200, NoContent204, Accepted202, + Ok200, } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7843,54 +7888,60 @@ pub mod online_deployments { GetTokenError(azure_core::Error), } } - pub async fn get_logs( + pub async fn list_keys( operation_config: &crate::OperationConfig, endpoint_name: &str, - deployment_name: &str, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - body: &DeploymentLogsRequest, - ) -> std::result::Result { + ) -> std::result::Result { let http_client = operation_config.http_client(); - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/onlineEndpoints/{}/deployments/{}/getLogs" , operation_config . base_path () , subscription_id , resource_group_name , workspace_name , endpoint_name , deployment_name) ; - let mut url = url::Url::parse(url_str).map_err(get_logs::Error::ParseUrlError)?; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/onlineEndpoints/{}/listKeys", + operation_config.base_path(), + subscription_id, + resource_group_name, + workspace_name, + endpoint_name + ); + let mut url = url::Url::parse(url_str).map_err(list_keys::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::POST); if let Some(token_credential) = operation_config.token_credential() { let token_response = token_credential .get_token(operation_config.token_credential_resource()) .await - .map_err(get_logs::Error::GetTokenError)?; + .map_err(list_keys::Error::GetTokenError)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); } url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); - let req_body = azure_core::to_json(body).map_err(get_logs::Error::SerializeError)?; + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(get_logs::Error::BuildRequestError)?; + let req = req_builder.body(req_body).map_err(list_keys::Error::BuildRequestError)?; let rsp = http_client .execute_request(req) .await - .map_err(get_logs::Error::ExecuteRequestError)?; + .map_err(list_keys::Error::ExecuteRequestError)?; match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: DeploymentLogs = - serde_json::from_slice(rsp_body).map_err(|source| get_logs::Error::DeserializeError(source, rsp_body.clone()))?; + let rsp_value: EndpointAuthKeys = + serde_json::from_slice(rsp_body).map_err(|source| list_keys::Error::DeserializeError(source, rsp_body.clone()))?; Ok(rsp_value) } status_code => { let rsp_body = rsp.body(); let rsp_value: ErrorResponse = - serde_json::from_slice(rsp_body).map_err(|source| get_logs::Error::DeserializeError(source, rsp_body.clone()))?; - Err(get_logs::Error::DefaultResponse { + serde_json::from_slice(rsp_body).map_err(|source| list_keys::Error::DeserializeError(source, rsp_body.clone()))?; + Err(list_keys::Error::DefaultResponse { status_code, value: rsp_value, }) } } } - pub mod get_logs { + pub mod list_keys { use crate::{models, models::*}; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -7913,86 +7964,55 @@ pub mod online_deployments { GetTokenError(azure_core::Error), } } -} -pub mod online_endpoints { - use crate::models::*; - pub async fn list( + pub async fn regenerate_keys( operation_config: &crate::OperationConfig, - name: Option<&str>, - count: Option, - compute_type: Option<&str>, - skip: Option<&str>, - tags: Option<&str>, - properties: Option<&str>, - order_by: Option<&str>, + endpoint_name: &str, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - ) -> std::result::Result { + body: &RegenerateEndpointKeysRequest, + ) -> std::result::Result { let http_client = operation_config.http_client(); - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/onlineEndpoints", - operation_config.base_path(), - subscription_id, - resource_group_name, - workspace_name - ); - let mut url = url::Url::parse(url_str).map_err(list::Error::ParseUrlError)?; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/onlineEndpoints/{}/regenerateKeys" , operation_config . base_path () , subscription_id , resource_group_name , workspace_name , endpoint_name) ; + let mut url = url::Url::parse(url_str).map_err(regenerate_keys::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::POST); if let Some(token_credential) = operation_config.token_credential() { let token_response = token_credential .get_token(operation_config.token_credential_resource()) .await - .map_err(list::Error::GetTokenError)?; + .map_err(regenerate_keys::Error::GetTokenError)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); } url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); - if let Some(name) = name { - url.query_pairs_mut().append_pair("name", name); - } - if let Some(count) = count { - url.query_pairs_mut().append_pair("count", count.to_string().as_str()); - } - if let Some(compute_type) = compute_type { - url.query_pairs_mut().append_pair("computeType", compute_type); - } - if let Some(skip) = skip { - url.query_pairs_mut().append_pair("$skip", skip); - } - if let Some(tags) = tags { - url.query_pairs_mut().append_pair("tags", tags); - } - if let Some(properties) = properties { - url.query_pairs_mut().append_pair("properties", properties); - } - if let Some(order_by) = order_by { - url.query_pairs_mut().append_pair("orderBy", order_by); - } - let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + let req_body = azure_core::to_json(body).map_err(regenerate_keys::Error::SerializeError)?; req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(list::Error::BuildRequestError)?; - let rsp = http_client.execute_request(req).await.map_err(list::Error::ExecuteRequestError)?; + let req = req_builder.body(req_body).map_err(regenerate_keys::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(regenerate_keys::Error::ExecuteRequestError)?; match rsp.status() { - http::StatusCode::OK => { - let rsp_body = rsp.body(); - let rsp_value: OnlineEndpointTrackedResourceArmPaginatedResult = - serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; - Ok(rsp_value) - } + http::StatusCode::OK => Ok(regenerate_keys::Response::Ok200), + http::StatusCode::ACCEPTED => Ok(regenerate_keys::Response::Accepted202), status_code => { let rsp_body = rsp.body(); - let rsp_value: ErrorResponse = - serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; - Err(list::Error::DefaultResponse { + let rsp_value: ErrorResponse = serde_json::from_slice(rsp_body) + .map_err(|source| regenerate_keys::Error::DeserializeError(source, rsp_body.clone()))?; + Err(regenerate_keys::Error::DefaultResponse { status_code, value: rsp_value, }) } } } - pub mod list { + pub mod regenerate_keys { use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Ok200, + Accepted202, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8014,56 +8034,60 @@ pub mod online_endpoints { GetTokenError(azure_core::Error), } } - pub async fn get( + pub async fn get_token( operation_config: &crate::OperationConfig, endpoint_name: &str, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - ) -> std::result::Result { + ) -> std::result::Result { let http_client = operation_config.http_client(); let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/onlineEndpoints/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/onlineEndpoints/{}/token", operation_config.base_path(), subscription_id, resource_group_name, workspace_name, endpoint_name ); - let mut url = url::Url::parse(url_str).map_err(get::Error::ParseUrlError)?; + let mut url = url::Url::parse(url_str).map_err(get_token::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::GET); + req_builder = req_builder.method(http::Method::POST); if let Some(token_credential) = operation_config.token_credential() { let token_response = token_credential .get_token(operation_config.token_credential_resource()) .await - .map_err(get::Error::GetTokenError)?; + .map_err(get_token::Error::GetTokenError)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); } url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(get::Error::BuildRequestError)?; - let rsp = http_client.execute_request(req).await.map_err(get::Error::ExecuteRequestError)?; + let req = req_builder.body(req_body).map_err(get_token::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_token::Error::ExecuteRequestError)?; match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: OnlineEndpointTrackedResource = - serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; + let rsp_value: EndpointAuthToken = + serde_json::from_slice(rsp_body).map_err(|source| get_token::Error::DeserializeError(source, rsp_body.clone()))?; Ok(rsp_value) } status_code => { let rsp_body = rsp.body(); let rsp_value: ErrorResponse = - serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; - Err(get::Error::DefaultResponse { + serde_json::from_slice(rsp_body).map_err(|source| get_token::Error::DeserializeError(source, rsp_body.clone()))?; + Err(get_token::Error::DefaultResponse { status_code, value: rsp_value, }) } } } - pub mod get { + pub mod get_token { use crate::{models, models::*}; #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8086,72 +8110,65 @@ pub mod online_endpoints { GetTokenError(azure_core::Error), } } - pub async fn create_or_update( +} +pub mod online_deployments { + use crate::models::*; + pub async fn list( operation_config: &crate::OperationConfig, endpoint_name: &str, + order_by: Option<&str>, + top: Option, + skip: Option<&str>, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - body: &OnlineEndpointTrackedResource, - ) -> std::result::Result { + ) -> std::result::Result { let http_client = operation_config.http_client(); - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/onlineEndpoints/{}", - operation_config.base_path(), - subscription_id, - resource_group_name, - workspace_name, - endpoint_name - ); - let mut url = url::Url::parse(url_str).map_err(create_or_update::Error::ParseUrlError)?; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/onlineEndpoints/{}/deployments" , operation_config . base_path () , subscription_id , resource_group_name , workspace_name , endpoint_name) ; + let mut url = url::Url::parse(url_str).map_err(list::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PUT); + req_builder = req_builder.method(http::Method::GET); if let Some(token_credential) = operation_config.token_credential() { let token_response = token_credential .get_token(operation_config.token_credential_resource()) .await - .map_err(create_or_update::Error::GetTokenError)?; + .map_err(list::Error::GetTokenError)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); } url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); - let req_body = azure_core::to_json(body).map_err(create_or_update::Error::SerializeError)?; + if let Some(order_by) = order_by { + url.query_pairs_mut().append_pair("$orderBy", order_by); + } + if let Some(top) = top { + url.query_pairs_mut().append_pair("$top", top.to_string().as_str()); + } + if let Some(skip) = skip { + url.query_pairs_mut().append_pair("$skip", skip); + } + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(create_or_update::Error::BuildRequestError)?; - let rsp = http_client - .execute_request(req) - .await - .map_err(create_or_update::Error::ExecuteRequestError)?; + let req = req_builder.body(req_body).map_err(list::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(list::Error::ExecuteRequestError)?; match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: OnlineEndpointTrackedResource = serde_json::from_slice(rsp_body) - .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; - Ok(create_or_update::Response::Ok200(rsp_value)) - } - http::StatusCode::CREATED => { - let rsp_body = rsp.body(); - let rsp_value: OnlineEndpointTrackedResource = serde_json::from_slice(rsp_body) - .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; - Ok(create_or_update::Response::Created201(rsp_value)) + let rsp_value: OnlineDeploymentTrackedResourceArmPaginatedResult = + serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) } status_code => { let rsp_body = rsp.body(); - let rsp_value: ErrorResponse = serde_json::from_slice(rsp_body) - .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; - Err(create_or_update::Error::DefaultResponse { + let rsp_value: ErrorResponse = + serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; + Err(list::Error::DefaultResponse { status_code, value: rsp_value, }) } } } - pub mod create_or_update { + pub mod list { use crate::{models, models::*}; - #[derive(Debug)] - pub enum Response { - Ok200(OnlineEndpointTrackedResource), - Created201(OnlineEndpointTrackedResource), - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8173,64 +8190,51 @@ pub mod online_endpoints { GetTokenError(azure_core::Error), } } - pub async fn update( + pub async fn get( operation_config: &crate::OperationConfig, endpoint_name: &str, + deployment_name: &str, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - body: &PartialOnlineEndpointPartialTrackedResource, - ) -> std::result::Result { + ) -> std::result::Result { let http_client = operation_config.http_client(); - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/onlineEndpoints/{}", - operation_config.base_path(), - subscription_id, - resource_group_name, - workspace_name, - endpoint_name - ); - let mut url = url::Url::parse(url_str).map_err(update::Error::ParseUrlError)?; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/onlineEndpoints/{}/deployments/{}" , operation_config . base_path () , subscription_id , resource_group_name , workspace_name , endpoint_name , deployment_name) ; + let mut url = url::Url::parse(url_str).map_err(get::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::PATCH); + req_builder = req_builder.method(http::Method::GET); if let Some(token_credential) = operation_config.token_credential() { let token_response = token_credential .get_token(operation_config.token_credential_resource()) .await - .map_err(update::Error::GetTokenError)?; + .map_err(get::Error::GetTokenError)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); } url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); - let req_body = azure_core::to_json(body).map_err(update::Error::SerializeError)?; + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(update::Error::BuildRequestError)?; - let rsp = http_client.execute_request(req).await.map_err(update::Error::ExecuteRequestError)?; + let req = req_builder.body(req_body).map_err(get::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(get::Error::ExecuteRequestError)?; match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: OnlineEndpointTrackedResource = - serde_json::from_slice(rsp_body).map_err(|source| update::Error::DeserializeError(source, rsp_body.clone()))?; - Ok(update::Response::Ok200(rsp_value)) + let rsp_value: OnlineDeploymentTrackedResource = + serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) } - http::StatusCode::ACCEPTED => Ok(update::Response::Accepted202), status_code => { let rsp_body = rsp.body(); let rsp_value: ErrorResponse = - serde_json::from_slice(rsp_body).map_err(|source| update::Error::DeserializeError(source, rsp_body.clone()))?; - Err(update::Error::DefaultResponse { + serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; + Err(get::Error::DefaultResponse { status_code, value: rsp_value, }) } } } - pub mod update { + pub mod get { use crate::{models, models::*}; - #[derive(Debug)] - pub enum Response { - Ok200(OnlineEndpointTrackedResource), - Accepted202, - } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8252,59 +8256,65 @@ pub mod online_endpoints { GetTokenError(azure_core::Error), } } - pub async fn delete( + pub async fn create_or_update( operation_config: &crate::OperationConfig, endpoint_name: &str, + deployment_name: &str, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - ) -> std::result::Result { + body: &OnlineDeploymentTrackedResource, + ) -> std::result::Result { let http_client = operation_config.http_client(); - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/onlineEndpoints/{}", - operation_config.base_path(), - subscription_id, - resource_group_name, - workspace_name, - endpoint_name - ); - let mut url = url::Url::parse(url_str).map_err(delete::Error::ParseUrlError)?; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/onlineEndpoints/{}/deployments/{}" , operation_config . base_path () , subscription_id , resource_group_name , workspace_name , endpoint_name , deployment_name) ; + let mut url = url::Url::parse(url_str).map_err(create_or_update::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::DELETE); + req_builder = req_builder.method(http::Method::PUT); if let Some(token_credential) = operation_config.token_credential() { let token_response = token_credential .get_token(operation_config.token_credential_resource()) .await - .map_err(delete::Error::GetTokenError)?; + .map_err(create_or_update::Error::GetTokenError)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); } url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); - let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + let req_body = azure_core::to_json(body).map_err(create_or_update::Error::SerializeError)?; req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(delete::Error::BuildRequestError)?; - let rsp = http_client.execute_request(req).await.map_err(delete::Error::ExecuteRequestError)?; + let req = req_builder.body(req_body).map_err(create_or_update::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(create_or_update::Error::ExecuteRequestError)?; match rsp.status() { - http::StatusCode::NO_CONTENT => Ok(delete::Response::NoContent204), - http::StatusCode::ACCEPTED => Ok(delete::Response::Accepted202), - http::StatusCode::OK => Ok(delete::Response::Ok200), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: OnlineDeploymentTrackedResource = serde_json::from_slice(rsp_body) + .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(create_or_update::Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = rsp.body(); + let rsp_value: OnlineDeploymentTrackedResource = serde_json::from_slice(rsp_body) + .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(create_or_update::Response::Created201(rsp_value)) + } status_code => { let rsp_body = rsp.body(); - let rsp_value: ErrorResponse = - serde_json::from_slice(rsp_body).map_err(|source| delete::Error::DeserializeError(source, rsp_body.clone()))?; - Err(delete::Error::DefaultResponse { + let rsp_value: ErrorResponse = serde_json::from_slice(rsp_body) + .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; + Err(create_or_update::Error::DefaultResponse { status_code, value: rsp_value, }) } } } - pub mod delete { + pub mod create_or_update { use crate::{models, models::*}; #[derive(Debug)] pub enum Response { - NoContent204, - Accepted202, - Ok200, + Ok200(OnlineDeploymentTrackedResource), + Created201(OnlineDeploymentTrackedResource), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -8327,53 +8337,56 @@ pub mod online_endpoints { GetTokenError(azure_core::Error), } } - pub async fn regenerate_keys( + pub async fn update( operation_config: &crate::OperationConfig, endpoint_name: &str, + deployment_name: &str, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - body: &RegenerateEndpointKeysRequest, - ) -> std::result::Result { + body: &PartialOnlineDeploymentPartialTrackedResource, + ) -> std::result::Result { let http_client = operation_config.http_client(); - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/onlineEndpoints/{}/regenerateKeys" , operation_config . base_path () , subscription_id , resource_group_name , workspace_name , endpoint_name) ; - let mut url = url::Url::parse(url_str).map_err(regenerate_keys::Error::ParseUrlError)?; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/onlineEndpoints/{}/deployments/{}" , operation_config . base_path () , subscription_id , resource_group_name , workspace_name , endpoint_name , deployment_name) ; + let mut url = url::Url::parse(url_str).map_err(update::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); + req_builder = req_builder.method(http::Method::PATCH); if let Some(token_credential) = operation_config.token_credential() { let token_response = token_credential .get_token(operation_config.token_credential_resource()) .await - .map_err(regenerate_keys::Error::GetTokenError)?; + .map_err(update::Error::GetTokenError)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); } url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); - let req_body = azure_core::to_json(body).map_err(regenerate_keys::Error::SerializeError)?; + let req_body = azure_core::to_json(body).map_err(update::Error::SerializeError)?; req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(regenerate_keys::Error::BuildRequestError)?; - let rsp = http_client - .execute_request(req) - .await - .map_err(regenerate_keys::Error::ExecuteRequestError)?; + let req = req_builder.body(req_body).map_err(update::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(update::Error::ExecuteRequestError)?; match rsp.status() { - http::StatusCode::OK => Ok(regenerate_keys::Response::Ok200), - http::StatusCode::ACCEPTED => Ok(regenerate_keys::Response::Accepted202), + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: OnlineDeploymentTrackedResource = + serde_json::from_slice(rsp_body).map_err(|source| update::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(update::Response::Ok200(rsp_value)) + } + http::StatusCode::ACCEPTED => Ok(update::Response::Accepted202), status_code => { let rsp_body = rsp.body(); - let rsp_value: ErrorResponse = serde_json::from_slice(rsp_body) - .map_err(|source| regenerate_keys::Error::DeserializeError(source, rsp_body.clone()))?; - Err(regenerate_keys::Error::DefaultResponse { + let rsp_value: ErrorResponse = + serde_json::from_slice(rsp_body).map_err(|source| update::Error::DeserializeError(source, rsp_body.clone()))?; + Err(update::Error::DefaultResponse { status_code, value: rsp_value, }) } } } - pub mod regenerate_keys { + pub mod update { use crate::{models, models::*}; #[derive(Debug)] pub enum Response { - Ok200, + Ok200(OnlineDeploymentTrackedResource), Accepted202, } #[derive(Debug, thiserror :: Error)] @@ -8397,61 +8410,54 @@ pub mod online_endpoints { GetTokenError(azure_core::Error), } } - pub async fn list_keys( + pub async fn delete( operation_config: &crate::OperationConfig, endpoint_name: &str, + deployment_name: &str, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - ) -> std::result::Result { + ) -> std::result::Result { let http_client = operation_config.http_client(); - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/onlineEndpoints/{}/listKeys", - operation_config.base_path(), - subscription_id, - resource_group_name, - workspace_name, - endpoint_name - ); - let mut url = url::Url::parse(url_str).map_err(list_keys::Error::ParseUrlError)?; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/onlineEndpoints/{}/deployments/{}" , operation_config . base_path () , subscription_id , resource_group_name , workspace_name , endpoint_name , deployment_name) ; + let mut url = url::Url::parse(url_str).map_err(delete::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); - req_builder = req_builder.method(http::Method::POST); + req_builder = req_builder.method(http::Method::DELETE); if let Some(token_credential) = operation_config.token_credential() { let token_response = token_credential .get_token(operation_config.token_credential_resource()) .await - .map_err(list_keys::Error::GetTokenError)?; + .map_err(delete::Error::GetTokenError)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); } url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(list_keys::Error::BuildRequestError)?; - let rsp = http_client - .execute_request(req) - .await - .map_err(list_keys::Error::ExecuteRequestError)?; + let req = req_builder.body(req_body).map_err(delete::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(delete::Error::ExecuteRequestError)?; match rsp.status() { - http::StatusCode::OK => { - let rsp_body = rsp.body(); - let rsp_value: EndpointAuthKeys = - serde_json::from_slice(rsp_body).map_err(|source| list_keys::Error::DeserializeError(source, rsp_body.clone()))?; - Ok(rsp_value) - } + http::StatusCode::OK => Ok(delete::Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(delete::Response::NoContent204), + http::StatusCode::ACCEPTED => Ok(delete::Response::Accepted202), status_code => { let rsp_body = rsp.body(); let rsp_value: ErrorResponse = - serde_json::from_slice(rsp_body).map_err(|source| list_keys::Error::DeserializeError(source, rsp_body.clone()))?; - Err(list_keys::Error::DefaultResponse { + serde_json::from_slice(rsp_body).map_err(|source| delete::Error::DeserializeError(source, rsp_body.clone()))?; + Err(delete::Error::DefaultResponse { status_code, value: rsp_value, }) } } } - pub mod list_keys { + pub mod delete { use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + Accepted202, + } #[derive(Debug, thiserror :: Error)] pub enum Error { #[error("HTTP status code {}", status_code)] @@ -8473,60 +8479,54 @@ pub mod online_endpoints { GetTokenError(azure_core::Error), } } - pub async fn get_token( + pub async fn get_logs( operation_config: &crate::OperationConfig, endpoint_name: &str, + deployment_name: &str, subscription_id: &str, resource_group_name: &str, workspace_name: &str, - ) -> std::result::Result { + body: &DeploymentLogsRequest, + ) -> std::result::Result { let http_client = operation_config.http_client(); - let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/onlineEndpoints/{}/token", - operation_config.base_path(), - subscription_id, - resource_group_name, - workspace_name, - endpoint_name - ); - let mut url = url::Url::parse(url_str).map_err(get_token::Error::ParseUrlError)?; + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.MachineLearningServices/workspaces/{}/onlineEndpoints/{}/deployments/{}/getLogs" , operation_config . base_path () , subscription_id , resource_group_name , workspace_name , endpoint_name , deployment_name) ; + let mut url = url::Url::parse(url_str).map_err(get_logs::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::POST); if let Some(token_credential) = operation_config.token_credential() { let token_response = token_credential .get_token(operation_config.token_credential_resource()) .await - .map_err(get_token::Error::GetTokenError)?; + .map_err(get_logs::Error::GetTokenError)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); } url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); - let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); - req_builder = req_builder.header(http::header::CONTENT_LENGTH, 0); + let req_body = azure_core::to_json(body).map_err(get_logs::Error::SerializeError)?; req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(get_token::Error::BuildRequestError)?; + let req = req_builder.body(req_body).map_err(get_logs::Error::BuildRequestError)?; let rsp = http_client .execute_request(req) .await - .map_err(get_token::Error::ExecuteRequestError)?; + .map_err(get_logs::Error::ExecuteRequestError)?; match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: EndpointAuthToken = - serde_json::from_slice(rsp_body).map_err(|source| get_token::Error::DeserializeError(source, rsp_body.clone()))?; + let rsp_value: DeploymentLogs = + serde_json::from_slice(rsp_body).map_err(|source| get_logs::Error::DeserializeError(source, rsp_body.clone()))?; Ok(rsp_value) } status_code => { let rsp_body = rsp.body(); let rsp_value: ErrorResponse = - serde_json::from_slice(rsp_body).map_err(|source| get_token::Error::DeserializeError(source, rsp_body.clone()))?; - Err(get_token::Error::DefaultResponse { + serde_json::from_slice(rsp_body).map_err(|source| get_logs::Error::DeserializeError(source, rsp_body.clone()))?; + Err(get_logs::Error::DefaultResponse { status_code, value: rsp_value, }) } } } - pub mod get_token { + pub mod get_logs { use crate::{models, models::*}; #[derive(Debug, thiserror :: Error)] pub enum Error { diff --git a/services/mgmt/maintenance/src/lib.rs b/services/mgmt/maintenance/src/lib.rs index 749eabed57..33692eadf6 100644 --- a/services/mgmt/maintenance/src/lib.rs +++ b/services/mgmt/maintenance/src/lib.rs @@ -21,7 +21,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-06-preview")] pub use package_2018_06_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -34,7 +34,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -53,7 +53,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -63,7 +63,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/managednetwork/src/lib.rs b/services/mgmt/managednetwork/src/lib.rs index 6689ea10b9..3de1f9c5ca 100644 --- a/services/mgmt/managednetwork/src/lib.rs +++ b/services/mgmt/managednetwork/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2019-06-01-preview")] pub use package_2019_06_01_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/managedservices/src/lib.rs b/services/mgmt/managedservices/src/lib.rs index 3700d2416f..9fbf1c7716 100644 --- a/services/mgmt/managedservices/src/lib.rs +++ b/services/mgmt/managedservices/src/lib.rs @@ -21,7 +21,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-06-preview")] pub use package_2018_06_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -34,7 +34,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -53,7 +53,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -63,7 +63,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/managementgroups/src/lib.rs b/services/mgmt/managementgroups/src/lib.rs index 41f90f9bfc..a23200823f 100644 --- a/services/mgmt/managementgroups/src/lib.rs +++ b/services/mgmt/managementgroups/src/lib.rs @@ -37,7 +37,7 @@ use azure_core::setters; #[cfg(feature = "package-2017-08")] pub use package_2017_08::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -50,7 +50,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -69,7 +69,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -79,7 +79,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/managementpartner/src/lib.rs b/services/mgmt/managementpartner/src/lib.rs index 43a978c55c..105108aa6c 100644 --- a/services/mgmt/managementpartner/src/lib.rs +++ b/services/mgmt/managementpartner/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-02")] pub use package_2018_02::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/maps/src/lib.rs b/services/mgmt/maps/src/lib.rs index 4a7d755db6..00c1d5168f 100644 --- a/services/mgmt/maps/src/lib.rs +++ b/services/mgmt/maps/src/lib.rs @@ -21,7 +21,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-05")] pub use package_2018_05::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -34,7 +34,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -53,7 +53,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -63,7 +63,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/mariadb/src/lib.rs b/services/mgmt/mariadb/src/lib.rs index 89f69d569c..a7ed9f5c04 100644 --- a/services/mgmt/mariadb/src/lib.rs +++ b/services/mgmt/mariadb/src/lib.rs @@ -21,7 +21,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-01-01")] pub use package_2020_01_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -34,7 +34,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -53,7 +53,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -63,7 +63,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/marketplace/src/lib.rs b/services/mgmt/marketplace/src/lib.rs index e355fa81a3..60b92f24de 100644 --- a/services/mgmt/marketplace/src/lib.rs +++ b/services/mgmt/marketplace/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-01-01")] pub use package_2020_01_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/marketplacenotifications/Cargo.toml b/services/mgmt/marketplacenotifications/Cargo.toml new file mode 100644 index 0000000000..af540b5e35 --- /dev/null +++ b/services/mgmt/marketplacenotifications/Cargo.toml @@ -0,0 +1,24 @@ +# generated by AutoRust 0.1.0 +[package] +name = "azure_mgmt_marketplacenotifications" +version = "0.1.0" +edition = "2018" + +[dependencies] +azure_core = { path = "../../../sdk/core", version = "0.1.0" } +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +reqwest = { version = "0.11", features = ["json"] } +bytes = "1.0" +thiserror = "1.0" +http = "0.2" +url = "2.2" + +[dev-dependencies] +azure_identity = { path = "../../../sdk/identity", version = "0.1.0" } +tokio = { version = "1.0", features = ["macros"] } + +[features] +default = ["package-composite-v1"] +"package-composite-v1" = [] +"package-2021-03-03" = [] diff --git a/services/mgmt/marketplacenotifications/src/lib.rs b/services/mgmt/marketplacenotifications/src/lib.rs new file mode 100644 index 0000000000..741155457c --- /dev/null +++ b/services/mgmt/marketplacenotifications/src/lib.rs @@ -0,0 +1,65 @@ +#![doc = "generated by AutoRust 0.1.0"] +#[cfg(feature = "package-composite-v1")] +mod package_composite_v1; +#[cfg(feature = "package-composite-v1")] +pub use package_composite_v1::{models, operations, API_VERSION}; +#[cfg(feature = "package-2021-03-03")] +mod package_2021_03_03; +use azure_core::setters; +#[cfg(feature = "package-2021-03-03")] +pub use package_2021_03_03::{models, operations, API_VERSION}; +pub fn config( + http_client: std::sync::Arc, + token_credential: Box, +) -> OperationConfigBuilder { + OperationConfigBuilder { + api_version: None, + http_client, + base_path: None, + token_credential, + token_credential_resource: None, + } +} +pub struct OperationConfigBuilder { + api_version: Option, + http_client: std::sync::Arc, + base_path: Option, + token_credential: Box, + token_credential_resource: Option, +} +impl OperationConfigBuilder { + setters! { api_version : String => Some (api_version) , base_path : String => Some (base_path) , token_credential_resource : String => Some (token_credential_resource) , } + pub fn build(self) -> OperationConfig { + OperationConfig { + api_version: self.api_version.unwrap_or(API_VERSION.to_owned()), + http_client: self.http_client, + base_path: self.base_path.unwrap_or("https://management.azure.com".to_owned()), + token_credential: Some(self.token_credential), + token_credential_resource: self.token_credential_resource.unwrap_or("https://management.azure.com/".to_owned()), + } + } +} +pub struct OperationConfig { + api_version: String, + http_client: std::sync::Arc, + base_path: String, + token_credential: Option>, + token_credential_resource: String, +} +impl OperationConfig { + pub fn api_version(&self) -> &str { + self.api_version.as_str() + } + pub fn http_client(&self) -> &dyn azure_core::HttpClient { + self.http_client.as_ref() + } + pub fn base_path(&self) -> &str { + self.base_path.as_str() + } + pub fn token_credential(&self) -> Option<&dyn azure_core::TokenCredential> { + self.token_credential.as_deref() + } + pub fn token_credential_resource(&self) -> &str { + self.token_credential_resource.as_str() + } +} diff --git a/services/mgmt/marketplacenotifications/src/package_2021_03_03/mod.rs b/services/mgmt/marketplacenotifications/src/package_2021_03_03/mod.rs new file mode 100644 index 0000000000..3bbec08088 --- /dev/null +++ b/services/mgmt/marketplacenotifications/src/package_2021_03_03/mod.rs @@ -0,0 +1,3 @@ +pub mod models; +pub mod operations; +pub const API_VERSION: &str = "2021-03-03"; diff --git a/services/mgmt/marketplacenotifications/src/package_2021_03_03/models.rs b/services/mgmt/marketplacenotifications/src/package_2021_03_03/models.rs new file mode 100644 index 0000000000..8440502869 --- /dev/null +++ b/services/mgmt/marketplacenotifications/src/package_2021_03_03/models.rs @@ -0,0 +1,125 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NotificationList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Notification { + #[serde(flatten)] + pub resource: Resource, + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiagnosticsInfoDto { + #[serde(rename = "ms-cv", default, skip_serializing_if = "Option::is_none")] + pub ms_cv: Option, + #[serde(rename = "buildNumber", default, skip_serializing_if = "Option::is_none")] + pub build_number: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorResponse { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +pub mod error_response { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Error { + #[serde(skip_serializing)] + pub code: Option, + #[serde(skip_serializing)] + pub message: Option, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AvailableOperations { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", skip_serializing)] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationDetail { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationDisplay { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Resource { + #[serde(skip_serializing)] + pub id: Option, + #[serde(skip_serializing)] + pub name: Option, + #[serde(rename = "type", skip_serializing)] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OfferProperties { + #[serde(rename = "offerId", skip_serializing)] + pub offer_id: Option, + #[serde(rename = "createdDate", skip_serializing)] + pub created_date: Option, + #[serde(rename = "offerDisplayName", skip_serializing)] + pub offer_display_name: Option, + #[serde(rename = "principalId", skip_serializing)] + pub principal_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SystemData { + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +pub mod system_data { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/marketplacenotifications/src/package_2021_03_03/operations.rs b/services/mgmt/marketplacenotifications/src/package_2021_03_03/operations.rs new file mode 100644 index 0000000000..e63c99a72f --- /dev/null +++ b/services/mgmt/marketplacenotifications/src/package_2021_03_03/operations.rs @@ -0,0 +1,226 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use crate::models::*; +pub mod notifications { + use crate::models::*; + pub async fn get_with_authorization( + operation_config: &crate::OperationConfig, + subscription: &str, + principal_id: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.MarketplaceNotifications/reviewsNotifications", + operation_config.base_path(), + subscription + ); + let mut url = url::Url::parse(url_str).map_err(get_with_authorization::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get_with_authorization::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + url.query_pairs_mut().append_pair("principalId", principal_id); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(get_with_authorization::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_with_authorization::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: NotificationList = serde_json::from_slice(rsp_body) + .map_err(|source| get_with_authorization::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = serde_json::from_slice(rsp_body) + .map_err(|source| get_with_authorization::Error::DeserializeError(source, rsp_body.clone()))?; + Err(get_with_authorization::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod get_with_authorization { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} +pub mod notification { + use crate::models::*; + pub async fn get_with_authorization( + operation_config: &crate::OperationConfig, + subscription: &str, + notification: &str, + principal_id: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.MarketplaceNotifications/reviewsNotification/{}", + operation_config.base_path(), + subscription, + notification + ); + let mut url = url::Url::parse(url_str).map_err(get_with_authorization::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get_with_authorization::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + url.query_pairs_mut().append_pair("principalId", principal_id); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(get_with_authorization::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_with_authorization::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: Notification = serde_json::from_slice(rsp_body) + .map_err(|source| get_with_authorization::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = serde_json::from_slice(rsp_body) + .map_err(|source| get_with_authorization::Error::DeserializeError(source, rsp_body.clone()))?; + Err(get_with_authorization::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod get_with_authorization { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get_operations( + operation_config: &crate::OperationConfig, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/providers/Microsoft.MarketplaceNotifications/operations", + operation_config.base_path(), + ); + let mut url = url::Url::parse(url_str).map_err(get_operations::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get_operations::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(get_operations::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_operations::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: AvailableOperations = + serde_json::from_slice(rsp_body).map_err(|source| get_operations::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = + serde_json::from_slice(rsp_body).map_err(|source| get_operations::Error::DeserializeError(source, rsp_body.clone()))?; + Err(get_operations::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod get_operations { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} diff --git a/services/mgmt/marketplacenotifications/src/package_composite_v1/mod.rs b/services/mgmt/marketplacenotifications/src/package_composite_v1/mod.rs new file mode 100644 index 0000000000..3bbec08088 --- /dev/null +++ b/services/mgmt/marketplacenotifications/src/package_composite_v1/mod.rs @@ -0,0 +1,3 @@ +pub mod models; +pub mod operations; +pub const API_VERSION: &str = "2021-03-03"; diff --git a/services/mgmt/marketplacenotifications/src/package_composite_v1/models.rs b/services/mgmt/marketplacenotifications/src/package_composite_v1/models.rs new file mode 100644 index 0000000000..8440502869 --- /dev/null +++ b/services/mgmt/marketplacenotifications/src/package_composite_v1/models.rs @@ -0,0 +1,125 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(non_camel_case_types)] +#![allow(unused_imports)] +use serde::{Deserialize, Serialize}; +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct NotificationList { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Notification { + #[serde(flatten)] + pub resource: Resource, + #[serde(rename = "systemData", skip_serializing)] + pub system_data: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct DiagnosticsInfoDto { + #[serde(rename = "ms-cv", default, skip_serializing_if = "Option::is_none")] + pub ms_cv: Option, + #[serde(rename = "buildNumber", default, skip_serializing_if = "Option::is_none")] + pub build_number: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ErrorResponse { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub error: Option, +} +pub mod error_response { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct Error { + #[serde(skip_serializing)] + pub code: Option, + #[serde(skip_serializing)] + pub message: Option, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct AvailableOperations { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub value: Vec, + #[serde(rename = "nextLink", skip_serializing)] + pub next_link: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationDetail { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(rename = "isDataAction", default, skip_serializing_if = "Option::is_none")] + pub is_data_action: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub display: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub origin: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OperationDisplay { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resource: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub operation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Resource { + #[serde(skip_serializing)] + pub id: Option, + #[serde(skip_serializing)] + pub name: Option, + #[serde(rename = "type", skip_serializing)] + pub type_: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct OfferProperties { + #[serde(rename = "offerId", skip_serializing)] + pub offer_id: Option, + #[serde(rename = "createdDate", skip_serializing)] + pub created_date: Option, + #[serde(rename = "offerDisplayName", skip_serializing)] + pub offer_display_name: Option, + #[serde(rename = "principalId", skip_serializing)] + pub principal_id: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SystemData { + #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")] + pub created_by: Option, + #[serde(rename = "createdByType", default, skip_serializing_if = "Option::is_none")] + pub created_by_type: Option, + #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")] + pub created_at: Option, + #[serde(rename = "lastModifiedBy", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by: Option, + #[serde(rename = "lastModifiedByType", default, skip_serializing_if = "Option::is_none")] + pub last_modified_by_type: Option, + #[serde(rename = "lastModifiedAt", default, skip_serializing_if = "Option::is_none")] + pub last_modified_at: Option, +} +pub mod system_data { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum CreatedByType { + User, + Application, + ManagedIdentity, + Key, + } + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub enum LastModifiedByType { + User, + Application, + ManagedIdentity, + Key, + } +} diff --git a/services/mgmt/marketplacenotifications/src/package_composite_v1/operations.rs b/services/mgmt/marketplacenotifications/src/package_composite_v1/operations.rs new file mode 100644 index 0000000000..e63c99a72f --- /dev/null +++ b/services/mgmt/marketplacenotifications/src/package_composite_v1/operations.rs @@ -0,0 +1,226 @@ +#![doc = "generated by AutoRust 0.1.0"] +#![allow(unused_mut)] +#![allow(unused_variables)] +#![allow(unused_imports)] +use crate::models::*; +pub mod notifications { + use crate::models::*; + pub async fn get_with_authorization( + operation_config: &crate::OperationConfig, + subscription: &str, + principal_id: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.MarketplaceNotifications/reviewsNotifications", + operation_config.base_path(), + subscription + ); + let mut url = url::Url::parse(url_str).map_err(get_with_authorization::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get_with_authorization::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + url.query_pairs_mut().append_pair("principalId", principal_id); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(get_with_authorization::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_with_authorization::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: NotificationList = serde_json::from_slice(rsp_body) + .map_err(|source| get_with_authorization::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = serde_json::from_slice(rsp_body) + .map_err(|source| get_with_authorization::Error::DeserializeError(source, rsp_body.clone()))?; + Err(get_with_authorization::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod get_with_authorization { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} +pub mod notification { + use crate::models::*; + pub async fn get_with_authorization( + operation_config: &crate::OperationConfig, + subscription: &str, + notification: &str, + principal_id: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/providers/Microsoft.MarketplaceNotifications/reviewsNotification/{}", + operation_config.base_path(), + subscription, + notification + ); + let mut url = url::Url::parse(url_str).map_err(get_with_authorization::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get_with_authorization::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + url.query_pairs_mut().append_pair("principalId", principal_id); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder + .body(req_body) + .map_err(get_with_authorization::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_with_authorization::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: Notification = serde_json::from_slice(rsp_body) + .map_err(|source| get_with_authorization::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = serde_json::from_slice(rsp_body) + .map_err(|source| get_with_authorization::Error::DeserializeError(source, rsp_body.clone()))?; + Err(get_with_authorization::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod get_with_authorization { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get_operations( + operation_config: &crate::OperationConfig, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/providers/Microsoft.MarketplaceNotifications/operations", + operation_config.base_path(), + ); + let mut url = url::Url::parse(url_str).map_err(get_operations::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get_operations::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(get_operations::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(get_operations::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: AvailableOperations = + serde_json::from_slice(rsp_body).map_err(|source| get_operations::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: ErrorResponse = + serde_json::from_slice(rsp_body).map_err(|source| get_operations::Error::DeserializeError(source, rsp_body.clone()))?; + Err(get_operations::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod get_operations { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::ErrorResponse, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} diff --git a/services/mgmt/marketplaceordering/src/lib.rs b/services/mgmt/marketplaceordering/src/lib.rs index 91b652e3ee..18ae1b2dd9 100644 --- a/services/mgmt/marketplaceordering/src/lib.rs +++ b/services/mgmt/marketplaceordering/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2015-06-01")] pub use package_2015_06_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/mediaservices/src/lib.rs b/services/mgmt/mediaservices/src/lib.rs index a7dfb69f79..dc8c8d12ca 100644 --- a/services/mgmt/mediaservices/src/lib.rs +++ b/services/mgmt/mediaservices/src/lib.rs @@ -33,7 +33,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-06-preview")] pub use package_2018_06_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -46,7 +46,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -65,7 +65,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -75,7 +75,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/migrate/src/lib.rs b/services/mgmt/migrate/src/lib.rs index 1847af1a69..f05f5c2b98 100644 --- a/services/mgmt/migrate/src/lib.rs +++ b/services/mgmt/migrate/src/lib.rs @@ -13,7 +13,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-01")] pub use package_2020_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -26,7 +26,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -45,7 +45,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -55,7 +55,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/migrateprojects/src/lib.rs b/services/mgmt/migrateprojects/src/lib.rs index 2fe7ab4316..e1c9b93de2 100644 --- a/services/mgmt/migrateprojects/src/lib.rs +++ b/services/mgmt/migrateprojects/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-09")] pub use package_2018_09::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/monitor/src/lib.rs b/services/mgmt/monitor/src/lib.rs index 18eb69d043..aa5defda04 100644 --- a/services/mgmt/monitor/src/lib.rs +++ b/services/mgmt/monitor/src/lib.rs @@ -141,7 +141,7 @@ use azure_core::setters; #[cfg(feature = "package-2015-04-01-only")] pub use package_2015_04_01_only::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -154,7 +154,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -173,7 +173,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -183,7 +183,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/msi/src/lib.rs b/services/mgmt/msi/src/lib.rs index b92c1aba68..daac355b71 100644 --- a/services/mgmt/msi/src/lib.rs +++ b/services/mgmt/msi/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2015-08-31-preview")] pub use package_2015_08_31_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/mysql/src/lib.rs b/services/mgmt/mysql/src/lib.rs index 91ebc9f1f3..47cb00f655 100644 --- a/services/mgmt/mysql/src/lib.rs +++ b/services/mgmt/mysql/src/lib.rs @@ -33,7 +33,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-07-01-preview")] pub use package_2020_07_01_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -46,7 +46,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -65,7 +65,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -75,7 +75,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/notificationhubs/src/lib.rs b/services/mgmt/notificationhubs/src/lib.rs index f2ed0afb38..0155b6edda 100644 --- a/services/mgmt/notificationhubs/src/lib.rs +++ b/services/mgmt/notificationhubs/src/lib.rs @@ -13,7 +13,7 @@ use azure_core::setters; #[cfg(feature = "package-2014-09")] pub use package_2014_09::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -26,7 +26,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -45,7 +45,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -55,7 +55,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/operationalinsights/src/lib.rs b/services/mgmt/operationalinsights/src/lib.rs index 60b69b5674..667d5c897d 100644 --- a/services/mgmt/operationalinsights/src/lib.rs +++ b/services/mgmt/operationalinsights/src/lib.rs @@ -33,7 +33,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-10")] pub use package_2020_10::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -46,7 +46,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -65,7 +65,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -75,7 +75,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/operationalinsights/src/package_2020_10/models.rs b/services/mgmt/operationalinsights/src/package_2020_10/models.rs index 4b64b31423..3d4ec0ac6c 100644 --- a/services/mgmt/operationalinsights/src/package_2020_10/models.rs +++ b/services/mgmt/operationalinsights/src/package_2020_10/models.rs @@ -526,7 +526,7 @@ pub struct ClusterProperties { #[serde(rename = "isAvailabilityZonesEnabled", default, skip_serializing_if = "Option::is_none")] pub is_availability_zones_enabled: Option, #[serde(rename = "billingType", default, skip_serializing_if = "Option::is_none")] - pub billing_type: Option, + pub billing_type: Option, #[serde(rename = "keyVaultProperties", default, skip_serializing_if = "Option::is_none")] pub key_vault_properties: Option, #[serde(rename = "lastModifiedDate", skip_serializing)] @@ -550,16 +550,13 @@ pub mod cluster_properties { ProvisioningAccount, Updating, } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BillingType { - Cluster, - Workspaces, - } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ClusterPatchProperties { #[serde(rename = "keyVaultProperties", default, skip_serializing_if = "Option::is_none")] pub key_vault_properties: Option, + #[serde(rename = "billingType", default, skip_serializing_if = "Option::is_none")] + pub billing_type: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ClusterPatch { @@ -602,6 +599,11 @@ pub struct KeyVaultProperties { pub key_rsa_size: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum BillingType { + Cluster, + Workspaces, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ClusterSku { #[serde(default, skip_serializing_if = "Option::is_none")] pub capacity: Option, diff --git a/services/mgmt/operationalinsights/src/package_2020_10_only/models.rs b/services/mgmt/operationalinsights/src/package_2020_10_only/models.rs index 5f8ebe7fc8..70757a5345 100644 --- a/services/mgmt/operationalinsights/src/package_2020_10_only/models.rs +++ b/services/mgmt/operationalinsights/src/package_2020_10_only/models.rs @@ -13,7 +13,7 @@ pub struct ClusterProperties { #[serde(rename = "isAvailabilityZonesEnabled", default, skip_serializing_if = "Option::is_none")] pub is_availability_zones_enabled: Option, #[serde(rename = "billingType", default, skip_serializing_if = "Option::is_none")] - pub billing_type: Option, + pub billing_type: Option, #[serde(rename = "keyVaultProperties", default, skip_serializing_if = "Option::is_none")] pub key_vault_properties: Option, #[serde(rename = "lastModifiedDate", skip_serializing)] @@ -37,16 +37,13 @@ pub mod cluster_properties { ProvisioningAccount, Updating, } - #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - pub enum BillingType { - Cluster, - Workspaces, - } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ClusterPatchProperties { #[serde(rename = "keyVaultProperties", default, skip_serializing_if = "Option::is_none")] pub key_vault_properties: Option, + #[serde(rename = "billingType", default, skip_serializing_if = "Option::is_none")] + pub billing_type: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ClusterPatch { @@ -89,6 +86,11 @@ pub struct KeyVaultProperties { pub key_rsa_size: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum BillingType { + Cluster, + Workspaces, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct ClusterSku { #[serde(default, skip_serializing_if = "Option::is_none")] pub capacity: Option, diff --git a/services/mgmt/operationsmanagement/src/lib.rs b/services/mgmt/operationsmanagement/src/lib.rs index d19232e673..a8109528a7 100644 --- a/services/mgmt/operationsmanagement/src/lib.rs +++ b/services/mgmt/operationsmanagement/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2015-11-preview")] pub use package_2015_11_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/peering/src/lib.rs b/services/mgmt/peering/src/lib.rs index 3218f7f7b9..faac209029 100644 --- a/services/mgmt/peering/src/lib.rs +++ b/services/mgmt/peering/src/lib.rs @@ -25,7 +25,7 @@ use azure_core::setters; #[cfg(feature = "package-2019-08-01-preview")] pub use package_2019_08_01_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -38,7 +38,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -57,7 +57,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -67,7 +67,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/policyinsights/src/lib.rs b/services/mgmt/policyinsights/src/lib.rs index e16e7f320d..994ca1f507 100644 --- a/services/mgmt/policyinsights/src/lib.rs +++ b/services/mgmt/policyinsights/src/lib.rs @@ -21,7 +21,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-04")] pub use package_2018_04::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -34,7 +34,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -53,7 +53,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -63,7 +63,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/portal/src/lib.rs b/services/mgmt/portal/src/lib.rs index 67938dfe53..c9abaf6e2e 100644 --- a/services/mgmt/portal/src/lib.rs +++ b/services/mgmt/portal/src/lib.rs @@ -17,7 +17,7 @@ use azure_core::setters; #[cfg(feature = "package-2015-08-01-preview")] pub use package_2015_08_01_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -30,7 +30,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -49,7 +49,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -59,7 +59,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/postgresql/src/lib.rs b/services/mgmt/postgresql/src/lib.rs index 48038a1c29..0ea99d7459 100644 --- a/services/mgmt/postgresql/src/lib.rs +++ b/services/mgmt/postgresql/src/lib.rs @@ -45,7 +45,7 @@ use azure_core::setters; #[cfg(feature = "package-2017-12-01")] pub use package_2017_12_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -58,7 +58,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -77,7 +77,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -87,7 +87,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/postgresqlhsc/src/lib.rs b/services/mgmt/postgresqlhsc/src/lib.rs index 89560b987e..c98ff0fddd 100644 --- a/services/mgmt/postgresqlhsc/src/lib.rs +++ b/services/mgmt/postgresqlhsc/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-10-05-privatepreview")] pub use package_2020_10_05_privatepreview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/powerbidedicated/src/lib.rs b/services/mgmt/powerbidedicated/src/lib.rs index 1260a7d450..9f50be6848 100644 --- a/services/mgmt/powerbidedicated/src/lib.rs +++ b/services/mgmt/powerbidedicated/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2017-10-01")] pub use package_2017_10_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/powerbiembedded/src/lib.rs b/services/mgmt/powerbiembedded/src/lib.rs index fe7df88363..2a3db7af5a 100644 --- a/services/mgmt/powerbiembedded/src/lib.rs +++ b/services/mgmt/powerbiembedded/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2016-01")] pub use package_2016_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/privatedns/src/lib.rs b/services/mgmt/privatedns/src/lib.rs index 29375bba40..576437f1b6 100644 --- a/services/mgmt/privatedns/src/lib.rs +++ b/services/mgmt/privatedns/src/lib.rs @@ -13,7 +13,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-06")] pub use package_2020_06::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -26,7 +26,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -45,7 +45,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -55,7 +55,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/providerhub/src/lib.rs b/services/mgmt/providerhub/src/lib.rs index 19f741ce3f..65b8161e2a 100644 --- a/services/mgmt/providerhub/src/lib.rs +++ b/services/mgmt/providerhub/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-11-20")] pub use package_2020_11_20::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/purview/src/lib.rs b/services/mgmt/purview/src/lib.rs index 920e33bbfd..eee4dd1197 100644 --- a/services/mgmt/purview/src/lib.rs +++ b/services/mgmt/purview/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-12-01-preview")] pub use package_2020_12_01_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/quantum/src/lib.rs b/services/mgmt/quantum/src/lib.rs index 2928a534d3..eac946771d 100644 --- a/services/mgmt/quantum/src/lib.rs +++ b/services/mgmt/quantum/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2019-11-04-preview")] pub use package_2019_11_04_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/recoveryservices/src/lib.rs b/services/mgmt/recoveryservices/src/lib.rs index 44f9304fd4..6808a307d8 100644 --- a/services/mgmt/recoveryservices/src/lib.rs +++ b/services/mgmt/recoveryservices/src/lib.rs @@ -25,7 +25,7 @@ use azure_core::setters; #[cfg(feature = "package-2021-01")] pub use package_2021_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -38,7 +38,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -57,7 +57,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -67,7 +67,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/recoveryservicesbackup/src/lib.rs b/services/mgmt/recoveryservicesbackup/src/lib.rs index 1cef46bfba..fad08d60b8 100644 --- a/services/mgmt/recoveryservicesbackup/src/lib.rs +++ b/services/mgmt/recoveryservicesbackup/src/lib.rs @@ -61,7 +61,7 @@ use azure_core::setters; #[cfg(feature = "package-2017-07-only")] pub use package_2017_07_only::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -74,7 +74,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -93,7 +93,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -103,7 +103,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/recoveryservicessiterecovery/src/lib.rs b/services/mgmt/recoveryservicessiterecovery/src/lib.rs index b24537b08a..8603a25075 100644 --- a/services/mgmt/recoveryservicessiterecovery/src/lib.rs +++ b/services/mgmt/recoveryservicessiterecovery/src/lib.rs @@ -17,7 +17,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-01")] pub use package_2018_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -30,7 +30,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -49,7 +49,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -59,7 +59,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/redhatopenshift/src/lib.rs b/services/mgmt/redhatopenshift/src/lib.rs index 7403dc3a04..080479b09d 100644 --- a/services/mgmt/redhatopenshift/src/lib.rs +++ b/services/mgmt/redhatopenshift/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-04-30")] pub use package_2020_04_30::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/redis/src/lib.rs b/services/mgmt/redis/src/lib.rs index aedc656e2d..83b5ee95a1 100644 --- a/services/mgmt/redis/src/lib.rs +++ b/services/mgmt/redis/src/lib.rs @@ -33,7 +33,7 @@ use azure_core::setters; #[cfg(feature = "package-2015-08")] pub use package_2015_08::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -46,7 +46,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -65,7 +65,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -75,7 +75,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/redisenterprise/src/lib.rs b/services/mgmt/redisenterprise/src/lib.rs index b0c33a12c8..357ce3e448 100644 --- a/services/mgmt/redisenterprise/src/lib.rs +++ b/services/mgmt/redisenterprise/src/lib.rs @@ -13,7 +13,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-10-01-preview")] pub use package_2020_10_01_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -26,7 +26,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -45,7 +45,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -55,7 +55,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/relay/src/lib.rs b/services/mgmt/relay/src/lib.rs index da73bdb4a8..fd967f6d36 100644 --- a/services/mgmt/relay/src/lib.rs +++ b/services/mgmt/relay/src/lib.rs @@ -13,7 +13,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-01-preview")] pub use package_2018_01_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -26,7 +26,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -45,7 +45,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -55,7 +55,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/reservations/src/lib.rs b/services/mgmt/reservations/src/lib.rs index d253d75cce..2ddab1dfa5 100644 --- a/services/mgmt/reservations/src/lib.rs +++ b/services/mgmt/reservations/src/lib.rs @@ -29,7 +29,7 @@ use azure_core::setters; #[cfg(feature = "package-2017-11")] pub use package_2017_11::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -42,7 +42,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -61,7 +61,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -71,7 +71,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/resourcegraph/src/lib.rs b/services/mgmt/resourcegraph/src/lib.rs index 1f0e65fbad..721fb0e86b 100644 --- a/services/mgmt/resourcegraph/src/lib.rs +++ b/services/mgmt/resourcegraph/src/lib.rs @@ -25,7 +25,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-09-preview")] pub use package_2018_09_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -38,7 +38,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -57,7 +57,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -67,7 +67,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/resourcehealth/src/lib.rs b/services/mgmt/resourcehealth/src/lib.rs index 14c1b219e6..dcee675c0a 100644 --- a/services/mgmt/resourcehealth/src/lib.rs +++ b/services/mgmt/resourcehealth/src/lib.rs @@ -17,7 +17,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-07-01")] pub use package_2018_07_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -30,7 +30,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -49,7 +49,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -59,7 +59,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/resourcemover/src/lib.rs b/services/mgmt/resourcemover/src/lib.rs index fed3fc3ad2..577560c085 100644 --- a/services/mgmt/resourcemover/src/lib.rs +++ b/services/mgmt/resourcemover/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2021-01-01")] pub use package_2021_01_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/resources/examples/group_create.rs b/services/mgmt/resources/examples/group_create.rs index 0da63d93c2..bb1c206376 100644 --- a/services/mgmt/resources/examples/group_create.rs +++ b/services/mgmt/resources/examples/group_create.rs @@ -11,11 +11,9 @@ use azure_identity::token_credentials::AzureCliCredential; use azure_mgmt_resources::{models::ResourceGroup, operations::resource_groups}; use std::env; -type Result = std::result::Result>; - #[tokio::main] -async fn main() -> Result<()> { - let http_client: std::sync::Arc> = std::sync::Arc::new(Box::new(reqwest::Client::new())); +async fn main() -> Result<(), Box> { + let http_client = azure_core::new_http_client(); let token_credential = AzureCliCredential {}; let subscription_id = &AzureCliCredential::get_subscription()?; let resource_group_name = &env::var("RESOURCE_GROUP_NAME").map_err(|_| "RESOURCE_GROUP_NAME required")?; diff --git a/services/mgmt/resources/src/lib.rs b/services/mgmt/resources/src/lib.rs index 08e7763322..e77643fe6c 100644 --- a/services/mgmt/resources/src/lib.rs +++ b/services/mgmt/resources/src/lib.rs @@ -197,7 +197,7 @@ use azure_core::setters; #[cfg(feature = "package-managedapplications-2016-09")] pub use package_managedapplications_2016_09::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -210,7 +210,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -229,7 +229,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -239,7 +239,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/saas/src/lib.rs b/services/mgmt/saas/src/lib.rs index 163158f9f3..d6f7f0d338 100644 --- a/services/mgmt/saas/src/lib.rs +++ b/services/mgmt/saas/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-03-01-beta")] pub use package_2018_03_01_beta::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/scheduler/src/lib.rs b/services/mgmt/scheduler/src/lib.rs index 8052085392..06321c9ea1 100644 --- a/services/mgmt/scheduler/src/lib.rs +++ b/services/mgmt/scheduler/src/lib.rs @@ -13,7 +13,7 @@ use azure_core::setters; #[cfg(feature = "package-2014-08-preview")] pub use package_2014_08_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -26,7 +26,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -45,7 +45,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -55,7 +55,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/search/src/lib.rs b/services/mgmt/search/src/lib.rs index 87c8139253..5983dacc9e 100644 --- a/services/mgmt/search/src/lib.rs +++ b/services/mgmt/search/src/lib.rs @@ -25,7 +25,7 @@ use azure_core::setters; #[cfg(feature = "package-2019-10-preview")] pub use package_2019_10_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -38,7 +38,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -57,7 +57,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -67,7 +67,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/security/src/lib.rs b/services/mgmt/security/src/lib.rs index 7f25565e1f..cd82eb7e95 100644 --- a/services/mgmt/security/src/lib.rs +++ b/services/mgmt/security/src/lib.rs @@ -61,7 +61,7 @@ use azure_core::setters; #[cfg(feature = "package-2021-05-preview-only")] pub use package_2021_05_preview_only::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -74,7 +74,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -93,7 +93,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -103,7 +103,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/securityandcompliance/src/lib.rs b/services/mgmt/securityandcompliance/src/lib.rs index 1a3672b479..1fcdbfe9ed 100644 --- a/services/mgmt/securityandcompliance/src/lib.rs +++ b/services/mgmt/securityandcompliance/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2021-03-08")] pub use package_2021_03_08::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/securityinsights/src/lib.rs b/services/mgmt/securityinsights/src/lib.rs index e72c0f78cd..23a1027a2a 100644 --- a/services/mgmt/securityinsights/src/lib.rs +++ b/services/mgmt/securityinsights/src/lib.rs @@ -13,7 +13,7 @@ use azure_core::setters; #[cfg(feature = "package-2019-01-preview")] pub use package_2019_01_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -26,7 +26,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -45,7 +45,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -55,7 +55,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/securityinsights/src/package_2021_03_preview_only/models.rs b/services/mgmt/securityinsights/src/package_2021_03_preview_only/models.rs index c0d66e24f7..6407b9a607 100644 --- a/services/mgmt/securityinsights/src/package_2021_03_preview_only/models.rs +++ b/services/mgmt/securityinsights/src/package_2021_03_preview_only/models.rs @@ -144,6 +144,74 @@ pub mod operation { } } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct RepoList { + #[serde(rename = "nextLink", skip_serializing)] + pub next_link: Option, + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Repo { + #[serde(rename = "repoUrl", default, skip_serializing_if = "Option::is_none")] + pub repo_url: Option, + #[serde(rename = "fullName", default, skip_serializing_if = "Option::is_none")] + pub full_name: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub branches: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SourceControlList { + #[serde(rename = "nextLink", skip_serializing)] + pub next_link: Option, + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SourceControl { + #[serde(flatten)] + pub resource_with_etag: ResourceWithEtag, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct SourceControlProperties { + #[serde(rename = "sourceControlId", default, skip_serializing_if = "Option::is_none")] + pub source_control_id: Option, + #[serde(rename = "displayName")] + pub display_name: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "repoType")] + pub repo_type: RepoType, + #[serde(rename = "contentTypes")] + pub content_types: Vec, + pub repository: Repository, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct Repository { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub url: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub branch: Option, + #[serde(rename = "pathMapping", default, skip_serializing_if = "Vec::is_empty")] + pub path_mapping: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ContentPathMap { + #[serde(rename = "contentType", default, skip_serializing_if = "Option::is_none")] + pub content_type: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub path: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum ContentType { + AnalyticRule, + Workbook, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum RepoType { + Github, + DevOps, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct AadDataConnector { #[serde(flatten)] pub data_connector: DataConnector, @@ -759,6 +827,130 @@ pub struct UserInfo { #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Label {} #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum EntityInnerType { + Account, + Host, + File, + AzureResource, + CloudApplication, + #[serde(rename = "DNS")] + Dns, + FileHash, + #[serde(rename = "IP")] + Ip, + Malware, + Process, + RegistryKey, + RegistryValue, + SecurityGroup, + #[serde(rename = "URL")] + Url, + IoTDevice, + SecurityAlert, + HuntingBookmark, + MailCluster, + MailMessage, + Mailbox, + SubmissionMail, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum EntityQueryKind { + Expansion, + Insight, + Activity, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum CustomEntityQueryKind { + Activity, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EntityQueryList { + #[serde(rename = "nextLink", skip_serializing)] + pub next_link: Option, + pub value: Vec, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct EntityQuery { + #[serde(flatten)] + pub resource_with_etag: ResourceWithEtag, + pub kind: EntityQueryKind, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct CustomEntityQuery { + #[serde(flatten)] + pub resource_with_etag: ResourceWithEtag, + pub kind: CustomEntityQueryKind, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExpansionEntityQuery { + #[serde(flatten)] + pub entity_query: EntityQuery, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ExpansionEntityQueriesProperties { + #[serde(rename = "dataSources", default, skip_serializing_if = "Vec::is_empty")] + pub data_sources: Vec, + #[serde(rename = "displayName", default, skip_serializing_if = "Option::is_none")] + pub display_name: Option, + #[serde(rename = "inputEntityType", default, skip_serializing_if = "Option::is_none")] + pub input_entity_type: Option, + #[serde(rename = "inputFields", default, skip_serializing_if = "Vec::is_empty")] + pub input_fields: Vec, + #[serde(rename = "outputEntityTypes", default, skip_serializing_if = "Vec::is_empty")] + pub output_entity_types: Vec, + #[serde(rename = "queryTemplate", default, skip_serializing_if = "Option::is_none")] + pub query_template: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActivityEntityQuery { + #[serde(flatten)] + pub entity_query: EntityQuery, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActivityCustomEntityQuery { + #[serde(flatten)] + pub custom_entity_query: CustomEntityQuery, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub properties: Option, +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct ActivityEntityQueriesProperties { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub title: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub content: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "queryDefinitions", default, skip_serializing_if = "Option::is_none")] + pub query_definitions: Option, + #[serde(rename = "inputEntityType", default, skip_serializing_if = "Option::is_none")] + pub input_entity_type: Option, + #[serde(rename = "requiredInputFieldsSets", default, skip_serializing_if = "Vec::is_empty")] + pub required_input_fields_sets: Vec>, + #[serde(rename = "entitiesFilter", default, skip_serializing_if = "Option::is_none")] + pub entities_filter: Option, + #[serde(rename = "templateName", default, skip_serializing_if = "Option::is_none")] + pub template_name: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub enabled: Option, + #[serde(rename = "createdTimeUtc", skip_serializing)] + pub created_time_utc: Option, + #[serde(rename = "lastModifiedTimeUtc", skip_serializing)] + pub last_modified_time_utc: Option, +} +pub mod activity_entity_queries_properties { + use super::*; + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] + pub struct QueryDefinitions { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub query: Option, + } +} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct MetadataList { pub value: Vec, #[serde(rename = "nextLink", skip_serializing)] diff --git a/services/mgmt/securityinsights/src/package_2021_03_preview_only/operations.rs b/services/mgmt/securityinsights/src/package_2021_03_preview_only/operations.rs index 03eda3396f..1bc9bd9dbc 100644 --- a/services/mgmt/securityinsights/src/package_2021_03_preview_only/operations.rs +++ b/services/mgmt/securityinsights/src/package_2021_03_preview_only/operations.rs @@ -825,7 +825,86 @@ pub mod operations { } } } -pub mod data_connectors { +pub mod source_control { + use crate::models::*; + pub async fn list_repositories( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + operational_insights_resource_provider: &str, + workspace_name: &str, + repo_type: &RepoType, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/listRepositories", + operation_config.base_path(), + subscription_id, + resource_group_name, + operational_insights_resource_provider, + workspace_name + ); + let mut url = url::Url::parse(url_str).map_err(list_repositories::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::POST); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list_repositories::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = azure_core::to_json(repo_type).map_err(list_repositories::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list_repositories::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(list_repositories::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: RepoList = serde_json::from_slice(rsp_body) + .map_err(|source| list_repositories::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = serde_json::from_slice(rsp_body) + .map_err(|source| list_repositories::Error::DeserializeError(source, rsp_body.clone()))?; + Err(list_repositories::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod list_repositories { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} +pub mod source_controls { use crate::models::*; pub async fn list( operation_config: &crate::OperationConfig, @@ -833,10 +912,10 @@ pub mod data_connectors { resource_group_name: &str, operational_insights_resource_provider: &str, workspace_name: &str, - ) -> std::result::Result { + ) -> std::result::Result { let http_client = operation_config.http_client(); let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/dataConnectors", + "{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/sourcecontrols", operation_config.base_path(), subscription_id, resource_group_name, @@ -861,7 +940,7 @@ pub mod data_connectors { match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: DataConnectorList = + let rsp_value: SourceControlList = serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -905,17 +984,17 @@ pub mod data_connectors { resource_group_name: &str, operational_insights_resource_provider: &str, workspace_name: &str, - data_connector_id: &str, - ) -> std::result::Result { + source_control_id: &str, + ) -> std::result::Result { let http_client = operation_config.http_client(); let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/dataConnectors/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/sourcecontrols/{}", operation_config.base_path(), subscription_id, resource_group_name, operational_insights_resource_provider, workspace_name, - data_connector_id + source_control_id ); let mut url = url::Url::parse(url_str).map_err(get::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); @@ -935,7 +1014,7 @@ pub mod data_connectors { match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: DataConnector = + let rsp_value: SourceControl = serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -973,73 +1052,70 @@ pub mod data_connectors { GetTokenError(azure_core::Error), } } - pub async fn create_or_update( + pub async fn create( operation_config: &crate::OperationConfig, subscription_id: &str, resource_group_name: &str, operational_insights_resource_provider: &str, workspace_name: &str, - data_connector_id: &str, - data_connector: &DataConnector, - ) -> std::result::Result { + source_control_id: &str, + source_control: &SourceControl, + ) -> std::result::Result { let http_client = operation_config.http_client(); let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/dataConnectors/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/sourcecontrols/{}", operation_config.base_path(), subscription_id, resource_group_name, operational_insights_resource_provider, workspace_name, - data_connector_id + source_control_id ); - let mut url = url::Url::parse(url_str).map_err(create_or_update::Error::ParseUrlError)?; + let mut url = url::Url::parse(url_str).map_err(create::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::PUT); if let Some(token_credential) = operation_config.token_credential() { let token_response = token_credential .get_token(operation_config.token_credential_resource()) .await - .map_err(create_or_update::Error::GetTokenError)?; + .map_err(create::Error::GetTokenError)?; req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); } url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); - let req_body = azure_core::to_json(data_connector).map_err(create_or_update::Error::SerializeError)?; + let req_body = azure_core::to_json(source_control).map_err(create::Error::SerializeError)?; req_builder = req_builder.uri(url.as_str()); - let req = req_builder.body(req_body).map_err(create_or_update::Error::BuildRequestError)?; - let rsp = http_client - .execute_request(req) - .await - .map_err(create_or_update::Error::ExecuteRequestError)?; + let req = req_builder.body(req_body).map_err(create::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(create::Error::ExecuteRequestError)?; match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: DataConnector = serde_json::from_slice(rsp_body) - .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; - Ok(create_or_update::Response::Ok200(rsp_value)) + let rsp_value: SourceControl = + serde_json::from_slice(rsp_body).map_err(|source| create::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(create::Response::Ok200(rsp_value)) } http::StatusCode::CREATED => { let rsp_body = rsp.body(); - let rsp_value: DataConnector = serde_json::from_slice(rsp_body) - .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; - Ok(create_or_update::Response::Created201(rsp_value)) + let rsp_value: SourceControl = + serde_json::from_slice(rsp_body).map_err(|source| create::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(create::Response::Created201(rsp_value)) } status_code => { let rsp_body = rsp.body(); - let rsp_value: CloudError = serde_json::from_slice(rsp_body) - .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; - Err(create_or_update::Error::DefaultResponse { + let rsp_value: CloudError = + serde_json::from_slice(rsp_body).map_err(|source| create::Error::DeserializeError(source, rsp_body.clone()))?; + Err(create::Error::DefaultResponse { status_code, value: rsp_value, }) } } } - pub mod create_or_update { + pub mod create { use crate::{models, models::*}; #[derive(Debug)] pub enum Response { - Ok200(DataConnector), - Created201(DataConnector), + Ok200(SourceControl), + Created201(SourceControl), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1068,17 +1144,17 @@ pub mod data_connectors { resource_group_name: &str, operational_insights_resource_provider: &str, workspace_name: &str, - data_connector_id: &str, + source_control_id: &str, ) -> std::result::Result { let http_client = operation_config.http_client(); let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/dataConnectors/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/sourcecontrols/{}", operation_config.base_path(), subscription_id, resource_group_name, operational_insights_resource_provider, workspace_name, - data_connector_id + source_control_id ); let mut url = url::Url::parse(url_str).map_err(delete::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); @@ -1138,7 +1214,7 @@ pub mod data_connectors { } } } -pub mod watchlists { +pub mod data_connectors { use crate::models::*; pub async fn list( operation_config: &crate::OperationConfig, @@ -1146,10 +1222,10 @@ pub mod watchlists { resource_group_name: &str, operational_insights_resource_provider: &str, workspace_name: &str, - ) -> std::result::Result { + ) -> std::result::Result { let http_client = operation_config.http_client(); let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/watchlists", + "{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/dataConnectors", operation_config.base_path(), subscription_id, resource_group_name, @@ -1174,7 +1250,7 @@ pub mod watchlists { match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: WatchlistList = + let rsp_value: DataConnectorList = serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1218,17 +1294,17 @@ pub mod watchlists { resource_group_name: &str, operational_insights_resource_provider: &str, workspace_name: &str, - watchlist_alias: &str, - ) -> std::result::Result { + data_connector_id: &str, + ) -> std::result::Result { let http_client = operation_config.http_client(); let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/watchlists/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/dataConnectors/{}", operation_config.base_path(), subscription_id, resource_group_name, operational_insights_resource_provider, workspace_name, - watchlist_alias + data_connector_id ); let mut url = url::Url::parse(url_str).map_err(get::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); @@ -1248,7 +1324,7 @@ pub mod watchlists { match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: Watchlist = + let rsp_value: DataConnector = serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1292,18 +1368,18 @@ pub mod watchlists { resource_group_name: &str, operational_insights_resource_provider: &str, workspace_name: &str, - watchlist_alias: &str, - watchlist: &Watchlist, + data_connector_id: &str, + data_connector: &DataConnector, ) -> std::result::Result { let http_client = operation_config.http_client(); let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/watchlists/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/dataConnectors/{}", operation_config.base_path(), subscription_id, resource_group_name, operational_insights_resource_provider, workspace_name, - watchlist_alias + data_connector_id ); let mut url = url::Url::parse(url_str).map_err(create_or_update::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); @@ -1316,7 +1392,7 @@ pub mod watchlists { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); } url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); - let req_body = azure_core::to_json(watchlist).map_err(create_or_update::Error::SerializeError)?; + let req_body = azure_core::to_json(data_connector).map_err(create_or_update::Error::SerializeError)?; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(create_or_update::Error::BuildRequestError)?; let rsp = http_client @@ -1326,13 +1402,13 @@ pub mod watchlists { match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: Watchlist = serde_json::from_slice(rsp_body) + let rsp_value: DataConnector = serde_json::from_slice(rsp_body) .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; Ok(create_or_update::Response::Ok200(rsp_value)) } http::StatusCode::CREATED => { let rsp_body = rsp.body(); - let rsp_value: Watchlist = serde_json::from_slice(rsp_body) + let rsp_value: DataConnector = serde_json::from_slice(rsp_body) .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; Ok(create_or_update::Response::Created201(rsp_value)) } @@ -1351,8 +1427,8 @@ pub mod watchlists { use crate::{models, models::*}; #[derive(Debug)] pub enum Response { - Ok200(Watchlist), - Created201(Watchlist), + Ok200(DataConnector), + Created201(DataConnector), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1381,17 +1457,17 @@ pub mod watchlists { resource_group_name: &str, operational_insights_resource_provider: &str, workspace_name: &str, - watchlist_alias: &str, + data_connector_id: &str, ) -> std::result::Result { let http_client = operation_config.http_client(); let url_str = &format!( - "{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/watchlists/{}", + "{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/dataConnectors/{}", operation_config.base_path(), subscription_id, resource_group_name, operational_insights_resource_provider, workspace_name, - watchlist_alias + data_connector_id ); let mut url = url::Url::parse(url_str).map_err(delete::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); @@ -1451,7 +1527,7 @@ pub mod watchlists { } } } -pub mod watchlist_items { +pub mod watchlists { use crate::models::*; pub async fn list( operation_config: &crate::OperationConfig, @@ -1459,10 +1535,16 @@ pub mod watchlist_items { resource_group_name: &str, operational_insights_resource_provider: &str, workspace_name: &str, - watchlist_alias: &str, - ) -> std::result::Result { + ) -> std::result::Result { let http_client = operation_config.http_client(); - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/watchlists/{}/watchlistItems" , operation_config . base_path () , subscription_id , resource_group_name , operational_insights_resource_provider , workspace_name , watchlist_alias) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/watchlists", + operation_config.base_path(), + subscription_id, + resource_group_name, + operational_insights_resource_provider, + workspace_name + ); let mut url = url::Url::parse(url_str).map_err(list::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::GET); @@ -1481,7 +1563,7 @@ pub mod watchlist_items { match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: WatchlistItemList = + let rsp_value: WatchlistList = serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1526,10 +1608,17 @@ pub mod watchlist_items { operational_insights_resource_provider: &str, workspace_name: &str, watchlist_alias: &str, - watchlist_item_id: &str, - ) -> std::result::Result { + ) -> std::result::Result { let http_client = operation_config.http_client(); - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/watchlists/{}/watchlistItems/{}" , operation_config . base_path () , subscription_id , resource_group_name , operational_insights_resource_provider , workspace_name , watchlist_alias , watchlist_item_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/watchlists/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + operational_insights_resource_provider, + workspace_name, + watchlist_alias + ); let mut url = url::Url::parse(url_str).map_err(get::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::GET); @@ -1548,7 +1637,7 @@ pub mod watchlist_items { match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: WatchlistItem = + let rsp_value: Watchlist = serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; Ok(rsp_value) } @@ -1593,11 +1682,18 @@ pub mod watchlist_items { operational_insights_resource_provider: &str, workspace_name: &str, watchlist_alias: &str, - watchlist_item_id: &str, - watchlist_item: &WatchlistItem, + watchlist: &Watchlist, ) -> std::result::Result { let http_client = operation_config.http_client(); - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/watchlists/{}/watchlistItems/{}" , operation_config . base_path () , subscription_id , resource_group_name , operational_insights_resource_provider , workspace_name , watchlist_alias , watchlist_item_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/watchlists/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + operational_insights_resource_provider, + workspace_name, + watchlist_alias + ); let mut url = url::Url::parse(url_str).map_err(create_or_update::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::PUT); @@ -1609,7 +1705,7 @@ pub mod watchlist_items { req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); } url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); - let req_body = azure_core::to_json(watchlist_item).map_err(create_or_update::Error::SerializeError)?; + let req_body = azure_core::to_json(watchlist).map_err(create_or_update::Error::SerializeError)?; req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(create_or_update::Error::BuildRequestError)?; let rsp = http_client @@ -1619,13 +1715,13 @@ pub mod watchlist_items { match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); - let rsp_value: WatchlistItem = serde_json::from_slice(rsp_body) + let rsp_value: Watchlist = serde_json::from_slice(rsp_body) .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; Ok(create_or_update::Response::Ok200(rsp_value)) } http::StatusCode::CREATED => { let rsp_body = rsp.body(); - let rsp_value: WatchlistItem = serde_json::from_slice(rsp_body) + let rsp_value: Watchlist = serde_json::from_slice(rsp_body) .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; Ok(create_or_update::Response::Created201(rsp_value)) } @@ -1644,8 +1740,8 @@ pub mod watchlist_items { use crate::{models, models::*}; #[derive(Debug)] pub enum Response { - Ok200(WatchlistItem), - Created201(WatchlistItem), + Ok200(Watchlist), + Created201(Watchlist), } #[derive(Debug, thiserror :: Error)] pub enum Error { @@ -1675,10 +1771,620 @@ pub mod watchlist_items { operational_insights_resource_provider: &str, workspace_name: &str, watchlist_alias: &str, - watchlist_item_id: &str, ) -> std::result::Result { let http_client = operation_config.http_client(); - let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/watchlists/{}/watchlistItems/{}" , operation_config . base_path () , subscription_id , resource_group_name , operational_insights_resource_provider , workspace_name , watchlist_alias , watchlist_item_id) ; + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/watchlists/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + operational_insights_resource_provider, + workspace_name, + watchlist_alias + ); + let mut url = url::Url::parse(url_str).map_err(delete::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(delete::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(delete::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(delete::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => Ok(delete::Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(delete::Response::NoContent204), + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = + serde_json::from_slice(rsp_body).map_err(|source| delete::Error::DeserializeError(source, rsp_body.clone()))?; + Err(delete::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod delete { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} +pub mod watchlist_items { + use crate::models::*; + pub async fn list( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + operational_insights_resource_provider: &str, + workspace_name: &str, + watchlist_alias: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/watchlists/{}/watchlistItems" , operation_config . base_path () , subscription_id , resource_group_name , operational_insights_resource_provider , workspace_name , watchlist_alias) ; + let mut url = url::Url::parse(url_str).map_err(list::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(list::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: WatchlistItemList = + serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = + serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; + Err(list::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod list { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + operational_insights_resource_provider: &str, + workspace_name: &str, + watchlist_alias: &str, + watchlist_item_id: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/watchlists/{}/watchlistItems/{}" , operation_config . base_path () , subscription_id , resource_group_name , operational_insights_resource_provider , workspace_name , watchlist_alias , watchlist_item_id) ; + let mut url = url::Url::parse(url_str).map_err(get::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(get::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(get::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: WatchlistItem = + serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = + serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; + Err(get::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod get { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn create_or_update( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + operational_insights_resource_provider: &str, + workspace_name: &str, + watchlist_alias: &str, + watchlist_item_id: &str, + watchlist_item: &WatchlistItem, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/watchlists/{}/watchlistItems/{}" , operation_config . base_path () , subscription_id , resource_group_name , operational_insights_resource_provider , workspace_name , watchlist_alias , watchlist_item_id) ; + let mut url = url::Url::parse(url_str).map_err(create_or_update::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(create_or_update::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = azure_core::to_json(watchlist_item).map_err(create_or_update::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(create_or_update::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(create_or_update::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: WatchlistItem = serde_json::from_slice(rsp_body) + .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(create_or_update::Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = rsp.body(); + let rsp_value: WatchlistItem = serde_json::from_slice(rsp_body) + .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(create_or_update::Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = serde_json::from_slice(rsp_body) + .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; + Err(create_or_update::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod create_or_update { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Ok200(WatchlistItem), + Created201(WatchlistItem), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn delete( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + operational_insights_resource_provider: &str, + workspace_name: &str, + watchlist_alias: &str, + watchlist_item_id: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = & format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/watchlists/{}/watchlistItems/{}" , operation_config . base_path () , subscription_id , resource_group_name , operational_insights_resource_provider , workspace_name , watchlist_alias , watchlist_item_id) ; + let mut url = url::Url::parse(url_str).map_err(delete::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::DELETE); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(delete::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(delete::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(delete::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => Ok(delete::Response::Ok200), + http::StatusCode::NO_CONTENT => Ok(delete::Response::NoContent204), + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = + serde_json::from_slice(rsp_body).map_err(|source| delete::Error::DeserializeError(source, rsp_body.clone()))?; + Err(delete::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod delete { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Ok200, + NoContent204, + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } +} +pub mod entity_queries { + use crate::models::*; + pub async fn list( + operation_config: &crate::OperationConfig, + kind: Option<&str>, + subscription_id: &str, + resource_group_name: &str, + operational_insights_resource_provider: &str, + workspace_name: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/entityQueries", + operation_config.base_path(), + subscription_id, + resource_group_name, + operational_insights_resource_provider, + workspace_name + ); + let mut url = url::Url::parse(url_str).map_err(list::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(list::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + if let Some(kind) = kind { + url.query_pairs_mut().append_pair("kind", kind); + } + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(list::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(list::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: EntityQueryList = + serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = + serde_json::from_slice(rsp_body).map_err(|source| list::Error::DeserializeError(source, rsp_body.clone()))?; + Err(list::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod list { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn get( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + operational_insights_resource_provider: &str, + workspace_name: &str, + entity_query_id: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/entityQueries/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + operational_insights_resource_provider, + workspace_name, + entity_query_id + ); + let mut url = url::Url::parse(url_str).map_err(get::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::GET); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(get::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(get::Error::BuildRequestError)?; + let rsp = http_client.execute_request(req).await.map_err(get::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: EntityQuery = + serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(rsp_value) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = + serde_json::from_slice(rsp_body).map_err(|source| get::Error::DeserializeError(source, rsp_body.clone()))?; + Err(get::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod get { + use crate::{models, models::*}; + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn create_or_update( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + operational_insights_resource_provider: &str, + workspace_name: &str, + entity_query_id: &str, + entity_query: &CustomEntityQuery, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/entityQueries/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + operational_insights_resource_provider, + workspace_name, + entity_query_id + ); + let mut url = url::Url::parse(url_str).map_err(create_or_update::Error::ParseUrlError)?; + let mut req_builder = http::request::Builder::new(); + req_builder = req_builder.method(http::Method::PUT); + if let Some(token_credential) = operation_config.token_credential() { + let token_response = token_credential + .get_token(operation_config.token_credential_resource()) + .await + .map_err(create_or_update::Error::GetTokenError)?; + req_builder = req_builder.header(http::header::AUTHORIZATION, format!("Bearer {}", token_response.token.secret())); + } + url.query_pairs_mut().append_pair("api-version", operation_config.api_version()); + let req_body = azure_core::to_json(entity_query).map_err(create_or_update::Error::SerializeError)?; + req_builder = req_builder.uri(url.as_str()); + let req = req_builder.body(req_body).map_err(create_or_update::Error::BuildRequestError)?; + let rsp = http_client + .execute_request(req) + .await + .map_err(create_or_update::Error::ExecuteRequestError)?; + match rsp.status() { + http::StatusCode::OK => { + let rsp_body = rsp.body(); + let rsp_value: EntityQuery = serde_json::from_slice(rsp_body) + .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(create_or_update::Response::Ok200(rsp_value)) + } + http::StatusCode::CREATED => { + let rsp_body = rsp.body(); + let rsp_value: EntityQuery = serde_json::from_slice(rsp_body) + .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; + Ok(create_or_update::Response::Created201(rsp_value)) + } + status_code => { + let rsp_body = rsp.body(); + let rsp_value: CloudError = serde_json::from_slice(rsp_body) + .map_err(|source| create_or_update::Error::DeserializeError(source, rsp_body.clone()))?; + Err(create_or_update::Error::DefaultResponse { + status_code, + value: rsp_value, + }) + } + } + } + pub mod create_or_update { + use crate::{models, models::*}; + #[derive(Debug)] + pub enum Response { + Ok200(EntityQuery), + Created201(EntityQuery), + } + #[derive(Debug, thiserror :: Error)] + pub enum Error { + #[error("HTTP status code {}", status_code)] + DefaultResponse { + status_code: http::StatusCode, + value: models::CloudError, + }, + #[error("Failed to parse request URL: {0}")] + ParseUrlError(url::ParseError), + #[error("Failed to build request: {0}")] + BuildRequestError(http::Error), + #[error("Failed to execute request: {0}")] + ExecuteRequestError(azure_core::HttpError), + #[error("Failed to serialize request body: {0}")] + SerializeError(serde_json::Error), + #[error("Failed to deserialize response: {0}, body: {1:?}")] + DeserializeError(serde_json::Error, bytes::Bytes), + #[error("Failed to get access token: {0}")] + GetTokenError(azure_core::Error), + } + } + pub async fn delete( + operation_config: &crate::OperationConfig, + subscription_id: &str, + resource_group_name: &str, + operational_insights_resource_provider: &str, + workspace_name: &str, + entity_query_id: &str, + ) -> std::result::Result { + let http_client = operation_config.http_client(); + let url_str = &format!( + "{}/subscriptions/{}/resourceGroups/{}/providers/{}/workspaces/{}/providers/Microsoft.SecurityInsights/entityQueries/{}", + operation_config.base_path(), + subscription_id, + resource_group_name, + operational_insights_resource_provider, + workspace_name, + entity_query_id + ); let mut url = url::Url::parse(url_str).map_err(delete::Error::ParseUrlError)?; let mut req_builder = http::request::Builder::new(); req_builder = req_builder.method(http::Method::DELETE); diff --git a/services/mgmt/serialconsole/src/lib.rs b/services/mgmt/serialconsole/src/lib.rs index c35008bd15..73d246567b 100644 --- a/services/mgmt/serialconsole/src/lib.rs +++ b/services/mgmt/serialconsole/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-05")] pub use package_2018_05::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/servicebus/src/lib.rs b/services/mgmt/servicebus/src/lib.rs index d69e4c465d..7a9c3532a9 100644 --- a/services/mgmt/servicebus/src/lib.rs +++ b/services/mgmt/servicebus/src/lib.rs @@ -17,7 +17,7 @@ use azure_core::setters; #[cfg(feature = "package-2015-08")] pub use package_2015_08::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -30,7 +30,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -49,7 +49,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -59,7 +59,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/servicefabricmesh/src/lib.rs b/services/mgmt/servicefabricmesh/src/lib.rs index 09777f3aef..81b362a37f 100644 --- a/services/mgmt/servicefabricmesh/src/lib.rs +++ b/services/mgmt/servicefabricmesh/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-07-01-preview")] pub use package_2018_07_01_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/signalr/src/lib.rs b/services/mgmt/signalr/src/lib.rs index 5110220a9c..9134a01d1f 100644 --- a/services/mgmt/signalr/src/lib.rs +++ b/services/mgmt/signalr/src/lib.rs @@ -21,7 +21,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-03-01-preview")] pub use package_2018_03_01_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -34,7 +34,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -53,7 +53,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -63,7 +63,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/softwareplan/src/lib.rs b/services/mgmt/softwareplan/src/lib.rs index e690c23f5f..4b52928c50 100644 --- a/services/mgmt/softwareplan/src/lib.rs +++ b/services/mgmt/softwareplan/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2019-12-01")] pub use package_2019_12_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/sql/src/lib.rs b/services/mgmt/sql/src/lib.rs index 694125e630..b5177626fd 100644 --- a/services/mgmt/sql/src/lib.rs +++ b/services/mgmt/sql/src/lib.rs @@ -33,7 +33,7 @@ use azure_core::setters; #[cfg(feature = "package-2014-04")] pub use package_2014_04::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -46,7 +46,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -65,7 +65,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -75,7 +75,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/sqlvirtualmachine/src/lib.rs b/services/mgmt/sqlvirtualmachine/src/lib.rs index b43a679161..993b25e8e1 100644 --- a/services/mgmt/sqlvirtualmachine/src/lib.rs +++ b/services/mgmt/sqlvirtualmachine/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2017-03-01-preview")] pub use package_2017_03_01_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/stor_simple1200_series/src/lib.rs b/services/mgmt/stor_simple1200_series/src/lib.rs index 5b72980034..9dcfc8d509 100644 --- a/services/mgmt/stor_simple1200_series/src/lib.rs +++ b/services/mgmt/stor_simple1200_series/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2016-10")] pub use package_2016_10::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/storage/examples/storage_account_list.rs b/services/mgmt/storage/examples/storage_account_list.rs index acaa021ebb..1a4e492d04 100644 --- a/services/mgmt/storage/examples/storage_account_list.rs +++ b/services/mgmt/storage/examples/storage_account_list.rs @@ -8,11 +8,9 @@ cargo run --example storage_account_list use azure_identity::token_credentials::AzureCliCredential; use azure_mgmt_storage::operations::storage_accounts; -type Result = std::result::Result>; - #[tokio::main] -async fn main() -> Result<()> { - let http_client: std::sync::Arc> = std::sync::Arc::new(Box::new(reqwest::Client::new())); +async fn main() -> Result<(), Box> { + let http_client = azure_core::new_http_client(); let token_credential = AzureCliCredential {}; let subscription_id = &AzureCliCredential::get_subscription()?; let config = &azure_mgmt_storage::config(http_client, Box::new(token_credential)).build(); diff --git a/services/mgmt/storage/src/lib.rs b/services/mgmt/storage/src/lib.rs index 7576589672..462015791a 100644 --- a/services/mgmt/storage/src/lib.rs +++ b/services/mgmt/storage/src/lib.rs @@ -77,7 +77,7 @@ use azure_core::setters; #[cfg(feature = "profile-hybrid-2020-09-01")] pub use profile_hybrid_2020_09_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -90,7 +90,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -109,7 +109,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -119,7 +119,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/storagecache/src/lib.rs b/services/mgmt/storagecache/src/lib.rs index 1196ff250c..600530a4e5 100644 --- a/services/mgmt/storagecache/src/lib.rs +++ b/services/mgmt/storagecache/src/lib.rs @@ -21,7 +21,7 @@ use azure_core::setters; #[cfg(feature = "package-2019-08")] pub use package_2019_08::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -34,7 +34,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -53,7 +53,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -63,7 +63,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/storageimportexport/src/lib.rs b/services/mgmt/storageimportexport/src/lib.rs index 76b004f939..aa74706ba3 100644 --- a/services/mgmt/storageimportexport/src/lib.rs +++ b/services/mgmt/storageimportexport/src/lib.rs @@ -13,7 +13,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-08")] pub use package_2020_08::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -26,7 +26,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -45,7 +45,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -55,7 +55,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/storagepool/src/lib.rs b/services/mgmt/storagepool/src/lib.rs index 3c7cdebbbd..4a3086f53e 100644 --- a/services/mgmt/storagepool/src/lib.rs +++ b/services/mgmt/storagepool/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-03-15-preview")] pub use package_2020_03_15_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/storagesync/src/lib.rs b/services/mgmt/storagesync/src/lib.rs index b895c3138f..5c40ee5204 100644 --- a/services/mgmt/storagesync/src/lib.rs +++ b/services/mgmt/storagesync/src/lib.rs @@ -41,7 +41,7 @@ use azure_core::setters; #[cfg(feature = "package-2017-06-05-preview")] pub use package_2017_06_05_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -54,7 +54,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -73,7 +73,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -83,7 +83,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/storsimple8000series/src/lib.rs b/services/mgmt/storsimple8000series/src/lib.rs index 54223b527c..74bbd57ee7 100644 --- a/services/mgmt/storsimple8000series/src/lib.rs +++ b/services/mgmt/storsimple8000series/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2017-06")] pub use package_2017_06::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/streamanalytics/src/lib.rs b/services/mgmt/streamanalytics/src/lib.rs index 5d4f28aca8..b5f35df947 100644 --- a/services/mgmt/streamanalytics/src/lib.rs +++ b/services/mgmt/streamanalytics/src/lib.rs @@ -17,7 +17,7 @@ use azure_core::setters; #[cfg(feature = "package-pure-2016-03")] pub use package_pure_2016_03::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -30,7 +30,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -49,7 +49,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -59,7 +59,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/subscription/src/lib.rs b/services/mgmt/subscription/src/lib.rs index 2e07278ea6..4b11654519 100644 --- a/services/mgmt/subscription/src/lib.rs +++ b/services/mgmt/subscription/src/lib.rs @@ -29,7 +29,7 @@ use azure_core::setters; #[cfg(feature = "package-2017-11-preview")] pub use package_2017_11_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -42,7 +42,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -61,7 +61,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -71,7 +71,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/support/src/lib.rs b/services/mgmt/support/src/lib.rs index e4208d8faf..950459b025 100644 --- a/services/mgmt/support/src/lib.rs +++ b/services/mgmt/support/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2019-05-preview")] pub use package_2019_05_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/testbase/src/lib.rs b/services/mgmt/testbase/src/lib.rs index 42c111d786..8e593cd657 100644 --- a/services/mgmt/testbase/src/lib.rs +++ b/services/mgmt/testbase/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-12-16-preview")] pub use package_2020_12_16_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/timeseriesinsights/src/lib.rs b/services/mgmt/timeseriesinsights/src/lib.rs index de376f50f3..92fa6473da 100644 --- a/services/mgmt/timeseriesinsights/src/lib.rs +++ b/services/mgmt/timeseriesinsights/src/lib.rs @@ -17,7 +17,7 @@ use azure_core::setters; #[cfg(feature = "package-2017-02-preview")] pub use package_2017_02_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -30,7 +30,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -49,7 +49,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -59,7 +59,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/trafficmanager/src/lib.rs b/services/mgmt/trafficmanager/src/lib.rs index d17a3da830..6b2520a137 100644 --- a/services/mgmt/trafficmanager/src/lib.rs +++ b/services/mgmt/trafficmanager/src/lib.rs @@ -37,7 +37,7 @@ use azure_core::setters; #[cfg(feature = "package-2015-11")] pub use package_2015_11::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -50,7 +50,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -69,7 +69,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -79,7 +79,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/videoanalyzer/src/lib.rs b/services/mgmt/videoanalyzer/src/lib.rs index bcf10ec7f3..2983587a04 100644 --- a/services/mgmt/videoanalyzer/src/lib.rs +++ b/services/mgmt/videoanalyzer/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2021-05-01-preview")] pub use package_2021_05_01_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/visualstudio/src/lib.rs b/services/mgmt/visualstudio/src/lib.rs index 5e7d216db3..f3ea9346f1 100644 --- a/services/mgmt/visualstudio/src/lib.rs +++ b/services/mgmt/visualstudio/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2014-04-preview")] pub use package_2014_04_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/vmware/examples/vmware_private_cloud_list.rs b/services/mgmt/vmware/examples/vmware_private_cloud_list.rs index 348b18b865..5c6d2e6769 100644 --- a/services/mgmt/vmware/examples/vmware_private_cloud_list.rs +++ b/services/mgmt/vmware/examples/vmware_private_cloud_list.rs @@ -13,11 +13,9 @@ cargo run --example vmware_private_cloud_list use azure_identity::token_credentials::AzureCliCredential; use azure_mgmt_vmware::operations::private_clouds; -type Result = std::result::Result>; - #[tokio::main] -async fn main() -> Result<()> { - let http_client: std::sync::Arc> = std::sync::Arc::new(Box::new(reqwest::Client::new())); +async fn main() -> Result<(), Box> { + let http_client = azure_core::new_http_client(); let token_credential = AzureCliCredential {}; let subscription_id = &AzureCliCredential::get_subscription()?; let config = &azure_mgmt_vmware::config(http_client, Box::new(token_credential)).build(); diff --git a/services/mgmt/vmware/src/lib.rs b/services/mgmt/vmware/src/lib.rs index f7ee7807c6..06f34f7fea 100644 --- a/services/mgmt/vmware/src/lib.rs +++ b/services/mgmt/vmware/src/lib.rs @@ -17,7 +17,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-03-20")] pub use package_2020_03_20::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -30,7 +30,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -49,7 +49,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -59,7 +59,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/vmware/src/package_2021_06_01/models.rs b/services/mgmt/vmware/src/package_2021_06_01/models.rs index 9033e0610b..e4210032af 100644 --- a/services/mgmt/vmware/src/package_2021_06_01/models.rs +++ b/services/mgmt/vmware/src/package_2021_06_01/models.rs @@ -285,8 +285,6 @@ pub struct PrivateCloudProperties { pub endpoints: Option, #[serde(rename = "networkBlock")] pub network_block: String, - #[serde(rename = "externalCloudLinks", skip_serializing)] - pub external_cloud_links: Vec, #[serde(rename = "managementNetwork", skip_serializing)] pub management_network: Option, #[serde(rename = "provisioningNetwork", skip_serializing)] @@ -301,6 +299,8 @@ pub struct PrivateCloudProperties { pub vcenter_certificate_thumbprint: Option, #[serde(rename = "nsxtCertificateThumbprint", skip_serializing)] pub nsxt_certificate_thumbprint: Option, + #[serde(rename = "externalCloudLinks", skip_serializing)] + pub external_cloud_links: Vec, } pub mod private_cloud_properties { use super::*; @@ -343,10 +343,10 @@ pub enum ClusterProvisioningState { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct CommonClusterProperties { - #[serde(rename = "provisioningState", skip_serializing)] - pub provisioning_state: Option, #[serde(rename = "clusterSize", default, skip_serializing_if = "Option::is_none")] pub cluster_size: Option, + #[serde(rename = "provisioningState", skip_serializing)] + pub provisioning_state: Option, #[serde(rename = "clusterId", skip_serializing)] pub cluster_id: Option, #[serde(skip_serializing)] diff --git a/services/mgmt/vmwarecloudsimple/src/lib.rs b/services/mgmt/vmwarecloudsimple/src/lib.rs index fc0f821fe5..ef5ce01339 100644 --- a/services/mgmt/vmwarecloudsimple/src/lib.rs +++ b/services/mgmt/vmwarecloudsimple/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2019-04-01")] pub use package_2019_04_01::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/webpubsub/src/lib.rs b/services/mgmt/webpubsub/src/lib.rs index 049901ea05..5a0042bde0 100644 --- a/services/mgmt/webpubsub/src/lib.rs +++ b/services/mgmt/webpubsub/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2021-04-01-preview")] pub use package_2021_04_01_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/windowsesu/src/lib.rs b/services/mgmt/windowsesu/src/lib.rs index ed04bfcb45..5eedda8662 100644 --- a/services/mgmt/windowsesu/src/lib.rs +++ b/services/mgmt/windowsesu/src/lib.rs @@ -5,7 +5,7 @@ use azure_core::setters; #[cfg(feature = "package-2019-09-16-preview")] pub use package_2019_09_16_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -18,7 +18,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -37,7 +37,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -47,7 +47,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/windowsiot/src/lib.rs b/services/mgmt/windowsiot/src/lib.rs index ae57af72d4..d15b2b65be 100644 --- a/services/mgmt/windowsiot/src/lib.rs +++ b/services/mgmt/windowsiot/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2018-02-preview")] pub use package_2018_02_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() diff --git a/services/mgmt/workloadmonitor/src/lib.rs b/services/mgmt/workloadmonitor/src/lib.rs index b4d82bcf03..136baf9422 100644 --- a/services/mgmt/workloadmonitor/src/lib.rs +++ b/services/mgmt/workloadmonitor/src/lib.rs @@ -9,7 +9,7 @@ use azure_core::setters; #[cfg(feature = "package-2020-01-13-preview")] pub use package_2020_01_13_preview::{models, operations, API_VERSION}; pub fn config( - http_client: std::sync::Arc>, + http_client: std::sync::Arc, token_credential: Box, ) -> OperationConfigBuilder { OperationConfigBuilder { @@ -22,7 +22,7 @@ pub fn config( } pub struct OperationConfigBuilder { api_version: Option, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: Option, token_credential: Box, token_credential_resource: Option, @@ -41,7 +41,7 @@ impl OperationConfigBuilder { } pub struct OperationConfig { api_version: String, - http_client: std::sync::Arc>, + http_client: std::sync::Arc, base_path: String, token_credential: Option>, token_credential_resource: String, @@ -51,7 +51,7 @@ impl OperationConfig { self.api_version.as_str() } pub fn http_client(&self) -> &dyn azure_core::HttpClient { - self.http_client.as_ref().as_ref() + self.http_client.as_ref() } pub fn base_path(&self) -> &str { self.base_path.as_str() From de1eeb4934b95b21aa1cef6531d986d5a6006027 Mon Sep 17 00:00:00 2001 From: Cameron Taggart Date: Mon, 31 May 2021 10:42:43 -0700 Subject: [PATCH 5/5] quality instead of use --- sdk/cosmos/examples/permission_00.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sdk/cosmos/examples/permission_00.rs b/sdk/cosmos/examples/permission_00.rs index c6f646afb9..6c51b9f055 100644 --- a/sdk/cosmos/examples/permission_00.rs +++ b/sdk/cosmos/examples/permission_00.rs @@ -1,4 +1,3 @@ -use azure_core::new_http_client; use azure_cosmos::prelude::*; use std::error::Error; @@ -25,7 +24,7 @@ async fn main() -> Result<(), Box> { let authorization_token = AuthorizationToken::primary_from_base64(&master_key)?; - let http_client = new_http_client(); + let http_client = azure_core::new_http_client(); let client = CosmosClient::new(http_client, account.clone(), authorization_token); let database_client = client.into_database_client(database_name);