#![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 environment_settings_client(&self) -> environment_settings::Client {
environment_settings::Client(self.clone())
}
pub fn environments_client(&self) -> environments::Client {
environments::Client(self.clone())
}
pub fn gallery_images_client(&self) -> gallery_images::Client {
gallery_images::Client(self.clone())
}
pub fn global_users_client(&self) -> global_users::Client {
global_users::Client(self.clone())
}
pub fn lab_accounts_client(&self) -> lab_accounts::Client {
lab_accounts::Client(self.clone())
}
pub fn labs_client(&self) -> labs::Client {
labs::Client(self.clone())
}
pub fn operations_client(&self) -> operations::Client {
operations::Client(self.clone())
}
pub fn provider_operations_client(&self) -> provider_operations::Client {
provider_operations::Client(self.clone())
}
pub fn users_client(&self) -> users::Client {
users::Client(self.clone())
}
}
pub mod provider_operations {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Result of the request to list REST API operations"]
pub fn list(&self) -> list::RequestBuilder {
list::RequestBuilder { client: self.0.clone() }
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ProviderOperationResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ProviderOperationResult = 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,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ProviderOperationResult, 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!("{}/providers/Microsoft.LabServices/operations", this.client.endpoint(),))?;
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, "2018-10-15");
}
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, "2018-10-15");
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 global_users {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the virtual machine details"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `user_name`: The name of the user."]
#[doc = "* `environment_operations_payload`: Represents payload for any Environment operations like get, start, stop, connect"]
pub fn get_environment(
&self,
user_name: impl Into<String>,
environment_operations_payload: impl Into<models::EnvironmentOperationsPayload>,
) -> get_environment::RequestBuilder {
get_environment::RequestBuilder {
client: self.0.clone(),
user_name: user_name.into(),
environment_operations_payload: environment_operations_payload.into(),
expand: None,
}
}
#[doc = "Get batch operation status"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `user_name`: The name of the user."]
#[doc = "* `operation_batch_status_payload`: Payload to get the status of an operation"]
pub fn get_operation_batch_status(
&self,
user_name: impl Into<String>,
operation_batch_status_payload: impl Into<models::OperationBatchStatusPayload>,
) -> get_operation_batch_status::RequestBuilder {
get_operation_batch_status::RequestBuilder {
client: self.0.clone(),
user_name: user_name.into(),
operation_batch_status_payload: operation_batch_status_payload.into(),
}
}
#[doc = "Gets the status of long running operation"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `user_name`: The name of the user."]
#[doc = "* `operation_status_payload`: Payload to get the status of an operation"]
pub fn get_operation_status(
&self,
user_name: impl Into<String>,
operation_status_payload: impl Into<models::OperationStatusPayload>,
) -> get_operation_status::RequestBuilder {
get_operation_status::RequestBuilder {
client: self.0.clone(),
user_name: user_name.into(),
operation_status_payload: operation_status_payload.into(),
}
}
#[doc = "Get personal preferences for a user"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `user_name`: The name of the user."]
#[doc = "* `personal_preferences_operations_payload`: Represents payload for any Environment operations like get, start, stop, connect"]
pub fn get_personal_preferences(
&self,
user_name: impl Into<String>,
personal_preferences_operations_payload: impl Into<models::PersonalPreferencesOperationsPayload>,
) -> get_personal_preferences::RequestBuilder {
get_personal_preferences::RequestBuilder {
client: self.0.clone(),
user_name: user_name.into(),
personal_preferences_operations_payload: personal_preferences_operations_payload.into(),
}
}
#[doc = "List Environments for the user"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `user_name`: The name of the user."]
#[doc = "* `list_environments_payload`: Represents the payload to list environments owned by a user"]
pub fn list_environments(
&self,
user_name: impl Into<String>,
list_environments_payload: impl Into<models::ListEnvironmentsPayload>,
) -> list_environments::RequestBuilder {
list_environments::RequestBuilder {
client: self.0.clone(),
user_name: user_name.into(),
list_environments_payload: list_environments_payload.into(),
}
}
#[doc = "List labs for the user."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `user_name`: The name of the user."]
pub fn list_labs(&self, user_name: impl Into<String>) -> list_labs::RequestBuilder {
list_labs::RequestBuilder {
client: self.0.clone(),
user_name: user_name.into(),
}
}
#[doc = "Register a user to a managed lab"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `user_name`: The name of the user."]
#[doc = "* `register_payload`: Represents payload for Register action."]
pub fn register(
&self,
user_name: impl Into<String>,
register_payload: impl Into<models::RegisterPayload>,
) -> register::RequestBuilder {
register::RequestBuilder {
client: self.0.clone(),
user_name: user_name.into(),
register_payload: register_payload.into(),
}
}
#[doc = "Resets the user password on an environment This operation can take a while to complete"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `user_name`: The name of the user."]
#[doc = "* `reset_password_payload`: Represents the payload for resetting passwords."]
pub fn reset_password(
&self,
user_name: impl Into<String>,
reset_password_payload: impl Into<models::ResetPasswordPayload>,
) -> reset_password::RequestBuilder {
reset_password::RequestBuilder {
client: self.0.clone(),
user_name: user_name.into(),
reset_password_payload: reset_password_payload.into(),
}
}
#[doc = "Starts an environment by starting all resources inside the environment. This operation can take a while to complete"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `user_name`: The name of the user."]
#[doc = "* `environment_operations_payload`: Represents payload for any Environment operations like get, start, stop, connect"]
pub fn start_environment(
&self,
user_name: impl Into<String>,
environment_operations_payload: impl Into<models::EnvironmentOperationsPayload>,
) -> start_environment::RequestBuilder {
start_environment::RequestBuilder {
client: self.0.clone(),
user_name: user_name.into(),
environment_operations_payload: environment_operations_payload.into(),
}
}
#[doc = "Stops an environment by stopping all resources inside the environment This operation can take a while to complete"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `user_name`: The name of the user."]
#[doc = "* `environment_operations_payload`: Represents payload for any Environment operations like get, start, stop, connect"]
pub fn stop_environment(
&self,
user_name: impl Into<String>,
environment_operations_payload: impl Into<models::EnvironmentOperationsPayload>,
) -> stop_environment::RequestBuilder {
stop_environment::RequestBuilder {
client: self.0.clone(),
user_name: user_name.into(),
environment_operations_payload: environment_operations_payload.into(),
}
}
}
pub mod get_environment {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GetEnvironmentResponse> {
let bytes = self.0.into_body().collect().await?;
let body: models::GetEnvironmentResponse = 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) user_name: String,
pub(crate) environment_operations_payload: models::EnvironmentOperationsPayload,
pub(crate) expand: Option<String>,
}
impl RequestBuilder {
#[doc = "Specify the $expand query. Example: 'properties($expand=environment)'"]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
#[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!(
"{}/providers/Microsoft.LabServices/users/{}/getEnvironment",
this.client.endpoint(),
&this.user_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, "2018-10-15");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.environment_operations_payload)?;
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
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::GetEnvironmentResponse>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get_operation_batch_status {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::OperationBatchStatusResponse> {
let bytes = self.0.into_body().collect().await?;
let body: models::OperationBatchStatusResponse = 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) user_name: String,
pub(crate) operation_batch_status_payload: models::OperationBatchStatusPayload,
}
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!(
"{}/providers/Microsoft.LabServices/users/{}/getOperationBatchStatus",
this.client.endpoint(),
&this.user_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, "2018-10-15");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.operation_batch_status_payload)?;
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::OperationBatchStatusResponse>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get_operation_status {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::OperationStatusResponse> {
let bytes = self.0.into_body().collect().await?;
let body: models::OperationStatusResponse = 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) user_name: String,
pub(crate) operation_status_payload: models::OperationStatusPayload,
}
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!(
"{}/providers/Microsoft.LabServices/users/{}/getOperationStatus",
this.client.endpoint(),
&this.user_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, "2018-10-15");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.operation_status_payload)?;
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::OperationStatusResponse>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get_personal_preferences {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GetPersonalPreferencesResponse> {
let bytes = self.0.into_body().collect().await?;
let body: models::GetPersonalPreferencesResponse = 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) user_name: String,
pub(crate) personal_preferences_operations_payload: models::PersonalPreferencesOperationsPayload,
}
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!(
"{}/providers/Microsoft.LabServices/users/{}/getPersonalPreferences",
this.client.endpoint(),
&this.user_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, "2018-10-15");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.personal_preferences_operations_payload)?;
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::GetPersonalPreferencesResponse>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod list_environments {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ListEnvironmentsResponse> {
let bytes = self.0.into_body().collect().await?;
let body: models::ListEnvironmentsResponse = 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) user_name: String,
pub(crate) list_environments_payload: models::ListEnvironmentsPayload,
}
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!(
"{}/providers/Microsoft.LabServices/users/{}/listEnvironments",
this.client.endpoint(),
&this.user_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, "2018-10-15");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.list_environments_payload)?;
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::ListEnvironmentsResponse>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod list_labs {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ListLabsResponse> {
let bytes = self.0.into_body().collect().await?;
let body: models::ListLabsResponse = 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) user_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!(
"{}/providers/Microsoft.LabServices/users/{}/listLabs",
this.client.endpoint(),
&this.user_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, "2018-10-15");
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?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ListLabsResponse>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod register {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) user_name: String,
pub(crate) register_payload: models::RegisterPayload,
}
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!(
"{}/providers/Microsoft.LabServices/users/{}/register",
this.client.endpoint(),
&this.user_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, "2018-10-15");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.register_payload)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod reset_password {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) user_name: String,
pub(crate) reset_password_payload: models::ResetPasswordPayload,
}
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!(
"{}/providers/Microsoft.LabServices/users/{}/resetPassword",
this.client.endpoint(),
&this.user_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, "2018-10-15");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.reset_password_payload)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod start_environment {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) user_name: String,
pub(crate) environment_operations_payload: models::EnvironmentOperationsPayload,
}
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!(
"{}/providers/Microsoft.LabServices/users/{}/startEnvironment",
this.client.endpoint(),
&this.user_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, "2018-10-15");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.environment_operations_payload)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod stop_environment {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) user_name: String,
pub(crate) environment_operations_payload: models::EnvironmentOperationsPayload,
}
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!(
"{}/providers/Microsoft.LabServices/users/{}/stopEnvironment",
this.client.endpoint(),
&this.user_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, "2018-10-15");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.environment_operations_payload)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod lab_accounts {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List lab accounts in a subscription."]
#[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(),
expand: None,
filter: None,
top: None,
orderby: None,
}
}
#[doc = "List lab accounts in a resource group."]
#[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(),
expand: None,
filter: None,
top: None,
orderby: None,
}
}
#[doc = "Get lab account"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_account_name`: The name of the lab Account."]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_account_name: lab_account_name.into(),
expand: None,
}
}
#[doc = "Create or replace an existing Lab Account."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_account_name`: The name of the lab Account."]
#[doc = "* `lab_account`: Represents a lab account."]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
lab_account: impl Into<models::LabAccount>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_account_name: lab_account_name.into(),
lab_account: lab_account.into(),
}
}
#[doc = "Modify properties of lab accounts."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_account_name`: The name of the lab Account."]
#[doc = "* `lab_account`: Represents a lab account."]
pub fn update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
lab_account: impl Into<models::LabAccountFragment>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_account_name: lab_account_name.into(),
lab_account: lab_account.into(),
}
}
#[doc = "Delete lab account. 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_account_name`: The name of the lab Account."]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_account_name: lab_account_name.into(),
}
}
#[doc = "Create a lab in a lab account."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_account_name`: The name of the lab Account."]
#[doc = "* `create_lab_properties`: Properties for creating a managed lab and a default environment setting"]
pub fn create_lab(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
create_lab_properties: impl Into<models::CreateLabProperties>,
) -> create_lab::RequestBuilder {
create_lab::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_account_name: lab_account_name.into(),
create_lab_properties: create_lab_properties.into(),
}
}
#[doc = "Get regional availability information for each size category configured under a lab account"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_account_name`: The name of the lab Account."]
pub fn get_regional_availability(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
) -> get_regional_availability::RequestBuilder {
get_regional_availability::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_account_name: lab_account_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::ResponseWithContinuationLabAccount> {
let bytes = self.0.into_body().collect().await?;
let body: models::ResponseWithContinuationLabAccount = 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) expand: Option<String>,
pub(crate) filter: Option<String>,
pub(crate) top: Option<i32>,
pub(crate) orderby: Option<String>,
}
impl RequestBuilder {
#[doc = "Specify the $expand query. Example: 'properties($expand=sizeConfiguration)'"]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
#[doc = "The filter to apply to the operation."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
#[doc = "The maximum number of resources to return from the operation."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
#[doc = "The ordering expression for the results, using OData notation."]
pub fn orderby(mut self, orderby: impl Into<String>) -> Self {
self.orderby = Some(orderby.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ResponseWithContinuationLabAccount, 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.LabServices/labaccounts",
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, "2018-10-15");
}
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, "2018-10-15");
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
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(orderby) = &this.orderby {
req.url_mut().query_pairs_mut().append_pair("$orderby", orderby);
}
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::ResponseWithContinuationLabAccount> {
let bytes = self.0.into_body().collect().await?;
let body: models::ResponseWithContinuationLabAccount = 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) expand: Option<String>,
pub(crate) filter: Option<String>,
pub(crate) top: Option<i32>,
pub(crate) orderby: Option<String>,
}
impl RequestBuilder {
#[doc = "Specify the $expand query. Example: 'properties($expand=sizeConfiguration)'"]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
#[doc = "The filter to apply to the operation."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
#[doc = "The maximum number of resources to return from the operation."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
#[doc = "The ordering expression for the results, using OData notation."]
pub fn orderby(mut self, orderby: impl Into<String>) -> Self {
self.orderby = Some(orderby.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ResponseWithContinuationLabAccount, 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.LabServices/labaccounts",
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, "2018-10-15");
}
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, "2018-10-15");
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
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(orderby) = &this.orderby {
req.url_mut().query_pairs_mut().append_pair("$orderby", orderby);
}
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 {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LabAccount> {
let bytes = self.0.into_body().collect().await?;
let body: models::LabAccount = 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_account_name: String,
pub(crate) expand: Option<String>,
}
impl RequestBuilder {
#[doc = "Specify the $expand query. Example: 'properties($expand=sizeConfiguration)'"]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
#[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.LabServices/labaccounts/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_account_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, "2018-10-15");
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
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::LabAccount>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LabAccount> {
let bytes = self.0.into_body().collect().await?;
let body: models::LabAccount = 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_account_name: String,
pub(crate) lab_account: models::LabAccount,
}
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.LabServices/labaccounts/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_account_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, "2018-10-15");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.lab_account)?;
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::LabAccount>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LabAccount> {
let bytes = self.0.into_body().collect().await?;
let body: models::LabAccount = 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_account_name: String,
pub(crate) lab_account: models::LabAccountFragment,
}
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.LabServices/labaccounts/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_account_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, "2018-10-15");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.lab_account)?;
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::LabAccount>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
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_account_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.LabServices/labaccounts/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_account_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, "2018-10-15");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod create_lab {
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_account_name: String,
pub(crate) create_lab_properties: models::CreateLabProperties,
}
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.LabServices/labaccounts/{}/createLab",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_account_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, "2018-10-15");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.create_lab_properties)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod get_regional_availability {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GetRegionalAvailabilityResponse> {
let bytes = self.0.into_body().collect().await?;
let body: models::GetRegionalAvailabilityResponse = 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_account_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.LabServices/labaccounts/{}/getRegionalAvailability",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_account_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, "2018-10-15");
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?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::GetRegionalAvailabilityResponse>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod operations {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Get operation"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `location_name`: The name of the location."]
#[doc = "* `operation_name`: The name of the operation."]
pub fn get(
&self,
subscription_id: impl Into<String>,
location_name: impl Into<String>,
operation_name: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
location_name: location_name.into(),
operation_name: operation_name.into(),
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::OperationResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::OperationResult = 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) location_name: String,
pub(crate) operation_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/{}/providers/Microsoft.LabServices/locations/{}/operations/{}",
this.client.endpoint(),
&this.subscription_id,
&this.location_name,
&this.operation_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, "2018-10-15");
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::OperationResult>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod gallery_images {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List gallery images in a given lab account."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_account_name`: The name of the lab Account."]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_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_account_name: lab_account_name.into(),
expand: None,
filter: None,
top: None,
orderby: None,
}
}
#[doc = "Get gallery image"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_account_name`: The name of the lab Account."]
#[doc = "* `gallery_image_name`: The name of the gallery Image."]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
gallery_image_name: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_account_name: lab_account_name.into(),
gallery_image_name: gallery_image_name.into(),
expand: None,
}
}
#[doc = "Create or replace an existing Gallery Image."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_account_name`: The name of the lab Account."]
#[doc = "* `gallery_image_name`: The name of the gallery Image."]
#[doc = "* `gallery_image`: Represents an image from the Azure Marketplace"]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
gallery_image_name: impl Into<String>,
gallery_image: impl Into<models::GalleryImage>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_account_name: lab_account_name.into(),
gallery_image_name: gallery_image_name.into(),
gallery_image: gallery_image.into(),
}
}
#[doc = "Modify properties of gallery images."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_account_name`: The name of the lab Account."]
#[doc = "* `gallery_image_name`: The name of the gallery Image."]
#[doc = "* `gallery_image`: Represents an image from the Azure Marketplace"]
pub fn update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
gallery_image_name: impl Into<String>,
gallery_image: impl Into<models::GalleryImageFragment>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_account_name: lab_account_name.into(),
gallery_image_name: gallery_image_name.into(),
gallery_image: gallery_image.into(),
}
}
#[doc = "Delete gallery image."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_account_name`: The name of the lab Account."]
#[doc = "* `gallery_image_name`: The name of the gallery Image."]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
gallery_image_name: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_account_name: lab_account_name.into(),
gallery_image_name: gallery_image_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::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_account_name: String,
pub(crate) expand: Option<String>,
pub(crate) filter: Option<String>,
pub(crate) top: Option<i32>,
pub(crate) orderby: Option<String>,
}
impl RequestBuilder {
#[doc = "Specify the $expand query. Example: 'properties($select=author)'"]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
#[doc = "The filter to apply to the operation."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
#[doc = "The maximum number of resources to return from the operation."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
#[doc = "The ordering expression for the results, using OData notation."]
pub fn orderby(mut self, orderby: impl Into<String>) -> Self {
self.orderby = Some(orderby.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.LabServices/labaccounts/{}/galleryimages",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_account_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, "2018-10-15");
}
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, "2018-10-15");
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
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(orderby) = &this.orderby {
req.url_mut().query_pairs_mut().append_pair("$orderby", orderby);
}
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 {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GalleryImage> {
let bytes = self.0.into_body().collect().await?;
let body: models::GalleryImage = 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_account_name: String,
pub(crate) gallery_image_name: String,
pub(crate) expand: Option<String>,
}
impl RequestBuilder {
#[doc = "Specify the $expand query. Example: 'properties($select=author)'"]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
#[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.LabServices/labaccounts/{}/galleryimages/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_account_name,
&this.gallery_image_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, "2018-10-15");
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
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::GalleryImage>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GalleryImage> {
let bytes = self.0.into_body().collect().await?;
let body: models::GalleryImage = 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_account_name: String,
pub(crate) gallery_image_name: String,
pub(crate) gallery_image: models::GalleryImage,
}
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.LabServices/labaccounts/{}/galleryimages/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_account_name,
&this.gallery_image_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, "2018-10-15");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.gallery_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::GalleryImage>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GalleryImage> {
let bytes = self.0.into_body().collect().await?;
let body: models::GalleryImage = 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_account_name: String,
pub(crate) gallery_image_name: String,
pub(crate) gallery_image: models::GalleryImageFragment,
}
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.LabServices/labaccounts/{}/galleryimages/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_account_name,
&this.gallery_image_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, "2018-10-15");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.gallery_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::GalleryImage>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
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_account_name: String,
pub(crate) gallery_image_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.LabServices/labaccounts/{}/galleryimages/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_account_name,
&this.gallery_image_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, "2018-10-15");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod labs {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List labs in a given lab account."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_account_name`: The name of the lab Account."]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_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_account_name: lab_account_name.into(),
expand: None,
filter: None,
top: None,
orderby: None,
}
}
#[doc = "Get lab"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_account_name`: The name of the lab Account."]
#[doc = "* `lab_name`: The name of the lab."]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
lab_name: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_account_name: lab_account_name.into(),
lab_name: lab_name.into(),
expand: None,
}
}
#[doc = "Create or replace an existing Lab."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_account_name`: The name of the lab Account."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `lab`: Represents a lab."]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
lab_name: impl Into<String>,
lab: impl Into<models::Lab>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_account_name: lab_account_name.into(),
lab_name: lab_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 = "* `lab_account_name`: The name of the lab Account."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `lab`: Represents a lab."]
pub fn update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
lab_name: impl Into<String>,
lab: impl Into<models::LabFragment>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_account_name: lab_account_name.into(),
lab_name: lab_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 = "* `lab_account_name`: The name of the lab Account."]
#[doc = "* `lab_name`: The name of the lab."]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
lab_name: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_account_name: lab_account_name.into(),
lab_name: lab_name.into(),
}
}
#[doc = "Add users to a lab"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_account_name`: The name of the lab Account."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `add_users_payload`: Payload for Add Users operation on a Lab."]
pub fn add_users(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
lab_name: impl Into<String>,
add_users_payload: impl Into<models::AddUsersPayload>,
) -> add_users::RequestBuilder {
add_users::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_account_name: lab_account_name.into(),
lab_name: lab_name.into(),
add_users_payload: add_users_payload.into(),
}
}
#[doc = "Register to managed lab."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_account_name`: The name of the lab Account."]
#[doc = "* `lab_name`: The name of the lab."]
pub fn register(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
lab_name: impl Into<String>,
) -> register::RequestBuilder {
register::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_account_name: lab_account_name.into(),
lab_name: lab_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::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) lab_account_name: String,
pub(crate) expand: Option<String>,
pub(crate) filter: Option<String>,
pub(crate) top: Option<i32>,
pub(crate) orderby: Option<String>,
}
impl RequestBuilder {
#[doc = "Specify the $expand query. Example: 'properties($select=maxUsersInLab)'"]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
#[doc = "The filter to apply to the operation."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
#[doc = "The maximum number of resources to return from the operation."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
#[doc = "The ordering expression for the results, using OData notation."]
pub fn orderby(mut self, orderby: impl Into<String>) -> Self {
self.orderby = Some(orderby.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.LabServices/labaccounts/{}/labs",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_account_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, "2018-10-15");
}
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, "2018-10-15");
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
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(orderby) = &this.orderby {
req.url_mut().query_pairs_mut().append_pair("$orderby", orderby);
}
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 {
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) lab_account_name: String,
pub(crate) lab_name: String,
pub(crate) expand: Option<String>,
}
impl RequestBuilder {
#[doc = "Specify the $expand query. Example: 'properties($select=maxUsersInLab)'"]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
#[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.LabServices/labaccounts/{}/labs/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_account_name,
&this.lab_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, "2018-10-15");
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
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 {
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) lab_account_name: String,
pub(crate) lab_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.LabServices/labaccounts/{}/labs/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_account_name,
&this.lab_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, "2018-10-15");
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 update {
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) lab_account_name: String,
pub(crate) lab_name: String,
pub(crate) lab: models::LabFragment,
}
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.LabServices/labaccounts/{}/labs/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_account_name,
&this.lab_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, "2018-10-15");
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 {
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_account_name: String,
pub(crate) lab_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.LabServices/labaccounts/{}/labs/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_account_name,
&this.lab_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, "2018-10-15");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod add_users {
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_account_name: String,
pub(crate) lab_name: String,
pub(crate) add_users_payload: models::AddUsersPayload,
}
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.LabServices/labaccounts/{}/labs/{}/addUsers",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_account_name,
&this.lab_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, "2018-10-15");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.add_users_payload)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod register {
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_account_name: String,
pub(crate) lab_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.LabServices/labaccounts/{}/labs/{}/register",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_account_name,
&this.lab_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, "2018-10-15");
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 environment_settings {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List environment setting in a given lab."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_account_name`: The name of the lab Account."]
#[doc = "* `lab_name`: The name of the lab."]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_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_account_name: lab_account_name.into(),
lab_name: lab_name.into(),
expand: None,
filter: None,
top: None,
orderby: None,
}
}
#[doc = "Get environment setting"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_account_name`: The name of the lab Account."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `environment_setting_name`: The name of the environment Setting."]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
lab_name: impl Into<String>,
environment_setting_name: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_account_name: lab_account_name.into(),
lab_name: lab_name.into(),
environment_setting_name: environment_setting_name.into(),
expand: None,
}
}
#[doc = "Create or replace an existing Environment Setting. 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_account_name`: The name of the lab Account."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `environment_setting_name`: The name of the environment Setting."]
#[doc = "* `environment_setting`: Represents settings of an environment, from which environment instances would be created"]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
lab_name: impl Into<String>,
environment_setting_name: impl Into<String>,
environment_setting: impl Into<models::EnvironmentSetting>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_account_name: lab_account_name.into(),
lab_name: lab_name.into(),
environment_setting_name: environment_setting_name.into(),
environment_setting: environment_setting.into(),
}
}
#[doc = "Modify properties of environment setting."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_account_name`: The name of the lab Account."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `environment_setting_name`: The name of the environment Setting."]
#[doc = "* `environment_setting`: Represents settings of an environment, from which environment instances would be created"]
pub fn update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
lab_name: impl Into<String>,
environment_setting_name: impl Into<String>,
environment_setting: impl Into<models::EnvironmentSettingFragment>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_account_name: lab_account_name.into(),
lab_name: lab_name.into(),
environment_setting_name: environment_setting_name.into(),
environment_setting: environment_setting.into(),
}
}
#[doc = "Delete environment setting. 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_account_name`: The name of the lab Account."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `environment_setting_name`: The name of the environment Setting."]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
lab_name: impl Into<String>,
environment_setting_name: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_account_name: lab_account_name.into(),
lab_name: lab_name.into(),
environment_setting_name: environment_setting_name.into(),
}
}
#[doc = "Claims a random environment for a user in an environment settings"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_account_name`: The name of the lab Account."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `environment_setting_name`: The name of the environment Setting."]
pub fn claim_any(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
lab_name: impl Into<String>,
environment_setting_name: impl Into<String>,
) -> claim_any::RequestBuilder {
claim_any::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_account_name: lab_account_name.into(),
lab_name: lab_name.into(),
environment_setting_name: environment_setting_name.into(),
}
}
#[doc = "Provisions/deprovisions required resources for an environment setting based on current state of the lab/environment setting."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_account_name`: The name of the lab Account."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `environment_setting_name`: The name of the environment Setting."]
#[doc = "* `publish_payload`: Payload for Publish operation on EnvironmentSetting."]
pub fn publish(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
lab_name: impl Into<String>,
environment_setting_name: impl Into<String>,
publish_payload: impl Into<models::PublishPayload>,
) -> publish::RequestBuilder {
publish::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_account_name: lab_account_name.into(),
lab_name: lab_name.into(),
environment_setting_name: environment_setting_name.into(),
publish_payload: publish_payload.into(),
}
}
#[doc = "Starts a template by starting all resources inside the template. 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_account_name`: The name of the lab Account."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `environment_setting_name`: The name of the environment Setting."]
pub fn start(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
lab_name: impl Into<String>,
environment_setting_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_account_name: lab_account_name.into(),
lab_name: lab_name.into(),
environment_setting_name: environment_setting_name.into(),
}
}
#[doc = "Starts a template by starting all resources inside the template. 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_account_name`: The name of the lab Account."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `environment_setting_name`: The name of the environment Setting."]
pub fn stop(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
lab_name: impl Into<String>,
environment_setting_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_account_name: lab_account_name.into(),
lab_name: lab_name.into(),
environment_setting_name: environment_setting_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::ResponseWithContinuationEnvironmentSetting> {
let bytes = self.0.into_body().collect().await?;
let body: models::ResponseWithContinuationEnvironmentSetting = 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_account_name: String,
pub(crate) lab_name: String,
pub(crate) expand: Option<String>,
pub(crate) filter: Option<String>,
pub(crate) top: Option<i32>,
pub(crate) orderby: Option<String>,
}
impl RequestBuilder {
#[doc = "Specify the $expand query. Example: 'properties($select=publishingState)'"]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
#[doc = "The filter to apply to the operation."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
#[doc = "The maximum number of resources to return from the operation."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
#[doc = "The ordering expression for the results, using OData notation."]
pub fn orderby(mut self, orderby: impl Into<String>) -> Self {
self.orderby = Some(orderby.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ResponseWithContinuationEnvironmentSetting, 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.LabServices/labaccounts/{}/labs/{}/environmentsettings" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . lab_account_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, "2018-10-15");
}
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, "2018-10-15");
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
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(orderby) = &this.orderby {
req.url_mut().query_pairs_mut().append_pair("$orderby", orderby);
}
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 {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::EnvironmentSetting> {
let bytes = self.0.into_body().collect().await?;
let body: models::EnvironmentSetting = 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_account_name: String,
pub(crate) lab_name: String,
pub(crate) environment_setting_name: String,
pub(crate) expand: Option<String>,
}
impl RequestBuilder {
#[doc = "Specify the $expand query. Example: 'properties($select=publishingState)'"]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
#[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.LabServices/labaccounts/{}/labs/{}/environmentsettings/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . lab_account_name , & this . lab_name , & this . environment_setting_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, "2018-10-15");
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
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::EnvironmentSetting>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::EnvironmentSetting> {
let bytes = self.0.into_body().collect().await?;
let body: models::EnvironmentSetting = 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_account_name: String,
pub(crate) lab_name: String,
pub(crate) environment_setting_name: String,
pub(crate) environment_setting: models::EnvironmentSetting,
}
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.LabServices/labaccounts/{}/labs/{}/environmentsettings/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . lab_account_name , & this . lab_name , & this . environment_setting_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, "2018-10-15");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.environment_setting)?;
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::EnvironmentSetting>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::EnvironmentSetting> {
let bytes = self.0.into_body().collect().await?;
let body: models::EnvironmentSetting = 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_account_name: String,
pub(crate) lab_name: String,
pub(crate) environment_setting_name: String,
pub(crate) environment_setting: models::EnvironmentSettingFragment,
}
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.LabServices/labaccounts/{}/labs/{}/environmentsettings/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . lab_account_name , & this . lab_name , & this . environment_setting_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, "2018-10-15");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.environment_setting)?;
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::EnvironmentSetting>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
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_account_name: String,
pub(crate) lab_name: String,
pub(crate) environment_setting_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.LabServices/labaccounts/{}/labs/{}/environmentsettings/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . lab_account_name , & this . lab_name , & this . environment_setting_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, "2018-10-15");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod claim_any {
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_account_name: String,
pub(crate) lab_name: String,
pub(crate) environment_setting_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.LabServices/labaccounts/{}/labs/{}/environmentsettings/{}/claimAny" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . lab_account_name , & this . lab_name , & this . environment_setting_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, "2018-10-15");
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 publish {
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_account_name: String,
pub(crate) lab_name: String,
pub(crate) environment_setting_name: String,
pub(crate) publish_payload: models::PublishPayload,
}
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.LabServices/labaccounts/{}/labs/{}/environmentsettings/{}/publish" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . lab_account_name , & this . lab_name , & this . environment_setting_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, "2018-10-15");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.publish_payload)?;
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_account_name: String,
pub(crate) lab_name: String,
pub(crate) environment_setting_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.LabServices/labaccounts/{}/labs/{}/environmentsettings/{}/start" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . lab_account_name , & this . lab_name , & this . environment_setting_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, "2018-10-15");
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_account_name: String,
pub(crate) lab_name: String,
pub(crate) environment_setting_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.LabServices/labaccounts/{}/labs/{}/environmentsettings/{}/stop" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . lab_account_name , & this . lab_name , & this . environment_setting_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, "2018-10-15");
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 environments {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List environments in a given environment setting."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_account_name`: The name of the lab Account."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `environment_setting_name`: The name of the environment Setting."]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
lab_name: impl Into<String>,
environment_setting_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_account_name: lab_account_name.into(),
lab_name: lab_name.into(),
environment_setting_name: environment_setting_name.into(),
expand: None,
filter: None,
top: None,
orderby: None,
}
}
#[doc = "Get environment"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_account_name`: The name of the lab Account."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `environment_setting_name`: The name of the environment Setting."]
#[doc = "* `environment_name`: The name of the environment."]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
lab_name: impl Into<String>,
environment_setting_name: impl Into<String>,
environment_name: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_account_name: lab_account_name.into(),
lab_name: lab_name.into(),
environment_setting_name: environment_setting_name.into(),
environment_name: environment_name.into(),
expand: None,
}
}
#[doc = "Create or replace an existing Environment."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_account_name`: The name of the lab Account."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `environment_setting_name`: The name of the environment Setting."]
#[doc = "* `environment_name`: The name of the environment."]
#[doc = "* `environment`: Represents an environment instance"]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
lab_name: impl Into<String>,
environment_setting_name: impl Into<String>,
environment_name: impl Into<String>,
environment: impl Into<models::Environment>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_account_name: lab_account_name.into(),
lab_name: lab_name.into(),
environment_setting_name: environment_setting_name.into(),
environment_name: environment_name.into(),
environment: environment.into(),
}
}
#[doc = "Modify properties of environments."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_account_name`: The name of the lab Account."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `environment_setting_name`: The name of the environment Setting."]
#[doc = "* `environment_name`: The name of the environment."]
#[doc = "* `environment`: Represents an environment instance"]
pub fn update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
lab_name: impl Into<String>,
environment_setting_name: impl Into<String>,
environment_name: impl Into<String>,
environment: impl Into<models::EnvironmentFragment>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_account_name: lab_account_name.into(),
lab_name: lab_name.into(),
environment_setting_name: environment_setting_name.into(),
environment_name: environment_name.into(),
environment: environment.into(),
}
}
#[doc = "Delete environment. 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_account_name`: The name of the lab Account."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `environment_setting_name`: The name of the environment Setting."]
#[doc = "* `environment_name`: The name of the environment."]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
lab_name: impl Into<String>,
environment_setting_name: impl Into<String>,
environment_name: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_account_name: lab_account_name.into(),
lab_name: lab_name.into(),
environment_setting_name: environment_setting_name.into(),
environment_name: environment_name.into(),
}
}
#[doc = "Claims the environment and assigns it to the user"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_account_name`: The name of the lab Account."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `environment_setting_name`: The name of the environment Setting."]
#[doc = "* `environment_name`: The name of the environment."]
pub fn claim(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
lab_name: impl Into<String>,
environment_setting_name: impl Into<String>,
environment_name: impl Into<String>,
) -> claim::RequestBuilder {
claim::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_account_name: lab_account_name.into(),
lab_name: lab_name.into(),
environment_setting_name: environment_setting_name.into(),
environment_name: environment_name.into(),
}
}
#[doc = "Resets the user password on an environment 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_account_name`: The name of the lab Account."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `environment_setting_name`: The name of the environment Setting."]
#[doc = "* `environment_name`: The name of the environment."]
#[doc = "* `reset_password_payload`: Represents the payload for resetting passwords."]
pub fn reset_password(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
lab_name: impl Into<String>,
environment_setting_name: impl Into<String>,
environment_name: impl Into<String>,
reset_password_payload: impl Into<models::ResetPasswordPayload>,
) -> reset_password::RequestBuilder {
reset_password::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_account_name: lab_account_name.into(),
lab_name: lab_name.into(),
environment_setting_name: environment_setting_name.into(),
environment_name: environment_name.into(),
reset_password_payload: reset_password_payload.into(),
}
}
#[doc = "Starts an environment by starting all resources inside the environment. 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_account_name`: The name of the lab Account."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `environment_setting_name`: The name of the environment Setting."]
#[doc = "* `environment_name`: The name of the environment."]
pub fn start(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
lab_name: impl Into<String>,
environment_setting_name: impl Into<String>,
environment_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_account_name: lab_account_name.into(),
lab_name: lab_name.into(),
environment_setting_name: environment_setting_name.into(),
environment_name: environment_name.into(),
}
}
#[doc = "Stops an environment by stopping all resources inside the environment 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_account_name`: The name of the lab Account."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `environment_setting_name`: The name of the environment Setting."]
#[doc = "* `environment_name`: The name of the environment."]
pub fn stop(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
lab_name: impl Into<String>,
environment_setting_name: impl Into<String>,
environment_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_account_name: lab_account_name.into(),
lab_name: lab_name.into(),
environment_setting_name: environment_setting_name.into(),
environment_name: environment_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::ResponseWithContinuationEnvironment> {
let bytes = self.0.into_body().collect().await?;
let body: models::ResponseWithContinuationEnvironment = 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_account_name: String,
pub(crate) lab_name: String,
pub(crate) environment_setting_name: String,
pub(crate) expand: Option<String>,
pub(crate) filter: Option<String>,
pub(crate) top: Option<i32>,
pub(crate) orderby: Option<String>,
}
impl RequestBuilder {
#[doc = "Specify the $expand query. Example: 'properties($expand=networkInterface)'"]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
#[doc = "The filter to apply to the operation."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
#[doc = "The maximum number of resources to return from the operation."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
#[doc = "The ordering expression for the results, using OData notation."]
pub fn orderby(mut self, orderby: impl Into<String>) -> Self {
self.orderby = Some(orderby.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ResponseWithContinuationEnvironment, 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.LabServices/labaccounts/{}/labs/{}/environmentsettings/{}/environments" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . lab_account_name , & this . lab_name , & this . environment_setting_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, "2018-10-15");
}
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, "2018-10-15");
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
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(orderby) = &this.orderby {
req.url_mut().query_pairs_mut().append_pair("$orderby", orderby);
}
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 {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Environment> {
let bytes = self.0.into_body().collect().await?;
let body: models::Environment = 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_account_name: String,
pub(crate) lab_name: String,
pub(crate) environment_setting_name: String,
pub(crate) environment_name: String,
pub(crate) expand: Option<String>,
}
impl RequestBuilder {
#[doc = "Specify the $expand query. Example: 'properties($expand=networkInterface)'"]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
#[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.LabServices/labaccounts/{}/labs/{}/environmentsettings/{}/environments/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . lab_account_name , & this . lab_name , & this . environment_setting_name , & this . environment_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, "2018-10-15");
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
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::Environment>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Environment> {
let bytes = self.0.into_body().collect().await?;
let body: models::Environment = 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_account_name: String,
pub(crate) lab_name: String,
pub(crate) environment_setting_name: String,
pub(crate) environment_name: String,
pub(crate) environment: models::Environment,
}
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.LabServices/labaccounts/{}/labs/{}/environmentsettings/{}/environments/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . lab_account_name , & this . lab_name , & this . environment_setting_name , & this . environment_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, "2018-10-15");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.environment)?;
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::Environment>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Environment> {
let bytes = self.0.into_body().collect().await?;
let body: models::Environment = 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_account_name: String,
pub(crate) lab_name: String,
pub(crate) environment_setting_name: String,
pub(crate) environment_name: String,
pub(crate) environment: models::EnvironmentFragment,
}
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.LabServices/labaccounts/{}/labs/{}/environmentsettings/{}/environments/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . lab_account_name , & this . lab_name , & this . environment_setting_name , & this . environment_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, "2018-10-15");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.environment)?;
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::Environment>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
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_account_name: String,
pub(crate) lab_name: String,
pub(crate) environment_setting_name: String,
pub(crate) environment_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.LabServices/labaccounts/{}/labs/{}/environmentsettings/{}/environments/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . lab_account_name , & this . lab_name , & this . environment_setting_name , & this . environment_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, "2018-10-15");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod claim {
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_account_name: String,
pub(crate) lab_name: String,
pub(crate) environment_setting_name: String,
pub(crate) environment_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.LabServices/labaccounts/{}/labs/{}/environmentsettings/{}/environments/{}/claim" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . lab_account_name , & this . lab_name , & this . environment_setting_name , & this . environment_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, "2018-10-15");
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 reset_password {
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_account_name: String,
pub(crate) lab_name: String,
pub(crate) environment_setting_name: String,
pub(crate) environment_name: String,
pub(crate) reset_password_payload: models::ResetPasswordPayload,
}
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.LabServices/labaccounts/{}/labs/{}/environmentsettings/{}/environments/{}/resetPassword" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . lab_account_name , & this . lab_name , & this . environment_setting_name , & this . environment_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, "2018-10-15");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.reset_password_payload)?;
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_account_name: String,
pub(crate) lab_name: String,
pub(crate) environment_setting_name: String,
pub(crate) environment_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.LabServices/labaccounts/{}/labs/{}/environmentsettings/{}/environments/{}/start" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . lab_account_name , & this . lab_name , & this . environment_setting_name , & this . environment_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, "2018-10-15");
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_account_name: String,
pub(crate) lab_name: String,
pub(crate) environment_setting_name: String,
pub(crate) environment_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.LabServices/labaccounts/{}/labs/{}/environmentsettings/{}/environments/{}/stop" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . lab_account_name , & this . lab_name , & this . environment_setting_name , & this . environment_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, "2018-10-15");
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 users {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List users in a given lab."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_account_name`: The name of the lab Account."]
#[doc = "* `lab_name`: The name of the lab."]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_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_account_name: lab_account_name.into(),
lab_name: lab_name.into(),
expand: None,
filter: None,
top: None,
orderby: None,
}
}
#[doc = "Get user"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_account_name`: The name of the lab Account."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `user_name`: The name of the user."]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
lab_name: impl Into<String>,
user_name: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_account_name: lab_account_name.into(),
lab_name: lab_name.into(),
user_name: user_name.into(),
expand: None,
}
}
#[doc = "Create or replace an existing User."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_account_name`: The name of the lab Account."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `user_name`: The name of the user."]
#[doc = "* `user`: The User registered to a lab"]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
lab_name: impl Into<String>,
user_name: impl Into<String>,
user: impl Into<models::User>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_account_name: lab_account_name.into(),
lab_name: lab_name.into(),
user_name: user_name.into(),
user: user.into(),
}
}
#[doc = "Modify properties of users."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The subscription ID."]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `lab_account_name`: The name of the lab Account."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `user_name`: The name of the user."]
#[doc = "* `user`: The User registered to a lab"]
pub fn update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
lab_name: impl Into<String>,
user_name: impl Into<String>,
user: impl Into<models::UserFragment>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_account_name: lab_account_name.into(),
lab_name: lab_name.into(),
user_name: user_name.into(),
user: user.into(),
}
}
#[doc = "Delete user. 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_account_name`: The name of the lab Account."]
#[doc = "* `lab_name`: The name of the lab."]
#[doc = "* `user_name`: The name of the user."]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
lab_account_name: impl Into<String>,
lab_name: impl Into<String>,
user_name: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
lab_account_name: lab_account_name.into(),
lab_name: lab_name.into(),
user_name: user_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::ResponseWithContinuationUser> {
let bytes = self.0.into_body().collect().await?;
let body: models::ResponseWithContinuationUser = 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_account_name: String,
pub(crate) lab_name: String,
pub(crate) expand: Option<String>,
pub(crate) filter: Option<String>,
pub(crate) top: Option<i32>,
pub(crate) orderby: Option<String>,
}
impl RequestBuilder {
#[doc = "Specify the $expand query. Example: 'properties($select=email)'"]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
#[doc = "The filter to apply to the operation."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
#[doc = "The maximum number of resources to return from the operation."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
#[doc = "The ordering expression for the results, using OData notation."]
pub fn orderby(mut self, orderby: impl Into<String>) -> Self {
self.orderby = Some(orderby.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ResponseWithContinuationUser, 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.LabServices/labaccounts/{}/labs/{}/users",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_account_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, "2018-10-15");
}
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, "2018-10-15");
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
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(orderby) = &this.orderby {
req.url_mut().query_pairs_mut().append_pair("$orderby", orderby);
}
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 {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::User> {
let bytes = self.0.into_body().collect().await?;
let body: models::User = 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_account_name: String,
pub(crate) lab_name: String,
pub(crate) user_name: String,
pub(crate) expand: Option<String>,
}
impl RequestBuilder {
#[doc = "Specify the $expand query. Example: 'properties($select=email)'"]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
#[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.LabServices/labaccounts/{}/labs/{}/users/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_account_name,
&this.lab_name,
&this.user_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, "2018-10-15");
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
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::User>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::User> {
let bytes = self.0.into_body().collect().await?;
let body: models::User = 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_account_name: String,
pub(crate) lab_name: String,
pub(crate) user_name: String,
pub(crate) user: models::User,
}
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.LabServices/labaccounts/{}/labs/{}/users/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_account_name,
&this.lab_name,
&this.user_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, "2018-10-15");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.user)?;
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::User>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::User> {
let bytes = self.0.into_body().collect().await?;
let body: models::User = 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_account_name: String,
pub(crate) lab_name: String,
pub(crate) user_name: String,
pub(crate) user: models::UserFragment,
}
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.LabServices/labaccounts/{}/labs/{}/users/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_account_name,
&this.lab_name,
&this.user_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, "2018-10-15");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.user)?;
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::User>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
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_account_name: String,
pub(crate) lab_name: String,
pub(crate) user_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.LabServices/labaccounts/{}/labs/{}/users/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.lab_account_name,
&this.lab_name,
&this.user_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, "2018-10-15");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}