#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(unused_imports)]
#![allow(clippy::redundant_clone)]
pub mod models;
#[derive(Clone)]
pub struct Client {
endpoint: String,
credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>,
scopes: Vec<String>,
pipeline: azure_core::Pipeline,
}
#[derive(Clone)]
pub struct ClientBuilder {
credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>,
endpoint: Option<String>,
scopes: Option<Vec<String>>,
options: azure_core::ClientOptions,
}
pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD;
impl ClientBuilder {
#[doc = "Create a new instance of `ClientBuilder`."]
#[must_use]
pub fn new(credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>) -> 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<String>) -> 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<azure_core::RetryOptions>) -> Self {
self.options = self.options.retry(retry);
self
}
#[doc = "Set the transport options."]
#[must_use]
pub fn transport(mut self, transport: impl Into<azure_core::TransportOptions>) -> Self {
self.options = self.options.transport(transport);
self
}
#[doc = "Convert the builder into a `Client` instance."]
#[must_use]
pub fn build(self) -> Client {
let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned());
let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]);
Client::new(endpoint, self.credential, scopes, self.options)
}
}
impl Client {
pub(crate) fn endpoint(&self) -> &str {
self.endpoint.as_str()
}
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<azure_core::Response> {
let mut context = azure_core::Context::default();
self.pipeline.send(&mut context, request).await
}
#[doc = "Create a new `ClientBuilder`."]
#[must_use]
pub fn builder(credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>) -> ClientBuilder {
ClientBuilder::new(credential)
}
#[doc = "Create a new `Client`."]
#[must_use]
pub fn new(
endpoint: impl Into<String>,
credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>,
scopes: Vec<String>,
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 artifact_client(&self) -> artifact::Client {
artifact::Client(self.clone())
}
pub fn artifact_source_client(&self) -> artifact_source::Client {
artifact_source::Client(self.clone())
}
pub fn cost_client(&self) -> cost::Client {
cost::Client(self.clone())
}
pub fn cost_insight_client(&self) -> cost_insight::Client {
cost_insight::Client(self.clone())
}
pub fn custom_image_client(&self) -> custom_image::Client {
custom_image::Client(self.clone())
}
pub fn formula_client(&self) -> formula::Client {
formula::Client(self.clone())
}
pub fn gallery_image_client(&self) -> gallery_image::Client {
gallery_image::Client(self.clone())
}
pub fn lab_client(&self) -> lab::Client {
lab::Client(self.clone())
}
pub fn policy_client(&self) -> policy::Client {
policy::Client(self.clone())
}
pub fn policy_set_client(&self) -> policy_set::Client {
policy_set::Client(self.clone())
}
pub fn schedule_client(&self) -> schedule::Client {
schedule::Client(self.clone())
}
pub fn virtual_machine_client(&self) -> virtual_machine::Client {
virtual_machine::Client(self.clone())
}
pub fn virtual_network_client(&self) -> virtual_network::Client {
virtual_network::Client(self.clone())
}
}
pub mod lab {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List labs."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
pub fn list_by_subscription(&self, subscription_id: impl Into<String>) -> list_by_subscription::RequestBuilder {
list_by_subscription::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
filter: None,
top: None,
order_by: None,
}
}
#[doc = "List labs."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
pub fn list_by_resource_group(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
) -> 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(),
filter: None,
top: None,
order_by: None,
}
}
#[doc = "Get lab."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `name`: The name of the lab."]
pub fn get_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
name: impl Into<String>,
) -> get_resource::RequestBuilder {
get_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
name: name.into(),
}
}
#[doc = "Create or replace an existing Lab. This operation can take a while to complete."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `name`: The name of the lab."]
pub fn create_or_update_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
name: impl Into<String>,
lab: impl Into<models::Lab>,
) -> create_or_update_resource::RequestBuilder {
create_or_update_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
name: name.into(),
lab: lab.into(),
}
}
#[doc = "Modify properties of labs."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `name`: The name of the lab."]
pub fn patch_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
name: impl Into<String>,
lab: impl Into<models::Lab>,
) -> patch_resource::RequestBuilder {
patch_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
name: name.into(),
lab: lab.into(),
}
}
#[doc = "Delete lab. This operation can take a while to complete."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `name`: The name of the lab."]
pub fn delete_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
name: impl Into<String>,
) -> delete_resource::RequestBuilder {
delete_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
name: name.into(),
}
}
#[doc = "Create virtual machines in a Lab. This operation can take a while to complete."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `name`: The name of the lab."]
pub fn create_environment(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
name: impl Into<String>,
lab_virtual_machine: impl Into<models::LabVirtualMachine>,
) -> create_environment::RequestBuilder {
create_environment::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
name: name.into(),
lab_virtual_machine: lab_virtual_machine.into(),
}
}
#[doc = "Generate a URI for uploading custom disk images to a Lab."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `name`: The name of the lab."]
pub fn generate_upload_uri(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
name: impl Into<String>,
generate_upload_uri_parameter: impl Into<models::GenerateUploadUriParameter>,
) -> generate_upload_uri::RequestBuilder {
generate_upload_uri::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
name: name.into(),
generate_upload_uri_parameter: generate_upload_uri_parameter.into(),
}
}
#[doc = "List disk images available for custom image creation."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `name`: The name of the lab."]
pub fn list_vhds(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
name: impl Into<String>,
) -> list_vhds::RequestBuilder {
list_vhds::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
name: name.into(),
}
}
}
pub mod list_by_subscription {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ResponseWithContinuationLab> {
let bytes = self.0.into_body().collect().await?;
let body: models::ResponseWithContinuationLab = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) filter: Option<String>,
pub(crate) top: Option<i32>,
pub(crate) order_by: Option<String>,
}
impl RequestBuilder {
#[doc = "The filter to apply on the operation."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn order_by(mut self, order_by: impl Into<String>) -> Self {
self.order_by = Some(order_by.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ResponseWithContinuationLab, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.DevTestLab/labs",
this.client.endpoint(),
&this.subscription_id
))?;
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 credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.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, "2015-05-21-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 credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("$top", &top.to_string());
}
if let Some(order_by) = &this.order_by {
req.url_mut().query_pairs_mut().append_pair("$orderBy", order_by);
}
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)
}
}
}
pub mod list_by_resource_group {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ResponseWithContinuationLab> {
let bytes = self.0.into_body().collect().await?;
let body: models::ResponseWithContinuationLab = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) filter: Option<String>,
pub(crate) top: Option<i32>,
pub(crate) order_by: Option<String>,
}
impl RequestBuilder {
#[doc = "The filter to apply on the operation."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn order_by(mut self, order_by: impl Into<String>) -> Self {
self.order_by = Some(order_by.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ResponseWithContinuationLab, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
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 credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.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, "2015-05-21-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 credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("$top", &top.to_string());
}
if let Some(order_by) = &this.order_by {
req.url_mut().query_pairs_mut().append_pair("$orderBy", order_by);
}
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)
}
}
}
pub mod get_resource {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Lab> {
let bytes = self.0.into_body().collect().await?;
let body: models::Lab = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Lab>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update_resource {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Lab> {
let bytes = self.0.into_body().collect().await?;
let body: models::Lab = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) name: String,
pub(crate) lab: models::Lab,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.lab)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Lab>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod patch_resource {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Lab> {
let bytes = self.0.into_body().collect().await?;
let body: models::Lab = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) name: String,
pub(crate) lab: models::Lab,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.lab)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Lab>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete_resource {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) name: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod create_environment {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) name: String,
pub(crate) lab_virtual_machine: models::LabVirtualMachine,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/createEnvironment",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.lab_virtual_machine)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod generate_upload_uri {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GenerateUploadUriResponse> {
let bytes = self.0.into_body().collect().await?;
let body: models::GenerateUploadUriResponse = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) name: String,
pub(crate) generate_upload_uri_parameter: models::GenerateUploadUriParameter,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/generateUploadUri",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.generate_upload_uri_parameter)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::GenerateUploadUriResponse>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod list_vhds {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ResponseWithContinuationLabVhd> {
let bytes = self.0.into_body().collect().await?;
let body: models::ResponseWithContinuationLabVhd = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) name: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ResponseWithContinuationLabVhd, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/listVhds",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.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, "2015-05-21-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::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
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)
}
}
}
}
pub mod artifact_source {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List artifact sources."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
filter: None,
top: None,
order_by: None,
}
}
#[doc = "Get artifact source."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `name`: The name of the artifact source."]
pub fn get_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
name: impl Into<String>,
) -> get_resource::RequestBuilder {
get_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
name: name.into(),
}
}
#[doc = "Create or replace an existing artifact source."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `name`: The name of the artifact source."]
pub fn create_or_update_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
name: impl Into<String>,
artifact_source: impl Into<models::ArtifactSource>,
) -> create_or_update_resource::RequestBuilder {
create_or_update_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
name: name.into(),
artifact_source: artifact_source.into(),
}
}
#[doc = "Modify properties of artifact sources."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `name`: The name of the artifact source."]
pub fn patch_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
name: impl Into<String>,
artifact_source: impl Into<models::ArtifactSource>,
) -> patch_resource::RequestBuilder {
patch_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
name: name.into(),
artifact_source: artifact_source.into(),
}
}
#[doc = "Delete artifact source."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `name`: The name of the artifact source."]
pub fn delete_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
name: impl Into<String>,
) -> delete_resource::RequestBuilder {
delete_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
name: name.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ResponseWithContinuationArtifactSource> {
let bytes = self.0.into_body().collect().await?;
let body: models::ResponseWithContinuationArtifactSource = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) filter: Option<String>,
pub(crate) top: Option<i32>,
pub(crate) order_by: Option<String>,
}
impl RequestBuilder {
#[doc = "The filter to apply on the operation."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn order_by(mut self, order_by: impl Into<String>) -> Self {
self.order_by = Some(order_by.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ResponseWithContinuationArtifactSource, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/artifactsources",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name
))?;
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 credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.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, "2015-05-21-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 credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("$top", &top.to_string());
}
if let Some(order_by) = &this.order_by {
req.url_mut().query_pairs_mut().append_pair("$orderBy", order_by);
}
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)
}
}
}
pub mod get_resource {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ArtifactSource> {
let bytes = self.0.into_body().collect().await?;
let body: models::ArtifactSource = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/artifactsources/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ArtifactSource>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update_resource {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ArtifactSource> {
let bytes = self.0.into_body().collect().await?;
let body: models::ArtifactSource = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) name: String,
pub(crate) artifact_source: models::ArtifactSource,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/artifactsources/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.artifact_source)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ArtifactSource>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod patch_resource {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ArtifactSource> {
let bytes = self.0.into_body().collect().await?;
let body: models::ArtifactSource = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) name: String,
pub(crate) artifact_source: models::ArtifactSource,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/artifactsources/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.artifact_source)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ArtifactSource>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete_resource {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/artifactsources/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod artifact {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List artifacts."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `artifact_source_name`: The name of the artifact source."]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
artifact_source_name: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
artifact_source_name: artifact_source_name.into(),
filter: None,
top: None,
order_by: None,
}
}
#[doc = "Get artifact."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `artifact_source_name`: The name of the artifact source."]
#[doc = "* `name`: The name of the artifact."]
pub fn get_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
artifact_source_name: impl Into<String>,
name: impl Into<String>,
) -> get_resource::RequestBuilder {
get_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
artifact_source_name: artifact_source_name.into(),
name: name.into(),
}
}
#[doc = "Generates an ARM template for the given artifact, uploads the required files to a storage account, and validates the generated artifact."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `artifact_source_name`: The name of the artifact source."]
#[doc = "* `name`: The name of the artifact."]
pub fn generate_arm_template(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
artifact_source_name: impl Into<String>,
name: impl Into<String>,
generate_arm_template_request: impl Into<models::GenerateArmTemplateRequest>,
) -> generate_arm_template::RequestBuilder {
generate_arm_template::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
artifact_source_name: artifact_source_name.into(),
name: name.into(),
generate_arm_template_request: generate_arm_template_request.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ResponseWithContinuationArtifact> {
let bytes = self.0.into_body().collect().await?;
let body: models::ResponseWithContinuationArtifact = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) artifact_source_name: String,
pub(crate) filter: Option<String>,
pub(crate) top: Option<i32>,
pub(crate) order_by: Option<String>,
}
impl RequestBuilder {
#[doc = "The filter to apply on the operation."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn order_by(mut self, order_by: impl Into<String>) -> Self {
self.order_by = Some(order_by.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ResponseWithContinuationArtifact, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/artifactsources/{}/artifacts",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.artifact_source_name
))?;
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 credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.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, "2015-05-21-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 credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("$top", &top.to_string());
}
if let Some(order_by) = &this.order_by {
req.url_mut().query_pairs_mut().append_pair("$orderBy", order_by);
}
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)
}
}
}
pub mod get_resource {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Artifact> {
let bytes = self.0.into_body().collect().await?;
let body: models::Artifact = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) artifact_source_name: String,
pub(crate) name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/artifactsources/{}/artifacts/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.artifact_source_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Artifact>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod generate_arm_template {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ArmTemplateInfo> {
let bytes = self.0.into_body().collect().await?;
let body: models::ArmTemplateInfo = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) artifact_source_name: String,
pub(crate) name: String,
pub(crate) generate_arm_template_request: models::GenerateArmTemplateRequest,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/artifactsources/{}/artifacts/{}/generateArmTemplate" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . lab_name , & this . artifact_source_name , & this . name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.generate_arm_template_request)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ArmTemplateInfo>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod cost_insight {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List cost insights."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
filter: None,
top: None,
order_by: None,
}
}
#[doc = "Get cost insight."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `name`: The name of the cost insight."]
pub fn get_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
name: impl Into<String>,
) -> get_resource::RequestBuilder {
get_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
name: name.into(),
}
}
#[doc = "Refresh Lab's Cost Insight Data. This operation can take a while to complete."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `name`: The name of the cost insight."]
pub fn refresh_data(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
name: impl Into<String>,
) -> refresh_data::RequestBuilder {
refresh_data::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
name: name.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ResponseWithContinuationCostInsight> {
let bytes = self.0.into_body().collect().await?;
let body: models::ResponseWithContinuationCostInsight = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) filter: Option<String>,
pub(crate) top: Option<i32>,
pub(crate) order_by: Option<String>,
}
impl RequestBuilder {
#[doc = "The filter to apply on the operation."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn order_by(mut self, order_by: impl Into<String>) -> Self {
self.order_by = Some(order_by.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ResponseWithContinuationCostInsight, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/costinsights",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name
))?;
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 credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.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, "2015-05-21-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 credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("$top", &top.to_string());
}
if let Some(order_by) = &this.order_by {
req.url_mut().query_pairs_mut().append_pair("$orderBy", order_by);
}
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)
}
}
}
pub mod get_resource {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::CostInsight> {
let bytes = self.0.into_body().collect().await?;
let body: models::CostInsight = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/costinsights/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::CostInsight>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod refresh_data {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) name: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/costinsights/{}/refreshData",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
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?))
}
})
}
}
}
}
pub mod cost {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List costs."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
filter: None,
top: None,
order_by: None,
}
}
#[doc = "Get cost."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `name`: The name of the cost."]
pub fn get_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
name: impl Into<String>,
) -> get_resource::RequestBuilder {
get_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
name: name.into(),
}
}
#[doc = "Refresh Lab's Cost Data. This operation can take a while to complete."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `name`: The name of the cost."]
pub fn refresh_data(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
name: impl Into<String>,
) -> refresh_data::RequestBuilder {
refresh_data::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
name: name.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ResponseWithContinuationCost> {
let bytes = self.0.into_body().collect().await?;
let body: models::ResponseWithContinuationCost = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) filter: Option<String>,
pub(crate) top: Option<i32>,
pub(crate) order_by: Option<String>,
}
impl RequestBuilder {
#[doc = "The filter to apply on the operation."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn order_by(mut self, order_by: impl Into<String>) -> Self {
self.order_by = Some(order_by.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ResponseWithContinuationCost, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/costs",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name
))?;
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 credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.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, "2015-05-21-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 credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("$top", &top.to_string());
}
if let Some(order_by) = &this.order_by {
req.url_mut().query_pairs_mut().append_pair("$orderBy", order_by);
}
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)
}
}
}
pub mod get_resource {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Cost> {
let bytes = self.0.into_body().collect().await?;
let body: models::Cost = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/costs/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Cost>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod refresh_data {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) name: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/costs/{}/refreshData",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
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?))
}
})
}
}
}
}
pub mod custom_image {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List custom images."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
filter: None,
top: None,
order_by: None,
}
}
#[doc = "Get custom image."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `name`: The name of the custom image."]
pub fn get_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
name: impl Into<String>,
) -> get_resource::RequestBuilder {
get_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
name: name.into(),
}
}
#[doc = "Create or replace an existing custom image. This operation can take a while to complete."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `name`: The name of the custom image."]
pub fn create_or_update_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
name: impl Into<String>,
custom_image: impl Into<models::CustomImage>,
) -> create_or_update_resource::RequestBuilder {
create_or_update_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
name: name.into(),
custom_image: custom_image.into(),
}
}
#[doc = "Delete custom image. This operation can take a while to complete."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `name`: The name of the custom image."]
pub fn delete_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
name: impl Into<String>,
) -> delete_resource::RequestBuilder {
delete_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
name: name.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ResponseWithContinuationCustomImage> {
let bytes = self.0.into_body().collect().await?;
let body: models::ResponseWithContinuationCustomImage = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) filter: Option<String>,
pub(crate) top: Option<i32>,
pub(crate) order_by: Option<String>,
}
impl RequestBuilder {
#[doc = "The filter to apply on the operation."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn order_by(mut self, order_by: impl Into<String>) -> Self {
self.order_by = Some(order_by.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ResponseWithContinuationCustomImage, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/customimages",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name
))?;
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 credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.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, "2015-05-21-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 credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("$top", &top.to_string());
}
if let Some(order_by) = &this.order_by {
req.url_mut().query_pairs_mut().append_pair("$orderBy", order_by);
}
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)
}
}
}
pub mod get_resource {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::CustomImage> {
let bytes = self.0.into_body().collect().await?;
let body: models::CustomImage = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/customimages/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::CustomImage>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update_resource {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::CustomImage> {
let bytes = self.0.into_body().collect().await?;
let body: models::CustomImage = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) name: String,
pub(crate) custom_image: models::CustomImage,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/customimages/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.custom_image)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::CustomImage>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete_resource {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) name: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/customimages/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod formula {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List formulas."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
filter: None,
top: None,
order_by: None,
}
}
#[doc = "Get formula."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `name`: The name of the formula."]
pub fn get_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
name: impl Into<String>,
) -> get_resource::RequestBuilder {
get_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
name: name.into(),
}
}
#[doc = "Create or replace an existing Formula. This operation can take a while to complete."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `name`: The name of the formula."]
pub fn create_or_update_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
name: impl Into<String>,
formula: impl Into<models::Formula>,
) -> create_or_update_resource::RequestBuilder {
create_or_update_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
name: name.into(),
formula: formula.into(),
}
}
#[doc = "Delete formula."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `name`: The name of the formula."]
pub fn delete_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
name: impl Into<String>,
) -> delete_resource::RequestBuilder {
delete_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
name: name.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ResponseWithContinuationFormula> {
let bytes = self.0.into_body().collect().await?;
let body: models::ResponseWithContinuationFormula = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) filter: Option<String>,
pub(crate) top: Option<i32>,
pub(crate) order_by: Option<String>,
}
impl RequestBuilder {
#[doc = "The filter to apply on the operation."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn order_by(mut self, order_by: impl Into<String>) -> Self {
self.order_by = Some(order_by.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ResponseWithContinuationFormula, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/formulas",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name
))?;
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 credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.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, "2015-05-21-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 credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("$top", &top.to_string());
}
if let Some(order_by) = &this.order_by {
req.url_mut().query_pairs_mut().append_pair("$orderBy", order_by);
}
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)
}
}
}
pub mod get_resource {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Formula> {
let bytes = self.0.into_body().collect().await?;
let body: models::Formula = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/formulas/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Formula>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update_resource {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Formula> {
let bytes = self.0.into_body().collect().await?;
let body: models::Formula = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) name: String,
pub(crate) formula: models::Formula,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/formulas/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.formula)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Formula>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete_resource {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/formulas/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod gallery_image {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List gallery images."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
filter: None,
top: None,
order_by: None,
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ResponseWithContinuationGalleryImage> {
let bytes = self.0.into_body().collect().await?;
let body: models::ResponseWithContinuationGalleryImage = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) filter: Option<String>,
pub(crate) top: Option<i32>,
pub(crate) order_by: Option<String>,
}
impl RequestBuilder {
#[doc = "The filter to apply on the operation."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn order_by(mut self, order_by: impl Into<String>) -> Self {
self.order_by = Some(order_by.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ResponseWithContinuationGalleryImage, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/galleryimages",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name
))?;
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 credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.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, "2015-05-21-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 credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("$top", &top.to_string());
}
if let Some(order_by) = &this.order_by {
req.url_mut().query_pairs_mut().append_pair("$orderBy", order_by);
}
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)
}
}
}
}
pub mod policy_set {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Evaluates Lab Policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `name`: The name of the policy set."]
pub fn evaluate_policies(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
name: impl Into<String>,
evaluate_policies_request: impl Into<models::EvaluatePoliciesRequest>,
) -> evaluate_policies::RequestBuilder {
evaluate_policies::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
name: name.into(),
evaluate_policies_request: evaluate_policies_request.into(),
}
}
}
pub mod evaluate_policies {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::EvaluatePoliciesResponse> {
let bytes = self.0.into_body().collect().await?;
let body: models::EvaluatePoliciesResponse = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) name: String,
pub(crate) evaluate_policies_request: models::EvaluatePoliciesRequest,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/policysets/{}/evaluatePolicies",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.evaluate_policies_request)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::EvaluatePoliciesResponse>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod policy {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List policies."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `policy_set_name`: The name of the policy set."]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
policy_set_name: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
policy_set_name: policy_set_name.into(),
filter: None,
top: None,
order_by: None,
}
}
#[doc = "Get policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `policy_set_name`: The name of the policy set."]
#[doc = "* `name`: The name of the policy."]
pub fn get_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
policy_set_name: impl Into<String>,
name: impl Into<String>,
) -> get_resource::RequestBuilder {
get_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
policy_set_name: policy_set_name.into(),
name: name.into(),
}
}
#[doc = "Create or replace an existing policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `policy_set_name`: The name of the policy set."]
#[doc = "* `name`: The name of the policy."]
pub fn create_or_update_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
policy_set_name: impl Into<String>,
name: impl Into<String>,
policy: impl Into<models::Policy>,
) -> create_or_update_resource::RequestBuilder {
create_or_update_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
policy_set_name: policy_set_name.into(),
name: name.into(),
policy: policy.into(),
}
}
#[doc = "Modify properties of policies."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `policy_set_name`: The name of the policy set."]
#[doc = "* `name`: The name of the policy."]
pub fn patch_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
policy_set_name: impl Into<String>,
name: impl Into<String>,
policy: impl Into<models::Policy>,
) -> patch_resource::RequestBuilder {
patch_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
policy_set_name: policy_set_name.into(),
name: name.into(),
policy: policy.into(),
}
}
#[doc = "Delete policy."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `policy_set_name`: The name of the policy set."]
#[doc = "* `name`: The name of the policy."]
pub fn delete_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
policy_set_name: impl Into<String>,
name: impl Into<String>,
) -> delete_resource::RequestBuilder {
delete_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
policy_set_name: policy_set_name.into(),
name: name.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ResponseWithContinuationPolicy> {
let bytes = self.0.into_body().collect().await?;
let body: models::ResponseWithContinuationPolicy = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) policy_set_name: String,
pub(crate) filter: Option<String>,
pub(crate) top: Option<i32>,
pub(crate) order_by: Option<String>,
}
impl RequestBuilder {
#[doc = "The filter to apply on the operation."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn order_by(mut self, order_by: impl Into<String>) -> Self {
self.order_by = Some(order_by.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ResponseWithContinuationPolicy, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/policysets/{}/policies",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.policy_set_name
))?;
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 credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.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, "2015-05-21-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 credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("$top", &top.to_string());
}
if let Some(order_by) = &this.order_by {
req.url_mut().query_pairs_mut().append_pair("$orderBy", order_by);
}
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)
}
}
}
pub mod get_resource {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Policy> {
let bytes = self.0.into_body().collect().await?;
let body: models::Policy = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) policy_set_name: String,
pub(crate) name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/policysets/{}/policies/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.policy_set_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Policy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update_resource {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Policy> {
let bytes = self.0.into_body().collect().await?;
let body: models::Policy = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) policy_set_name: String,
pub(crate) name: String,
pub(crate) policy: models::Policy,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/policysets/{}/policies/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.policy_set_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.policy)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Policy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod patch_resource {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Policy> {
let bytes = self.0.into_body().collect().await?;
let body: models::Policy = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) policy_set_name: String,
pub(crate) name: String,
pub(crate) policy: models::Policy,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/policysets/{}/policies/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.policy_set_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.policy)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Policy>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete_resource {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) policy_set_name: String,
pub(crate) name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/policysets/{}/policies/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.policy_set_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod schedule {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List schedules."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
filter: None,
top: None,
order_by: None,
}
}
#[doc = "Get schedule."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `name`: The name of the schedule."]
pub fn get_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
name: impl Into<String>,
) -> get_resource::RequestBuilder {
get_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
name: name.into(),
}
}
#[doc = "Create or replace an existing schedule. This operation can take a while to complete."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `name`: The name of the schedule."]
pub fn create_or_update_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
name: impl Into<String>,
schedule: impl Into<models::Schedule>,
) -> create_or_update_resource::RequestBuilder {
create_or_update_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
name: name.into(),
schedule: schedule.into(),
}
}
#[doc = "Modify properties of schedules."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `name`: The name of the schedule."]
pub fn patch_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
name: impl Into<String>,
schedule: impl Into<models::Schedule>,
) -> patch_resource::RequestBuilder {
patch_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
name: name.into(),
schedule: schedule.into(),
}
}
#[doc = "Delete schedule. This operation can take a while to complete."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `name`: The name of the schedule."]
pub fn delete_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
name: impl Into<String>,
) -> delete_resource::RequestBuilder {
delete_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
name: name.into(),
}
}
#[doc = "Execute a schedule. This operation can take a while to complete."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `name`: The name of the schedule."]
pub fn execute(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
name: impl Into<String>,
) -> execute::RequestBuilder {
execute::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
name: name.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ResponseWithContinuationSchedule> {
let bytes = self.0.into_body().collect().await?;
let body: models::ResponseWithContinuationSchedule = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) filter: Option<String>,
pub(crate) top: Option<i32>,
pub(crate) order_by: Option<String>,
}
impl RequestBuilder {
#[doc = "The filter to apply on the operation."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn order_by(mut self, order_by: impl Into<String>) -> Self {
self.order_by = Some(order_by.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ResponseWithContinuationSchedule, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/schedules",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name
))?;
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 credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.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, "2015-05-21-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 credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("$top", &top.to_string());
}
if let Some(order_by) = &this.order_by {
req.url_mut().query_pairs_mut().append_pair("$orderBy", order_by);
}
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)
}
}
}
pub mod get_resource {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Schedule> {
let bytes = self.0.into_body().collect().await?;
let body: models::Schedule = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/schedules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Schedule>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update_resource {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Schedule> {
let bytes = self.0.into_body().collect().await?;
let body: models::Schedule = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) name: String,
pub(crate) schedule: models::Schedule,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/schedules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.schedule)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Schedule>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod patch_resource {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Schedule> {
let bytes = self.0.into_body().collect().await?;
let body: models::Schedule = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) name: String,
pub(crate) schedule: models::Schedule,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/schedules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.schedule)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Schedule>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete_resource {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) name: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/schedules/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod execute {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) name: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/schedules/{}/execute",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
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?))
}
})
}
}
}
}
pub mod virtual_machine {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List virtual machines."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
filter: None,
top: None,
order_by: None,
}
}
#[doc = "Get virtual machine."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `name`: The name of the virtual Machine."]
pub fn get_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
name: impl Into<String>,
) -> get_resource::RequestBuilder {
get_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
name: name.into(),
}
}
#[doc = "Create or replace an existing Virtual Machine. This operation can take a while to complete."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `name`: The name of the virtual Machine."]
pub fn create_or_update_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
name: impl Into<String>,
lab_virtual_machine: impl Into<models::LabVirtualMachine>,
) -> create_or_update_resource::RequestBuilder {
create_or_update_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
name: name.into(),
lab_virtual_machine: lab_virtual_machine.into(),
}
}
#[doc = "Modify properties of virtual machines."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `name`: The name of the virtual Machine."]
pub fn patch_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
name: impl Into<String>,
lab_virtual_machine: impl Into<models::LabVirtualMachine>,
) -> patch_resource::RequestBuilder {
patch_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
name: name.into(),
lab_virtual_machine: lab_virtual_machine.into(),
}
}
#[doc = "Delete virtual machine. This operation can take a while to complete."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `name`: The name of the virtual Machine."]
pub fn delete_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
name: impl Into<String>,
) -> delete_resource::RequestBuilder {
delete_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
name: name.into(),
}
}
#[doc = "Apply artifacts to Lab VM. This operation can take a while to complete."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `name`: The name of the virtual Machine."]
pub fn apply_artifacts(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
name: impl Into<String>,
apply_artifacts_request: impl Into<models::ApplyArtifactsRequest>,
) -> apply_artifacts::RequestBuilder {
apply_artifacts::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
name: name.into(),
apply_artifacts_request: apply_artifacts_request.into(),
}
}
#[doc = "Start a Lab VM. This operation can take a while to complete."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `name`: The name of the virtual Machine."]
pub fn start(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
name: impl Into<String>,
) -> start::RequestBuilder {
start::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
name: name.into(),
}
}
#[doc = "Stop a Lab VM. This operation can take a while to complete."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `name`: The name of the virtual Machine."]
pub fn stop(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
name: impl Into<String>,
) -> stop::RequestBuilder {
stop::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
name: name.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ResponseWithContinuationLabVirtualMachine> {
let bytes = self.0.into_body().collect().await?;
let body: models::ResponseWithContinuationLabVirtualMachine = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) filter: Option<String>,
pub(crate) top: Option<i32>,
pub(crate) order_by: Option<String>,
}
impl RequestBuilder {
#[doc = "The filter to apply on the operation."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn order_by(mut self, order_by: impl Into<String>) -> Self {
self.order_by = Some(order_by.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ResponseWithContinuationLabVirtualMachine, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/virtualmachines",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name
))?;
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 credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.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, "2015-05-21-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 credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("$top", &top.to_string());
}
if let Some(order_by) = &this.order_by {
req.url_mut().query_pairs_mut().append_pair("$orderBy", order_by);
}
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)
}
}
}
pub mod get_resource {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LabVirtualMachine> {
let bytes = self.0.into_body().collect().await?;
let body: models::LabVirtualMachine = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/virtualmachines/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::LabVirtualMachine>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update_resource {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LabVirtualMachine> {
let bytes = self.0.into_body().collect().await?;
let body: models::LabVirtualMachine = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) name: String,
pub(crate) lab_virtual_machine: models::LabVirtualMachine,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/virtualmachines/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.lab_virtual_machine)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::LabVirtualMachine>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod patch_resource {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LabVirtualMachine> {
let bytes = self.0.into_body().collect().await?;
let body: models::LabVirtualMachine = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) name: String,
pub(crate) lab_virtual_machine: models::LabVirtualMachine,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/virtualmachines/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.lab_virtual_machine)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::LabVirtualMachine>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete_resource {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) name: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/virtualmachines/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod apply_artifacts {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) name: String,
pub(crate) apply_artifacts_request: models::ApplyArtifactsRequest,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/virtualmachines/{}/applyArtifacts" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . lab_name , & this . name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.apply_artifacts_request)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod start {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) name: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/virtualmachines/{}/start",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
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?))
}
})
}
}
}
pub mod stop {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) name: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/virtualmachines/{}/stop",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
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?))
}
})
}
}
}
}
pub mod virtual_network {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List virtual networks."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
filter: None,
top: None,
order_by: None,
}
}
#[doc = "Get virtual network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `name`: The name of the virtual network."]
pub fn get_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
name: impl Into<String>,
) -> get_resource::RequestBuilder {
get_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
name: name.into(),
}
}
#[doc = "Create or replace an existing virtual network. This operation can take a while to complete."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `name`: The name of the virtual network."]
pub fn create_or_update_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
name: impl Into<String>,
virtual_network: impl Into<models::VirtualNetwork>,
) -> create_or_update_resource::RequestBuilder {
create_or_update_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
name: name.into(),
virtual_network: virtual_network.into(),
}
}
#[doc = "Modify properties of virtual networks."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `name`: The name of the virtual network."]
pub fn patch_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
name: impl Into<String>,
virtual_network: impl Into<models::VirtualNetwork>,
) -> patch_resource::RequestBuilder {
patch_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
name: name.into(),
virtual_network: virtual_network.into(),
}
}
#[doc = "Delete virtual network. This operation can take a while to complete."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `name`: The name of the virtual network."]
pub fn delete_resource(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_name: impl Into<String>,
name: impl Into<String>,
) -> delete_resource::RequestBuilder {
delete_resource::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_name: lab_name.into(),
name: name.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ResponseWithContinuationVirtualNetwork> {
let bytes = self.0.into_body().collect().await?;
let body: models::ResponseWithContinuationVirtualNetwork = 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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) filter: Option<String>,
pub(crate) top: Option<i32>,
pub(crate) order_by: Option<String>,
}
impl RequestBuilder {
#[doc = "The filter to apply on the operation."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn order_by(mut self, order_by: impl Into<String>) -> Self {
self.order_by = Some(order_by.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ResponseWithContinuationVirtualNetwork, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/virtualnetworks",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name
))?;
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 credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.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, "2015-05-21-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 credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("$top", &top.to_string());
}
if let Some(order_by) = &this.order_by {
req.url_mut().query_pairs_mut().append_pair("$orderBy", order_by);
}
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)
}
}
}
pub mod get_resource {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::VirtualNetwork> {
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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/virtualnetworks/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::VirtualNetwork>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update_resource {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::VirtualNetwork> {
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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) name: String,
pub(crate) virtual_network: models::VirtualNetwork,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/virtualnetworks/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.virtual_network)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::VirtualNetwork>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod patch_resource {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::VirtualNetwork> {
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<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) name: String,
pub(crate) virtual_network: models::VirtualNetwork,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/virtualnetworks/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.virtual_network)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::VirtualNetwork>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete_resource {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) lab_name: String,
pub(crate) name: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.DevTestLab/labs/{}/virtualnetworks/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_name,
&this.name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-21-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}