#![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 addons_client(&self) -> addons::Client {
addons::Client(self.clone())
}
pub fn authorizations_client(&self) -> authorizations::Client {
authorizations::Client(self.clone())
}
pub fn cloud_links_client(&self) -> cloud_links::Client {
cloud_links::Client(self.clone())
}
pub fn clusters_client(&self) -> clusters::Client {
clusters::Client(self.clone())
}
pub fn datastores_client(&self) -> datastores::Client {
datastores::Client(self.clone())
}
pub fn global_reach_connections_client(&self) -> global_reach_connections::Client {
global_reach_connections::Client(self.clone())
}
pub fn hcx_enterprise_sites_client(&self) -> hcx_enterprise_sites::Client {
hcx_enterprise_sites::Client(self.clone())
}
pub fn locations_client(&self) -> locations::Client {
locations::Client(self.clone())
}
pub fn operations_client(&self) -> operations::Client {
operations::Client(self.clone())
}
pub fn private_clouds_client(&self) -> private_clouds::Client {
private_clouds::Client(self.clone())
}
pub fn script_cmdlets_client(&self) -> script_cmdlets::Client {
script_cmdlets::Client(self.clone())
}
pub fn script_executions_client(&self) -> script_executions::Client {
script_executions::Client(self.clone())
}
pub fn script_packages_client(&self) -> script_packages::Client {
script_packages::Client(self.clone())
}
pub fn workload_networks_client(&self) -> workload_networks::Client {
workload_networks::Client(self.clone())
}
}
pub mod operations {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists all of the available operations"]
pub fn list(&self) -> list::RequestBuilder {
list::RequestBuilder { client: self.0.clone() }
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::OperationList> {
let bytes = self.0.into_body().collect().await?;
let body: models::OperationList = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::OperationList, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!("{}/providers/Microsoft.AVS/operations", this.client.endpoint(),))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-06-01");
}
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, "2021-06-01");
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 locations {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Return trial status for subscription by region"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `location`: Azure region"]
pub fn check_trial_availability(
&self,
subscription_id: impl Into<String>,
location: impl Into<String>,
) -> check_trial_availability::RequestBuilder {
check_trial_availability::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
location: location.into(),
}
}
#[doc = "Return quota for subscription by region"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `location`: Azure region"]
pub fn check_quota_availability(
&self,
subscription_id: impl Into<String>,
location: impl Into<String>,
) -> check_quota_availability::RequestBuilder {
check_quota_availability::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
location: location.into(),
}
}
}
pub mod check_trial_availability {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Trial> {
let bytes = self.0.into_body().collect().await?;
let body: models::Trial = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) location: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.AVS/locations/{}/checkTrialAvailability",
this.client.endpoint(),
&this.subscription_id,
&this.location
))?;
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, "2021-06-01");
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::Trial>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod check_quota_availability {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Quota> {
let bytes = self.0.into_body().collect().await?;
let body: models::Quota = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) location: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.AVS/locations/{}/checkQuotaAvailability",
this.client.endpoint(),
&this.subscription_id,
&this.location
))?;
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, "2021-06-01");
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::Quota>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod private_clouds {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List private clouds in a resource group"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
pub fn list(&self, subscription_id: impl Into<String>, resource_group_name: impl Into<String>) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
}
}
#[doc = "List private clouds in a subscription"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
pub fn list_in_subscription(&self, subscription_id: impl Into<String>) -> list_in_subscription::RequestBuilder {
list_in_subscription::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Get a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
}
}
#[doc = "Create or update a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `private_cloud`: The private cloud"]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
private_cloud: impl Into<models::PrivateCloud>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
private_cloud: private_cloud.into(),
}
}
#[doc = "Update a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `private_cloud_update`: The private cloud properties to be updated"]
pub fn update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
private_cloud_update: impl Into<models::PrivateCloudUpdate>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
private_cloud_update: private_cloud_update.into(),
}
}
#[doc = "Delete a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
}
}
#[doc = "Rotate the vCenter password"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
pub fn rotate_vcenter_password(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
) -> rotate_vcenter_password::RequestBuilder {
rotate_vcenter_password::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
}
}
#[doc = "Rotate the NSX-T Manager password"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
pub fn rotate_nsxt_password(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
) -> rotate_nsxt_password::RequestBuilder {
rotate_nsxt_password::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
}
}
#[doc = "List the admin credentials for the private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
pub fn list_admin_credentials(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
) -> list_admin_credentials::RequestBuilder {
list_admin_credentials::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PrivateCloudList> {
let bytes = self.0.into_body().collect().await?;
let body: models::PrivateCloudList = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::PrivateCloudList, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-06-01");
}
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, "2021-06-01");
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_in_subscription {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PrivateCloudList> {
let bytes = self.0.into_body().collect().await?;
let body: models::PrivateCloudList = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::PrivateCloudList, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.AVS/privateClouds",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-06-01");
}
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, "2021-06-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PrivateCloud> {
let bytes = self.0.into_body().collect().await?;
let body: models::PrivateCloud = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_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, "2021-06-01");
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::PrivateCloud>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PrivateCloud> {
let bytes = self.0.into_body().collect().await?;
let body: models::PrivateCloud = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) private_cloud: models::PrivateCloud,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_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, "2021-06-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.private_cloud)?;
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::PrivateCloud>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PrivateCloud> {
let bytes = self.0.into_body().collect().await?;
let body: models::PrivateCloud = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) private_cloud_update: models::PrivateCloudUpdate,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_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, "2021-06-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.private_cloud_update)?;
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::PrivateCloud>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_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, "2021-06-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod rotate_vcenter_password {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/rotateVcenterPassword",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_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, "2021-06-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod rotate_nsxt_password {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/rotateNsxtPassword",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_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, "2021-06-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod list_admin_credentials {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::AdminCredentials> {
let bytes = self.0.into_body().collect().await?;
let body: models::AdminCredentials = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/listAdminCredentials",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_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, "2021-06-01");
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::AdminCredentials>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod clusters {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List clusters in a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
}
}
#[doc = "Get a cluster by name in a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `cluster_name`: Name of the cluster in the private cloud"]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
cluster_name: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
cluster_name: cluster_name.into(),
}
}
#[doc = "Create or update a cluster in a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: The name of the private cloud."]
#[doc = "* `cluster_name`: Name of the cluster in the private cloud"]
#[doc = "* `cluster`: A cluster in the private cloud"]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
cluster_name: impl Into<String>,
cluster: impl Into<models::Cluster>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
cluster_name: cluster_name.into(),
cluster: cluster.into(),
}
}
#[doc = "Update a cluster in a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `cluster_name`: Name of the cluster in the private cloud"]
#[doc = "* `cluster_update`: The cluster properties to be updated"]
pub fn update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
cluster_name: impl Into<String>,
cluster_update: impl Into<models::ClusterUpdate>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
cluster_name: cluster_name.into(),
cluster_update: cluster_update.into(),
}
}
#[doc = "Delete a cluster in a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `cluster_name`: Name of the cluster in the private cloud"]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
cluster_name: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
cluster_name: cluster_name.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ClusterList> {
let bytes = self.0.into_body().collect().await?;
let body: models::ClusterList = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ClusterList, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/clusters",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_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, "2021-06-01");
}
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, "2021-06-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Cluster> {
let bytes = self.0.into_body().collect().await?;
let body: models::Cluster = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) cluster_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/clusters/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_name,
&this.cluster_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, "2021-06-01");
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::Cluster>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Cluster> {
let bytes = self.0.into_body().collect().await?;
let body: models::Cluster = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) cluster_name: String,
pub(crate) cluster: models::Cluster,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/clusters/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_name,
&this.cluster_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, "2021-06-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.cluster)?;
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::Cluster>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Cluster> {
let bytes = self.0.into_body().collect().await?;
let body: models::Cluster = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) cluster_name: String,
pub(crate) cluster_update: models::ClusterUpdate,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/clusters/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_name,
&this.cluster_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, "2021-06-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.cluster_update)?;
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::Cluster>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) cluster_name: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/clusters/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_name,
&this.cluster_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, "2021-06-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod datastores {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List datastores in a private cloud cluster"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `cluster_name`: Name of the cluster in the private cloud"]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
cluster_name: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
cluster_name: cluster_name.into(),
}
}
#[doc = "Get a datastore in a private cloud cluster"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `cluster_name`: Name of the cluster in the private cloud"]
#[doc = "* `datastore_name`: Name of the datastore in the private cloud cluster"]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
cluster_name: impl Into<String>,
datastore_name: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
cluster_name: cluster_name.into(),
datastore_name: datastore_name.into(),
}
}
#[doc = "Create or update a datastore in a private cloud cluster"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `cluster_name`: Name of the cluster in the private cloud"]
#[doc = "* `datastore_name`: Name of the datastore in the private cloud cluster"]
#[doc = "* `datastore`: A datastore in a private cloud cluster"]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
cluster_name: impl Into<String>,
datastore_name: impl Into<String>,
datastore: impl Into<models::Datastore>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
cluster_name: cluster_name.into(),
datastore_name: datastore_name.into(),
datastore: datastore.into(),
}
}
#[doc = "Delete a datastore in a private cloud cluster"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `cluster_name`: Name of the cluster in the private cloud"]
#[doc = "* `datastore_name`: Name of the datastore in the private cloud cluster"]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
cluster_name: impl Into<String>,
datastore_name: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
cluster_name: cluster_name.into(),
datastore_name: datastore_name.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DatastoreList> {
let bytes = self.0.into_body().collect().await?;
let body: models::DatastoreList = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) cluster_name: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::DatastoreList, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/clusters/{}/datastores",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_name,
&this.cluster_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, "2021-06-01");
}
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, "2021-06-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Datastore> {
let bytes = self.0.into_body().collect().await?;
let body: models::Datastore = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) cluster_name: String,
pub(crate) datastore_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/clusters/{}/datastores/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_name,
&this.cluster_name,
&this.datastore_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, "2021-06-01");
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::Datastore>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Datastore> {
let bytes = self.0.into_body().collect().await?;
let body: models::Datastore = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) cluster_name: String,
pub(crate) datastore_name: String,
pub(crate) datastore: models::Datastore,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/clusters/{}/datastores/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_name,
&this.cluster_name,
&this.datastore_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, "2021-06-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.datastore)?;
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::Datastore>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) cluster_name: String,
pub(crate) datastore_name: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/clusters/{}/datastores/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_name,
&this.cluster_name,
&this.datastore_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, "2021-06-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod hcx_enterprise_sites {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List HCX Enterprise Sites in a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
}
}
#[doc = "Get an HCX Enterprise Site by name in a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `hcx_enterprise_site_name`: Name of the HCX Enterprise Site in the private cloud"]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
hcx_enterprise_site_name: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
hcx_enterprise_site_name: hcx_enterprise_site_name.into(),
}
}
#[doc = "Create or update an HCX Enterprise Site in a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: The name of the private cloud."]
#[doc = "* `hcx_enterprise_site_name`: Name of the HCX Enterprise Site in the private cloud"]
#[doc = "* `hcx_enterprise_site`: The HCX Enterprise Site"]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
hcx_enterprise_site_name: impl Into<String>,
hcx_enterprise_site: impl Into<models::HcxEnterpriseSite>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
hcx_enterprise_site_name: hcx_enterprise_site_name.into(),
hcx_enterprise_site: hcx_enterprise_site.into(),
}
}
#[doc = "Delete an HCX Enterprise Site in a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `hcx_enterprise_site_name`: Name of the HCX Enterprise Site in the private cloud"]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
hcx_enterprise_site_name: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
hcx_enterprise_site_name: hcx_enterprise_site_name.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::HcxEnterpriseSiteList> {
let bytes = self.0.into_body().collect().await?;
let body: models::HcxEnterpriseSiteList = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::HcxEnterpriseSiteList, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/hcxEnterpriseSites",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_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, "2021-06-01");
}
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, "2021-06-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::HcxEnterpriseSite> {
let bytes = self.0.into_body().collect().await?;
let body: models::HcxEnterpriseSite = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) hcx_enterprise_site_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/hcxEnterpriseSites/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_name,
&this.hcx_enterprise_site_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, "2021-06-01");
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::HcxEnterpriseSite>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::HcxEnterpriseSite> {
let bytes = self.0.into_body().collect().await?;
let body: models::HcxEnterpriseSite = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) hcx_enterprise_site_name: String,
pub(crate) hcx_enterprise_site: models::HcxEnterpriseSite,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/hcxEnterpriseSites/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_name,
&this.hcx_enterprise_site_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, "2021-06-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.hcx_enterprise_site)?;
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::HcxEnterpriseSite>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) hcx_enterprise_site_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/hcxEnterpriseSites/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_name,
&this.hcx_enterprise_site_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, "2021-06-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod authorizations {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List ExpressRoute Circuit Authorizations in a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
}
}
#[doc = "Get an ExpressRoute Circuit Authorization by name in a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `authorization_name`: Name of the ExpressRoute Circuit Authorization in the private cloud"]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
authorization_name: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
authorization_name: authorization_name.into(),
}
}
#[doc = "Create or update an ExpressRoute Circuit Authorization in a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: The name of the private cloud."]
#[doc = "* `authorization_name`: Name of the ExpressRoute Circuit Authorization in the private cloud"]
#[doc = "* `authorization`: An ExpressRoute Circuit Authorization"]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
authorization_name: impl Into<String>,
authorization: impl Into<models::ExpressRouteAuthorization>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
authorization_name: authorization_name.into(),
authorization: authorization.into(),
}
}
#[doc = "Delete an ExpressRoute Circuit Authorization in a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `authorization_name`: Name of the ExpressRoute Circuit Authorization in the private cloud"]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
authorization_name: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
authorization_name: authorization_name.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ExpressRouteAuthorizationList> {
let bytes = self.0.into_body().collect().await?;
let body: models::ExpressRouteAuthorizationList = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ExpressRouteAuthorizationList, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/authorizations",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_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, "2021-06-01");
}
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, "2021-06-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ExpressRouteAuthorization> {
let bytes = self.0.into_body().collect().await?;
let body: models::ExpressRouteAuthorization = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) authorization_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/authorizations/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_name,
&this.authorization_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, "2021-06-01");
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::ExpressRouteAuthorization>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ExpressRouteAuthorization> {
let bytes = self.0.into_body().collect().await?;
let body: models::ExpressRouteAuthorization = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) authorization_name: String,
pub(crate) authorization: models::ExpressRouteAuthorization,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/authorizations/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_name,
&this.authorization_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, "2021-06-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.authorization)?;
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::ExpressRouteAuthorization>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) authorization_name: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/authorizations/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_name,
&this.authorization_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, "2021-06-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod global_reach_connections {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List global reach connections in a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
}
}
#[doc = "Get a global reach connection by name in a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `global_reach_connection_name`: Name of the global reach connection in the private cloud"]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
global_reach_connection_name: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
global_reach_connection_name: global_reach_connection_name.into(),
}
}
#[doc = "Create or update a global reach connection in a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: The name of the private cloud."]
#[doc = "* `global_reach_connection_name`: Name of the global reach connection in the private cloud"]
#[doc = "* `global_reach_connection`: A global reach connection in the private cloud"]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
global_reach_connection_name: impl Into<String>,
global_reach_connection: impl Into<models::GlobalReachConnection>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
global_reach_connection_name: global_reach_connection_name.into(),
global_reach_connection: global_reach_connection.into(),
}
}
#[doc = "Delete a global reach connection in a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `global_reach_connection_name`: Name of the global reach connection in the private cloud"]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
global_reach_connection_name: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
global_reach_connection_name: global_reach_connection_name.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GlobalReachConnectionList> {
let bytes = self.0.into_body().collect().await?;
let body: models::GlobalReachConnectionList = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::GlobalReachConnectionList, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/globalReachConnections",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_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, "2021-06-01");
}
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, "2021-06-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GlobalReachConnection> {
let bytes = self.0.into_body().collect().await?;
let body: models::GlobalReachConnection = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) global_reach_connection_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/globalReachConnections/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_name,
&this.global_reach_connection_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, "2021-06-01");
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::GlobalReachConnection>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GlobalReachConnection> {
let bytes = self.0.into_body().collect().await?;
let body: models::GlobalReachConnection = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) global_reach_connection_name: String,
pub(crate) global_reach_connection: models::GlobalReachConnection,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/globalReachConnections/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_name,
&this.global_reach_connection_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, "2021-06-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.global_reach_connection)?;
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::GlobalReachConnection>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) global_reach_connection_name: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/globalReachConnections/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_name,
&this.global_reach_connection_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, "2021-06-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod workload_networks {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List of segments in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
pub fn list_segments(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
) -> list_segments::RequestBuilder {
list_segments::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
}
}
#[doc = "Get a segment by id in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `segment_id`: NSX Segment identifier. Generally the same as the Segment's display name"]
pub fn get_segment(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
segment_id: impl Into<String>,
) -> get_segment::RequestBuilder {
get_segment::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
segment_id: segment_id.into(),
}
}
#[doc = "Create a segment by id in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `segment_id`: NSX Segment identifier. Generally the same as the Segment's display name"]
#[doc = "* `workload_network_segment`: NSX Segment"]
pub fn create_segments(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
segment_id: impl Into<String>,
workload_network_segment: impl Into<models::WorkloadNetworkSegment>,
) -> create_segments::RequestBuilder {
create_segments::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
segment_id: segment_id.into(),
workload_network_segment: workload_network_segment.into(),
}
}
#[doc = "Create or update a segment by id in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `segment_id`: NSX Segment identifier. Generally the same as the Segment's display name"]
#[doc = "* `workload_network_segment`: NSX Segment"]
pub fn update_segments(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
segment_id: impl Into<String>,
workload_network_segment: impl Into<models::WorkloadNetworkSegment>,
) -> update_segments::RequestBuilder {
update_segments::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
segment_id: segment_id.into(),
workload_network_segment: workload_network_segment.into(),
}
}
#[doc = "Delete a segment by id in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `segment_id`: NSX Segment identifier. Generally the same as the Segment's display name"]
pub fn delete_segment(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
segment_id: impl Into<String>,
) -> delete_segment::RequestBuilder {
delete_segment::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
segment_id: segment_id.into(),
}
}
#[doc = "List dhcp in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
pub fn list_dhcp(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
) -> list_dhcp::RequestBuilder {
list_dhcp::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
}
}
#[doc = "Get dhcp by id in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `dhcp_id`: NSX DHCP identifier. Generally the same as the DHCP display name"]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
pub fn get_dhcp(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
dhcp_id: impl Into<String>,
private_cloud_name: impl Into<String>,
) -> get_dhcp::RequestBuilder {
get_dhcp::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
dhcp_id: dhcp_id.into(),
private_cloud_name: private_cloud_name.into(),
}
}
#[doc = "Create dhcp by id in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `dhcp_id`: NSX DHCP identifier. Generally the same as the DHCP display name"]
#[doc = "* `workload_network_dhcp`: NSX DHCP"]
pub fn create_dhcp(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
dhcp_id: impl Into<String>,
workload_network_dhcp: impl Into<models::WorkloadNetworkDhcp>,
) -> create_dhcp::RequestBuilder {
create_dhcp::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
dhcp_id: dhcp_id.into(),
workload_network_dhcp: workload_network_dhcp.into(),
}
}
#[doc = "Create or update dhcp by id in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `dhcp_id`: NSX DHCP identifier. Generally the same as the DHCP display name"]
#[doc = "* `workload_network_dhcp`: NSX DHCP"]
pub fn update_dhcp(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
dhcp_id: impl Into<String>,
workload_network_dhcp: impl Into<models::WorkloadNetworkDhcp>,
) -> update_dhcp::RequestBuilder {
update_dhcp::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
dhcp_id: dhcp_id.into(),
workload_network_dhcp: workload_network_dhcp.into(),
}
}
#[doc = "Delete dhcp by id in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `dhcp_id`: NSX DHCP identifier. Generally the same as the DHCP display name"]
pub fn delete_dhcp(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
dhcp_id: impl Into<String>,
) -> delete_dhcp::RequestBuilder {
delete_dhcp::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
dhcp_id: dhcp_id.into(),
}
}
#[doc = "List of gateways in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
pub fn list_gateways(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
) -> list_gateways::RequestBuilder {
list_gateways::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
}
}
#[doc = "Get a gateway by id in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `gateway_id`: NSX Gateway identifier. Generally the same as the Gateway's display name"]
pub fn get_gateway(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
gateway_id: impl Into<String>,
) -> get_gateway::RequestBuilder {
get_gateway::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
gateway_id: gateway_id.into(),
}
}
#[doc = "List of port mirroring profiles in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
pub fn list_port_mirroring(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
) -> list_port_mirroring::RequestBuilder {
list_port_mirroring::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
}
}
#[doc = "Get a port mirroring profile by id in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `port_mirroring_id`: NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name"]
pub fn get_port_mirroring(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
port_mirroring_id: impl Into<String>,
) -> get_port_mirroring::RequestBuilder {
get_port_mirroring::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
port_mirroring_id: port_mirroring_id.into(),
}
}
#[doc = "Create a port mirroring profile by id in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `port_mirroring_id`: NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name"]
#[doc = "* `workload_network_port_mirroring`: NSX port mirroring"]
pub fn create_port_mirroring(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
port_mirroring_id: impl Into<String>,
workload_network_port_mirroring: impl Into<models::WorkloadNetworkPortMirroring>,
) -> create_port_mirroring::RequestBuilder {
create_port_mirroring::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
port_mirroring_id: port_mirroring_id.into(),
workload_network_port_mirroring: workload_network_port_mirroring.into(),
}
}
#[doc = "Create or update a port mirroring profile by id in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `port_mirroring_id`: NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name"]
#[doc = "* `workload_network_port_mirroring`: NSX port mirroring"]
pub fn update_port_mirroring(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
port_mirroring_id: impl Into<String>,
workload_network_port_mirroring: impl Into<models::WorkloadNetworkPortMirroring>,
) -> update_port_mirroring::RequestBuilder {
update_port_mirroring::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
port_mirroring_id: port_mirroring_id.into(),
workload_network_port_mirroring: workload_network_port_mirroring.into(),
}
}
#[doc = "Delete a port mirroring profile by id in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `port_mirroring_id`: NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name"]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
pub fn delete_port_mirroring(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
port_mirroring_id: impl Into<String>,
private_cloud_name: impl Into<String>,
) -> delete_port_mirroring::RequestBuilder {
delete_port_mirroring::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
port_mirroring_id: port_mirroring_id.into(),
private_cloud_name: private_cloud_name.into(),
}
}
#[doc = "List of vm groups in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
pub fn list_vm_groups(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
) -> list_vm_groups::RequestBuilder {
list_vm_groups::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
}
}
#[doc = "Get a vm group by id in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `vm_group_id`: NSX VM Group identifier. Generally the same as the VM Group's display name"]
pub fn get_vm_group(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
vm_group_id: impl Into<String>,
) -> get_vm_group::RequestBuilder {
get_vm_group::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
vm_group_id: vm_group_id.into(),
}
}
#[doc = "Create a vm group by id in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `vm_group_id`: NSX VM Group identifier. Generally the same as the VM Group's display name"]
#[doc = "* `workload_network_vm_group`: NSX VM Group"]
pub fn create_vm_group(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
vm_group_id: impl Into<String>,
workload_network_vm_group: impl Into<models::WorkloadNetworkVmGroup>,
) -> create_vm_group::RequestBuilder {
create_vm_group::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
vm_group_id: vm_group_id.into(),
workload_network_vm_group: workload_network_vm_group.into(),
}
}
#[doc = "Create or update a vm group by id in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `vm_group_id`: NSX VM Group identifier. Generally the same as the VM Group's display name"]
#[doc = "* `workload_network_vm_group`: NSX VM Group"]
pub fn update_vm_group(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
vm_group_id: impl Into<String>,
workload_network_vm_group: impl Into<models::WorkloadNetworkVmGroup>,
) -> update_vm_group::RequestBuilder {
update_vm_group::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
vm_group_id: vm_group_id.into(),
workload_network_vm_group: workload_network_vm_group.into(),
}
}
#[doc = "Delete a vm group by id in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `vm_group_id`: NSX VM Group identifier. Generally the same as the VM Group's display name"]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
pub fn delete_vm_group(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
vm_group_id: impl Into<String>,
private_cloud_name: impl Into<String>,
) -> delete_vm_group::RequestBuilder {
delete_vm_group::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
vm_group_id: vm_group_id.into(),
private_cloud_name: private_cloud_name.into(),
}
}
#[doc = "List of virtual machines in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
pub fn list_virtual_machines(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
) -> list_virtual_machines::RequestBuilder {
list_virtual_machines::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
}
}
#[doc = "Get a virtual machine by id in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `virtual_machine_id`: Virtual Machine identifier"]
pub fn get_virtual_machine(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
virtual_machine_id: impl Into<String>,
) -> get_virtual_machine::RequestBuilder {
get_virtual_machine::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
virtual_machine_id: virtual_machine_id.into(),
}
}
#[doc = "List of DNS services in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
pub fn list_dns_services(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
) -> list_dns_services::RequestBuilder {
list_dns_services::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
}
}
#[doc = "Get a DNS service by id in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `dns_service_id`: NSX DNS Service identifier. Generally the same as the DNS Service's display name"]
pub fn get_dns_service(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
dns_service_id: impl Into<String>,
) -> get_dns_service::RequestBuilder {
get_dns_service::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
dns_service_id: dns_service_id.into(),
}
}
#[doc = "Create a DNS service by id in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `dns_service_id`: NSX DNS Service identifier. Generally the same as the DNS Service's display name"]
#[doc = "* `workload_network_dns_service`: NSX DNS Service"]
pub fn create_dns_service(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
dns_service_id: impl Into<String>,
workload_network_dns_service: impl Into<models::WorkloadNetworkDnsService>,
) -> create_dns_service::RequestBuilder {
create_dns_service::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
dns_service_id: dns_service_id.into(),
workload_network_dns_service: workload_network_dns_service.into(),
}
}
#[doc = "Create or update a DNS service by id in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `dns_service_id`: NSX DNS Service identifier. Generally the same as the DNS Service's display name"]
#[doc = "* `workload_network_dns_service`: NSX DNS Service"]
pub fn update_dns_service(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
dns_service_id: impl Into<String>,
workload_network_dns_service: impl Into<models::WorkloadNetworkDnsService>,
) -> update_dns_service::RequestBuilder {
update_dns_service::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
dns_service_id: dns_service_id.into(),
workload_network_dns_service: workload_network_dns_service.into(),
}
}
#[doc = "Delete a DNS service by id in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `dns_service_id`: NSX DNS Service identifier. Generally the same as the DNS Service's display name"]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
pub fn delete_dns_service(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
dns_service_id: impl Into<String>,
private_cloud_name: impl Into<String>,
) -> delete_dns_service::RequestBuilder {
delete_dns_service::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
dns_service_id: dns_service_id.into(),
private_cloud_name: private_cloud_name.into(),
}
}
#[doc = "List of DNS zones in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
pub fn list_dns_zones(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
) -> list_dns_zones::RequestBuilder {
list_dns_zones::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
}
}
#[doc = "Get a DNS zone by id in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `dns_zone_id`: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name"]
pub fn get_dns_zone(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
dns_zone_id: impl Into<String>,
) -> get_dns_zone::RequestBuilder {
get_dns_zone::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
dns_zone_id: dns_zone_id.into(),
}
}
#[doc = "Create a DNS zone by id in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `dns_zone_id`: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name"]
#[doc = "* `workload_network_dns_zone`: NSX DNS Zone"]
pub fn create_dns_zone(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
dns_zone_id: impl Into<String>,
workload_network_dns_zone: impl Into<models::WorkloadNetworkDnsZone>,
) -> create_dns_zone::RequestBuilder {
create_dns_zone::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
dns_zone_id: dns_zone_id.into(),
workload_network_dns_zone: workload_network_dns_zone.into(),
}
}
#[doc = "Create or update a DNS zone by id in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `dns_zone_id`: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name"]
#[doc = "* `workload_network_dns_zone`: NSX DNS Zone"]
pub fn update_dns_zone(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
dns_zone_id: impl Into<String>,
workload_network_dns_zone: impl Into<models::WorkloadNetworkDnsZone>,
) -> update_dns_zone::RequestBuilder {
update_dns_zone::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
dns_zone_id: dns_zone_id.into(),
workload_network_dns_zone: workload_network_dns_zone.into(),
}
}
#[doc = "Delete a DNS zone by id in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `dns_zone_id`: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name"]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
pub fn delete_dns_zone(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
dns_zone_id: impl Into<String>,
private_cloud_name: impl Into<String>,
) -> delete_dns_zone::RequestBuilder {
delete_dns_zone::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
dns_zone_id: dns_zone_id.into(),
private_cloud_name: private_cloud_name.into(),
}
}
#[doc = "List of Public IP Blocks in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
pub fn list_public_i_ps(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
) -> list_public_i_ps::RequestBuilder {
list_public_i_ps::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
}
}
#[doc = "Get a Public IP Block by id in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `public_ip_id`: NSX Public IP Block identifier. Generally the same as the Public IP Block's display name"]
pub fn get_public_ip(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
public_ip_id: impl Into<String>,
) -> get_public_ip::RequestBuilder {
get_public_ip::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
public_ip_id: public_ip_id.into(),
}
}
#[doc = "Create a Public IP Block by id in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `public_ip_id`: NSX Public IP Block identifier. Generally the same as the Public IP Block's display name"]
#[doc = "* `workload_network_public_ip`: NSX Public IP Block"]
pub fn create_public_ip(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
public_ip_id: impl Into<String>,
workload_network_public_ip: impl Into<models::WorkloadNetworkPublicIp>,
) -> create_public_ip::RequestBuilder {
create_public_ip::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
public_ip_id: public_ip_id.into(),
workload_network_public_ip: workload_network_public_ip.into(),
}
}
#[doc = "Delete a Public IP Block by id in a private cloud workload network."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `public_ip_id`: NSX Public IP Block identifier. Generally the same as the Public IP Block's display name"]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
pub fn delete_public_ip(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
public_ip_id: impl Into<String>,
private_cloud_name: impl Into<String>,
) -> delete_public_ip::RequestBuilder {
delete_public_ip::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
public_ip_id: public_ip_id.into(),
private_cloud_name: private_cloud_name.into(),
}
}
}
pub mod list_segments {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadNetworkSegmentsList> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadNetworkSegmentsList = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::WorkloadNetworkSegmentsList, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/segments" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_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, "2021-06-01");
}
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, "2021-06-01");
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_segment {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadNetworkSegment> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadNetworkSegment = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) segment_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 ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/segments/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_name , & this . segment_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, "2021-06-01");
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::WorkloadNetworkSegment>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_segments {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadNetworkSegment> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadNetworkSegment = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) segment_id: String,
pub(crate) workload_network_segment: models::WorkloadNetworkSegment,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/segments/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_name , & this . segment_id)) ? ;
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, "2021-06-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.workload_network_segment)?;
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::WorkloadNetworkSegment>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update_segments {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadNetworkSegment> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadNetworkSegment = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) segment_id: String,
pub(crate) workload_network_segment: models::WorkloadNetworkSegment,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/segments/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_name , & this . segment_id)) ? ;
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, "2021-06-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.workload_network_segment)?;
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::WorkloadNetworkSegment>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete_segment {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) segment_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/segments/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_name , & this . segment_id)) ? ;
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, "2021-06-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod list_dhcp {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadNetworkDhcpList> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadNetworkDhcpList = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::WorkloadNetworkDhcpList, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/dhcpConfigurations" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_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, "2021-06-01");
}
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, "2021-06-01");
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_dhcp {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadNetworkDhcp> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadNetworkDhcp = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) dhcp_id: String,
pub(crate) private_cloud_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/dhcpConfigurations/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_name , & this . dhcp_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, "2021-06-01");
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::WorkloadNetworkDhcp>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_dhcp {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadNetworkDhcp> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadNetworkDhcp = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) dhcp_id: String,
pub(crate) workload_network_dhcp: models::WorkloadNetworkDhcp,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/dhcpConfigurations/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_name , & this . dhcp_id)) ? ;
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, "2021-06-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.workload_network_dhcp)?;
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::WorkloadNetworkDhcp>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update_dhcp {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadNetworkDhcp> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadNetworkDhcp = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) dhcp_id: String,
pub(crate) workload_network_dhcp: models::WorkloadNetworkDhcp,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/dhcpConfigurations/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_name , & this . dhcp_id)) ? ;
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, "2021-06-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.workload_network_dhcp)?;
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::WorkloadNetworkDhcp>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete_dhcp {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) dhcp_id: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/dhcpConfigurations/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_name , & this . dhcp_id)) ? ;
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, "2021-06-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod list_gateways {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadNetworkGatewayList> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadNetworkGatewayList = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::WorkloadNetworkGatewayList, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/gateways" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_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, "2021-06-01");
}
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, "2021-06-01");
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_gateway {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadNetworkGateway> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadNetworkGateway = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) gateway_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 ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/gateways/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_name , & this . gateway_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, "2021-06-01");
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::WorkloadNetworkGateway>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod list_port_mirroring {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadNetworkPortMirroringList> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadNetworkPortMirroringList = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::WorkloadNetworkPortMirroringList, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/portMirroringProfiles" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_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, "2021-06-01");
}
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, "2021-06-01");
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_port_mirroring {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadNetworkPortMirroring> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadNetworkPortMirroring = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) port_mirroring_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 ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/portMirroringProfiles/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_name , & this . port_mirroring_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, "2021-06-01");
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::WorkloadNetworkPortMirroring>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_port_mirroring {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadNetworkPortMirroring> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadNetworkPortMirroring = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) port_mirroring_id: String,
pub(crate) workload_network_port_mirroring: models::WorkloadNetworkPortMirroring,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/portMirroringProfiles/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_name , & this . port_mirroring_id)) ? ;
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, "2021-06-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.workload_network_port_mirroring)?;
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::WorkloadNetworkPortMirroring>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update_port_mirroring {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadNetworkPortMirroring> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadNetworkPortMirroring = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) port_mirroring_id: String,
pub(crate) workload_network_port_mirroring: models::WorkloadNetworkPortMirroring,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/portMirroringProfiles/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_name , & this . port_mirroring_id)) ? ;
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, "2021-06-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.workload_network_port_mirroring)?;
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::WorkloadNetworkPortMirroring>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete_port_mirroring {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) port_mirroring_id: String,
pub(crate) private_cloud_name: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/portMirroringProfiles/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_name , & this . port_mirroring_id)) ? ;
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, "2021-06-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod list_vm_groups {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadNetworkVmGroupsList> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadNetworkVmGroupsList = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::WorkloadNetworkVmGroupsList, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/vmGroups" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_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, "2021-06-01");
}
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, "2021-06-01");
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_vm_group {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadNetworkVmGroup> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadNetworkVmGroup = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) vm_group_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 ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/vmGroups/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_name , & this . vm_group_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, "2021-06-01");
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::WorkloadNetworkVmGroup>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_vm_group {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadNetworkVmGroup> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadNetworkVmGroup = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) vm_group_id: String,
pub(crate) workload_network_vm_group: models::WorkloadNetworkVmGroup,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/vmGroups/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_name , & this . vm_group_id)) ? ;
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, "2021-06-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.workload_network_vm_group)?;
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::WorkloadNetworkVmGroup>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update_vm_group {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadNetworkVmGroup> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadNetworkVmGroup = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) vm_group_id: String,
pub(crate) workload_network_vm_group: models::WorkloadNetworkVmGroup,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/vmGroups/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_name , & this . vm_group_id)) ? ;
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, "2021-06-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.workload_network_vm_group)?;
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::WorkloadNetworkVmGroup>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete_vm_group {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) vm_group_id: String,
pub(crate) private_cloud_name: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/vmGroups/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_name , & this . vm_group_id)) ? ;
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, "2021-06-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod list_virtual_machines {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadNetworkVirtualMachinesList> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadNetworkVirtualMachinesList = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::WorkloadNetworkVirtualMachinesList, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/virtualMachines" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_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, "2021-06-01");
}
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, "2021-06-01");
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_virtual_machine {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadNetworkVirtualMachine> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadNetworkVirtualMachine = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) virtual_machine_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 ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/virtualMachines/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_name , & this . virtual_machine_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, "2021-06-01");
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::WorkloadNetworkVirtualMachine>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod list_dns_services {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadNetworkDnsServicesList> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadNetworkDnsServicesList = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::WorkloadNetworkDnsServicesList, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/dnsServices" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_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, "2021-06-01");
}
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, "2021-06-01");
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_dns_service {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadNetworkDnsService> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadNetworkDnsService = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) dns_service_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 ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/dnsServices/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_name , & this . dns_service_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, "2021-06-01");
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::WorkloadNetworkDnsService>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_dns_service {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadNetworkDnsService> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadNetworkDnsService = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) dns_service_id: String,
pub(crate) workload_network_dns_service: models::WorkloadNetworkDnsService,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/dnsServices/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_name , & this . dns_service_id)) ? ;
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, "2021-06-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.workload_network_dns_service)?;
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::WorkloadNetworkDnsService>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update_dns_service {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadNetworkDnsService> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadNetworkDnsService = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) dns_service_id: String,
pub(crate) workload_network_dns_service: models::WorkloadNetworkDnsService,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/dnsServices/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_name , & this . dns_service_id)) ? ;
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, "2021-06-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.workload_network_dns_service)?;
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::WorkloadNetworkDnsService>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete_dns_service {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) dns_service_id: String,
pub(crate) private_cloud_name: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/dnsServices/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_name , & this . dns_service_id)) ? ;
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, "2021-06-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod list_dns_zones {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadNetworkDnsZonesList> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadNetworkDnsZonesList = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::WorkloadNetworkDnsZonesList, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/dnsZones" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_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, "2021-06-01");
}
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, "2021-06-01");
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_dns_zone {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadNetworkDnsZone> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadNetworkDnsZone = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) dns_zone_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 ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/dnsZones/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_name , & this . dns_zone_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, "2021-06-01");
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::WorkloadNetworkDnsZone>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_dns_zone {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadNetworkDnsZone> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadNetworkDnsZone = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) dns_zone_id: String,
pub(crate) workload_network_dns_zone: models::WorkloadNetworkDnsZone,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/dnsZones/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_name , & this . dns_zone_id)) ? ;
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, "2021-06-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.workload_network_dns_zone)?;
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::WorkloadNetworkDnsZone>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update_dns_zone {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadNetworkDnsZone> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadNetworkDnsZone = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) dns_zone_id: String,
pub(crate) workload_network_dns_zone: models::WorkloadNetworkDnsZone,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/dnsZones/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_name , & this . dns_zone_id)) ? ;
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, "2021-06-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.workload_network_dns_zone)?;
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::WorkloadNetworkDnsZone>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete_dns_zone {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) dns_zone_id: String,
pub(crate) private_cloud_name: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/dnsZones/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_name , & this . dns_zone_id)) ? ;
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, "2021-06-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod list_public_i_ps {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadNetworkPublicIPsList> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadNetworkPublicIPsList = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::WorkloadNetworkPublicIPsList, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/publicIPs" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_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, "2021-06-01");
}
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, "2021-06-01");
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_public_ip {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadNetworkPublicIp> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadNetworkPublicIp = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) public_ip_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 ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/publicIPs/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_name , & this . public_ip_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, "2021-06-01");
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::WorkloadNetworkPublicIp>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_public_ip {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkloadNetworkPublicIp> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkloadNetworkPublicIp = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) public_ip_id: String,
pub(crate) workload_network_public_ip: models::WorkloadNetworkPublicIp,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/publicIPs/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_name , & this . public_ip_id)) ? ;
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, "2021-06-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.workload_network_public_ip)?;
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::WorkloadNetworkPublicIp>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete_public_ip {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) public_ip_id: String,
pub(crate) private_cloud_name: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/workloadNetworks/default/publicIPs/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_name , & this . public_ip_id)) ? ;
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, "2021-06-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod cloud_links {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List cloud link in a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
}
}
#[doc = "Get an cloud link by name in a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `cloud_link_name`: Name of the cloud link resource"]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
cloud_link_name: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
cloud_link_name: cloud_link_name.into(),
}
}
#[doc = "Create or update a cloud link in a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: The name of the private cloud."]
#[doc = "* `cloud_link_name`: Name of the cloud link resource"]
#[doc = "* `cloud_link`: A cloud link in the private cloud"]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
cloud_link_name: impl Into<String>,
cloud_link: impl Into<models::CloudLink>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
cloud_link_name: cloud_link_name.into(),
cloud_link: cloud_link.into(),
}
}
#[doc = "Delete a cloud link in a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `cloud_link_name`: Name of the cloud link resource"]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
cloud_link_name: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
cloud_link_name: cloud_link_name.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::CloudLinkList> {
let bytes = self.0.into_body().collect().await?;
let body: models::CloudLinkList = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::CloudLinkList, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/cloudLinks",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_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, "2021-06-01");
}
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, "2021-06-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::CloudLink> {
let bytes = self.0.into_body().collect().await?;
let body: models::CloudLink = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) cloud_link_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/cloudLinks/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_name,
&this.cloud_link_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, "2021-06-01");
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::CloudLink>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::CloudLink> {
let bytes = self.0.into_body().collect().await?;
let body: models::CloudLink = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) cloud_link_name: String,
pub(crate) cloud_link: models::CloudLink,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/cloudLinks/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_name,
&this.cloud_link_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, "2021-06-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.cloud_link)?;
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::CloudLink>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) cloud_link_name: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/cloudLinks/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_name,
&this.cloud_link_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, "2021-06-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod addons {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List addons in a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
}
}
#[doc = "Get an addon by name in a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `addon_name`: Name of the addon for the private cloud"]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
addon_name: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
addon_name: addon_name.into(),
}
}
#[doc = "Create or update a addon in a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: The name of the private cloud."]
#[doc = "* `addon_name`: Name of the addon for the private cloud"]
#[doc = "* `addon`: A addon in the private cloud"]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
addon_name: impl Into<String>,
addon: impl Into<models::Addon>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
addon_name: addon_name.into(),
addon: addon.into(),
}
}
#[doc = "Delete a addon in a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `addon_name`: Name of the addon for the private cloud"]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
addon_name: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
addon_name: addon_name.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::AddonList> {
let bytes = self.0.into_body().collect().await?;
let body: models::AddonList = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::AddonList, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/addons",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_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, "2021-06-01");
}
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, "2021-06-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Addon> {
let bytes = self.0.into_body().collect().await?;
let body: models::Addon = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) addon_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/addons/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_name,
&this.addon_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, "2021-06-01");
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::Addon>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Addon> {
let bytes = self.0.into_body().collect().await?;
let body: models::Addon = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) addon_name: String,
pub(crate) addon: models::Addon,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/addons/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_name,
&this.addon_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, "2021-06-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.addon)?;
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::Addon>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) addon_name: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/addons/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_name,
&this.addon_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, "2021-06-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod script_packages {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Return script packages available for a private cloud to run on their Private Cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
}
}
#[doc = "Return script package available to run on an Private Cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `script_package_name`: Name of the script package in the private cloud"]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
script_package_name: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
script_package_name: script_package_name.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ScriptPackagesList> {
let bytes = self.0.into_body().collect().await?;
let body: models::ScriptPackagesList = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ScriptPackagesList, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/scriptPackages",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_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, "2021-06-01");
}
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, "2021-06-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ScriptPackage> {
let bytes = self.0.into_body().collect().await?;
let body: models::ScriptPackage = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) script_package_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/scriptPackages/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_name,
&this.script_package_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, "2021-06-01");
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::ScriptPackage>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod script_cmdlets {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Return script cmdlet resources available for a private cloud to create a script execution resource on their Private Cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `script_package_name`: Name of the script package in the private cloud"]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
script_package_name: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
script_package_name: script_package_name.into(),
}
}
#[doc = "Return information about a script cmdlet resource in a specific package on a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `script_package_name`: Name of the script package in the private cloud"]
#[doc = "* `script_cmdlet_name`: Name of the script cmdlet resource in the script package in the private cloud"]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
script_package_name: impl Into<String>,
script_cmdlet_name: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
script_package_name: script_package_name.into(),
script_cmdlet_name: script_cmdlet_name.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ScriptCmdletsList> {
let bytes = self.0.into_body().collect().await?;
let body: models::ScriptCmdletsList = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) script_package_name: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ScriptCmdletsList, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/scriptPackages/{}/scriptCmdlets" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_name , & this . script_package_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, "2021-06-01");
}
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, "2021-06-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ScriptCmdlet> {
let bytes = self.0.into_body().collect().await?;
let body: models::ScriptCmdlet = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) script_package_name: String,
pub(crate) script_cmdlet_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/scriptPackages/{}/scriptCmdlets/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_name , & this . script_package_name , & this . script_cmdlet_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, "2021-06-01");
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::ScriptCmdlet>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod script_executions {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Get an script execution resource by name in a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
}
}
#[doc = "Get an script execution resource by name in a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `script_execution_name`: Name of the user-invoked script execution resource"]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
script_execution_name: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
script_execution_name: script_execution_name.into(),
}
}
#[doc = "Create or update a script execution resource in a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: The name of the private cloud."]
#[doc = "* `script_execution_name`: Name of the user-invoked script execution resource"]
#[doc = "* `script_execution`: A script running in the private cloud"]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
script_execution_name: impl Into<String>,
script_execution: impl Into<models::ScriptExecution>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
script_execution_name: script_execution_name.into(),
script_execution: script_execution.into(),
}
}
#[doc = "Cancel a ScriptExecution in a private cloud"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `script_execution_name`: Name of the user-invoked script execution resource"]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
script_execution_name: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
script_execution_name: script_execution_name.into(),
}
}
#[doc = "Return the logs for a script execution resource"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `private_cloud_name`: Name of the private cloud"]
#[doc = "* `script_execution_name`: Name of the user-invoked script execution resource"]
pub fn get_execution_logs(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
private_cloud_name: impl Into<String>,
script_execution_name: impl Into<String>,
) -> get_execution_logs::RequestBuilder {
get_execution_logs::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
private_cloud_name: private_cloud_name.into(),
script_execution_name: script_execution_name.into(),
script_output_stream_type: Vec::new(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ScriptExecutionsList> {
let bytes = self.0.into_body().collect().await?;
let body: models::ScriptExecutionsList = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ScriptExecutionsList, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/scriptExecutions",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_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, "2021-06-01");
}
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, "2021-06-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ScriptExecution> {
let bytes = self.0.into_body().collect().await?;
let body: models::ScriptExecution = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) script_execution_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/scriptExecutions/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_name,
&this.script_execution_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, "2021-06-01");
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::ScriptExecution>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ScriptExecution> {
let bytes = self.0.into_body().collect().await?;
let body: models::ScriptExecution = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) script_execution_name: String,
pub(crate) script_execution: models::ScriptExecution,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/scriptExecutions/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_name,
&this.script_execution_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, "2021-06-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.script_execution)?;
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::ScriptExecution>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) script_execution_name: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as long running operations are not supported yet"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/scriptExecutions/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.private_cloud_name,
&this.script_execution_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, "2021-06-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod get_execution_logs {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ScriptExecution> {
let bytes = self.0.into_body().collect().await?;
let body: models::ScriptExecution = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) private_cloud_name: String,
pub(crate) script_execution_name: String,
pub(crate) script_output_stream_type: Vec<String>,
}
impl RequestBuilder {
#[doc = "Name of the desired output stream to return. If not provided, will return all. An empty array will return nothing"]
pub fn script_output_stream_type(mut self, script_output_stream_type: Vec<String>) -> Self {
self.script_output_stream_type = script_output_stream_type;
self
}
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AVS/privateClouds/{}/scriptExecutions/{}/getExecutionLogs" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . private_cloud_name , & this . script_execution_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, "2021-06-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.script_output_stream_type)?;
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::ScriptExecution>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}