#![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 dev_boxes_client(&self) -> dev_boxes::Client {
dev_boxes::Client(self.clone())
}
pub fn dev_center_client(&self) -> dev_center::Client {
dev_center::Client(self.clone())
}
pub fn environments_client(&self) -> environments::Client {
environments::Client(self.clone())
}
}
pub mod dev_center {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists all projects."]
pub fn list_projects(&self) -> list_projects::RequestBuilder {
list_projects::RequestBuilder {
client: self.0.clone(),
filter: None,
top: None,
}
}
#[doc = "Gets a project."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `project_name`: The DevCenter Project upon which to execute operations."]
pub fn get_project(&self, project_name: impl Into<String>) -> get_project::RequestBuilder {
get_project::RequestBuilder {
client: self.0.clone(),
project_name: project_name.into(),
}
}
#[doc = "Lists Dev Boxes that the caller has access to in the DevCenter."]
pub fn list_all_dev_boxes(&self) -> list_all_dev_boxes::RequestBuilder {
list_all_dev_boxes::RequestBuilder {
client: self.0.clone(),
filter: None,
top: None,
}
}
#[doc = "Lists Dev Boxes in the Dev Center for a particular user."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `user_id`: The AAD object id of the user. If value is 'me', the identity is taken from the authentication context"]
pub fn list_all_dev_boxes_by_user(&self, user_id: impl Into<String>) -> list_all_dev_boxes_by_user::RequestBuilder {
list_all_dev_boxes_by_user::RequestBuilder {
client: self.0.clone(),
user_id: user_id.into(),
filter: None,
top: None,
}
}
}
pub mod list_projects {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ProjectListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ProjectListResult = 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) filter: Option<String>,
pub(crate) top: Option<i32>,
}
impl RequestBuilder {
#[doc = "An OData filter clause 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. Example: 'top=10'."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ProjectListResult, 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!("{}/projects", 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, "2022-03-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let 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, "2022-03-01-preview");
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("filter", filter);
}
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("top", &top.to_string());
}
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_project {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Project> {
let bytes = self.0.into_body().collect().await?;
let body: models::Project = 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) project_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!("{}/projects/{}", this.client.endpoint(), &this.project_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, "2022-03-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Project>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod list_all_dev_boxes {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DevBoxListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DevBoxListResult = 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) filter: Option<String>,
pub(crate) top: Option<i32>,
}
impl RequestBuilder {
#[doc = "An OData filter clause 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. Example: 'top=10'."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::DevBoxListResult, 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!("{}/devboxes", 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, "2022-03-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let 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, "2022-03-01-preview");
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("filter", filter);
}
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("top", &top.to_string());
}
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_all_dev_boxes_by_user {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DevBoxListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DevBoxListResult = 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_id: String,
pub(crate) filter: Option<String>,
pub(crate) top: Option<i32>,
}
impl RequestBuilder {
#[doc = "An OData filter clause 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. Example: 'top=10'."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::DevBoxListResult, 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!("{}/users/{}/devboxes", this.client.endpoint(), &this.user_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, "2022-03-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let 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, "2022-03-01-preview");
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("filter", filter);
}
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("top", &top.to_string());
}
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 dev_boxes {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists available pools"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `project_name`: The DevCenter Project upon which to execute operations."]
pub fn list_pools(&self, project_name: impl Into<String>) -> list_pools::RequestBuilder {
list_pools::RequestBuilder {
client: self.0.clone(),
project_name: project_name.into(),
top: None,
filter: None,
}
}
#[doc = "Gets a pool"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `pool_name`: The name of a pool of Dev Boxes."]
#[doc = "* `project_name`: The DevCenter Project upon which to execute operations."]
pub fn get_pool(&self, pool_name: impl Into<String>, project_name: impl Into<String>) -> get_pool::RequestBuilder {
get_pool::RequestBuilder {
client: self.0.clone(),
pool_name: pool_name.into(),
project_name: project_name.into(),
}
}
#[doc = "Lists available schedules for a pool."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `project_name`: The DevCenter Project upon which to execute operations."]
#[doc = "* `pool_name`: The name of a pool of Dev Boxes."]
pub fn list_schedules_by_pool(
&self,
project_name: impl Into<String>,
pool_name: impl Into<String>,
) -> list_schedules_by_pool::RequestBuilder {
list_schedules_by_pool::RequestBuilder {
client: self.0.clone(),
project_name: project_name.into(),
pool_name: pool_name.into(),
top: None,
filter: None,
}
}
#[doc = "Gets a schedule."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `project_name`: The DevCenter Project upon which to execute operations."]
#[doc = "* `pool_name`: The name of a pool of Dev Boxes."]
#[doc = "* `schedule_name`: The name of a schedule."]
pub fn get_schedule_by_pool(
&self,
project_name: impl Into<String>,
pool_name: impl Into<String>,
schedule_name: impl Into<String>,
) -> get_schedule_by_pool::RequestBuilder {
get_schedule_by_pool::RequestBuilder {
client: self.0.clone(),
project_name: project_name.into(),
pool_name: pool_name.into(),
schedule_name: schedule_name.into(),
}
}
#[doc = "Lists Dev Boxes in the project for a particular user."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `project_name`: The DevCenter Project upon which to execute operations."]
#[doc = "* `user_id`: The AAD object id of the user. If value is 'me', the identity is taken from the authentication context"]
pub fn list_dev_boxes_by_user(
&self,
project_name: impl Into<String>,
user_id: impl Into<String>,
) -> list_dev_boxes_by_user::RequestBuilder {
list_dev_boxes_by_user::RequestBuilder {
client: self.0.clone(),
project_name: project_name.into(),
user_id: user_id.into(),
filter: None,
top: None,
}
}
#[doc = "Gets a Dev Box"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `project_name`: The DevCenter Project upon which to execute operations."]
#[doc = "* `user_id`: The AAD object id of the user. If value is 'me', the identity is taken from the authentication context"]
#[doc = "* `dev_box_name`: The name of a Dev Box."]
pub fn get_dev_box_by_user(
&self,
project_name: impl Into<String>,
user_id: impl Into<String>,
dev_box_name: impl Into<String>,
) -> get_dev_box_by_user::RequestBuilder {
get_dev_box_by_user::RequestBuilder {
client: self.0.clone(),
project_name: project_name.into(),
user_id: user_id.into(),
dev_box_name: dev_box_name.into(),
}
}
#[doc = "Creates or updates a Dev Box."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `project_name`: The DevCenter Project upon which to execute operations."]
#[doc = "* `user_id`: The AAD object id of the user. If value is 'me', the identity is taken from the authentication context"]
#[doc = "* `dev_box_name`: The name of a Dev Box."]
#[doc = "* `body`: Represents a environment."]
pub fn create_dev_box(
&self,
project_name: impl Into<String>,
user_id: impl Into<String>,
dev_box_name: impl Into<String>,
body: impl Into<models::DevBox>,
) -> create_dev_box::RequestBuilder {
create_dev_box::RequestBuilder {
client: self.0.clone(),
project_name: project_name.into(),
user_id: user_id.into(),
dev_box_name: dev_box_name.into(),
body: body.into(),
}
}
#[doc = "Deletes a Dev Box."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `project_name`: The DevCenter Project upon which to execute operations."]
#[doc = "* `user_id`: The AAD object id of the user. If value is 'me', the identity is taken from the authentication context"]
#[doc = "* `dev_box_name`: The name of a Dev Box."]
pub fn delete_dev_box(
&self,
project_name: impl Into<String>,
user_id: impl Into<String>,
dev_box_name: impl Into<String>,
) -> delete_dev_box::RequestBuilder {
delete_dev_box::RequestBuilder {
client: self.0.clone(),
project_name: project_name.into(),
user_id: user_id.into(),
dev_box_name: dev_box_name.into(),
}
}
#[doc = "Starts a Dev Box"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `project_name`: The DevCenter Project upon which to execute operations."]
#[doc = "* `user_id`: The AAD object id of the user. If value is 'me', the identity is taken from the authentication context"]
#[doc = "* `dev_box_name`: The name of a Dev Box."]
pub fn start_dev_box(
&self,
project_name: impl Into<String>,
user_id: impl Into<String>,
dev_box_name: impl Into<String>,
) -> start_dev_box::RequestBuilder {
start_dev_box::RequestBuilder {
client: self.0.clone(),
project_name: project_name.into(),
user_id: user_id.into(),
dev_box_name: dev_box_name.into(),
}
}
#[doc = "Stops a Dev Box"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `project_name`: The DevCenter Project upon which to execute operations."]
#[doc = "* `user_id`: The AAD object id of the user. If value is 'me', the identity is taken from the authentication context"]
#[doc = "* `dev_box_name`: The name of a Dev Box."]
pub fn stop_dev_box(
&self,
project_name: impl Into<String>,
user_id: impl Into<String>,
dev_box_name: impl Into<String>,
) -> stop_dev_box::RequestBuilder {
stop_dev_box::RequestBuilder {
client: self.0.clone(),
project_name: project_name.into(),
user_id: user_id.into(),
dev_box_name: dev_box_name.into(),
}
}
#[doc = "Gets RDP Connection info"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `project_name`: The DevCenter Project upon which to execute operations."]
#[doc = "* `user_id`: The AAD object id of the user. If value is 'me', the identity is taken from the authentication context"]
#[doc = "* `dev_box_name`: The name of a Dev Box."]
pub fn get_remote_connection(
&self,
project_name: impl Into<String>,
user_id: impl Into<String>,
dev_box_name: impl Into<String>,
) -> get_remote_connection::RequestBuilder {
get_remote_connection::RequestBuilder {
client: self.0.clone(),
project_name: project_name.into(),
user_id: user_id.into(),
dev_box_name: dev_box_name.into(),
}
}
}
pub mod list_pools {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PoolListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::PoolListResult = 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) project_name: String,
pub(crate) top: Option<i32>,
pub(crate) filter: Option<String>,
}
impl RequestBuilder {
#[doc = "The maximum number of resources to return from the operation. Example: 'top=10'."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
#[doc = "An OData filter clause to apply to the operation."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::PoolListResult, 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!("{}/projects/{}/pools", this.client.endpoint(), &this.project_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, "2022-03-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let 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, "2022-03-01-preview");
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("top", &top.to_string());
}
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("filter", filter);
}
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_pool {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Pool> {
let bytes = self.0.into_body().collect().await?;
let body: models::Pool = 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) pool_name: String,
pub(crate) project_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!(
"{}/projects/{}/pools/{}",
this.client.endpoint(),
&this.project_name,
&this.pool_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, "2022-03-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Pool>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod list_schedules_by_pool {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ScheduleListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ScheduleListResult = 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) project_name: String,
pub(crate) pool_name: String,
pub(crate) top: Option<i32>,
pub(crate) filter: Option<String>,
}
impl RequestBuilder {
#[doc = "The maximum number of resources to return from the operation. Example: 'top=10'."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
#[doc = "An OData filter clause to apply to the operation."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ScheduleListResult, 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!(
"{}/projects/{}/pools/{}/schedules",
this.client.endpoint(),
&this.project_name,
&this.pool_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, "2022-03-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let 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, "2022-03-01-preview");
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("top", &top.to_string());
}
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("filter", filter);
}
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_schedule_by_pool {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Schedule> {
let bytes = self.0.into_body().collect().await?;
let body: models::Schedule = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) project_name: String,
pub(crate) pool_name: String,
pub(crate) schedule_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!(
"{}/projects/{}/pools/{}/schedules/{}",
this.client.endpoint(),
&this.project_name,
&this.pool_name,
&this.schedule_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, "2022-03-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Schedule>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod list_dev_boxes_by_user {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DevBoxListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DevBoxListResult = 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) project_name: String,
pub(crate) user_id: String,
pub(crate) filter: Option<String>,
pub(crate) top: Option<i32>,
}
impl RequestBuilder {
#[doc = "An OData filter clause 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. Example: 'top=10'."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::DevBoxListResult, 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!(
"{}/projects/{}/users/{}/devboxes",
this.client.endpoint(),
&this.project_name,
&this.user_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, "2022-03-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let 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, "2022-03-01-preview");
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("filter", filter);
}
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("top", &top.to_string());
}
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_dev_box_by_user {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DevBox> {
let bytes = self.0.into_body().collect().await?;
let body: models::DevBox = 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) project_name: String,
pub(crate) user_id: String,
pub(crate) dev_box_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!(
"{}/projects/{}/users/{}/devboxes/{}",
this.client.endpoint(),
&this.project_name,
&this.user_id,
&this.dev_box_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, "2022-03-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::DevBox>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_dev_box {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DevBox> {
let bytes = self.0.into_body().collect().await?;
let body: models::DevBox = 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) project_name: String,
pub(crate) user_id: String,
pub(crate) dev_box_name: String,
pub(crate) body: models::DevBox,
}
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!(
"{}/projects/{}/users/{}/devboxes/{}",
this.client.endpoint(),
&this.project_name,
&this.user_id,
&this.dev_box_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, "2022-03-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::DevBox>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete_dev_box {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DevBox> {
let bytes = self.0.into_body().collect().await?;
let body: models::DevBox = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
pub fn headers(&self) -> Headers {
Headers(self.0.headers())
}
}
impl From<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()
}
}
pub struct Headers<'a>(&'a azure_core::headers::Headers);
impl<'a> Headers<'a> {
#[doc = "URL to query for status of the operation."]
pub fn operation_location(&self) -> azure_core::Result<&str> {
self.0.get_str(&azure_core::headers::HeaderName::from_static("operation-location"))
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) project_name: String,
pub(crate) user_id: String,
pub(crate) dev_box_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!(
"{}/projects/{}/users/{}/devboxes/{}",
this.client.endpoint(),
&this.project_name,
&this.user_id,
&this.dev_box_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, "2022-03-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::DevBox>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod start_dev_box {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DevBox> {
let bytes = self.0.into_body().collect().await?;
let body: models::DevBox = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
pub fn headers(&self) -> Headers {
Headers(self.0.headers())
}
}
impl From<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()
}
}
pub struct Headers<'a>(&'a azure_core::headers::Headers);
impl<'a> Headers<'a> {
#[doc = "URL to query for status of the operation."]
pub fn operation_location(&self) -> azure_core::Result<&str> {
self.0.get_str(&azure_core::headers::HeaderName::from_static("operation-location"))
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) project_name: String,
pub(crate) user_id: String,
pub(crate) dev_box_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!(
"{}/projects/{}/users/{}/devboxes/{}:start",
this.client.endpoint(),
&this.project_name,
&this.user_id,
&this.dev_box_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, "2022-03-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::DevBox>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod stop_dev_box {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DevBox> {
let bytes = self.0.into_body().collect().await?;
let body: models::DevBox = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
pub fn headers(&self) -> Headers {
Headers(self.0.headers())
}
}
impl From<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()
}
}
pub struct Headers<'a>(&'a azure_core::headers::Headers);
impl<'a> Headers<'a> {
#[doc = "URL to query for status of the operation."]
pub fn operation_location(&self) -> azure_core::Result<&str> {
self.0.get_str(&azure_core::headers::HeaderName::from_static("operation-location"))
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) project_name: String,
pub(crate) user_id: String,
pub(crate) dev_box_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!(
"{}/projects/{}/users/{}/devboxes/{}:stop",
this.client.endpoint(),
&this.project_name,
&this.user_id,
&this.dev_box_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, "2022-03-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::DevBox>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get_remote_connection {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::RemoteConnection> {
let bytes = self.0.into_body().collect().await?;
let body: models::RemoteConnection = 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) project_name: String,
pub(crate) user_id: String,
pub(crate) dev_box_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!(
"{}/projects/{}/users/{}/devboxes/{}/remoteConnection",
this.client.endpoint(),
&this.project_name,
&this.user_id,
&this.dev_box_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, "2022-03-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::RemoteConnection>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod environments {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists the environments for a project."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `project_name`: The DevCenter Project upon which to execute operations."]
pub fn list_environments(&self, project_name: impl Into<String>) -> list_environments::RequestBuilder {
list_environments::RequestBuilder {
client: self.0.clone(),
project_name: project_name.into(),
top: None,
}
}
#[doc = "Lists the environments for a project and user."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `project_name`: The DevCenter Project upon which to execute operations."]
#[doc = "* `user_id`: The AAD object id of the user. If value is 'me', the identity is taken from the authentication context"]
pub fn list_environments_by_user(
&self,
project_name: impl Into<String>,
user_id: impl Into<String>,
) -> list_environments_by_user::RequestBuilder {
list_environments_by_user::RequestBuilder {
client: self.0.clone(),
project_name: project_name.into(),
user_id: user_id.into(),
top: None,
}
}
#[doc = "Gets an environment"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `project_name`: The DevCenter Project upon which to execute operations."]
#[doc = "* `user_id`: The AAD object id of the user. If value is 'me', the identity is taken from the authentication context"]
#[doc = "* `environment_name`: The name of the environment."]
pub fn get_environment_by_user(
&self,
project_name: impl Into<String>,
user_id: impl Into<String>,
environment_name: impl Into<String>,
) -> get_environment_by_user::RequestBuilder {
get_environment_by_user::RequestBuilder {
client: self.0.clone(),
project_name: project_name.into(),
user_id: user_id.into(),
environment_name: environment_name.into(),
}
}
#[doc = "Creates or updates an environment."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `project_name`: The DevCenter Project upon which to execute operations."]
#[doc = "* `user_id`: The AAD object id of the user. If value is 'me', the identity is taken from the authentication context"]
#[doc = "* `environment_name`: The name of the environment."]
#[doc = "* `body`: Represents a environment."]
pub fn create_or_update_environment(
&self,
project_name: impl Into<String>,
user_id: impl Into<String>,
environment_name: impl Into<String>,
body: impl Into<models::Environment>,
) -> create_or_update_environment::RequestBuilder {
create_or_update_environment::RequestBuilder {
client: self.0.clone(),
project_name: project_name.into(),
user_id: user_id.into(),
environment_name: environment_name.into(),
body: body.into(),
}
}
#[doc = "Partially updates an environment"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `project_name`: The DevCenter Project upon which to execute operations."]
#[doc = "* `user_id`: The AAD object id of the user. If value is 'me', the identity is taken from the authentication context"]
#[doc = "* `environment_name`: The name of the environment."]
#[doc = "* `body`: Updatable environment properties."]
pub fn update_environment(
&self,
project_name: impl Into<String>,
user_id: impl Into<String>,
environment_name: impl Into<String>,
body: impl Into<models::EnvironmentUpdateProperties>,
) -> update_environment::RequestBuilder {
update_environment::RequestBuilder {
client: self.0.clone(),
project_name: project_name.into(),
user_id: user_id.into(),
environment_name: environment_name.into(),
body: body.into(),
}
}
#[doc = "Deletes an environment and all it's associated resources"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `project_name`: The DevCenter Project upon which to execute operations."]
#[doc = "* `user_id`: The AAD object id of the user. If value is 'me', the identity is taken from the authentication context"]
#[doc = "* `environment_name`: The name of the environment."]
pub fn delete_environment(
&self,
project_name: impl Into<String>,
user_id: impl Into<String>,
environment_name: impl Into<String>,
) -> delete_environment::RequestBuilder {
delete_environment::RequestBuilder {
client: self.0.clone(),
project_name: project_name.into(),
user_id: user_id.into(),
environment_name: environment_name.into(),
}
}
#[doc = "Executes a deploy action"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `project_name`: The DevCenter Project upon which to execute operations."]
#[doc = "* `user_id`: The AAD object id of the user. If value is 'me', the identity is taken from the authentication context"]
#[doc = "* `environment_name`: The name of the environment."]
#[doc = "* `body`: Action properties overriding the environment's default values."]
pub fn deploy_environment_action(
&self,
project_name: impl Into<String>,
user_id: impl Into<String>,
environment_name: impl Into<String>,
body: impl Into<models::ActionRequest>,
) -> deploy_environment_action::RequestBuilder {
deploy_environment_action::RequestBuilder {
client: self.0.clone(),
project_name: project_name.into(),
user_id: user_id.into(),
environment_name: environment_name.into(),
body: body.into(),
}
}
#[doc = "Executes a delete action"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `project_name`: The DevCenter Project upon which to execute operations."]
#[doc = "* `user_id`: The AAD object id of the user. If value is 'me', the identity is taken from the authentication context"]
#[doc = "* `environment_name`: The name of the environment."]
#[doc = "* `body`: Action properties overriding the environment's default values."]
pub fn delete_environment_action(
&self,
project_name: impl Into<String>,
user_id: impl Into<String>,
environment_name: impl Into<String>,
body: impl Into<models::ActionRequest>,
) -> delete_environment_action::RequestBuilder {
delete_environment_action::RequestBuilder {
client: self.0.clone(),
project_name: project_name.into(),
user_id: user_id.into(),
environment_name: environment_name.into(),
body: body.into(),
}
}
#[doc = "Executes a custom action"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `project_name`: The DevCenter Project upon which to execute operations."]
#[doc = "* `user_id`: The AAD object id of the user. If value is 'me', the identity is taken from the authentication context"]
#[doc = "* `environment_name`: The name of the environment."]
#[doc = "* `body`: Action properties overriding the environment's default values."]
pub fn custom_environment_action(
&self,
project_name: impl Into<String>,
user_id: impl Into<String>,
environment_name: impl Into<String>,
body: impl Into<models::ActionRequest>,
) -> custom_environment_action::RequestBuilder {
custom_environment_action::RequestBuilder {
client: self.0.clone(),
project_name: project_name.into(),
user_id: user_id.into(),
environment_name: environment_name.into(),
body: body.into(),
}
}
#[doc = "Lists the artifacts for an environment"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `project_name`: The DevCenter Project upon which to execute operations."]
#[doc = "* `user_id`: The AAD object id of the user. If value is 'me', the identity is taken from the authentication context"]
#[doc = "* `environment_name`: The name of the environment."]
pub fn list_artifacts_by_environment(
&self,
project_name: impl Into<String>,
user_id: impl Into<String>,
environment_name: impl Into<String>,
) -> list_artifacts_by_environment::RequestBuilder {
list_artifacts_by_environment::RequestBuilder {
client: self.0.clone(),
project_name: project_name.into(),
user_id: user_id.into(),
environment_name: environment_name.into(),
}
}
#[doc = "Lists the artifacts for an environment at a specified path, or returns the file at the path."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `project_name`: The DevCenter Project upon which to execute operations."]
#[doc = "* `user_id`: The AAD object id of the user. If value is 'me', the identity is taken from the authentication context"]
#[doc = "* `environment_name`: The name of the environment."]
#[doc = "* `artifact_path`: The path of the artifact."]
pub fn list_artifacts_by_environment_and_path(
&self,
project_name: impl Into<String>,
user_id: impl Into<String>,
environment_name: impl Into<String>,
artifact_path: impl Into<String>,
) -> list_artifacts_by_environment_and_path::RequestBuilder {
list_artifacts_by_environment_and_path::RequestBuilder {
client: self.0.clone(),
project_name: project_name.into(),
user_id: user_id.into(),
environment_name: environment_name.into(),
artifact_path: artifact_path.into(),
}
}
#[doc = "Lists latest version of all catalog items available for a project."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `project_name`: The DevCenter Project upon which to execute operations."]
pub fn list_catalog_items(&self, project_name: impl Into<String>) -> list_catalog_items::RequestBuilder {
list_catalog_items::RequestBuilder {
client: self.0.clone(),
project_name: project_name.into(),
top: None,
}
}
#[doc = "Get a catalog item from a project."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `project_name`: The DevCenter Project upon which to execute operations."]
#[doc = "* `catalog_item_id`: The unique id of the catalog item."]
pub fn get_catalog_item(
&self,
project_name: impl Into<String>,
catalog_item_id: impl Into<String>,
) -> get_catalog_item::RequestBuilder {
get_catalog_item::RequestBuilder {
client: self.0.clone(),
project_name: project_name.into(),
catalog_item_id: catalog_item_id.into(),
}
}
#[doc = "List all versions of a catalog item from a project."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `project_name`: The DevCenter Project upon which to execute operations."]
#[doc = "* `catalog_item_id`: The unique id of the catalog item."]
pub fn list_catalog_item_versions(
&self,
project_name: impl Into<String>,
catalog_item_id: impl Into<String>,
) -> list_catalog_item_versions::RequestBuilder {
list_catalog_item_versions::RequestBuilder {
client: self.0.clone(),
project_name: project_name.into(),
catalog_item_id: catalog_item_id.into(),
top: None,
}
}
#[doc = "Get a specific catalog item version from a project."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `project_name`: The DevCenter Project upon which to execute operations."]
#[doc = "* `catalog_item_id`: The unique id of the catalog item."]
#[doc = "* `version`: The version of the catalog item."]
pub fn get_catalog_item_version(
&self,
project_name: impl Into<String>,
catalog_item_id: impl Into<String>,
version: impl Into<String>,
) -> get_catalog_item_version::RequestBuilder {
get_catalog_item_version::RequestBuilder {
client: self.0.clone(),
project_name: project_name.into(),
catalog_item_id: catalog_item_id.into(),
version: version.into(),
}
}
#[doc = "Lists all environment types configured for a project."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `project_name`: The DevCenter Project upon which to execute operations."]
pub fn list_environment_types(&self, project_name: impl Into<String>) -> list_environment_types::RequestBuilder {
list_environment_types::RequestBuilder {
client: self.0.clone(),
project_name: project_name.into(),
top: None,
}
}
}
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::EnvironmentListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::EnvironmentListResult = 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) project_name: String,
pub(crate) top: Option<i32>,
}
impl RequestBuilder {
#[doc = "The maximum number of resources to return from the operation. Example: 'top=10'."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::EnvironmentListResult, 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!("{}/projects/{}/environments", this.client.endpoint(), &this.project_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, "2022-03-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let 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, "2022-03-01-preview");
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("top", &top.to_string());
}
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_environments_by_user {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::EnvironmentListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::EnvironmentListResult = 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) project_name: String,
pub(crate) user_id: String,
pub(crate) top: Option<i32>,
}
impl RequestBuilder {
#[doc = "The maximum number of resources to return from the operation. Example: 'top=10'."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::EnvironmentListResult, 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!(
"{}/projects/{}/users/{}/environments",
this.client.endpoint(),
&this.project_name,
&this.user_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, "2022-03-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let 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, "2022-03-01-preview");
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("top", &top.to_string());
}
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_environment_by_user {
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) project_name: String,
pub(crate) user_id: 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!(
"{}/projects/{}/users/{}/environments/{}",
this.client.endpoint(),
&this.project_name,
&this.user_id,
&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, "2022-03-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Environment>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update_environment {
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
}
pub fn headers(&self) -> Headers {
Headers(self.0.headers())
}
}
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()
}
}
pub struct Headers<'a>(&'a azure_core::headers::Headers);
impl<'a> Headers<'a> {
#[doc = "URL to query for status of the operation."]
pub fn operation_location(&self) -> azure_core::Result<&str> {
self.0.get_str(&azure_core::headers::HeaderName::from_static("operation-location"))
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) project_name: String,
pub(crate) user_id: String,
pub(crate) environment_name: String,
pub(crate) body: models::Environment,
}
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!(
"{}/projects/{}/users/{}/environments/{}",
this.client.endpoint(),
&this.project_name,
&this.user_id,
&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, "2022-03-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[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_environment {
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) project_name: String,
pub(crate) user_id: String,
pub(crate) environment_name: String,
pub(crate) body: models::EnvironmentUpdateProperties,
}
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!(
"{}/projects/{}/users/{}/environments/{}",
this.client.endpoint(),
&this.project_name,
&this.user_id,
&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, "2022-03-01-preview");
req.insert_header("content-type", "application/merge-patch+json");
let req_body = azure_core::to_json(&this.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 delete_environment {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) project_name: String,
pub(crate) user_id: 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!(
"{}/projects/{}/users/{}/environments/{}",
this.client.endpoint(),
&this.project_name,
&this.user_id,
&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, "2022-03-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod deploy_environment_action {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) project_name: String,
pub(crate) user_id: String,
pub(crate) environment_name: String,
pub(crate) body: models::ActionRequest,
}
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!(
"{}/projects/{}/users/{}/environments/{}:deploy",
this.client.endpoint(),
&this.project_name,
&this.user_id,
&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, "2022-03-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod delete_environment_action {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) project_name: String,
pub(crate) user_id: String,
pub(crate) environment_name: String,
pub(crate) body: models::ActionRequest,
}
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!(
"{}/projects/{}/users/{}/environments/{}:delete",
this.client.endpoint(),
&this.project_name,
&this.user_id,
&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, "2022-03-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod custom_environment_action {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) project_name: String,
pub(crate) user_id: String,
pub(crate) environment_name: String,
pub(crate) body: models::ActionRequest,
}
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!(
"{}/projects/{}/users/{}/environments/{}:custom",
this.client.endpoint(),
&this.project_name,
&this.user_id,
&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, "2022-03-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod list_artifacts_by_environment {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ArtifactListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ArtifactListResult = 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) project_name: String,
pub(crate) user_id: String,
pub(crate) environment_name: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ArtifactListResult, 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!(
"{}/projects/{}/users/{}/environments/{}/artifacts",
this.client.endpoint(),
&this.project_name,
&this.user_id,
&this.environment_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, "2022-03-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let 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, "2022-03-01-preview");
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_artifacts_by_environment_and_path {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ArtifactListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ArtifactListResult = 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) project_name: String,
pub(crate) user_id: String,
pub(crate) environment_name: String,
pub(crate) artifact_path: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ArtifactListResult, 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!(
"{}/projects/{}/users/{}/environments/{}/artifacts/{}",
this.client.endpoint(),
&this.project_name,
&this.user_id,
&this.environment_name,
&this.artifact_path
))?;
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, "2022-03-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let 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, "2022-03-01-preview");
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_catalog_items {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::CatalogItemListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::CatalogItemListResult = 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) project_name: String,
pub(crate) top: Option<i32>,
}
impl RequestBuilder {
#[doc = "The maximum number of resources to return from the operation. Example: 'top=10'."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::CatalogItemListResult, 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!("{}/projects/{}/catalogItems", this.client.endpoint(), &this.project_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, "2022-03-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let 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, "2022-03-01-preview");
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("top", &top.to_string());
}
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_catalog_item {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::CatalogItem> {
let bytes = self.0.into_body().collect().await?;
let body: models::CatalogItem = 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) project_name: String,
pub(crate) catalog_item_id: 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!(
"{}/projects/{}/catalogItems/{}",
this.client.endpoint(),
&this.project_name,
&this.catalog_item_id
))?;
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, "2022-03-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::CatalogItem>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod list_catalog_item_versions {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::CatalogItemVersionListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::CatalogItemVersionListResult = 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) project_name: String,
pub(crate) catalog_item_id: String,
pub(crate) top: Option<i32>,
}
impl RequestBuilder {
#[doc = "The maximum number of resources to return from the operation. Example: 'top=10'."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::CatalogItemVersionListResult, 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!(
"{}/projects/{}/catalogItems/{}/versions",
this.client.endpoint(),
&this.project_name,
&this.catalog_item_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, "2022-03-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let 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, "2022-03-01-preview");
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("top", &top.to_string());
}
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_catalog_item_version {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::CatalogItemVersion> {
let bytes = self.0.into_body().collect().await?;
let body: models::CatalogItemVersion = 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) project_name: String,
pub(crate) catalog_item_id: String,
pub(crate) version: 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!(
"{}/projects/{}/catalogItems/{}/versions/{}",
this.client.endpoint(),
&this.project_name,
&this.catalog_item_id,
&this.version
))?;
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, "2022-03-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::CatalogItemVersion>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod list_environment_types {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::EnvironmentTypeListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::EnvironmentTypeListResult = 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) project_name: String,
pub(crate) top: Option<i32>,
}
impl RequestBuilder {
#[doc = "The maximum number of resources to return from the operation. Example: 'top=10'."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::EnvironmentTypeListResult, 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!(
"{}/projects/{}/environmentTypes",
this.client.endpoint(),
&this.project_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, "2022-03-01-preview");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let 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, "2022-03-01-preview");
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("top", &top.to_string());
}
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)
}
}
}
}