#![allow(unused_mut)] #![allow(unused_variables)] #![allow(unused_imports)] #![allow(clippy::redundant_clone)] pub mod models; #[derive(Clone)] pub struct Client { endpoint: azure_core::Url, credential: std::sync::Arc, scopes: Vec, pipeline: azure_core::Pipeline, } #[derive(Clone)] pub struct ClientBuilder { credential: std::sync::Arc, endpoint: Option, scopes: Option>, options: azure_core::ClientOptions, } pub use azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD as DEFAULT_ENDPOINT; impl ClientBuilder { #[doc = "Create a new instance of `ClientBuilder`."] #[must_use] pub fn new(credential: std::sync::Arc) -> Self { Self { credential, endpoint: None, scopes: None, options: azure_core::ClientOptions::default(), } } #[doc = "Set the endpoint."] #[must_use] pub fn endpoint(mut self, endpoint: impl Into) -> Self { self.endpoint = Some(endpoint.into()); self } #[doc = "Set the scopes."] #[must_use] pub fn scopes(mut self, scopes: &[&str]) -> Self { self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect()); self } #[doc = "Set the retry options."] #[must_use] pub fn retry(mut self, retry: impl Into) -> Self { self.options = self.options.retry(retry); self } #[doc = "Set the transport options."] #[must_use] pub fn transport(mut self, transport: impl Into) -> Self { self.options = self.options.transport(transport); self } #[doc = "Convert the builder into a `Client` instance."] pub fn build(self) -> azure_core::Result { let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned()); let scopes = if let Some(scopes) = self.scopes { scopes } else { vec![endpoint.join(azure_core::auth::DEFAULT_SCOPE_SUFFIX)?.to_string()] }; Ok(Client::new(endpoint, self.credential, scopes, self.options)) } } impl Client { pub(crate) async fn bearer_token(&self) -> azure_core::Result { let credential = self.token_credential(); let response = credential.get_token(&self.scopes()).await?; Ok(response.token) } pub(crate) fn endpoint(&self) -> &azure_core::Url { &self.endpoint } pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential { self.credential.as_ref() } pub(crate) fn scopes(&self) -> Vec<&str> { self.scopes.iter().map(String::as_str).collect() } pub(crate) async fn send(&self, request: &mut azure_core::Request) -> azure_core::Result { let context = azure_core::Context::default(); self.pipeline.send(&context, request).await } #[doc = "Create a new `ClientBuilder`."] #[must_use] pub fn builder(credential: std::sync::Arc) -> ClientBuilder { ClientBuilder::new(credential) } #[doc = "Create a new `Client`."] #[must_use] pub fn new( endpoint: impl Into, credential: std::sync::Arc, scopes: Vec, options: azure_core::ClientOptions, ) -> Self { let endpoint = endpoint.into(); let pipeline = azure_core::Pipeline::new( option_env!("CARGO_PKG_NAME"), option_env!("CARGO_PKG_VERSION"), options, Vec::new(), Vec::new(), ); Self { endpoint, credential, scopes, pipeline, } } pub fn availability_sets_client(&self) -> availability_sets::Client { availability_sets::Client(self.clone()) } pub fn clouds_client(&self) -> clouds::Client { clouds::Client(self.clone()) } pub fn guest_agents_client(&self) -> guest_agents::Client { guest_agents::Client(self.clone()) } pub fn hybrid_identity_metadatas_client(&self) -> hybrid_identity_metadatas::Client { hybrid_identity_metadatas::Client(self.clone()) } pub fn inventory_items_client(&self) -> inventory_items::Client { inventory_items::Client(self.clone()) } pub fn machine_extensions_client(&self) -> machine_extensions::Client { machine_extensions::Client(self.clone()) } pub fn operations_client(&self) -> operations::Client { operations::Client(self.clone()) } pub fn virtual_machine_instance_hybrid_identity_metadata_client(&self) -> virtual_machine_instance_hybrid_identity_metadata::Client { virtual_machine_instance_hybrid_identity_metadata::Client(self.clone()) } pub fn virtual_machine_instances_client(&self) -> virtual_machine_instances::Client { virtual_machine_instances::Client(self.clone()) } pub fn virtual_machine_templates_client(&self) -> virtual_machine_templates::Client { virtual_machine_templates::Client(self.clone()) } pub fn virtual_machines_client(&self) -> virtual_machines::Client { virtual_machines::Client(self.clone()) } pub fn virtual_networks_client(&self) -> virtual_networks::Client { virtual_networks::Client(self.clone()) } pub fn vm_instance_guest_agents_client(&self) -> vm_instance_guest_agents::Client { vm_instance_guest_agents::Client(self.clone()) } pub fn vmm_servers_client(&self) -> vmm_servers::Client { vmm_servers::Client(self.clone()) } } pub mod vmm_servers { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; pub struct Client(pub(crate) super::Client); impl Client { #[doc = "Gets a VMMServer."] #[doc = "Implements VMMServer GET method."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `vmm_server_name`: Name of the VMMServer."] pub fn get( &self, subscription_id: impl Into, resource_group_name: impl Into, vmm_server_name: impl Into, ) -> get::RequestBuilder { get::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), vmm_server_name: vmm_server_name.into(), } } #[doc = "Implements VmmServers PUT method."] #[doc = "Onboards the SCVMM fabric as an Azure VmmServer resource."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `vmm_server_name`: Name of the VMMServer."] #[doc = "* `body`: Request payload."] pub fn create_or_update( &self, subscription_id: impl Into, resource_group_name: impl Into, vmm_server_name: impl Into, body: impl Into, ) -> create_or_update::RequestBuilder { create_or_update::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), vmm_server_name: vmm_server_name.into(), body: body.into(), } } #[doc = "Implements VmmServers PATCH method."] #[doc = "Updates the VmmServers resource."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `vmm_server_name`: Name of the VMMServer."] #[doc = "* `body`: VmmServers patch payload."] pub fn update( &self, resource_group_name: impl Into, subscription_id: impl Into, vmm_server_name: impl Into, body: impl Into, ) -> update::RequestBuilder { update::RequestBuilder { client: self.0.clone(), resource_group_name: resource_group_name.into(), subscription_id: subscription_id.into(), vmm_server_name: vmm_server_name.into(), body: body.into(), } } #[doc = "Implements VmmServers DELETE method."] #[doc = "Deboards the SCVMM fabric from Azure."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `vmm_server_name`: Name of the VMMServer."] pub fn delete( &self, subscription_id: impl Into, resource_group_name: impl Into, vmm_server_name: impl Into, ) -> delete::RequestBuilder { delete::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), vmm_server_name: vmm_server_name.into(), force: None, } } #[doc = "Implements GET VmmServers in a resource group."] #[doc = "List of VmmServers in a resource group."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] pub fn list_by_resource_group( &self, subscription_id: impl Into, resource_group_name: impl Into, ) -> list_by_resource_group::RequestBuilder { list_by_resource_group::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), } } #[doc = "Implements GET VmmServers in a subscription."] #[doc = "List of VmmServers in a subscription."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::RequestBuilder { list_by_subscription::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), } } } pub mod get { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::VmmServer = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) vmm_server_name: String, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/vmmServers/{}", &self.subscription_id, &self.resource_group_name, &self.vmm_server_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that sends the request and returns the parsed response body."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { self.send().await?.into_body().await }) } } } pub mod create_or_update { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::VmmServer = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) vmm_server_name: String, pub(crate) body: models::VmmServer, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Put); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); req.insert_header("content-type", "application/json"); let req_body = azure_core::to_json(&this.body)?; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/vmmServers/{}", &self.subscription_id, &self.resource_group_name, &self.vmm_server_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that polls the long running operation, returning once the operation completes."] #[doc = ""] #[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { use azure_core::{ error::{Error, ErrorKind}, lro::{ get_retry_after, location::{get_location, get_provisioning_state, FinalState}, LroStatus, }, sleep::sleep, }; use std::time::Duration; let this = self.clone(); let response = this.send().await?; let headers = response.as_raw_response().headers(); let location = get_location(headers, FinalState::AzureAsyncOperation)?; if let Some(url) = location { loop { let mut req = azure_core::Request::new(url.clone(), azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; let headers = response.headers(); let retry_after = get_retry_after(headers); let bytes = response.into_body().collect().await?; let provisioning_state = get_provisioning_state(&bytes).ok_or_else(|| { Error::message( ErrorKind::Other, "Long running operation failed (missing provisioning state)".to_string(), ) })?; log::trace!("current provisioning_state: {provisioning_state:?}"); match provisioning_state { LroStatus::Succeeded => { let mut req = azure_core::Request::new(self.url()?, azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; return Response(response).into_body().await; } LroStatus::Failed => { return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())) } LroStatus::Canceled => { return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string())) } _ => { sleep(retry_after).await; } } } } else { response.into_body().await } }) } } } pub mod update { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::VmmServer = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) subscription_id: String, pub(crate) vmm_server_name: String, pub(crate) body: models::ResourcePatch, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Patch); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); req.insert_header("content-type", "application/json"); let req_body = azure_core::to_json(&this.body)?; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/vmmServers/{}", &self.subscription_id, &self.resource_group_name, &self.vmm_server_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that polls the long running operation, returning once the operation completes."] #[doc = ""] #[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { use azure_core::{ error::{Error, ErrorKind}, lro::{ get_retry_after, location::{get_location, get_provisioning_state, FinalState}, LroStatus, }, sleep::sleep, }; use std::time::Duration; let this = self.clone(); let response = this.send().await?; let headers = response.as_raw_response().headers(); let location = get_location(headers, FinalState::AzureAsyncOperation)?; if let Some(url) = location { loop { let mut req = azure_core::Request::new(url.clone(), azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; let headers = response.headers(); let retry_after = get_retry_after(headers); let bytes = response.into_body().collect().await?; let provisioning_state = get_provisioning_state(&bytes).ok_or_else(|| { Error::message( ErrorKind::Other, "Long running operation failed (missing provisioning state)".to_string(), ) })?; log::trace!("current provisioning_state: {provisioning_state:?}"); match provisioning_state { LroStatus::Succeeded => { let mut req = azure_core::Request::new(self.url()?, azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; return Response(response).into_body().await; } LroStatus::Failed => { return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())) } LroStatus::Canceled => { return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string())) } _ => { sleep(retry_after).await; } } } } else { response.into_body().await } }) } } } pub mod delete { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) vmm_server_name: String, pub(crate) force: Option, } impl RequestBuilder { #[doc = "Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted too."] pub fn force(mut self, force: bool) -> Self { self.force = Some(force); self } #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Delete); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); if let Some(force) = &this.force { req.url_mut().query_pairs_mut().append_pair("force", &force.to_string()); } let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/vmmServers/{}", &self.subscription_id, &self.resource_group_name, &self.vmm_server_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } pub mod list_by_resource_group { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::VmmServerListResult = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, } impl RequestBuilder { pub fn into_stream(self) -> azure_core::Pageable { let make_request = move |continuation: Option| { let this = self.clone(); async move { let mut url = this.url()?; let rsp = match continuation { Some(value) => { url.set_path(""); url = url.join(&value)?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let has_api_version_already = req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { req.url_mut() .query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } None => { let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } }; let rsp = match rsp.status() { azure_core::StatusCode::Ok => Ok(Response(rsp)), status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse { status: status_code, error_code: None, })), }; rsp?.into_body().await } }; azure_core::Pageable::new(make_request) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/vmmServers", &self.subscription_id, &self.resource_group_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } pub mod list_by_subscription { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::VmmServerListResult = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, } impl RequestBuilder { pub fn into_stream(self) -> azure_core::Pageable { let make_request = move |continuation: Option| { let this = self.clone(); async move { let mut url = this.url()?; let rsp = match continuation { Some(value) => { url.set_path(""); url = url.join(&value)?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let has_api_version_already = req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { req.url_mut() .query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } None => { let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } }; let rsp = match rsp.status() { azure_core::StatusCode::Ok => Ok(Response(rsp)), status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse { status: status_code, error_code: None, })), }; rsp?.into_body().await } }; azure_core::Pageable::new(make_request) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/providers/Microsoft.ScVmm/vmmServers", &self.subscription_id )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } } pub mod operations { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; pub struct Client(pub(crate) super::Client); impl Client { #[doc = "Returns list of all operations."] pub fn list(&self) -> list::RequestBuilder { list::RequestBuilder { client: self.0.clone() } } } pub mod list { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::ResourceProviderOperationList = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, } impl RequestBuilder { pub fn into_stream(self) -> azure_core::Pageable { let make_request = move |continuation: Option| { let this = self.clone(); async move { let mut url = this.url()?; let rsp = match continuation { Some(value) => { url.set_path(""); url = url.join(&value)?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let has_api_version_already = req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { req.url_mut() .query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } None => { let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } }; let rsp = match rsp.status() { azure_core::StatusCode::Ok => Ok(Response(rsp)), status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse { status: status_code, error_code: None, })), }; rsp?.into_body().await } }; azure_core::Pageable::new(make_request) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path("/providers/Microsoft.ScVmm/operations"); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } } pub mod clouds { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; pub struct Client(pub(crate) super::Client); impl Client { #[doc = "Gets a Cloud."] #[doc = "Implements Cloud GET method."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `cloud_name`: Name of the Cloud."] pub fn get( &self, subscription_id: impl Into, resource_group_name: impl Into, cloud_name: impl Into, ) -> get::RequestBuilder { get::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), cloud_name: cloud_name.into(), } } #[doc = "Implements Clouds PUT method."] #[doc = "Onboards the ScVmm fabric cloud as an Azure cloud resource."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `cloud_name`: Name of the Cloud."] #[doc = "* `body`: Request payload."] pub fn create_or_update( &self, subscription_id: impl Into, resource_group_name: impl Into, cloud_name: impl Into, body: impl Into, ) -> create_or_update::RequestBuilder { create_or_update::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), cloud_name: cloud_name.into(), body: body.into(), } } #[doc = "Implements the Clouds PATCH method."] #[doc = "Updates the Clouds resource."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `cloud_name`: Name of the Cloud."] #[doc = "* `body`: Clouds patch payload."] pub fn update( &self, resource_group_name: impl Into, subscription_id: impl Into, cloud_name: impl Into, body: impl Into, ) -> update::RequestBuilder { update::RequestBuilder { client: self.0.clone(), resource_group_name: resource_group_name.into(), subscription_id: subscription_id.into(), cloud_name: cloud_name.into(), body: body.into(), } } #[doc = "Implements Cloud resource DELETE method."] #[doc = "Deregisters the ScVmm fabric cloud from Azure."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `cloud_name`: Name of the Cloud."] pub fn delete( &self, subscription_id: impl Into, resource_group_name: impl Into, cloud_name: impl Into, ) -> delete::RequestBuilder { delete::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), cloud_name: cloud_name.into(), force: None, } } #[doc = "Implements GET Clouds in a resource group."] #[doc = "List of Clouds in a resource group."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] pub fn list_by_resource_group( &self, subscription_id: impl Into, resource_group_name: impl Into, ) -> list_by_resource_group::RequestBuilder { list_by_resource_group::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), } } #[doc = "Implements GET Clouds in a subscription."] #[doc = "List of Clouds in a subscription."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::RequestBuilder { list_by_subscription::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), } } } pub mod get { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::Cloud = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) cloud_name: String, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/clouds/{}", &self.subscription_id, &self.resource_group_name, &self.cloud_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that sends the request and returns the parsed response body."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { self.send().await?.into_body().await }) } } } pub mod create_or_update { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::Cloud = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) cloud_name: String, pub(crate) body: models::Cloud, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Put); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); req.insert_header("content-type", "application/json"); let req_body = azure_core::to_json(&this.body)?; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/clouds/{}", &self.subscription_id, &self.resource_group_name, &self.cloud_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that polls the long running operation, returning once the operation completes."] #[doc = ""] #[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { use azure_core::{ error::{Error, ErrorKind}, lro::{ get_retry_after, location::{get_location, get_provisioning_state, FinalState}, LroStatus, }, sleep::sleep, }; use std::time::Duration; let this = self.clone(); let response = this.send().await?; let headers = response.as_raw_response().headers(); let location = get_location(headers, FinalState::AzureAsyncOperation)?; if let Some(url) = location { loop { let mut req = azure_core::Request::new(url.clone(), azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; let headers = response.headers(); let retry_after = get_retry_after(headers); let bytes = response.into_body().collect().await?; let provisioning_state = get_provisioning_state(&bytes).ok_or_else(|| { Error::message( ErrorKind::Other, "Long running operation failed (missing provisioning state)".to_string(), ) })?; log::trace!("current provisioning_state: {provisioning_state:?}"); match provisioning_state { LroStatus::Succeeded => { let mut req = azure_core::Request::new(self.url()?, azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; return Response(response).into_body().await; } LroStatus::Failed => { return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())) } LroStatus::Canceled => { return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string())) } _ => { sleep(retry_after).await; } } } } else { response.into_body().await } }) } } } pub mod update { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::Cloud = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) subscription_id: String, pub(crate) cloud_name: String, pub(crate) body: models::ResourcePatch, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Patch); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); req.insert_header("content-type", "application/json"); let req_body = azure_core::to_json(&this.body)?; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/clouds/{}", &self.subscription_id, &self.resource_group_name, &self.cloud_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that polls the long running operation, returning once the operation completes."] #[doc = ""] #[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { use azure_core::{ error::{Error, ErrorKind}, lro::{ get_retry_after, location::{get_location, get_provisioning_state, FinalState}, LroStatus, }, sleep::sleep, }; use std::time::Duration; let this = self.clone(); let response = this.send().await?; let headers = response.as_raw_response().headers(); let location = get_location(headers, FinalState::AzureAsyncOperation)?; if let Some(url) = location { loop { let mut req = azure_core::Request::new(url.clone(), azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; let headers = response.headers(); let retry_after = get_retry_after(headers); let bytes = response.into_body().collect().await?; let provisioning_state = get_provisioning_state(&bytes).ok_or_else(|| { Error::message( ErrorKind::Other, "Long running operation failed (missing provisioning state)".to_string(), ) })?; log::trace!("current provisioning_state: {provisioning_state:?}"); match provisioning_state { LroStatus::Succeeded => { let mut req = azure_core::Request::new(self.url()?, azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; return Response(response).into_body().await; } LroStatus::Failed => { return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())) } LroStatus::Canceled => { return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string())) } _ => { sleep(retry_after).await; } } } } else { response.into_body().await } }) } } } pub mod delete { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) cloud_name: String, pub(crate) force: Option, } impl RequestBuilder { #[doc = "Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted too."] pub fn force(mut self, force: bool) -> Self { self.force = Some(force); self } #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Delete); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); if let Some(force) = &this.force { req.url_mut().query_pairs_mut().append_pair("force", &force.to_string()); } let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/clouds/{}", &self.subscription_id, &self.resource_group_name, &self.cloud_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } pub mod list_by_resource_group { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::CloudListResult = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, } impl RequestBuilder { pub fn into_stream(self) -> azure_core::Pageable { let make_request = move |continuation: Option| { let this = self.clone(); async move { let mut url = this.url()?; let rsp = match continuation { Some(value) => { url.set_path(""); url = url.join(&value)?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let has_api_version_already = req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { req.url_mut() .query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } None => { let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } }; let rsp = match rsp.status() { azure_core::StatusCode::Ok => Ok(Response(rsp)), status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse { status: status_code, error_code: None, })), }; rsp?.into_body().await } }; azure_core::Pageable::new(make_request) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/clouds", &self.subscription_id, &self.resource_group_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } pub mod list_by_subscription { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::CloudListResult = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, } impl RequestBuilder { pub fn into_stream(self) -> azure_core::Pageable { let make_request = move |continuation: Option| { let this = self.clone(); async move { let mut url = this.url()?; let rsp = match continuation { Some(value) => { url.set_path(""); url = url.join(&value)?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let has_api_version_already = req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { req.url_mut() .query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } None => { let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } }; let rsp = match rsp.status() { azure_core::StatusCode::Ok => Ok(Response(rsp)), status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse { status: status_code, error_code: None, })), }; rsp?.into_body().await } }; azure_core::Pageable::new(make_request) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/providers/Microsoft.ScVmm/clouds", &self.subscription_id )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } } pub mod virtual_networks { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; pub struct Client(pub(crate) super::Client); impl Client { #[doc = "Gets a VirtualNetwork."] #[doc = "Implements VirtualNetwork GET method."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `virtual_network_name`: Name of the VirtualNetwork."] pub fn get( &self, subscription_id: impl Into, resource_group_name: impl Into, virtual_network_name: impl Into, ) -> get::RequestBuilder { get::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), virtual_network_name: virtual_network_name.into(), } } #[doc = "Implements VirtualNetworks PUT method."] #[doc = "Onboards the ScVmm virtual network as an Azure virtual network resource."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `virtual_network_name`: Name of the VirtualNetwork."] #[doc = "* `body`: Request payload."] pub fn create_or_update( &self, subscription_id: impl Into, resource_group_name: impl Into, virtual_network_name: impl Into, body: impl Into, ) -> create_or_update::RequestBuilder { create_or_update::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), virtual_network_name: virtual_network_name.into(), body: body.into(), } } #[doc = "Implements the VirtualNetworks PATCH method."] #[doc = "Updates the VirtualNetworks resource."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `virtual_network_name`: Name of the VirtualNetwork."] #[doc = "* `body`: VirtualNetworks patch payload."] pub fn update( &self, resource_group_name: impl Into, subscription_id: impl Into, virtual_network_name: impl Into, body: impl Into, ) -> update::RequestBuilder { update::RequestBuilder { client: self.0.clone(), resource_group_name: resource_group_name.into(), subscription_id: subscription_id.into(), virtual_network_name: virtual_network_name.into(), body: body.into(), } } #[doc = "Implements VirtualNetwork DELETE method."] #[doc = "Deregisters the ScVmm virtual network from Azure."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `virtual_network_name`: Name of the VirtualNetwork."] pub fn delete( &self, subscription_id: impl Into, resource_group_name: impl Into, virtual_network_name: impl Into, ) -> delete::RequestBuilder { delete::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), virtual_network_name: virtual_network_name.into(), force: None, } } #[doc = "Implements GET VirtualNetworks in a resource group."] #[doc = "List of VirtualNetworks in a resource group."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] pub fn list_by_resource_group( &self, subscription_id: impl Into, resource_group_name: impl Into, ) -> list_by_resource_group::RequestBuilder { list_by_resource_group::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), } } #[doc = "Implements GET VirtualNetworks in a subscription."] #[doc = "List of VirtualNetworks in a subscription."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::RequestBuilder { list_by_subscription::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), } } } pub mod get { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::VirtualNetwork = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) virtual_network_name: String, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualNetworks/{}", &self.subscription_id, &self.resource_group_name, &self.virtual_network_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that sends the request and returns the parsed response body."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { self.send().await?.into_body().await }) } } } pub mod create_or_update { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::VirtualNetwork = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) virtual_network_name: String, pub(crate) body: models::VirtualNetwork, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Put); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); req.insert_header("content-type", "application/json"); let req_body = azure_core::to_json(&this.body)?; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualNetworks/{}", &self.subscription_id, &self.resource_group_name, &self.virtual_network_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that polls the long running operation, returning once the operation completes."] #[doc = ""] #[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { use azure_core::{ error::{Error, ErrorKind}, lro::{ get_retry_after, location::{get_location, get_provisioning_state, FinalState}, LroStatus, }, sleep::sleep, }; use std::time::Duration; let this = self.clone(); let response = this.send().await?; let headers = response.as_raw_response().headers(); let location = get_location(headers, FinalState::AzureAsyncOperation)?; if let Some(url) = location { loop { let mut req = azure_core::Request::new(url.clone(), azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; let headers = response.headers(); let retry_after = get_retry_after(headers); let bytes = response.into_body().collect().await?; let provisioning_state = get_provisioning_state(&bytes).ok_or_else(|| { Error::message( ErrorKind::Other, "Long running operation failed (missing provisioning state)".to_string(), ) })?; log::trace!("current provisioning_state: {provisioning_state:?}"); match provisioning_state { LroStatus::Succeeded => { let mut req = azure_core::Request::new(self.url()?, azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; return Response(response).into_body().await; } LroStatus::Failed => { return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())) } LroStatus::Canceled => { return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string())) } _ => { sleep(retry_after).await; } } } } else { response.into_body().await } }) } } } pub mod update { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::VirtualNetwork = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) subscription_id: String, pub(crate) virtual_network_name: String, pub(crate) body: models::ResourcePatch, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Patch); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); req.insert_header("content-type", "application/json"); let req_body = azure_core::to_json(&this.body)?; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualNetworks/{}", &self.subscription_id, &self.resource_group_name, &self.virtual_network_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that polls the long running operation, returning once the operation completes."] #[doc = ""] #[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { use azure_core::{ error::{Error, ErrorKind}, lro::{ get_retry_after, location::{get_location, get_provisioning_state, FinalState}, LroStatus, }, sleep::sleep, }; use std::time::Duration; let this = self.clone(); let response = this.send().await?; let headers = response.as_raw_response().headers(); let location = get_location(headers, FinalState::AzureAsyncOperation)?; if let Some(url) = location { loop { let mut req = azure_core::Request::new(url.clone(), azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; let headers = response.headers(); let retry_after = get_retry_after(headers); let bytes = response.into_body().collect().await?; let provisioning_state = get_provisioning_state(&bytes).ok_or_else(|| { Error::message( ErrorKind::Other, "Long running operation failed (missing provisioning state)".to_string(), ) })?; log::trace!("current provisioning_state: {provisioning_state:?}"); match provisioning_state { LroStatus::Succeeded => { let mut req = azure_core::Request::new(self.url()?, azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; return Response(response).into_body().await; } LroStatus::Failed => { return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())) } LroStatus::Canceled => { return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string())) } _ => { sleep(retry_after).await; } } } } else { response.into_body().await } }) } } } pub mod delete { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) virtual_network_name: String, pub(crate) force: Option, } impl RequestBuilder { #[doc = "Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted too."] pub fn force(mut self, force: bool) -> Self { self.force = Some(force); self } #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Delete); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); if let Some(force) = &this.force { req.url_mut().query_pairs_mut().append_pair("force", &force.to_string()); } let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualNetworks/{}", &self.subscription_id, &self.resource_group_name, &self.virtual_network_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } pub mod list_by_resource_group { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::VirtualNetworkListResult = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, } impl RequestBuilder { pub fn into_stream(self) -> azure_core::Pageable { let make_request = move |continuation: Option| { let this = self.clone(); async move { let mut url = this.url()?; let rsp = match continuation { Some(value) => { url.set_path(""); url = url.join(&value)?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let has_api_version_already = req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { req.url_mut() .query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } None => { let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } }; let rsp = match rsp.status() { azure_core::StatusCode::Ok => Ok(Response(rsp)), status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse { status: status_code, error_code: None, })), }; rsp?.into_body().await } }; azure_core::Pageable::new(make_request) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualNetworks", &self.subscription_id, &self.resource_group_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } pub mod list_by_subscription { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::VirtualNetworkListResult = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, } impl RequestBuilder { pub fn into_stream(self) -> azure_core::Pageable { let make_request = move |continuation: Option| { let this = self.clone(); async move { let mut url = this.url()?; let rsp = match continuation { Some(value) => { url.set_path(""); url = url.join(&value)?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let has_api_version_already = req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { req.url_mut() .query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } None => { let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } }; let rsp = match rsp.status() { azure_core::StatusCode::Ok => Ok(Response(rsp)), status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse { status: status_code, error_code: None, })), }; rsp?.into_body().await } }; azure_core::Pageable::new(make_request) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/providers/Microsoft.ScVmm/virtualNetworks", &self.subscription_id )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } } pub mod virtual_machines { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; pub struct Client(pub(crate) super::Client); impl Client { #[doc = "Gets a VirtualMachine."] #[doc = "Implements VirtualMachine GET method."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `virtual_machine_name`: Name of the VirtualMachine."] pub fn get( &self, subscription_id: impl Into, resource_group_name: impl Into, virtual_machine_name: impl Into, ) -> get::RequestBuilder { get::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), virtual_machine_name: virtual_machine_name.into(), } } #[doc = "Implements VirtualMachines PUT method."] #[doc = "Creates Or Updates virtual machines deployed on scvmm fabric."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `virtual_machine_name`: Name of the VirtualMachine."] #[doc = "* `body`: Request payload."] pub fn create_or_update( &self, subscription_id: impl Into, resource_group_name: impl Into, virtual_machine_name: impl Into, body: impl Into, ) -> create_or_update::RequestBuilder { create_or_update::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), virtual_machine_name: virtual_machine_name.into(), body: body.into(), } } #[doc = "Implements the VirtualMachines PATCH method."] #[doc = "Updates the VirtualMachines resource."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `virtual_machine_name`: Name of the VirtualMachine."] #[doc = "* `body`: VirtualMachines patch payload."] pub fn update( &self, resource_group_name: impl Into, subscription_id: impl Into, virtual_machine_name: impl Into, body: impl Into, ) -> update::RequestBuilder { update::RequestBuilder { client: self.0.clone(), resource_group_name: resource_group_name.into(), subscription_id: subscription_id.into(), virtual_machine_name: virtual_machine_name.into(), body: body.into(), } } #[doc = "Implements VirtualMachine DELETE method."] #[doc = "Deletes a VirtualMachine deployed on ScVmm fabric."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `virtual_machine_name`: Name of the VirtualMachine."] pub fn delete( &self, subscription_id: impl Into, resource_group_name: impl Into, virtual_machine_name: impl Into, ) -> delete::RequestBuilder { delete::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), virtual_machine_name: virtual_machine_name.into(), retain: None, force: None, delete_from_host: None, } } #[doc = "Implements the operation to stop a virtual machine."] #[doc = "Stop virtual machine."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `virtual_machine_name`: Name of the VirtualMachine."] pub fn stop( &self, resource_group_name: impl Into, subscription_id: impl Into, virtual_machine_name: impl Into, ) -> stop::RequestBuilder { stop::RequestBuilder { client: self.0.clone(), resource_group_name: resource_group_name.into(), subscription_id: subscription_id.into(), virtual_machine_name: virtual_machine_name.into(), body: None, } } #[doc = "Implements the operation to start a virtual machine."] #[doc = "Start virtual machine."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `virtual_machine_name`: Name of the VirtualMachine."] pub fn start( &self, resource_group_name: impl Into, subscription_id: impl Into, virtual_machine_name: impl Into, ) -> start::RequestBuilder { start::RequestBuilder { client: self.0.clone(), resource_group_name: resource_group_name.into(), subscription_id: subscription_id.into(), virtual_machine_name: virtual_machine_name.into(), } } #[doc = "Implements the operation to restart a virtual machine."] #[doc = "Restart virtual machine."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `virtual_machine_name`: Name of the VirtualMachine."] pub fn restart( &self, resource_group_name: impl Into, subscription_id: impl Into, virtual_machine_name: impl Into, ) -> restart::RequestBuilder { restart::RequestBuilder { client: self.0.clone(), resource_group_name: resource_group_name.into(), subscription_id: subscription_id.into(), virtual_machine_name: virtual_machine_name.into(), } } #[doc = "Implements the operation to creates a checkpoint in a virtual machine."] #[doc = "Creates a checkpoint in virtual machine."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `virtual_machine_name`: Name of the VirtualMachine."] pub fn create_checkpoint( &self, resource_group_name: impl Into, subscription_id: impl Into, virtual_machine_name: impl Into, ) -> create_checkpoint::RequestBuilder { create_checkpoint::RequestBuilder { client: self.0.clone(), resource_group_name: resource_group_name.into(), subscription_id: subscription_id.into(), virtual_machine_name: virtual_machine_name.into(), body: None, } } #[doc = "Implements the operation to delete a checkpoint in a virtual machine."] #[doc = "Deletes a checkpoint in virtual machine."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `virtual_machine_name`: Name of the VirtualMachine."] pub fn delete_checkpoint( &self, resource_group_name: impl Into, subscription_id: impl Into, virtual_machine_name: impl Into, ) -> delete_checkpoint::RequestBuilder { delete_checkpoint::RequestBuilder { client: self.0.clone(), resource_group_name: resource_group_name.into(), subscription_id: subscription_id.into(), virtual_machine_name: virtual_machine_name.into(), body: None, } } #[doc = "Implements the operation to restores to a checkpoint in a virtual machine."] #[doc = "Restores to a checkpoint in virtual machine."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `virtual_machine_name`: Name of the VirtualMachine."] pub fn restore_checkpoint( &self, resource_group_name: impl Into, subscription_id: impl Into, virtual_machine_name: impl Into, ) -> restore_checkpoint::RequestBuilder { restore_checkpoint::RequestBuilder { client: self.0.clone(), resource_group_name: resource_group_name.into(), subscription_id: subscription_id.into(), virtual_machine_name: virtual_machine_name.into(), body: None, } } #[doc = "Implements GET VirtualMachines in a resource group."] #[doc = "List of VirtualMachines in a resource group."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] pub fn list_by_resource_group( &self, subscription_id: impl Into, resource_group_name: impl Into, ) -> list_by_resource_group::RequestBuilder { list_by_resource_group::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), } } #[doc = "Implements GET VirtualMachines in a subscription."] #[doc = "List of VirtualMachines in a subscription."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::RequestBuilder { list_by_subscription::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), } } } pub mod get { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::VirtualMachine = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) virtual_machine_name: String, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}", &self.subscription_id, &self.resource_group_name, &self.virtual_machine_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that sends the request and returns the parsed response body."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { self.send().await?.into_body().await }) } } } pub mod create_or_update { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::VirtualMachine = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) virtual_machine_name: String, pub(crate) body: models::VirtualMachine, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Put); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); req.insert_header("content-type", "application/json"); let req_body = azure_core::to_json(&this.body)?; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}", &self.subscription_id, &self.resource_group_name, &self.virtual_machine_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that polls the long running operation, returning once the operation completes."] #[doc = ""] #[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { use azure_core::{ error::{Error, ErrorKind}, lro::{ get_retry_after, location::{get_location, get_provisioning_state, FinalState}, LroStatus, }, sleep::sleep, }; use std::time::Duration; let this = self.clone(); let response = this.send().await?; let headers = response.as_raw_response().headers(); let location = get_location(headers, FinalState::AzureAsyncOperation)?; if let Some(url) = location { loop { let mut req = azure_core::Request::new(url.clone(), azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; let headers = response.headers(); let retry_after = get_retry_after(headers); let bytes = response.into_body().collect().await?; let provisioning_state = get_provisioning_state(&bytes).ok_or_else(|| { Error::message( ErrorKind::Other, "Long running operation failed (missing provisioning state)".to_string(), ) })?; log::trace!("current provisioning_state: {provisioning_state:?}"); match provisioning_state { LroStatus::Succeeded => { let mut req = azure_core::Request::new(self.url()?, azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; return Response(response).into_body().await; } LroStatus::Failed => { return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())) } LroStatus::Canceled => { return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string())) } _ => { sleep(retry_after).await; } } } } else { response.into_body().await } }) } } } pub mod update { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::VirtualMachine = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) subscription_id: String, pub(crate) virtual_machine_name: String, pub(crate) body: models::VirtualMachineUpdate, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Patch); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); req.insert_header("content-type", "application/json"); let req_body = azure_core::to_json(&this.body)?; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}", &self.subscription_id, &self.resource_group_name, &self.virtual_machine_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that polls the long running operation, returning once the operation completes."] #[doc = ""] #[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { use azure_core::{ error::{Error, ErrorKind}, lro::{ get_retry_after, location::{get_location, get_provisioning_state, FinalState}, LroStatus, }, sleep::sleep, }; use std::time::Duration; let this = self.clone(); let response = this.send().await?; let headers = response.as_raw_response().headers(); let location = get_location(headers, FinalState::AzureAsyncOperation)?; if let Some(url) = location { loop { let mut req = azure_core::Request::new(url.clone(), azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; let headers = response.headers(); let retry_after = get_retry_after(headers); let bytes = response.into_body().collect().await?; let provisioning_state = get_provisioning_state(&bytes).ok_or_else(|| { Error::message( ErrorKind::Other, "Long running operation failed (missing provisioning state)".to_string(), ) })?; log::trace!("current provisioning_state: {provisioning_state:?}"); match provisioning_state { LroStatus::Succeeded => { let mut req = azure_core::Request::new(self.url()?, azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; return Response(response).into_body().await; } LroStatus::Failed => { return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())) } LroStatus::Canceled => { return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string())) } _ => { sleep(retry_after).await; } } } } else { response.into_body().await } }) } } } pub mod delete { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) virtual_machine_name: String, pub(crate) retain: Option, pub(crate) force: Option, pub(crate) delete_from_host: Option, } impl RequestBuilder { #[doc = "Whether to just disable the VM from azure and retain the VM in the VMM."] pub fn retain(mut self, retain: bool) -> Self { self.retain = Some(retain); self } #[doc = "Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted too."] pub fn force(mut self, force: bool) -> Self { self.force = Some(force); self } #[doc = "Whether to disable the VM from azure and also delete it from VMM."] pub fn delete_from_host(mut self, delete_from_host: bool) -> Self { self.delete_from_host = Some(delete_from_host); self } #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Delete); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); if let Some(retain) = &this.retain { req.url_mut().query_pairs_mut().append_pair("retain", &retain.to_string()); } if let Some(force) = &this.force { req.url_mut().query_pairs_mut().append_pair("force", &force.to_string()); } if let Some(delete_from_host) = &this.delete_from_host { req.url_mut() .query_pairs_mut() .append_pair("deleteFromHost", &delete_from_host.to_string()); } let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}", &self.subscription_id, &self.resource_group_name, &self.virtual_machine_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } pub mod stop { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) subscription_id: String, pub(crate) virtual_machine_name: String, pub(crate) body: Option, } impl RequestBuilder { #[doc = "Virtualmachine stop action payload."] pub fn body(mut self, body: impl Into) -> Self { self.body = Some(body.into()); self } #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Post); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = if let Some(body) = &this.body { req.insert_header("content-type", "application/json"); azure_core::to_json(body)? } else { azure_core::EMPTY_BODY }; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}/stop", &self.subscription_id, &self.resource_group_name, &self.virtual_machine_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } pub mod start { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) subscription_id: String, pub(crate) virtual_machine_name: String, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Post); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.insert_header(azure_core::headers::CONTENT_LENGTH, "0"); req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}/start", &self.subscription_id, &self.resource_group_name, &self.virtual_machine_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } pub mod restart { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) subscription_id: String, pub(crate) virtual_machine_name: String, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Post); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.insert_header(azure_core::headers::CONTENT_LENGTH, "0"); req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}/restart", &self.subscription_id, &self.resource_group_name, &self.virtual_machine_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } pub mod create_checkpoint { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) subscription_id: String, pub(crate) virtual_machine_name: String, pub(crate) body: Option, } impl RequestBuilder { #[doc = "Virtualmachine create checkpoint action payload."] pub fn body(mut self, body: impl Into) -> Self { self.body = Some(body.into()); self } #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Post); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = if let Some(body) = &this.body { req.insert_header("content-type", "application/json"); azure_core::to_json(body)? } else { azure_core::EMPTY_BODY }; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}/createCheckpoint", &self.subscription_id, &self.resource_group_name, &self.virtual_machine_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } pub mod delete_checkpoint { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) subscription_id: String, pub(crate) virtual_machine_name: String, pub(crate) body: Option, } impl RequestBuilder { #[doc = "Virtualmachine delete checkpoint action payload."] pub fn body(mut self, body: impl Into) -> Self { self.body = Some(body.into()); self } #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Post); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = if let Some(body) = &this.body { req.insert_header("content-type", "application/json"); azure_core::to_json(body)? } else { azure_core::EMPTY_BODY }; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}/deleteCheckpoint", &self.subscription_id, &self.resource_group_name, &self.virtual_machine_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } pub mod restore_checkpoint { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) subscription_id: String, pub(crate) virtual_machine_name: String, pub(crate) body: Option, } impl RequestBuilder { #[doc = "Virtualmachine restore checkpoint action payload."] pub fn body(mut self, body: impl Into) -> Self { self.body = Some(body.into()); self } #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Post); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = if let Some(body) = &this.body { req.insert_header("content-type", "application/json"); azure_core::to_json(body)? } else { azure_core::EMPTY_BODY }; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}/restoreCheckpoint", &self.subscription_id, &self.resource_group_name, &self.virtual_machine_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } pub mod list_by_resource_group { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::VirtualMachineListResult = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, } impl RequestBuilder { pub fn into_stream(self) -> azure_core::Pageable { let make_request = move |continuation: Option| { let this = self.clone(); async move { let mut url = this.url()?; let rsp = match continuation { Some(value) => { url.set_path(""); url = url.join(&value)?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let has_api_version_already = req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { req.url_mut() .query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } None => { let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } }; let rsp = match rsp.status() { azure_core::StatusCode::Ok => Ok(Response(rsp)), status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse { status: status_code, error_code: None, })), }; rsp?.into_body().await } }; azure_core::Pageable::new(make_request) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines", &self.subscription_id, &self.resource_group_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } pub mod list_by_subscription { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::VirtualMachineListResult = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, } impl RequestBuilder { pub fn into_stream(self) -> azure_core::Pageable { let make_request = move |continuation: Option| { let this = self.clone(); async move { let mut url = this.url()?; let rsp = match continuation { Some(value) => { url.set_path(""); url = url.join(&value)?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let has_api_version_already = req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { req.url_mut() .query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } None => { let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } }; let rsp = match rsp.status() { azure_core::StatusCode::Ok => Ok(Response(rsp)), status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse { status: status_code, error_code: None, })), }; rsp?.into_body().await } }; azure_core::Pageable::new(make_request) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/providers/Microsoft.ScVmm/virtualMachines", &self.subscription_id )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } } pub mod virtual_machine_templates { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; pub struct Client(pub(crate) super::Client); impl Client { #[doc = "Gets a VirtualMachineTemplate."] #[doc = "Implements VirtualMachineTemplate GET method."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `virtual_machine_template_name`: Name of the VirtualMachineTemplate."] pub fn get( &self, subscription_id: impl Into, resource_group_name: impl Into, virtual_machine_template_name: impl Into, ) -> get::RequestBuilder { get::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), virtual_machine_template_name: virtual_machine_template_name.into(), } } #[doc = "Implements VirtualMachineTemplates PUT method."] #[doc = "Onboards the ScVmm VM Template as an Azure VM Template resource."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `virtual_machine_template_name`: Name of the VirtualMachineTemplate."] #[doc = "* `body`: Request payload."] pub fn create_or_update( &self, subscription_id: impl Into, resource_group_name: impl Into, virtual_machine_template_name: impl Into, body: impl Into, ) -> create_or_update::RequestBuilder { create_or_update::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), virtual_machine_template_name: virtual_machine_template_name.into(), body: body.into(), } } #[doc = "Implements the VirtualMachineTemplate PATCH method."] #[doc = "Updates the VirtualMachineTemplate resource."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `virtual_machine_template_name`: Name of the VirtualMachineTemplate."] #[doc = "* `body`: VirtualMachineTemplates patch details."] pub fn update( &self, resource_group_name: impl Into, subscription_id: impl Into, virtual_machine_template_name: impl Into, body: impl Into, ) -> update::RequestBuilder { update::RequestBuilder { client: self.0.clone(), resource_group_name: resource_group_name.into(), subscription_id: subscription_id.into(), virtual_machine_template_name: virtual_machine_template_name.into(), body: body.into(), } } #[doc = "Implements VirtualMachineTemplate DELETE method."] #[doc = "Deregisters the ScVmm VM Template from Azure."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `virtual_machine_template_name`: Name of the VirtualMachineTemplate."] pub fn delete( &self, subscription_id: impl Into, resource_group_name: impl Into, virtual_machine_template_name: impl Into, ) -> delete::RequestBuilder { delete::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), virtual_machine_template_name: virtual_machine_template_name.into(), force: None, } } #[doc = "Implements GET VirtualMachineTemplates in a resource group."] #[doc = "List of VirtualMachineTemplates in a resource group."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] pub fn list_by_resource_group( &self, subscription_id: impl Into, resource_group_name: impl Into, ) -> list_by_resource_group::RequestBuilder { list_by_resource_group::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), } } #[doc = "Implements GET VirtualMachineTemplates in a subscription."] #[doc = "List of VirtualMachineTemplates in a subscription."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::RequestBuilder { list_by_subscription::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), } } } pub mod get { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::VirtualMachineTemplate = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) virtual_machine_template_name: String, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachineTemplates/{}", &self.subscription_id, &self.resource_group_name, &self.virtual_machine_template_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that sends the request and returns the parsed response body."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { self.send().await?.into_body().await }) } } } pub mod create_or_update { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::VirtualMachineTemplate = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) virtual_machine_template_name: String, pub(crate) body: models::VirtualMachineTemplate, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Put); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); req.insert_header("content-type", "application/json"); let req_body = azure_core::to_json(&this.body)?; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachineTemplates/{}", &self.subscription_id, &self.resource_group_name, &self.virtual_machine_template_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that polls the long running operation, returning once the operation completes."] #[doc = ""] #[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { use azure_core::{ error::{Error, ErrorKind}, lro::{ get_retry_after, location::{get_location, get_provisioning_state, FinalState}, LroStatus, }, sleep::sleep, }; use std::time::Duration; let this = self.clone(); let response = this.send().await?; let headers = response.as_raw_response().headers(); let location = get_location(headers, FinalState::AzureAsyncOperation)?; if let Some(url) = location { loop { let mut req = azure_core::Request::new(url.clone(), azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; let headers = response.headers(); let retry_after = get_retry_after(headers); let bytes = response.into_body().collect().await?; let provisioning_state = get_provisioning_state(&bytes).ok_or_else(|| { Error::message( ErrorKind::Other, "Long running operation failed (missing provisioning state)".to_string(), ) })?; log::trace!("current provisioning_state: {provisioning_state:?}"); match provisioning_state { LroStatus::Succeeded => { let mut req = azure_core::Request::new(self.url()?, azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; return Response(response).into_body().await; } LroStatus::Failed => { return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())) } LroStatus::Canceled => { return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string())) } _ => { sleep(retry_after).await; } } } } else { response.into_body().await } }) } } } pub mod update { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::VirtualMachineTemplate = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) subscription_id: String, pub(crate) virtual_machine_template_name: String, pub(crate) body: models::ResourcePatch, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Patch); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); req.insert_header("content-type", "application/json"); let req_body = azure_core::to_json(&this.body)?; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachineTemplates/{}", &self.subscription_id, &self.resource_group_name, &self.virtual_machine_template_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that polls the long running operation, returning once the operation completes."] #[doc = ""] #[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { use azure_core::{ error::{Error, ErrorKind}, lro::{ get_retry_after, location::{get_location, get_provisioning_state, FinalState}, LroStatus, }, sleep::sleep, }; use std::time::Duration; let this = self.clone(); let response = this.send().await?; let headers = response.as_raw_response().headers(); let location = get_location(headers, FinalState::AzureAsyncOperation)?; if let Some(url) = location { loop { let mut req = azure_core::Request::new(url.clone(), azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; let headers = response.headers(); let retry_after = get_retry_after(headers); let bytes = response.into_body().collect().await?; let provisioning_state = get_provisioning_state(&bytes).ok_or_else(|| { Error::message( ErrorKind::Other, "Long running operation failed (missing provisioning state)".to_string(), ) })?; log::trace!("current provisioning_state: {provisioning_state:?}"); match provisioning_state { LroStatus::Succeeded => { let mut req = azure_core::Request::new(self.url()?, azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; return Response(response).into_body().await; } LroStatus::Failed => { return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())) } LroStatus::Canceled => { return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string())) } _ => { sleep(retry_after).await; } } } } else { response.into_body().await } }) } } } pub mod delete { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) virtual_machine_template_name: String, pub(crate) force: Option, } impl RequestBuilder { #[doc = "Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted too."] pub fn force(mut self, force: bool) -> Self { self.force = Some(force); self } #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Delete); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); if let Some(force) = &this.force { req.url_mut().query_pairs_mut().append_pair("force", &force.to_string()); } let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachineTemplates/{}", &self.subscription_id, &self.resource_group_name, &self.virtual_machine_template_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } pub mod list_by_resource_group { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::VirtualMachineTemplateListResult = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, } impl RequestBuilder { pub fn into_stream(self) -> azure_core::Pageable { let make_request = move |continuation: Option| { let this = self.clone(); async move { let mut url = this.url()?; let rsp = match continuation { Some(value) => { url.set_path(""); url = url.join(&value)?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let has_api_version_already = req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { req.url_mut() .query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } None => { let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } }; let rsp = match rsp.status() { azure_core::StatusCode::Ok => Ok(Response(rsp)), status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse { status: status_code, error_code: None, })), }; rsp?.into_body().await } }; azure_core::Pageable::new(make_request) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachineTemplates", &self.subscription_id, &self.resource_group_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } pub mod list_by_subscription { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::VirtualMachineTemplateListResult = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, } impl RequestBuilder { pub fn into_stream(self) -> azure_core::Pageable { let make_request = move |continuation: Option| { let this = self.clone(); async move { let mut url = this.url()?; let rsp = match continuation { Some(value) => { url.set_path(""); url = url.join(&value)?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let has_api_version_already = req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { req.url_mut() .query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } None => { let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } }; let rsp = match rsp.status() { azure_core::StatusCode::Ok => Ok(Response(rsp)), status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse { status: status_code, error_code: None, })), }; rsp?.into_body().await } }; azure_core::Pageable::new(make_request) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/providers/Microsoft.ScVmm/virtualMachineTemplates", &self.subscription_id )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } } pub mod availability_sets { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; pub struct Client(pub(crate) super::Client); impl Client { #[doc = "Gets an AvailabilitySet."] #[doc = "Implements AvailabilitySet GET method."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `availability_set_name`: Name of the AvailabilitySet."] pub fn get( &self, subscription_id: impl Into, resource_group_name: impl Into, availability_set_name: impl Into, ) -> get::RequestBuilder { get::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), availability_set_name: availability_set_name.into(), } } #[doc = "Implements AvailabilitySets PUT method."] #[doc = "Onboards the ScVmm availability set as an Azure resource."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `availability_set_name`: Name of the AvailabilitySet."] #[doc = "* `body`: Request payload."] pub fn create_or_update( &self, subscription_id: impl Into, resource_group_name: impl Into, availability_set_name: impl Into, body: impl Into, ) -> create_or_update::RequestBuilder { create_or_update::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), availability_set_name: availability_set_name.into(), body: body.into(), } } #[doc = "Implements the AvailabilitySets PATCH method."] #[doc = "Updates the AvailabilitySets resource."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `availability_set_name`: Name of the AvailabilitySet."] #[doc = "* `body`: AvailabilitySets patch payload."] pub fn update( &self, resource_group_name: impl Into, subscription_id: impl Into, availability_set_name: impl Into, body: impl Into, ) -> update::RequestBuilder { update::RequestBuilder { client: self.0.clone(), resource_group_name: resource_group_name.into(), subscription_id: subscription_id.into(), availability_set_name: availability_set_name.into(), body: body.into(), } } #[doc = "Implements AvailabilitySet DELETE method."] #[doc = "Deregisters the ScVmm availability set from Azure."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `availability_set_name`: Name of the AvailabilitySet."] pub fn delete( &self, subscription_id: impl Into, resource_group_name: impl Into, availability_set_name: impl Into, ) -> delete::RequestBuilder { delete::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), availability_set_name: availability_set_name.into(), force: None, } } #[doc = "Implements GET AvailabilitySets in a resource group."] #[doc = "List of AvailabilitySets in a resource group."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] pub fn list_by_resource_group( &self, subscription_id: impl Into, resource_group_name: impl Into, ) -> list_by_resource_group::RequestBuilder { list_by_resource_group::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), } } #[doc = "Implements GET AvailabilitySets in a subscription."] #[doc = "List of AvailabilitySets in a subscription."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] pub fn list_by_subscription(&self, subscription_id: impl Into) -> list_by_subscription::RequestBuilder { list_by_subscription::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), } } } pub mod get { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::AvailabilitySet = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) availability_set_name: String, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/availabilitySets/{}", &self.subscription_id, &self.resource_group_name, &self.availability_set_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that sends the request and returns the parsed response body."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { self.send().await?.into_body().await }) } } } pub mod create_or_update { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::AvailabilitySet = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } pub fn headers(&self) -> Headers { Headers(self.0.headers()) } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } pub struct Headers<'a>(&'a azure_core::headers::Headers); impl<'a> Headers<'a> { #[doc = "Tracking URL for long running operation."] pub fn azure_async_operation(&self) -> azure_core::Result<&str> { self.0 .get_str(&azure_core::headers::HeaderName::from_static("azure-asyncoperation")) } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) availability_set_name: String, pub(crate) body: models::AvailabilitySet, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Put); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); req.insert_header("content-type", "application/json"); let req_body = azure_core::to_json(&this.body)?; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/availabilitySets/{}", &self.subscription_id, &self.resource_group_name, &self.availability_set_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that polls the long running operation, returning once the operation completes."] #[doc = ""] #[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { use azure_core::{ error::{Error, ErrorKind}, lro::{ get_retry_after, location::{get_location, get_provisioning_state, FinalState}, LroStatus, }, sleep::sleep, }; use std::time::Duration; let this = self.clone(); let response = this.send().await?; let headers = response.as_raw_response().headers(); let location = get_location(headers, FinalState::AzureAsyncOperation)?; if let Some(url) = location { loop { let mut req = azure_core::Request::new(url.clone(), azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; let headers = response.headers(); let retry_after = get_retry_after(headers); let bytes = response.into_body().collect().await?; let provisioning_state = get_provisioning_state(&bytes).ok_or_else(|| { Error::message( ErrorKind::Other, "Long running operation failed (missing provisioning state)".to_string(), ) })?; log::trace!("current provisioning_state: {provisioning_state:?}"); match provisioning_state { LroStatus::Succeeded => { let mut req = azure_core::Request::new(self.url()?, azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; return Response(response).into_body().await; } LroStatus::Failed => { return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())) } LroStatus::Canceled => { return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string())) } _ => { sleep(retry_after).await; } } } } else { response.into_body().await } }) } } } pub mod update { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::AvailabilitySet = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) resource_group_name: String, pub(crate) subscription_id: String, pub(crate) availability_set_name: String, pub(crate) body: models::ResourcePatch, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Patch); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); req.insert_header("content-type", "application/json"); let req_body = azure_core::to_json(&this.body)?; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/availabilitySets/{}", &self.subscription_id, &self.resource_group_name, &self.availability_set_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that polls the long running operation, returning once the operation completes."] #[doc = ""] #[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { use azure_core::{ error::{Error, ErrorKind}, lro::{ get_retry_after, location::{get_location, get_provisioning_state, FinalState}, LroStatus, }, sleep::sleep, }; use std::time::Duration; let this = self.clone(); let response = this.send().await?; let headers = response.as_raw_response().headers(); let location = get_location(headers, FinalState::AzureAsyncOperation)?; if let Some(url) = location { loop { let mut req = azure_core::Request::new(url.clone(), azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; let headers = response.headers(); let retry_after = get_retry_after(headers); let bytes = response.into_body().collect().await?; let provisioning_state = get_provisioning_state(&bytes).ok_or_else(|| { Error::message( ErrorKind::Other, "Long running operation failed (missing provisioning state)".to_string(), ) })?; log::trace!("current provisioning_state: {provisioning_state:?}"); match provisioning_state { LroStatus::Succeeded => { let mut req = azure_core::Request::new(self.url()?, azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; return Response(response).into_body().await; } LroStatus::Failed => { return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())) } LroStatus::Canceled => { return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string())) } _ => { sleep(retry_after).await; } } } } else { response.into_body().await } }) } } } pub mod delete { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } pub fn headers(&self) -> Headers { Headers(self.0.headers()) } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } pub struct Headers<'a>(&'a azure_core::headers::Headers); impl<'a> Headers<'a> { #[doc = "Tracking URL for long running operation."] pub fn azure_async_operation(&self) -> azure_core::Result<&str> { self.0 .get_str(&azure_core::headers::HeaderName::from_static("azure-asyncoperation")) } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) availability_set_name: String, pub(crate) force: Option, } impl RequestBuilder { #[doc = "Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted too."] pub fn force(mut self, force: bool) -> Self { self.force = Some(force); self } #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Delete); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); if let Some(force) = &this.force { req.url_mut().query_pairs_mut().append_pair("force", &force.to_string()); } let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/availabilitySets/{}", &self.subscription_id, &self.resource_group_name, &self.availability_set_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } pub mod list_by_resource_group { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::AvailabilitySetListResult = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, } impl RequestBuilder { pub fn into_stream(self) -> azure_core::Pageable { let make_request = move |continuation: Option| { let this = self.clone(); async move { let mut url = this.url()?; let rsp = match continuation { Some(value) => { url.set_path(""); url = url.join(&value)?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let has_api_version_already = req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { req.url_mut() .query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } None => { let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } }; let rsp = match rsp.status() { azure_core::StatusCode::Ok => Ok(Response(rsp)), status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse { status: status_code, error_code: None, })), }; rsp?.into_body().await } }; azure_core::Pageable::new(make_request) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/availabilitySets", &self.subscription_id, &self.resource_group_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } pub mod list_by_subscription { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::AvailabilitySetListResult = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, } impl RequestBuilder { pub fn into_stream(self) -> azure_core::Pageable { let make_request = move |continuation: Option| { let this = self.clone(); async move { let mut url = this.url()?; let rsp = match continuation { Some(value) => { url.set_path(""); url = url.join(&value)?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let has_api_version_already = req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { req.url_mut() .query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } None => { let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } }; let rsp = match rsp.status() { azure_core::StatusCode::Ok => Ok(Response(rsp)), status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse { status: status_code, error_code: None, })), }; rsp?.into_body().await } }; azure_core::Pageable::new(make_request) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/providers/Microsoft.ScVmm/availabilitySets", &self.subscription_id )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } } pub mod inventory_items { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; pub struct Client(pub(crate) super::Client); impl Client { #[doc = "Implements GET InventoryItem method."] #[doc = "Shows an inventory item."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `vmm_server_name`: Name of the VMMServer."] #[doc = "* `inventory_item_name`: Name of the inventoryItem."] pub fn get( &self, subscription_id: impl Into, resource_group_name: impl Into, vmm_server_name: impl Into, inventory_item_name: impl Into, ) -> get::RequestBuilder { get::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), vmm_server_name: vmm_server_name.into(), inventory_item_name: inventory_item_name.into(), } } #[doc = "Implements InventoryItem PUT method."] #[doc = "Create Or Update InventoryItem."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `vmm_server_name`: Name of the VMMServer."] #[doc = "* `inventory_item_name`: Name of the inventoryItem."] pub fn create( &self, subscription_id: impl Into, resource_group_name: impl Into, vmm_server_name: impl Into, inventory_item_name: impl Into, ) -> create::RequestBuilder { create::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), vmm_server_name: vmm_server_name.into(), inventory_item_name: inventory_item_name.into(), body: None, } } #[doc = "Implements inventoryItem DELETE method."] #[doc = "Deletes an inventoryItem."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `vmm_server_name`: Name of the VMMServer."] #[doc = "* `inventory_item_name`: Name of the inventoryItem."] pub fn delete( &self, subscription_id: impl Into, resource_group_name: impl Into, vmm_server_name: impl Into, inventory_item_name: impl Into, ) -> delete::RequestBuilder { delete::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), vmm_server_name: vmm_server_name.into(), inventory_item_name: inventory_item_name.into(), } } #[doc = "Implements GET for the list of Inventory Items in the VMMServer."] #[doc = "Returns the list of inventoryItems in the given VMMServer."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `vmm_server_name`: Name of the VMMServer."] pub fn list_by_vmm_server( &self, subscription_id: impl Into, resource_group_name: impl Into, vmm_server_name: impl Into, ) -> list_by_vmm_server::RequestBuilder { list_by_vmm_server::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), vmm_server_name: vmm_server_name.into(), } } } pub mod get { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::InventoryItem = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) vmm_server_name: String, pub(crate) inventory_item_name: String, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/vmmServers/{}/inventoryItems/{}", &self.subscription_id, &self.resource_group_name, &self.vmm_server_name, &self.inventory_item_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that sends the request and returns the parsed response body."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { self.send().await?.into_body().await }) } } } pub mod create { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::InventoryItem = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) vmm_server_name: String, pub(crate) inventory_item_name: String, pub(crate) body: Option, } impl RequestBuilder { #[doc = "Request payload."] pub fn body(mut self, body: impl Into) -> Self { self.body = Some(body.into()); self } #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Put); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = if let Some(body) = &this.body { req.insert_header("content-type", "application/json"); azure_core::to_json(body)? } else { azure_core::EMPTY_BODY }; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/vmmServers/{}/inventoryItems/{}", &self.subscription_id, &self.resource_group_name, &self.vmm_server_name, &self.inventory_item_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that sends the request and returns the parsed response body."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { self.send().await?.into_body().await }) } } } pub mod delete { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) vmm_server_name: String, pub(crate) inventory_item_name: String, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Delete); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/vmmServers/{}/inventoryItems/{}", &self.subscription_id, &self.resource_group_name, &self.vmm_server_name, &self.inventory_item_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } pub mod list_by_vmm_server { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::InventoryItemsList = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) vmm_server_name: String, } impl RequestBuilder { pub fn into_stream(self) -> azure_core::Pageable { let make_request = move |continuation: Option| { let this = self.clone(); async move { let mut url = this.url()?; let rsp = match continuation { Some(value) => { url.set_path(""); url = url.join(&value)?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let has_api_version_already = req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { req.url_mut() .query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } None => { let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } }; let rsp = match rsp.status() { azure_core::StatusCode::Ok => Ok(Response(rsp)), status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse { status: status_code, error_code: None, })), }; rsp?.into_body().await } }; azure_core::Pageable::new(make_request) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/vmmServers/{}/inventoryItems", &self.subscription_id, &self.resource_group_name, &self.vmm_server_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } } pub mod hybrid_identity_metadatas { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; pub struct Client(pub(crate) super::Client); impl Client { #[doc = "Gets HybridIdentityMetadata."] #[doc = "Implements HybridIdentityMetadata GET method."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `virtual_machine_name`: Name of the vm."] #[doc = "* `metadata_name`: Name of the HybridIdentityMetadata."] pub fn get( &self, subscription_id: impl Into, resource_group_name: impl Into, virtual_machine_name: impl Into, metadata_name: impl Into, ) -> get::RequestBuilder { get::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), virtual_machine_name: virtual_machine_name.into(), metadata_name: metadata_name.into(), } } #[doc = "Implements HybridIdentityMetadata PUT method."] #[doc = "Create Or Update HybridIdentityMetadata."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `virtual_machine_name`: Name of the vm."] #[doc = "* `metadata_name`: Name of the hybridIdentityMetadata."] pub fn create( &self, subscription_id: impl Into, resource_group_name: impl Into, virtual_machine_name: impl Into, metadata_name: impl Into, ) -> create::RequestBuilder { create::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), virtual_machine_name: virtual_machine_name.into(), metadata_name: metadata_name.into(), body: None, } } #[doc = "Deletes an HybridIdentityMetadata."] #[doc = "Implements HybridIdentityMetadata DELETE method."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `virtual_machine_name`: Name of the vm."] #[doc = "* `metadata_name`: Name of the HybridIdentityMetadata."] pub fn delete( &self, subscription_id: impl Into, resource_group_name: impl Into, virtual_machine_name: impl Into, metadata_name: impl Into, ) -> delete::RequestBuilder { delete::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), virtual_machine_name: virtual_machine_name.into(), metadata_name: metadata_name.into(), } } #[doc = "Implements GET HybridIdentityMetadata in a vm."] #[doc = "Returns the list of HybridIdentityMetadata of the given vm."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `virtual_machine_name`: Name of the vm."] pub fn list_by_vm( &self, subscription_id: impl Into, resource_group_name: impl Into, virtual_machine_name: impl Into, ) -> list_by_vm::RequestBuilder { list_by_vm::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), virtual_machine_name: virtual_machine_name.into(), } } } pub mod get { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::HybridIdentityMetadata = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) virtual_machine_name: String, pub(crate) metadata_name: String, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}/hybridIdentityMetadata/{}", &self.subscription_id, &self.resource_group_name, &self.virtual_machine_name, &self.metadata_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that sends the request and returns the parsed response body."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { self.send().await?.into_body().await }) } } } pub mod create { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::HybridIdentityMetadata = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) virtual_machine_name: String, pub(crate) metadata_name: String, pub(crate) body: Option, } impl RequestBuilder { #[doc = "Request payload."] pub fn body(mut self, body: impl Into) -> Self { self.body = Some(body.into()); self } #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Put); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = if let Some(body) = &this.body { req.insert_header("content-type", "application/json"); azure_core::to_json(body)? } else { azure_core::EMPTY_BODY }; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}/hybridIdentityMetadata/{}", &self.subscription_id, &self.resource_group_name, &self.virtual_machine_name, &self.metadata_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that sends the request and returns the parsed response body."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { self.send().await?.into_body().await }) } } } pub mod delete { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) virtual_machine_name: String, pub(crate) metadata_name: String, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Delete); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}/hybridIdentityMetadata/{}", &self.subscription_id, &self.resource_group_name, &self.virtual_machine_name, &self.metadata_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } pub mod list_by_vm { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::HybridIdentityMetadataList = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) virtual_machine_name: String, } impl RequestBuilder { pub fn into_stream(self) -> azure_core::Pageable { let make_request = move |continuation: Option| { let this = self.clone(); async move { let mut url = this.url()?; let rsp = match continuation { Some(value) => { url.set_path(""); url = url.join(&value)?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let has_api_version_already = req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { req.url_mut() .query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } None => { let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } }; let rsp = match rsp.status() { azure_core::StatusCode::Ok => Ok(Response(rsp)), status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse { status: status_code, error_code: None, })), }; rsp?.into_body().await } }; azure_core::Pageable::new(make_request) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}/hybridIdentityMetadata", &self.subscription_id, &self.resource_group_name, &self.virtual_machine_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } } pub mod machine_extensions { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; pub struct Client(pub(crate) super::Client); impl Client { #[doc = "The operation to get the extension."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `virtual_machine_name`: The name of the machine where the extension should be created or updated."] #[doc = "* `extension_name`: The name of the machine extension."] pub fn get( &self, subscription_id: impl Into, resource_group_name: impl Into, virtual_machine_name: impl Into, extension_name: impl Into, ) -> get::RequestBuilder { get::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), virtual_machine_name: virtual_machine_name.into(), extension_name: extension_name.into(), } } #[doc = "The operation to create or update the extension."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `virtual_machine_name`: The name of the machine where the extension should be created or updated."] #[doc = "* `extension_name`: The name of the machine extension."] #[doc = "* `extension_parameters`: Parameters supplied to the Create Machine Extension operation."] pub fn create_or_update( &self, subscription_id: impl Into, resource_group_name: impl Into, virtual_machine_name: impl Into, extension_name: impl Into, extension_parameters: impl Into, ) -> create_or_update::RequestBuilder { create_or_update::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), virtual_machine_name: virtual_machine_name.into(), extension_name: extension_name.into(), extension_parameters: extension_parameters.into(), } } #[doc = "The operation to update the extension."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `virtual_machine_name`: The name of the machine where the extension should be created or updated."] #[doc = "* `extension_name`: The name of the machine extension."] #[doc = "* `extension_parameters`: Parameters supplied to the Create Machine Extension operation."] pub fn update( &self, subscription_id: impl Into, resource_group_name: impl Into, virtual_machine_name: impl Into, extension_name: impl Into, extension_parameters: impl Into, ) -> update::RequestBuilder { update::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), virtual_machine_name: virtual_machine_name.into(), extension_name: extension_name.into(), extension_parameters: extension_parameters.into(), } } #[doc = "The operation to delete the extension."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `virtual_machine_name`: The name of the machine where the extension should be created or updated."] #[doc = "* `extension_name`: The name of the machine extension."] pub fn delete( &self, subscription_id: impl Into, resource_group_name: impl Into, virtual_machine_name: impl Into, extension_name: impl Into, ) -> delete::RequestBuilder { delete::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), virtual_machine_name: virtual_machine_name.into(), extension_name: extension_name.into(), } } #[doc = "The operation to get all extensions of a non-Azure machine"] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `virtual_machine_name`: The name of the machine where the extension should be created or updated."] pub fn list( &self, subscription_id: impl Into, resource_group_name: impl Into, virtual_machine_name: impl Into, ) -> list::RequestBuilder { list::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), virtual_machine_name: virtual_machine_name.into(), expand: None, } } } pub mod get { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::MachineExtension = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) virtual_machine_name: String, pub(crate) extension_name: String, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}/extensions/{}", &self.subscription_id, &self.resource_group_name, &self.virtual_machine_name, &self.extension_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that sends the request and returns the parsed response body."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { self.send().await?.into_body().await }) } } } pub mod create_or_update { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::MachineExtension = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) virtual_machine_name: String, pub(crate) extension_name: String, pub(crate) extension_parameters: models::MachineExtension, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Put); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); req.insert_header("content-type", "application/json"); let req_body = azure_core::to_json(&this.extension_parameters)?; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}/extensions/{}", &self.subscription_id, &self.resource_group_name, &self.virtual_machine_name, &self.extension_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that polls the long running operation, returning once the operation completes."] #[doc = ""] #[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { use azure_core::{ error::{Error, ErrorKind}, lro::{ get_retry_after, location::{get_location, get_provisioning_state, FinalState}, LroStatus, }, sleep::sleep, }; use std::time::Duration; let this = self.clone(); let response = this.send().await?; let headers = response.as_raw_response().headers(); let location = get_location(headers, FinalState::AzureAsyncOperation)?; if let Some(url) = location { loop { let mut req = azure_core::Request::new(url.clone(), azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; let headers = response.headers(); let retry_after = get_retry_after(headers); let bytes = response.into_body().collect().await?; let provisioning_state = get_provisioning_state(&bytes).ok_or_else(|| { Error::message( ErrorKind::Other, "Long running operation failed (missing provisioning state)".to_string(), ) })?; log::trace!("current provisioning_state: {provisioning_state:?}"); match provisioning_state { LroStatus::Succeeded => { let mut req = azure_core::Request::new(self.url()?, azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; return Response(response).into_body().await; } LroStatus::Failed => { return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())) } LroStatus::Canceled => { return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string())) } _ => { sleep(retry_after).await; } } } } else { response.into_body().await } }) } } } pub mod update { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::MachineExtension = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } pub fn headers(&self) -> Headers { Headers(self.0.headers()) } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } pub struct Headers<'a>(&'a azure_core::headers::Headers); impl<'a> Headers<'a> { #[doc = "Tracking URL for long running operation."] pub fn azure_async_operation(&self) -> azure_core::Result<&str> { self.0 .get_str(&azure_core::headers::HeaderName::from_static("azure-asyncoperation")) } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) virtual_machine_name: String, pub(crate) extension_name: String, pub(crate) extension_parameters: models::MachineExtensionUpdate, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Patch); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); req.insert_header("content-type", "application/json"); let req_body = azure_core::to_json(&this.extension_parameters)?; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}/extensions/{}", &self.subscription_id, &self.resource_group_name, &self.virtual_machine_name, &self.extension_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that polls the long running operation and checks for the state via `properties.provisioningState` in the response body."] #[doc = ""] #[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { use azure_core::{ error::{Error, ErrorKind}, lro::{body_content::get_provisioning_state, get_retry_after, LroStatus}, sleep::sleep, }; use std::time::Duration; loop { let this = self.clone(); let response = this.send().await?; let retry_after = get_retry_after(response.as_raw_response().headers()); let status = response.as_raw_response().status(); let body = response.into_body().await?; let provisioning_state = get_provisioning_state(status, &body)?; log::trace!("current provisioning_state: {provisioning_state:?}"); match provisioning_state { LroStatus::Succeeded => return Ok(body), LroStatus::Failed => return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())), LroStatus::Canceled => { return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string())) } _ => { sleep(retry_after).await; } } } }) } } } pub mod delete { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) virtual_machine_name: String, pub(crate) extension_name: String, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Delete); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}/extensions/{}", &self.subscription_id, &self.resource_group_name, &self.virtual_machine_name, &self.extension_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } pub mod list { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::MachineExtensionsListResult = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) virtual_machine_name: String, pub(crate) expand: Option, } impl RequestBuilder { #[doc = "The expand expression to apply on the operation."] pub fn expand(mut self, expand: impl Into) -> Self { self.expand = Some(expand.into()); self } pub fn into_stream(self) -> azure_core::Pageable { let make_request = move |continuation: Option| { let this = self.clone(); async move { let mut url = this.url()?; let rsp = match continuation { Some(value) => { url.set_path(""); url = url.join(&value)?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let has_api_version_already = req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { req.url_mut() .query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } None => { let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); if let Some(expand) = &this.expand { req.url_mut().query_pairs_mut().append_pair("$expand", expand); } let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } }; let rsp = match rsp.status() { azure_core::StatusCode::Ok => Ok(Response(rsp)), status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse { status: status_code, error_code: None, })), }; rsp?.into_body().await } }; azure_core::Pageable::new(make_request) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}/extensions", &self.subscription_id, &self.resource_group_name, &self.virtual_machine_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } } pub mod guest_agents { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; pub struct Client(pub(crate) super::Client); impl Client { #[doc = "Gets GuestAgent."] #[doc = "Implements GuestAgent GET method."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `virtual_machine_name`: Name of the vm."] #[doc = "* `guest_agent_name`: Name of the GuestAgent."] pub fn get( &self, subscription_id: impl Into, resource_group_name: impl Into, virtual_machine_name: impl Into, guest_agent_name: impl Into, ) -> get::RequestBuilder { get::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), virtual_machine_name: virtual_machine_name.into(), guest_agent_name: guest_agent_name.into(), } } #[doc = "Implements GuestAgent PUT method."] #[doc = "Create Or Update GuestAgent."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `virtual_machine_name`: Name of the vm."] #[doc = "* `guest_agent_name`: Name of the guestAgents."] pub fn create( &self, subscription_id: impl Into, resource_group_name: impl Into, virtual_machine_name: impl Into, guest_agent_name: impl Into, ) -> create::RequestBuilder { create::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), virtual_machine_name: virtual_machine_name.into(), guest_agent_name: guest_agent_name.into(), body: None, } } #[doc = "Deletes an GuestAgent."] #[doc = "Implements GuestAgent DELETE method."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `virtual_machine_name`: Name of the vm."] #[doc = "* `guest_agent_name`: Name of the GuestAgent."] pub fn delete( &self, subscription_id: impl Into, resource_group_name: impl Into, virtual_machine_name: impl Into, guest_agent_name: impl Into, ) -> delete::RequestBuilder { delete::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), virtual_machine_name: virtual_machine_name.into(), guest_agent_name: guest_agent_name.into(), } } #[doc = "Implements GET GuestAgent in a vm."] #[doc = "Returns the list of GuestAgent of the given vm."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `subscription_id`: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)."] #[doc = "* `resource_group_name`: The name of the resource group."] #[doc = "* `virtual_machine_name`: Name of the vm."] pub fn list_by_vm( &self, subscription_id: impl Into, resource_group_name: impl Into, virtual_machine_name: impl Into, ) -> list_by_vm::RequestBuilder { list_by_vm::RequestBuilder { client: self.0.clone(), subscription_id: subscription_id.into(), resource_group_name: resource_group_name.into(), virtual_machine_name: virtual_machine_name.into(), } } } pub mod get { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::GuestAgent = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) virtual_machine_name: String, pub(crate) guest_agent_name: String, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}/guestAgents/{}", &self.subscription_id, &self.resource_group_name, &self.virtual_machine_name, &self.guest_agent_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that sends the request and returns the parsed response body."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { self.send().await?.into_body().await }) } } } pub mod create { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::GuestAgent = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) virtual_machine_name: String, pub(crate) guest_agent_name: String, pub(crate) body: Option, } impl RequestBuilder { #[doc = "Request payload."] pub fn body(mut self, body: impl Into) -> Self { self.body = Some(body.into()); self } #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Put); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = if let Some(body) = &this.body { req.insert_header("content-type", "application/json"); azure_core::to_json(body)? } else { azure_core::EMPTY_BODY }; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}/guestAgents/{}", &self.subscription_id, &self.resource_group_name, &self.virtual_machine_name, &self.guest_agent_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that polls the long running operation, returning once the operation completes."] #[doc = ""] #[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { use azure_core::{ error::{Error, ErrorKind}, lro::{ get_retry_after, location::{get_location, get_provisioning_state, FinalState}, LroStatus, }, sleep::sleep, }; use std::time::Duration; let this = self.clone(); let response = this.send().await?; let headers = response.as_raw_response().headers(); let location = get_location(headers, FinalState::AzureAsyncOperation)?; if let Some(url) = location { loop { let mut req = azure_core::Request::new(url.clone(), azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; let headers = response.headers(); let retry_after = get_retry_after(headers); let bytes = response.into_body().collect().await?; let provisioning_state = get_provisioning_state(&bytes).ok_or_else(|| { Error::message( ErrorKind::Other, "Long running operation failed (missing provisioning state)".to_string(), ) })?; log::trace!("current provisioning_state: {provisioning_state:?}"); match provisioning_state { LroStatus::Succeeded => { let mut req = azure_core::Request::new(self.url()?, azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; return Response(response).into_body().await; } LroStatus::Failed => { return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())) } LroStatus::Canceled => { return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string())) } _ => { sleep(retry_after).await; } } } } else { response.into_body().await } }) } } } pub mod delete { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) virtual_machine_name: String, pub(crate) guest_agent_name: String, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Delete); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}/guestAgents/{}", &self.subscription_id, &self.resource_group_name, &self.virtual_machine_name, &self.guest_agent_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } pub mod list_by_vm { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::GuestAgentList = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) subscription_id: String, pub(crate) resource_group_name: String, pub(crate) virtual_machine_name: String, } impl RequestBuilder { pub fn into_stream(self) -> azure_core::Pageable { let make_request = move |continuation: Option| { let this = self.clone(); async move { let mut url = this.url()?; let rsp = match continuation { Some(value) => { url.set_path(""); url = url.join(&value)?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let has_api_version_already = req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { req.url_mut() .query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } None => { let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } }; let rsp = match rsp.status() { azure_core::StatusCode::Ok => Ok(Response(rsp)), status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse { status: status_code, error_code: None, })), }; rsp?.into_body().await } }; azure_core::Pageable::new(make_request) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.ScVmm/virtualMachines/{}/guestAgents", &self.subscription_id, &self.resource_group_name, &self.virtual_machine_name )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } } pub mod virtual_machine_instances { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; pub struct Client(pub(crate) super::Client); impl Client { #[doc = "Gets a virtual machine."] #[doc = "Retrieves information about a virtual machine instance."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `resource_uri`: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended."] pub fn get(&self, resource_uri: impl Into) -> get::RequestBuilder { get::RequestBuilder { client: self.0.clone(), resource_uri: resource_uri.into(), } } #[doc = "Implements virtual machine PUT method."] #[doc = "The operation to create or update a virtual machine instance. Please note some properties can be set only during virtual machine instance creation."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `resource_uri`: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended."] pub fn create_or_update(&self, resource_uri: impl Into) -> create_or_update::RequestBuilder { create_or_update::RequestBuilder { client: self.0.clone(), resource_uri: resource_uri.into(), body: None, } } #[doc = "Updates a virtual machine."] #[doc = "The operation to update a virtual machine instance."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `resource_uri`: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended."] pub fn update(&self, resource_uri: impl Into) -> update::RequestBuilder { update::RequestBuilder { client: self.0.clone(), resource_uri: resource_uri.into(), body: None, } } #[doc = "Deletes an virtual machine."] #[doc = "The operation to delete a virtual machine instance."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `resource_uri`: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended."] pub fn delete(&self, resource_uri: impl Into) -> delete::RequestBuilder { delete::RequestBuilder { client: self.0.clone(), resource_uri: resource_uri.into(), force: None, delete_from_host: None, } } #[doc = "Implements List virtual machine instances."] #[doc = "Lists all of the virtual machine instances within the specified parent resource."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `resource_uri`: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended."] pub fn list(&self, resource_uri: impl Into) -> list::RequestBuilder { list::RequestBuilder { client: self.0.clone(), resource_uri: resource_uri.into(), } } #[doc = "Implements the operation to stop a virtual machine."] #[doc = "The operation to power off (stop) a virtual machine instance."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `resource_uri`: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended."] pub fn stop(&self, resource_uri: impl Into) -> stop::RequestBuilder { stop::RequestBuilder { client: self.0.clone(), resource_uri: resource_uri.into(), body: None, } } #[doc = "Implements the operation to start a virtual machine."] #[doc = "The operation to start a virtual machine instance."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `resource_uri`: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended."] pub fn start(&self, resource_uri: impl Into) -> start::RequestBuilder { start::RequestBuilder { client: self.0.clone(), resource_uri: resource_uri.into(), } } #[doc = "Implements the operation to restart a virtual machine."] #[doc = "The operation to restart a virtual machine instance."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `resource_uri`: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended."] pub fn restart(&self, resource_uri: impl Into) -> restart::RequestBuilder { restart::RequestBuilder { client: self.0.clone(), resource_uri: resource_uri.into(), } } #[doc = "Implements the operation to creates a checkpoint in a virtual machine instance."] #[doc = "Creates a checkpoint in virtual machine instance."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `resource_uri`: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended."] pub fn create_checkpoint(&self, resource_uri: impl Into) -> create_checkpoint::RequestBuilder { create_checkpoint::RequestBuilder { client: self.0.clone(), resource_uri: resource_uri.into(), body: None, } } #[doc = "Implements the operation to delete a checkpoint in a virtual machine instance."] #[doc = "Deletes a checkpoint in virtual machine instance."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `resource_uri`: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended."] pub fn delete_checkpoint(&self, resource_uri: impl Into) -> delete_checkpoint::RequestBuilder { delete_checkpoint::RequestBuilder { client: self.0.clone(), resource_uri: resource_uri.into(), body: None, } } #[doc = "Implements the operation to restores to a checkpoint in a virtual machine instance."] #[doc = "Restores to a checkpoint in virtual machine instance."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `resource_uri`: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended."] pub fn restore_checkpoint(&self, resource_uri: impl Into) -> restore_checkpoint::RequestBuilder { restore_checkpoint::RequestBuilder { client: self.0.clone(), resource_uri: resource_uri.into(), body: None, } } } pub mod get { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::VirtualMachineInstance = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) resource_uri: String, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/{}/providers/Microsoft.ScVmm/virtualMachineInstances/default", &self.resource_uri )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that sends the request and returns the parsed response body."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { self.send().await?.into_body().await }) } } } pub mod create_or_update { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::VirtualMachineInstance = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) resource_uri: String, pub(crate) body: Option, } impl RequestBuilder { #[doc = "Request payload."] pub fn body(mut self, body: impl Into) -> Self { self.body = Some(body.into()); self } #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Put); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = if let Some(body) = &this.body { req.insert_header("content-type", "application/json"); azure_core::to_json(body)? } else { azure_core::EMPTY_BODY }; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/{}/providers/Microsoft.ScVmm/virtualMachineInstances/default", &self.resource_uri )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that polls the long running operation, returning once the operation completes."] #[doc = ""] #[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { use azure_core::{ error::{Error, ErrorKind}, lro::{ get_retry_after, location::{get_location, get_provisioning_state, FinalState}, LroStatus, }, sleep::sleep, }; use std::time::Duration; let this = self.clone(); let response = this.send().await?; let headers = response.as_raw_response().headers(); let location = get_location(headers, FinalState::AzureAsyncOperation)?; if let Some(url) = location { loop { let mut req = azure_core::Request::new(url.clone(), azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; let headers = response.headers(); let retry_after = get_retry_after(headers); let bytes = response.into_body().collect().await?; let provisioning_state = get_provisioning_state(&bytes).ok_or_else(|| { Error::message( ErrorKind::Other, "Long running operation failed (missing provisioning state)".to_string(), ) })?; log::trace!("current provisioning_state: {provisioning_state:?}"); match provisioning_state { LroStatus::Succeeded => { let mut req = azure_core::Request::new(self.url()?, azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; return Response(response).into_body().await; } LroStatus::Failed => { return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())) } LroStatus::Canceled => { return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string())) } _ => { sleep(retry_after).await; } } } } else { response.into_body().await } }) } } } pub mod update { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::VirtualMachineInstance = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) resource_uri: String, pub(crate) body: Option, } impl RequestBuilder { #[doc = "Resource properties to update."] pub fn body(mut self, body: impl Into) -> Self { self.body = Some(body.into()); self } #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Patch); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = if let Some(body) = &this.body { req.insert_header("content-type", "application/json"); azure_core::to_json(body)? } else { azure_core::EMPTY_BODY }; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/{}/providers/Microsoft.ScVmm/virtualMachineInstances/default", &self.resource_uri )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that polls the long running operation, returning once the operation completes."] #[doc = ""] #[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { use azure_core::{ error::{Error, ErrorKind}, lro::{ get_retry_after, location::{get_location, get_provisioning_state, FinalState}, LroStatus, }, sleep::sleep, }; use std::time::Duration; let this = self.clone(); let response = this.send().await?; let headers = response.as_raw_response().headers(); let location = get_location(headers, FinalState::AzureAsyncOperation)?; if let Some(url) = location { loop { let mut req = azure_core::Request::new(url.clone(), azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; let headers = response.headers(); let retry_after = get_retry_after(headers); let bytes = response.into_body().collect().await?; let provisioning_state = get_provisioning_state(&bytes).ok_or_else(|| { Error::message( ErrorKind::Other, "Long running operation failed (missing provisioning state)".to_string(), ) })?; log::trace!("current provisioning_state: {provisioning_state:?}"); match provisioning_state { LroStatus::Succeeded => { let mut req = azure_core::Request::new(self.url()?, azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; return Response(response).into_body().await; } LroStatus::Failed => { return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())) } LroStatus::Canceled => { return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string())) } _ => { sleep(retry_after).await; } } } } else { response.into_body().await } }) } } } pub mod delete { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) resource_uri: String, pub(crate) force: Option, pub(crate) delete_from_host: Option, } impl RequestBuilder { #[doc = "Whether force delete was specified."] pub fn force(mut self, force: bool) -> Self { self.force = Some(force); self } #[doc = "Whether to disable the VM from azure and also delete it from VMM."] pub fn delete_from_host(mut self, delete_from_host: bool) -> Self { self.delete_from_host = Some(delete_from_host); self } #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Delete); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); if let Some(force) = &this.force { req.url_mut().query_pairs_mut().append_pair("force", &force.to_string()); } if let Some(delete_from_host) = &this.delete_from_host { req.url_mut() .query_pairs_mut() .append_pair("deleteFromHost", &delete_from_host.to_string()); } let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/{}/providers/Microsoft.ScVmm/virtualMachineInstances/default", &self.resource_uri )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } pub mod list { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::VirtualMachineInstanceListResult = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) resource_uri: String, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/{}/providers/Microsoft.ScVmm/virtualMachineInstances", &self.resource_uri )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that sends the request and returns the parsed response body."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { self.send().await?.into_body().await }) } } } pub mod stop { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) resource_uri: String, pub(crate) body: Option, } impl RequestBuilder { #[doc = "Virtualmachine stop action payload."] pub fn body(mut self, body: impl Into) -> Self { self.body = Some(body.into()); self } #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Post); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = if let Some(body) = &this.body { req.insert_header("content-type", "application/json"); azure_core::to_json(body)? } else { azure_core::EMPTY_BODY }; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/{}/providers/Microsoft.ScVmm/virtualMachineInstances/default/stop", &self.resource_uri )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } pub mod start { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) resource_uri: String, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Post); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.insert_header(azure_core::headers::CONTENT_LENGTH, "0"); req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/{}/providers/Microsoft.ScVmm/virtualMachineInstances/default/start", &self.resource_uri )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } pub mod restart { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) resource_uri: String, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Post); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.insert_header(azure_core::headers::CONTENT_LENGTH, "0"); req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/{}/providers/Microsoft.ScVmm/virtualMachineInstances/default/restart", &self.resource_uri )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } pub mod create_checkpoint { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) resource_uri: String, pub(crate) body: Option, } impl RequestBuilder { #[doc = "Virtualmachine create checkpoint action payload."] pub fn body(mut self, body: impl Into) -> Self { self.body = Some(body.into()); self } #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Post); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = if let Some(body) = &this.body { req.insert_header("content-type", "application/json"); azure_core::to_json(body)? } else { azure_core::EMPTY_BODY }; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/{}/providers/Microsoft.ScVmm/virtualMachineInstances/default/createCheckpoint", &self.resource_uri )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } pub mod delete_checkpoint { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) resource_uri: String, pub(crate) body: Option, } impl RequestBuilder { #[doc = "Virtualmachine delete checkpoint action payload."] pub fn body(mut self, body: impl Into) -> Self { self.body = Some(body.into()); self } #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Post); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = if let Some(body) = &this.body { req.insert_header("content-type", "application/json"); azure_core::to_json(body)? } else { azure_core::EMPTY_BODY }; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/{}/providers/Microsoft.ScVmm/virtualMachineInstances/default/deleteCheckpoint", &self.resource_uri )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } pub mod restore_checkpoint { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) resource_uri: String, pub(crate) body: Option, } impl RequestBuilder { #[doc = "Virtualmachine restore checkpoint action payload."] pub fn body(mut self, body: impl Into) -> Self { self.body = Some(body.into()); self } #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Post); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = if let Some(body) = &this.body { req.insert_header("content-type", "application/json"); azure_core::to_json(body)? } else { azure_core::EMPTY_BODY }; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/{}/providers/Microsoft.ScVmm/virtualMachineInstances/default/restoreCheckpoint", &self.resource_uri )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } } pub mod virtual_machine_instance_hybrid_identity_metadata { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; pub struct Client(pub(crate) super::Client); impl Client { #[doc = "Gets HybridIdentityMetadata."] #[doc = "Implements HybridIdentityMetadata GET method."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `resource_uri`: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended."] pub fn get(&self, resource_uri: impl Into) -> get::RequestBuilder { get::RequestBuilder { client: self.0.clone(), resource_uri: resource_uri.into(), } } #[doc = "Implements GET HybridIdentityMetadata in a vm."] #[doc = "Returns the list of HybridIdentityMetadata of the given vm."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `resource_uri`: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended."] pub fn list(&self, resource_uri: impl Into) -> list::RequestBuilder { list::RequestBuilder { client: self.0.clone(), resource_uri: resource_uri.into(), } } } pub mod get { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::VmInstanceHybridIdentityMetadata = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) resource_uri: String, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/{}/providers/Microsoft.ScVmm/virtualMachineInstances/default/hybridIdentityMetadata/default", &self.resource_uri )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that sends the request and returns the parsed response body."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { self.send().await?.into_body().await }) } } } pub mod list { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::VmInstanceHybridIdentityMetadataList = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) resource_uri: String, } impl RequestBuilder { pub fn into_stream(self) -> azure_core::Pageable { let make_request = move |continuation: Option| { let this = self.clone(); async move { let mut url = this.url()?; let rsp = match continuation { Some(value) => { url.set_path(""); url = url.join(&value)?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let has_api_version_already = req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { req.url_mut() .query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } None => { let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } }; let rsp = match rsp.status() { azure_core::StatusCode::Ok => Ok(Response(rsp)), status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse { status: status_code, error_code: None, })), }; rsp?.into_body().await } }; azure_core::Pageable::new(make_request) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/{}/providers/Microsoft.ScVmm/virtualMachineInstances/default/hybridIdentityMetadata", &self.resource_uri )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } } pub mod vm_instance_guest_agents { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; pub struct Client(pub(crate) super::Client); impl Client { #[doc = "Gets GuestAgent."] #[doc = "Implements GuestAgent GET method."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `resource_uri`: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended."] pub fn get(&self, resource_uri: impl Into) -> get::RequestBuilder { get::RequestBuilder { client: self.0.clone(), resource_uri: resource_uri.into(), } } #[doc = "Implements GuestAgent PUT method."] #[doc = "Create Or Update GuestAgent."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `resource_uri`: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended."] pub fn create(&self, resource_uri: impl Into) -> create::RequestBuilder { create::RequestBuilder { client: self.0.clone(), resource_uri: resource_uri.into(), body: None, } } #[doc = "Deletes an GuestAgent."] #[doc = "Implements GuestAgent DELETE method."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `resource_uri`: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended."] pub fn delete(&self, resource_uri: impl Into) -> delete::RequestBuilder { delete::RequestBuilder { client: self.0.clone(), resource_uri: resource_uri.into(), } } #[doc = "Implements GET GuestAgent in a vm."] #[doc = "Returns the list of GuestAgent of the given vm."] #[doc = ""] #[doc = "Arguments:"] #[doc = "* `resource_uri`: The fully qualified Azure Resource manager identifier of the Hybrid Compute machine resource to be extended."] pub fn list(&self, resource_uri: impl Into) -> list::RequestBuilder { list::RequestBuilder { client: self.0.clone(), resource_uri: resource_uri.into(), } } } pub mod get { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::GuestAgent = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) resource_uri: String, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/{}/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents/default", &self.resource_uri )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that sends the request and returns the parsed response body."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { self.send().await?.into_body().await }) } } } pub mod create { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::GuestAgent = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) resource_uri: String, pub(crate) body: Option, } impl RequestBuilder { #[doc = "Request payload."] pub fn body(mut self, body: impl Into) -> Self { self.body = Some(body.into()); self } #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Put); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = if let Some(body) = &this.body { req.insert_header("content-type", "application/json"); azure_core::to_json(body)? } else { azure_core::EMPTY_BODY }; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/{}/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents/default", &self.resource_uri )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } impl std::future::IntoFuture for RequestBuilder { type Output = azure_core::Result; type IntoFuture = BoxFuture<'static, azure_core::Result>; #[doc = "Returns a future that polls the long running operation, returning once the operation completes."] #[doc = ""] #[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."] #[doc = ""] #[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."] #[doc = ""] #[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."] fn into_future(self) -> Self::IntoFuture { Box::pin(async move { use azure_core::{ error::{Error, ErrorKind}, lro::{ get_retry_after, location::{get_location, get_provisioning_state, FinalState}, LroStatus, }, sleep::sleep, }; use std::time::Duration; let this = self.clone(); let response = this.send().await?; let headers = response.as_raw_response().headers(); let location = get_location(headers, FinalState::AzureAsyncOperation)?; if let Some(url) = location { loop { let mut req = azure_core::Request::new(url.clone(), azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; let headers = response.headers(); let retry_after = get_retry_after(headers); let bytes = response.into_body().collect().await?; let provisioning_state = get_provisioning_state(&bytes).ok_or_else(|| { Error::message( ErrorKind::Other, "Long running operation failed (missing provisioning state)".to_string(), ) })?; log::trace!("current provisioning_state: {provisioning_state:?}"); match provisioning_state { LroStatus::Succeeded => { let mut req = azure_core::Request::new(self.url()?, azure_core::Method::Get); let bearer_token = self.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let response = self.client.send(&mut req).await?; return Response(response).into_body().await; } LroStatus::Failed => { return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())) } LroStatus::Canceled => { return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string())) } _ => { sleep(retry_after).await; } } } } else { response.into_body().await } }) } } } pub mod delete { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" This `RequestBuilder` implements a Long Running Operation"] #[doc = r" (LRO)."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the `RequestBuilder` into a future"] #[doc = r" executes the request and polls the service until the"] #[doc = r" operation completes."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use"] #[doc = r" [`RequestBuilder::send()`], which will return a lower-level"] #[doc = r" [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) resource_uri: String, } impl RequestBuilder { #[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."] #[doc = ""] #[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."] #[doc = "However, this function can provide more flexibility when required."] pub fn send(self) -> BoxFuture<'static, azure_core::Result> { Box::pin({ let this = self.clone(); async move { let url = this.url()?; let mut req = azure_core::Request::new(url, azure_core::Method::Delete); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); Ok(Response(this.client.send(&mut req).await?)) } }) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/{}/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents/default", &self.resource_uri )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } pub mod list { use super::models; #[cfg(not(target_arch = "wasm32"))] use futures::future::BoxFuture; #[cfg(target_arch = "wasm32")] use futures::future::LocalBoxFuture as BoxFuture; #[derive(Debug)] pub struct Response(azure_core::Response); impl Response { pub async fn into_body(self) -> azure_core::Result { let bytes = self.0.into_body().collect().await?; let body: models::GuestAgentList = serde_json::from_slice(&bytes)?; Ok(body) } pub fn into_raw_response(self) -> azure_core::Response { self.0 } pub fn as_raw_response(&self) -> &azure_core::Response { &self.0 } } impl From for azure_core::Response { fn from(rsp: Response) -> Self { rsp.into_raw_response() } } impl AsRef for Response { fn as_ref(&self) -> &azure_core::Response { self.as_raw_response() } } #[derive(Clone)] #[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."] #[doc = r""] #[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"] #[doc = r" parameters can be chained."] #[doc = r""] #[doc = r" To finalize and submit the request, invoke `.await`, which"] #[doc = r" which will convert the [`RequestBuilder`] into a future"] #[doc = r" executes the request and returns a `Result` with the parsed"] #[doc = r" response."] #[doc = r""] #[doc = r" In order to execute the request without polling the service"] #[doc = r" until the operation completes, use `.send().await` instead."] #[doc = r""] #[doc = r" If you need lower-level access to the raw response details"] #[doc = r" (e.g. to inspect response headers or raw body data) then you"] #[doc = r" can finalize the request using the"] #[doc = r" [`RequestBuilder::send()`] method which returns a future"] #[doc = r" that resolves to a lower-level [`Response`] value."] pub struct RequestBuilder { pub(crate) client: super::super::Client, pub(crate) resource_uri: String, } impl RequestBuilder { pub fn into_stream(self) -> azure_core::Pageable { let make_request = move |continuation: Option| { let this = self.clone(); async move { let mut url = this.url()?; let rsp = match continuation { Some(value) => { url.set_path(""); url = url.join(&value)?; let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let has_api_version_already = req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { req.url_mut() .query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } None => { let mut req = azure_core::Request::new(url, azure_core::Method::Get); let bearer_token = this.client.bearer_token().await?; req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret())); let req_body = azure_core::EMPTY_BODY; req.set_body(req_body); this.client.send(&mut req).await? } }; let rsp = match rsp.status() { azure_core::StatusCode::Ok => Ok(Response(rsp)), status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse { status: status_code, error_code: None, })), }; rsp?.into_body().await } }; azure_core::Pageable::new(make_request) } fn url(&self) -> azure_core::Result { let mut url = self.client.endpoint().clone(); url.set_path(&format!( "/{}/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents", &self.resource_uri )); let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION); if !has_api_version_already { url.query_pairs_mut() .append_pair(azure_core::query_param::API_VERSION, "2023-04-01-preview"); } Ok(url) } } } }