#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(unused_imports)]
#![allow(clippy::redundant_clone)]
pub mod models;
#[derive(Clone)]
pub struct Client {
endpoint: azure_core::Url,
credential: std::sync::Arc<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<azure_core::Url>,
scopes: Option<Vec<String>>,
options: azure_core::ClientOptions,
}
pub use azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD as DEFAULT_ENDPOINT;
impl ClientBuilder {
#[doc = "Create a new instance of `ClientBuilder`."]
#[must_use]
pub fn new(credential: std::sync::Arc<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<azure_core::Url>) -> 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."]
pub fn build(self) -> azure_core::Result<Client> {
let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned());
let scopes = if let Some(scopes) = self.scopes {
scopes
} else {
vec![endpoint.join(azure_core::auth::DEFAULT_SCOPE_SUFFIX)?.to_string()]
};
Ok(Client::new(endpoint, self.credential, scopes, self.options))
}
}
impl Client {
pub(crate) async fn bearer_token(&self) -> azure_core::Result<azure_core::auth::Secret> {
let credential = self.token_credential();
let response = credential.get_token(&self.scopes()).await?;
Ok(response.token)
}
pub(crate) fn endpoint(&self) -> &azure_core::Url {
&self.endpoint
}
pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential {
self.credential.as_ref()
}
pub(crate) fn scopes(&self) -> Vec<&str> {
self.scopes.iter().map(String::as_str).collect()
}
pub(crate) async fn send(&self, request: &mut azure_core::Request) -> azure_core::Result<azure_core::Response> {
let context = azure_core::Context::default();
self.pipeline.send(&context, request).await
}
#[doc = "Create a new `ClientBuilder`."]
#[must_use]
pub fn builder(credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>) -> ClientBuilder {
ClientBuilder::new(credential)
}
#[doc = "Create a new `Client`."]
#[must_use]
pub fn new(
endpoint: impl Into<azure_core::Url>,
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 deployment_operations_client(&self) -> deployment_operations::Client {
deployment_operations::Client(self.clone())
}
pub fn deployments_client(&self) -> deployments::Client {
deployments::Client(self.clone())
}
pub fn operations_client(&self) -> operations::Client {
operations::Client(self.clone())
}
pub fn provider_resource_types_client(&self) -> provider_resource_types::Client {
provider_resource_types::Client(self.clone())
}
pub fn providers_client(&self) -> providers::Client {
providers::Client(self.clone())
}
pub fn resource_groups_client(&self) -> resource_groups::Client {
resource_groups::Client(self.clone())
}
pub fn resources_client(&self) -> resources::Client {
resources::Client(self.clone())
}
pub fn tags_client(&self) -> tags::Client {
tags::Client(self.clone())
}
}
pub mod operations {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists all of the available Microsoft.Resources REST API operations."]
pub fn list(&self) -> list::RequestBuilder {
list::RequestBuilder { client: self.0.clone() }
}
}
pub mod list {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::OperationListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::OperationListResult = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::OperationListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = this.url()?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-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 bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!("{}/providers/Microsoft.Resources/operations", self.client.endpoint(),))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
}
pub mod deployments {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a deployment."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `scope`: The resource scope."]
#[doc = "* `deployment_name`: The name of the deployment."]
pub fn get_at_scope(&self, scope: impl Into<String>, deployment_name: impl Into<String>) -> get_at_scope::RequestBuilder {
get_at_scope::RequestBuilder {
client: self.0.clone(),
scope: scope.into(),
deployment_name: deployment_name.into(),
}
}
#[doc = "Deploys resources at a given scope."]
#[doc = "You can provide the template and parameters directly in the request or link to JSON files."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `scope`: The resource scope."]
#[doc = "* `deployment_name`: The name of the deployment."]
#[doc = "* `parameters`: Additional parameters supplied to the operation."]
pub fn create_or_update_at_scope(
&self,
scope: impl Into<String>,
deployment_name: impl Into<String>,
parameters: impl Into<models::Deployment>,
) -> create_or_update_at_scope::RequestBuilder {
create_or_update_at_scope::RequestBuilder {
client: self.0.clone(),
scope: scope.into(),
deployment_name: deployment_name.into(),
parameters: parameters.into(),
}
}
#[doc = "Deletes a deployment from the deployment history."]
#[doc = "A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `scope`: The resource scope."]
#[doc = "* `deployment_name`: The name of the deployment."]
pub fn delete_at_scope(&self, scope: impl Into<String>, deployment_name: impl Into<String>) -> delete_at_scope::RequestBuilder {
delete_at_scope::RequestBuilder {
client: self.0.clone(),
scope: scope.into(),
deployment_name: deployment_name.into(),
}
}
#[doc = "Checks whether the deployment exists."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `scope`: The resource scope."]
#[doc = "* `deployment_name`: The name of the deployment."]
pub fn check_existence_at_scope(
&self,
scope: impl Into<String>,
deployment_name: impl Into<String>,
) -> check_existence_at_scope::RequestBuilder {
check_existence_at_scope::RequestBuilder {
client: self.0.clone(),
scope: scope.into(),
deployment_name: deployment_name.into(),
}
}
#[doc = "Cancels a currently running template deployment."]
#[doc = "You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `scope`: The resource scope."]
#[doc = "* `deployment_name`: The name of the deployment."]
pub fn cancel_at_scope(&self, scope: impl Into<String>, deployment_name: impl Into<String>) -> cancel_at_scope::RequestBuilder {
cancel_at_scope::RequestBuilder {
client: self.0.clone(),
scope: scope.into(),
deployment_name: deployment_name.into(),
}
}
#[doc = "Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `scope`: The resource scope."]
#[doc = "* `deployment_name`: The name of the deployment."]
#[doc = "* `parameters`: Parameters to validate."]
pub fn validate_at_scope(
&self,
scope: impl Into<String>,
deployment_name: impl Into<String>,
parameters: impl Into<models::Deployment>,
) -> validate_at_scope::RequestBuilder {
validate_at_scope::RequestBuilder {
client: self.0.clone(),
scope: scope.into(),
deployment_name: deployment_name.into(),
parameters: parameters.into(),
}
}
#[doc = "Exports the template used for specified deployment."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `scope`: The resource scope."]
#[doc = "* `deployment_name`: The name of the deployment."]
pub fn export_template_at_scope(
&self,
scope: impl Into<String>,
deployment_name: impl Into<String>,
) -> export_template_at_scope::RequestBuilder {
export_template_at_scope::RequestBuilder {
client: self.0.clone(),
scope: scope.into(),
deployment_name: deployment_name.into(),
}
}
#[doc = "Get all the deployments at the given scope."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `scope`: The resource scope."]
pub fn list_at_scope(&self, scope: impl Into<String>) -> list_at_scope::RequestBuilder {
list_at_scope::RequestBuilder {
client: self.0.clone(),
scope: scope.into(),
filter: None,
top: None,
}
}
#[doc = "Gets a deployment."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `deployment_name`: The name of the deployment."]
pub fn get_at_tenant_scope(&self, deployment_name: impl Into<String>) -> get_at_tenant_scope::RequestBuilder {
get_at_tenant_scope::RequestBuilder {
client: self.0.clone(),
deployment_name: deployment_name.into(),
}
}
#[doc = "Deploys resources at tenant scope."]
#[doc = "You can provide the template and parameters directly in the request or link to JSON files."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `deployment_name`: The name of the deployment."]
#[doc = "* `parameters`: Additional parameters supplied to the operation."]
pub fn create_or_update_at_tenant_scope(
&self,
deployment_name: impl Into<String>,
parameters: impl Into<models::ScopedDeployment>,
) -> create_or_update_at_tenant_scope::RequestBuilder {
create_or_update_at_tenant_scope::RequestBuilder {
client: self.0.clone(),
deployment_name: deployment_name.into(),
parameters: parameters.into(),
}
}
#[doc = "Deletes a deployment from the deployment history."]
#[doc = "A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `deployment_name`: The name of the deployment."]
pub fn delete_at_tenant_scope(&self, deployment_name: impl Into<String>) -> delete_at_tenant_scope::RequestBuilder {
delete_at_tenant_scope::RequestBuilder {
client: self.0.clone(),
deployment_name: deployment_name.into(),
}
}
#[doc = "Checks whether the deployment exists."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `deployment_name`: The name of the deployment."]
pub fn check_existence_at_tenant_scope(
&self,
deployment_name: impl Into<String>,
) -> check_existence_at_tenant_scope::RequestBuilder {
check_existence_at_tenant_scope::RequestBuilder {
client: self.0.clone(),
deployment_name: deployment_name.into(),
}
}
#[doc = "Cancels a currently running template deployment."]
#[doc = "You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `deployment_name`: The name of the deployment."]
pub fn cancel_at_tenant_scope(&self, deployment_name: impl Into<String>) -> cancel_at_tenant_scope::RequestBuilder {
cancel_at_tenant_scope::RequestBuilder {
client: self.0.clone(),
deployment_name: deployment_name.into(),
}
}
#[doc = "Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `deployment_name`: The name of the deployment."]
#[doc = "* `parameters`: Parameters to validate."]
pub fn validate_at_tenant_scope(
&self,
deployment_name: impl Into<String>,
parameters: impl Into<models::ScopedDeployment>,
) -> validate_at_tenant_scope::RequestBuilder {
validate_at_tenant_scope::RequestBuilder {
client: self.0.clone(),
deployment_name: deployment_name.into(),
parameters: parameters.into(),
}
}
#[doc = "Returns changes that will be made by the deployment if executed at the scope of the tenant group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `deployment_name`: The name of the deployment."]
#[doc = "* `parameters`: Parameters to validate."]
pub fn what_if_at_tenant_scope(
&self,
deployment_name: impl Into<String>,
parameters: impl Into<models::ScopedDeploymentWhatIf>,
) -> what_if_at_tenant_scope::RequestBuilder {
what_if_at_tenant_scope::RequestBuilder {
client: self.0.clone(),
deployment_name: deployment_name.into(),
parameters: parameters.into(),
}
}
#[doc = "Exports the template used for specified deployment."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `deployment_name`: The name of the deployment."]
pub fn export_template_at_tenant_scope(
&self,
deployment_name: impl Into<String>,
) -> export_template_at_tenant_scope::RequestBuilder {
export_template_at_tenant_scope::RequestBuilder {
client: self.0.clone(),
deployment_name: deployment_name.into(),
}
}
#[doc = "Get all the deployments at the tenant scope."]
pub fn list_at_tenant_scope(&self) -> list_at_tenant_scope::RequestBuilder {
list_at_tenant_scope::RequestBuilder {
client: self.0.clone(),
filter: None,
top: None,
}
}
#[doc = "Gets a deployment."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `group_id`: The management group ID."]
#[doc = "* `deployment_name`: The name of the deployment."]
pub fn get_at_management_group_scope(
&self,
group_id: impl Into<String>,
deployment_name: impl Into<String>,
) -> get_at_management_group_scope::RequestBuilder {
get_at_management_group_scope::RequestBuilder {
client: self.0.clone(),
group_id: group_id.into(),
deployment_name: deployment_name.into(),
}
}
#[doc = "Deploys resources at management group scope."]
#[doc = "You can provide the template and parameters directly in the request or link to JSON files."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `group_id`: The management group ID."]
#[doc = "* `deployment_name`: The name of the deployment."]
#[doc = "* `parameters`: Additional parameters supplied to the operation."]
pub fn create_or_update_at_management_group_scope(
&self,
group_id: impl Into<String>,
deployment_name: impl Into<String>,
parameters: impl Into<models::ScopedDeployment>,
) -> create_or_update_at_management_group_scope::RequestBuilder {
create_or_update_at_management_group_scope::RequestBuilder {
client: self.0.clone(),
group_id: group_id.into(),
deployment_name: deployment_name.into(),
parameters: parameters.into(),
}
}
#[doc = "Deletes a deployment from the deployment history."]
#[doc = "A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `group_id`: The management group ID."]
#[doc = "* `deployment_name`: The name of the deployment."]
pub fn delete_at_management_group_scope(
&self,
group_id: impl Into<String>,
deployment_name: impl Into<String>,
) -> delete_at_management_group_scope::RequestBuilder {
delete_at_management_group_scope::RequestBuilder {
client: self.0.clone(),
group_id: group_id.into(),
deployment_name: deployment_name.into(),
}
}
#[doc = "Checks whether the deployment exists."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `group_id`: The management group ID."]
#[doc = "* `deployment_name`: The name of the deployment."]
pub fn check_existence_at_management_group_scope(
&self,
group_id: impl Into<String>,
deployment_name: impl Into<String>,
) -> check_existence_at_management_group_scope::RequestBuilder {
check_existence_at_management_group_scope::RequestBuilder {
client: self.0.clone(),
group_id: group_id.into(),
deployment_name: deployment_name.into(),
}
}
#[doc = "Cancels a currently running template deployment."]
#[doc = "You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `group_id`: The management group ID."]
#[doc = "* `deployment_name`: The name of the deployment."]
pub fn cancel_at_management_group_scope(
&self,
group_id: impl Into<String>,
deployment_name: impl Into<String>,
) -> cancel_at_management_group_scope::RequestBuilder {
cancel_at_management_group_scope::RequestBuilder {
client: self.0.clone(),
group_id: group_id.into(),
deployment_name: deployment_name.into(),
}
}
#[doc = "Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `group_id`: The management group ID."]
#[doc = "* `deployment_name`: The name of the deployment."]
#[doc = "* `parameters`: Parameters to validate."]
pub fn validate_at_management_group_scope(
&self,
group_id: impl Into<String>,
deployment_name: impl Into<String>,
parameters: impl Into<models::ScopedDeployment>,
) -> validate_at_management_group_scope::RequestBuilder {
validate_at_management_group_scope::RequestBuilder {
client: self.0.clone(),
group_id: group_id.into(),
deployment_name: deployment_name.into(),
parameters: parameters.into(),
}
}
#[doc = "Returns changes that will be made by the deployment if executed at the scope of the management group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `group_id`: The management group ID."]
#[doc = "* `deployment_name`: The name of the deployment."]
#[doc = "* `parameters`: Parameters to validate."]
pub fn what_if_at_management_group_scope(
&self,
group_id: impl Into<String>,
deployment_name: impl Into<String>,
parameters: impl Into<models::ScopedDeploymentWhatIf>,
) -> what_if_at_management_group_scope::RequestBuilder {
what_if_at_management_group_scope::RequestBuilder {
client: self.0.clone(),
group_id: group_id.into(),
deployment_name: deployment_name.into(),
parameters: parameters.into(),
}
}
#[doc = "Exports the template used for specified deployment."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `group_id`: The management group ID."]
#[doc = "* `deployment_name`: The name of the deployment."]
pub fn export_template_at_management_group_scope(
&self,
group_id: impl Into<String>,
deployment_name: impl Into<String>,
) -> export_template_at_management_group_scope::RequestBuilder {
export_template_at_management_group_scope::RequestBuilder {
client: self.0.clone(),
group_id: group_id.into(),
deployment_name: deployment_name.into(),
}
}
#[doc = "Get all the deployments for a management group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `group_id`: The management group ID."]
pub fn list_at_management_group_scope(&self, group_id: impl Into<String>) -> list_at_management_group_scope::RequestBuilder {
list_at_management_group_scope::RequestBuilder {
client: self.0.clone(),
group_id: group_id.into(),
filter: None,
top: None,
}
}
#[doc = "Gets a deployment."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `deployment_name`: The name of the deployment."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn get_at_subscription_scope(
&self,
deployment_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get_at_subscription_scope::RequestBuilder {
get_at_subscription_scope::RequestBuilder {
client: self.0.clone(),
deployment_name: deployment_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deploys resources at subscription scope."]
#[doc = "You can provide the template and parameters directly in the request or link to JSON files."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `deployment_name`: The name of the deployment."]
#[doc = "* `parameters`: Additional parameters supplied to the operation."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn create_or_update_at_subscription_scope(
&self,
deployment_name: impl Into<String>,
parameters: impl Into<models::Deployment>,
subscription_id: impl Into<String>,
) -> create_or_update_at_subscription_scope::RequestBuilder {
create_or_update_at_subscription_scope::RequestBuilder {
client: self.0.clone(),
deployment_name: deployment_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a deployment from the deployment history."]
#[doc = "A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `deployment_name`: The name of the deployment."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn delete_at_subscription_scope(
&self,
deployment_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete_at_subscription_scope::RequestBuilder {
delete_at_subscription_scope::RequestBuilder {
client: self.0.clone(),
deployment_name: deployment_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Checks whether the deployment exists."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `deployment_name`: The name of the deployment."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn check_existence_at_subscription_scope(
&self,
deployment_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> check_existence_at_subscription_scope::RequestBuilder {
check_existence_at_subscription_scope::RequestBuilder {
client: self.0.clone(),
deployment_name: deployment_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Cancels a currently running template deployment."]
#[doc = "You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `deployment_name`: The name of the deployment."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn cancel_at_subscription_scope(
&self,
deployment_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> cancel_at_subscription_scope::RequestBuilder {
cancel_at_subscription_scope::RequestBuilder {
client: self.0.clone(),
deployment_name: deployment_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `deployment_name`: The name of the deployment."]
#[doc = "* `parameters`: Parameters to validate."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn validate_at_subscription_scope(
&self,
deployment_name: impl Into<String>,
parameters: impl Into<models::Deployment>,
subscription_id: impl Into<String>,
) -> validate_at_subscription_scope::RequestBuilder {
validate_at_subscription_scope::RequestBuilder {
client: self.0.clone(),
deployment_name: deployment_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Returns changes that will be made by the deployment if executed at the scope of the subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `deployment_name`: The name of the deployment."]
#[doc = "* `parameters`: Parameters to What If."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn what_if_at_subscription_scope(
&self,
deployment_name: impl Into<String>,
parameters: impl Into<models::DeploymentWhatIf>,
subscription_id: impl Into<String>,
) -> what_if_at_subscription_scope::RequestBuilder {
what_if_at_subscription_scope::RequestBuilder {
client: self.0.clone(),
deployment_name: deployment_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Exports the template used for specified deployment."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `deployment_name`: The name of the deployment."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn export_template_at_subscription_scope(
&self,
deployment_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> export_template_at_subscription_scope::RequestBuilder {
export_template_at_subscription_scope::RequestBuilder {
client: self.0.clone(),
deployment_name: deployment_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Get all the deployments for a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn list_at_subscription_scope(&self, subscription_id: impl Into<String>) -> list_at_subscription_scope::RequestBuilder {
list_at_subscription_scope::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
filter: None,
top: None,
}
}
#[doc = "Gets a deployment."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `deployment_name`: The name of the deployment."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
deployment_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
deployment_name: deployment_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deploys resources to a resource group."]
#[doc = "You can provide the template and parameters directly in the request or link to JSON files."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist."]
#[doc = "* `deployment_name`: The name of the deployment."]
#[doc = "* `parameters`: Additional parameters supplied to the operation."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
deployment_name: impl Into<String>,
parameters: impl Into<models::Deployment>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
deployment_name: deployment_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a deployment from the deployment history."]
#[doc = "A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. Deleting a template deployment does not affect the state of the resource group. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group with the deployment to delete. The name is case insensitive."]
#[doc = "* `deployment_name`: The name of the deployment."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
deployment_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
deployment_name: deployment_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Checks whether the deployment exists."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group with the deployment to check. The name is case insensitive."]
#[doc = "* `deployment_name`: The name of the deployment."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn check_existence(
&self,
resource_group_name: impl Into<String>,
deployment_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> check_existence::RequestBuilder {
check_existence::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
deployment_name: deployment_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Cancels a currently running template deployment."]
#[doc = "You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resource group partially deployed."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `deployment_name`: The name of the deployment."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn cancel(
&self,
resource_group_name: impl Into<String>,
deployment_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> cancel::RequestBuilder {
cancel::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
deployment_name: deployment_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group the template will be deployed to. The name is case insensitive."]
#[doc = "* `deployment_name`: The name of the deployment."]
#[doc = "* `parameters`: Parameters to validate."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn validate(
&self,
resource_group_name: impl Into<String>,
deployment_name: impl Into<String>,
parameters: impl Into<models::Deployment>,
subscription_id: impl Into<String>,
) -> validate::RequestBuilder {
validate::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
deployment_name: deployment_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Returns changes that will be made by the deployment if executed at the scope of the resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group the template will be deployed to. The name is case insensitive."]
#[doc = "* `deployment_name`: The name of the deployment."]
#[doc = "* `parameters`: Parameters to validate."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn what_if(
&self,
resource_group_name: impl Into<String>,
deployment_name: impl Into<String>,
parameters: impl Into<models::DeploymentWhatIf>,
subscription_id: impl Into<String>,
) -> what_if::RequestBuilder {
what_if::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
deployment_name: deployment_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Exports the template used for specified deployment."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `deployment_name`: The name of the deployment."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn export_template(
&self,
resource_group_name: impl Into<String>,
deployment_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> export_template::RequestBuilder {
export_template::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
deployment_name: deployment_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Get all the deployments for a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group with the deployments to get. The name is case insensitive."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn list_by_resource_group(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_resource_group::RequestBuilder {
list_by_resource_group::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
filter: None,
top: None,
}
}
#[doc = "Calculate the hash of the given template."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `template`: The template provided to calculate hash."]
pub fn calculate_template_hash(&self, template: impl Into<serde_json::Value>) -> calculate_template_hash::RequestBuilder {
calculate_template_hash::RequestBuilder {
client: self.0.clone(),
template: template.into(),
}
}
}
pub mod get_at_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentExtended> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentExtended = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) scope: String,
pub(crate) deployment_name: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/{}/providers/Microsoft.Resources/deployments/{}",
self.client.endpoint(),
&self.scope,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::DeploymentExtended>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::DeploymentExtended>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update_at_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentExtended> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentExtended = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" This `RequestBuilder` implements a Long Running Operation"]
#[doc = r" (LRO)."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the `RequestBuilder` into a future"]
#[doc = r" executes the request and polls the service until the"]
#[doc = r" operation completes."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use"]
#[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) scope: String,
pub(crate) deployment_name: String,
pub(crate) parameters: models::Deployment,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/{}/providers/Microsoft.Resources/deployments/{}",
self.client.endpoint(),
&self.scope,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::DeploymentExtended>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::DeploymentExtended>>;
#[doc = "Returns a future that polls the long running operation and checks for the state via `properties.provisioningState` in the response body."]
#[doc = ""]
#[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
use azure_core::{
error::{Error, ErrorKind},
lro::{body_content::get_provisioning_state, get_retry_after, LroStatus},
sleep::sleep,
};
use std::time::Duration;
loop {
let this = self.clone();
let response = this.send().await?;
let retry_after = get_retry_after(response.as_raw_response().headers());
let status = response.as_raw_response().status();
let body = response.into_body().await?;
let provisioning_state = get_provisioning_state(status, &body)?;
log::trace!("current provisioning_state: {provisioning_state:?}");
match provisioning_state {
LroStatus::Succeeded => return Ok(body),
LroStatus::Failed => return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())),
LroStatus::Canceled => {
return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string()))
}
_ => {
sleep(retry_after).await;
}
}
}
})
}
}
}
pub mod delete_at_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" This `RequestBuilder` implements a Long Running Operation"]
#[doc = r" (LRO)."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the `RequestBuilder` into a future"]
#[doc = r" executes the request and polls the service until the"]
#[doc = r" operation completes."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use"]
#[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) scope: String,
pub(crate) deployment_name: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/{}/providers/Microsoft.Resources/deployments/{}",
self.client.endpoint(),
&self.scope,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod check_existence_at_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) scope: String,
pub(crate) deployment_name: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Head);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/{}/providers/Microsoft.Resources/deployments/{}",
self.client.endpoint(),
&self.scope,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod cancel_at_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) scope: String,
pub(crate) deployment_name: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/{}/providers/Microsoft.Resources/deployments/{}/cancel",
self.client.endpoint(),
&self.scope,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod validate_at_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentValidateResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentValidateResult = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" This `RequestBuilder` implements a Long Running Operation"]
#[doc = r" (LRO)."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the `RequestBuilder` into a future"]
#[doc = r" executes the request and polls the service until the"]
#[doc = r" operation completes."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use"]
#[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) scope: String,
pub(crate) deployment_name: String,
pub(crate) parameters: models::Deployment,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/{}/providers/Microsoft.Resources/deployments/{}/validate",
self.client.endpoint(),
&self.scope,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::DeploymentValidateResult>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::DeploymentValidateResult>>;
#[doc = "Returns a future that polls the long running operation and checks for the state via `properties.provisioningState` in the response body."]
#[doc = ""]
#[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
use azure_core::{
error::{Error, ErrorKind},
lro::{body_content::get_provisioning_state, get_retry_after, LroStatus},
sleep::sleep,
};
use std::time::Duration;
loop {
let this = self.clone();
let response = this.send().await?;
let retry_after = get_retry_after(response.as_raw_response().headers());
let status = response.as_raw_response().status();
let body = response.into_body().await?;
let provisioning_state = get_provisioning_state(status, &body)?;
log::trace!("current provisioning_state: {provisioning_state:?}");
match provisioning_state {
LroStatus::Succeeded => return Ok(body),
LroStatus::Failed => return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())),
LroStatus::Canceled => {
return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string()))
}
_ => {
sleep(retry_after).await;
}
}
}
})
}
}
}
pub mod export_template_at_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentExportResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentExportResult = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) scope: String,
pub(crate) deployment_name: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/{}/providers/Microsoft.Resources/deployments/{}/exportTemplate",
self.client.endpoint(),
&self.scope,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::DeploymentExportResult>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::DeploymentExportResult>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod list_at_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentListResult = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) scope: String,
pub(crate) filter: Option<String>,
pub(crate) top: Option<i32>,
}
impl RequestBuilder {
#[doc = "The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
#[doc = "The number of results to get. If null is passed, returns all deployments."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::DeploymentListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = this.url()?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-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 bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("$top", &top.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/{}/providers/Microsoft.Resources/deployments/",
self.client.endpoint(),
&self.scope
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod get_at_tenant_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentExtended> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentExtended = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) deployment_name: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/providers/Microsoft.Resources/deployments/{}",
self.client.endpoint(),
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::DeploymentExtended>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::DeploymentExtended>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update_at_tenant_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentExtended> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentExtended = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" This `RequestBuilder` implements a Long Running Operation"]
#[doc = r" (LRO)."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the `RequestBuilder` into a future"]
#[doc = r" executes the request and polls the service until the"]
#[doc = r" operation completes."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use"]
#[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) deployment_name: String,
pub(crate) parameters: models::ScopedDeployment,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/providers/Microsoft.Resources/deployments/{}",
self.client.endpoint(),
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::DeploymentExtended>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::DeploymentExtended>>;
#[doc = "Returns a future that polls the long running operation and checks for the state via `properties.provisioningState` in the response body."]
#[doc = ""]
#[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
use azure_core::{
error::{Error, ErrorKind},
lro::{body_content::get_provisioning_state, get_retry_after, LroStatus},
sleep::sleep,
};
use std::time::Duration;
loop {
let this = self.clone();
let response = this.send().await?;
let retry_after = get_retry_after(response.as_raw_response().headers());
let status = response.as_raw_response().status();
let body = response.into_body().await?;
let provisioning_state = get_provisioning_state(status, &body)?;
log::trace!("current provisioning_state: {provisioning_state:?}");
match provisioning_state {
LroStatus::Succeeded => return Ok(body),
LroStatus::Failed => return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())),
LroStatus::Canceled => {
return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string()))
}
_ => {
sleep(retry_after).await;
}
}
}
})
}
}
}
pub mod delete_at_tenant_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" This `RequestBuilder` implements a Long Running Operation"]
#[doc = r" (LRO)."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the `RequestBuilder` into a future"]
#[doc = r" executes the request and polls the service until the"]
#[doc = r" operation completes."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use"]
#[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) deployment_name: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/providers/Microsoft.Resources/deployments/{}",
self.client.endpoint(),
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod check_existence_at_tenant_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) deployment_name: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Head);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/providers/Microsoft.Resources/deployments/{}",
self.client.endpoint(),
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod cancel_at_tenant_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) deployment_name: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/providers/Microsoft.Resources/deployments/{}/cancel",
self.client.endpoint(),
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod validate_at_tenant_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentValidateResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentValidateResult = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" This `RequestBuilder` implements a Long Running Operation"]
#[doc = r" (LRO)."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the `RequestBuilder` into a future"]
#[doc = r" executes the request and polls the service until the"]
#[doc = r" operation completes."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use"]
#[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) deployment_name: String,
pub(crate) parameters: models::ScopedDeployment,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/providers/Microsoft.Resources/deployments/{}/validate",
self.client.endpoint(),
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::DeploymentValidateResult>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::DeploymentValidateResult>>;
#[doc = "Returns a future that polls the long running operation and checks for the state via `properties.provisioningState` in the response body."]
#[doc = ""]
#[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
use azure_core::{
error::{Error, ErrorKind},
lro::{body_content::get_provisioning_state, get_retry_after, LroStatus},
sleep::sleep,
};
use std::time::Duration;
loop {
let this = self.clone();
let response = this.send().await?;
let retry_after = get_retry_after(response.as_raw_response().headers());
let status = response.as_raw_response().status();
let body = response.into_body().await?;
let provisioning_state = get_provisioning_state(status, &body)?;
log::trace!("current provisioning_state: {provisioning_state:?}");
match provisioning_state {
LroStatus::Succeeded => return Ok(body),
LroStatus::Failed => return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())),
LroStatus::Canceled => {
return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string()))
}
_ => {
sleep(retry_after).await;
}
}
}
})
}
}
}
pub mod what_if_at_tenant_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WhatIfOperationResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::WhatIfOperationResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
pub fn headers(&self) -> Headers {
Headers(self.0.headers())
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
pub struct Headers<'a>(&'a azure_core::headers::Headers);
impl<'a> Headers<'a> {
#[doc = "URL to get status of this long-running operation."]
pub fn location(&self) -> azure_core::Result<&str> {
self.0.get_str(&azure_core::headers::HeaderName::from_static("location"))
}
#[doc = "Number of seconds to wait before polling for status."]
pub fn retry_after(&self) -> azure_core::Result<&str> {
self.0.get_str(&azure_core::headers::HeaderName::from_static("retry-after"))
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" This `RequestBuilder` implements a Long Running Operation"]
#[doc = r" (LRO)."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the `RequestBuilder` into a future"]
#[doc = r" executes the request and polls the service until the"]
#[doc = r" operation completes."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use"]
#[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) deployment_name: String,
pub(crate) parameters: models::ScopedDeploymentWhatIf,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/providers/Microsoft.Resources/deployments/{}/whatIf",
self.client.endpoint(),
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::WhatIfOperationResult>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::WhatIfOperationResult>>;
#[doc = "Returns a future that polls the long running operation, returning once the operation completes."]
#[doc = ""]
#[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
use azure_core::{
error::{Error, ErrorKind},
lro::{
get_retry_after,
location::{get_location, get_provisioning_state, FinalState},
LroStatus,
},
sleep::sleep,
};
use std::time::Duration;
let this = self.clone();
let response = this.send().await?;
let headers = response.as_raw_response().headers();
let location = get_location(headers, FinalState::Location)?;
if let Some(url) = location {
loop {
let mut req = azure_core::Request::new(url.clone(), azure_core::Method::Get);
let bearer_token = self.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let response = self.client.send(&mut req).await?;
let headers = response.headers();
let retry_after = get_retry_after(headers);
let bytes = response.into_body().collect().await?;
let provisioning_state = get_provisioning_state(&bytes).ok_or_else(|| {
Error::message(
ErrorKind::Other,
"Long running operation failed (missing provisioning state)".to_string(),
)
})?;
log::trace!("current provisioning_state: {provisioning_state:?}");
match provisioning_state {
LroStatus::Succeeded => {
let mut req = azure_core::Request::new(self.url()?, azure_core::Method::Get);
let bearer_token = self.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let response = self.client.send(&mut req).await?;
return Response(response).into_body().await;
}
LroStatus::Failed => {
return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string()))
}
LroStatus::Canceled => {
return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string()))
}
_ => {
sleep(retry_after).await;
}
}
}
} else {
response.into_body().await
}
})
}
}
}
pub mod export_template_at_tenant_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentExportResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentExportResult = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) deployment_name: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/providers/Microsoft.Resources/deployments/{}/exportTemplate",
self.client.endpoint(),
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::DeploymentExportResult>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::DeploymentExportResult>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod list_at_tenant_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentListResult = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) filter: Option<String>,
pub(crate) top: Option<i32>,
}
impl RequestBuilder {
#[doc = "The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
#[doc = "The number of results to get. If null is passed, returns all deployments."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::DeploymentListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = this.url()?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-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 bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("$top", &top.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!("{}/providers/Microsoft.Resources/deployments/", self.client.endpoint(),))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod get_at_management_group_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentExtended> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentExtended = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) group_id: String,
pub(crate) deployment_name: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/providers/Microsoft.Management/managementGroups/{}/providers/Microsoft.Resources/deployments/{}",
self.client.endpoint(),
&self.group_id,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::DeploymentExtended>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::DeploymentExtended>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update_at_management_group_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentExtended> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentExtended = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" This `RequestBuilder` implements a Long Running Operation"]
#[doc = r" (LRO)."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the `RequestBuilder` into a future"]
#[doc = r" executes the request and polls the service until the"]
#[doc = r" operation completes."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use"]
#[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) group_id: String,
pub(crate) deployment_name: String,
pub(crate) parameters: models::ScopedDeployment,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/providers/Microsoft.Management/managementGroups/{}/providers/Microsoft.Resources/deployments/{}",
self.client.endpoint(),
&self.group_id,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::DeploymentExtended>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::DeploymentExtended>>;
#[doc = "Returns a future that polls the long running operation and checks for the state via `properties.provisioningState` in the response body."]
#[doc = ""]
#[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
use azure_core::{
error::{Error, ErrorKind},
lro::{body_content::get_provisioning_state, get_retry_after, LroStatus},
sleep::sleep,
};
use std::time::Duration;
loop {
let this = self.clone();
let response = this.send().await?;
let retry_after = get_retry_after(response.as_raw_response().headers());
let status = response.as_raw_response().status();
let body = response.into_body().await?;
let provisioning_state = get_provisioning_state(status, &body)?;
log::trace!("current provisioning_state: {provisioning_state:?}");
match provisioning_state {
LroStatus::Succeeded => return Ok(body),
LroStatus::Failed => return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())),
LroStatus::Canceled => {
return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string()))
}
_ => {
sleep(retry_after).await;
}
}
}
})
}
}
}
pub mod delete_at_management_group_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" This `RequestBuilder` implements a Long Running Operation"]
#[doc = r" (LRO)."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the `RequestBuilder` into a future"]
#[doc = r" executes the request and polls the service until the"]
#[doc = r" operation completes."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use"]
#[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) group_id: String,
pub(crate) deployment_name: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/providers/Microsoft.Management/managementGroups/{}/providers/Microsoft.Resources/deployments/{}",
self.client.endpoint(),
&self.group_id,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod check_existence_at_management_group_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) group_id: String,
pub(crate) deployment_name: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Head);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/providers/Microsoft.Management/managementGroups/{}/providers/Microsoft.Resources/deployments/{}",
self.client.endpoint(),
&self.group_id,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod cancel_at_management_group_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) group_id: String,
pub(crate) deployment_name: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/providers/Microsoft.Management/managementGroups/{}/providers/Microsoft.Resources/deployments/{}/cancel",
self.client.endpoint(),
&self.group_id,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod validate_at_management_group_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentValidateResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentValidateResult = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" This `RequestBuilder` implements a Long Running Operation"]
#[doc = r" (LRO)."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the `RequestBuilder` into a future"]
#[doc = r" executes the request and polls the service until the"]
#[doc = r" operation completes."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use"]
#[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) group_id: String,
pub(crate) deployment_name: String,
pub(crate) parameters: models::ScopedDeployment,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/providers/Microsoft.Management/managementGroups/{}/providers/Microsoft.Resources/deployments/{}/validate",
self.client.endpoint(),
&self.group_id,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::DeploymentValidateResult>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::DeploymentValidateResult>>;
#[doc = "Returns a future that polls the long running operation and checks for the state via `properties.provisioningState` in the response body."]
#[doc = ""]
#[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
use azure_core::{
error::{Error, ErrorKind},
lro::{body_content::get_provisioning_state, get_retry_after, LroStatus},
sleep::sleep,
};
use std::time::Duration;
loop {
let this = self.clone();
let response = this.send().await?;
let retry_after = get_retry_after(response.as_raw_response().headers());
let status = response.as_raw_response().status();
let body = response.into_body().await?;
let provisioning_state = get_provisioning_state(status, &body)?;
log::trace!("current provisioning_state: {provisioning_state:?}");
match provisioning_state {
LroStatus::Succeeded => return Ok(body),
LroStatus::Failed => return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())),
LroStatus::Canceled => {
return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string()))
}
_ => {
sleep(retry_after).await;
}
}
}
})
}
}
}
pub mod what_if_at_management_group_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WhatIfOperationResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::WhatIfOperationResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
pub fn headers(&self) -> Headers {
Headers(self.0.headers())
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
pub struct Headers<'a>(&'a azure_core::headers::Headers);
impl<'a> Headers<'a> {
#[doc = "URL to get status of this long-running operation."]
pub fn location(&self) -> azure_core::Result<&str> {
self.0.get_str(&azure_core::headers::HeaderName::from_static("location"))
}
#[doc = "Number of seconds to wait before polling for status."]
pub fn retry_after(&self) -> azure_core::Result<&str> {
self.0.get_str(&azure_core::headers::HeaderName::from_static("retry-after"))
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" This `RequestBuilder` implements a Long Running Operation"]
#[doc = r" (LRO)."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the `RequestBuilder` into a future"]
#[doc = r" executes the request and polls the service until the"]
#[doc = r" operation completes."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use"]
#[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) group_id: String,
pub(crate) deployment_name: String,
pub(crate) parameters: models::ScopedDeploymentWhatIf,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/providers/Microsoft.Management/managementGroups/{}/providers/Microsoft.Resources/deployments/{}/whatIf",
self.client.endpoint(),
&self.group_id,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::WhatIfOperationResult>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::WhatIfOperationResult>>;
#[doc = "Returns a future that polls the long running operation, returning once the operation completes."]
#[doc = ""]
#[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
use azure_core::{
error::{Error, ErrorKind},
lro::{
get_retry_after,
location::{get_location, get_provisioning_state, FinalState},
LroStatus,
},
sleep::sleep,
};
use std::time::Duration;
let this = self.clone();
let response = this.send().await?;
let headers = response.as_raw_response().headers();
let location = get_location(headers, FinalState::Location)?;
if let Some(url) = location {
loop {
let mut req = azure_core::Request::new(url.clone(), azure_core::Method::Get);
let bearer_token = self.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let response = self.client.send(&mut req).await?;
let headers = response.headers();
let retry_after = get_retry_after(headers);
let bytes = response.into_body().collect().await?;
let provisioning_state = get_provisioning_state(&bytes).ok_or_else(|| {
Error::message(
ErrorKind::Other,
"Long running operation failed (missing provisioning state)".to_string(),
)
})?;
log::trace!("current provisioning_state: {provisioning_state:?}");
match provisioning_state {
LroStatus::Succeeded => {
let mut req = azure_core::Request::new(self.url()?, azure_core::Method::Get);
let bearer_token = self.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let response = self.client.send(&mut req).await?;
return Response(response).into_body().await;
}
LroStatus::Failed => {
return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string()))
}
LroStatus::Canceled => {
return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string()))
}
_ => {
sleep(retry_after).await;
}
}
}
} else {
response.into_body().await
}
})
}
}
}
pub mod export_template_at_management_group_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentExportResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentExportResult = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) group_id: String,
pub(crate) deployment_name: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/providers/Microsoft.Management/managementGroups/{}/providers/Microsoft.Resources/deployments/{}/exportTemplate",
self.client.endpoint(),
&self.group_id,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::DeploymentExportResult>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::DeploymentExportResult>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod list_at_management_group_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentListResult = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) group_id: String,
pub(crate) filter: Option<String>,
pub(crate) top: Option<i32>,
}
impl RequestBuilder {
#[doc = "The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
#[doc = "The number of results to get. If null is passed, returns all deployments."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::DeploymentListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = this.url()?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-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 bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("$top", &top.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/providers/Microsoft.Management/managementGroups/{}/providers/Microsoft.Resources/deployments/",
self.client.endpoint(),
&self.group_id
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod get_at_subscription_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentExtended> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentExtended = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) deployment_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Resources/deployments/{}",
self.client.endpoint(),
&self.subscription_id,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::DeploymentExtended>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::DeploymentExtended>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update_at_subscription_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentExtended> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentExtended = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" This `RequestBuilder` implements a Long Running Operation"]
#[doc = r" (LRO)."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the `RequestBuilder` into a future"]
#[doc = r" executes the request and polls the service until the"]
#[doc = r" operation completes."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use"]
#[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) deployment_name: String,
pub(crate) parameters: models::Deployment,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Resources/deployments/{}",
self.client.endpoint(),
&self.subscription_id,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::DeploymentExtended>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::DeploymentExtended>>;
#[doc = "Returns a future that polls the long running operation and checks for the state via `properties.provisioningState` in the response body."]
#[doc = ""]
#[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
use azure_core::{
error::{Error, ErrorKind},
lro::{body_content::get_provisioning_state, get_retry_after, LroStatus},
sleep::sleep,
};
use std::time::Duration;
loop {
let this = self.clone();
let response = this.send().await?;
let retry_after = get_retry_after(response.as_raw_response().headers());
let status = response.as_raw_response().status();
let body = response.into_body().await?;
let provisioning_state = get_provisioning_state(status, &body)?;
log::trace!("current provisioning_state: {provisioning_state:?}");
match provisioning_state {
LroStatus::Succeeded => return Ok(body),
LroStatus::Failed => return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())),
LroStatus::Canceled => {
return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string()))
}
_ => {
sleep(retry_after).await;
}
}
}
})
}
}
}
pub mod delete_at_subscription_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" This `RequestBuilder` implements a Long Running Operation"]
#[doc = r" (LRO)."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the `RequestBuilder` into a future"]
#[doc = r" executes the request and polls the service until the"]
#[doc = r" operation completes."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use"]
#[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) deployment_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Resources/deployments/{}",
self.client.endpoint(),
&self.subscription_id,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod check_existence_at_subscription_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) deployment_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Head);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Resources/deployments/{}",
self.client.endpoint(),
&self.subscription_id,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod cancel_at_subscription_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) deployment_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Resources/deployments/{}/cancel",
self.client.endpoint(),
&self.subscription_id,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod validate_at_subscription_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentValidateResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentValidateResult = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" This `RequestBuilder` implements a Long Running Operation"]
#[doc = r" (LRO)."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the `RequestBuilder` into a future"]
#[doc = r" executes the request and polls the service until the"]
#[doc = r" operation completes."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use"]
#[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) deployment_name: String,
pub(crate) parameters: models::Deployment,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Resources/deployments/{}/validate",
self.client.endpoint(),
&self.subscription_id,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::DeploymentValidateResult>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::DeploymentValidateResult>>;
#[doc = "Returns a future that polls the long running operation and checks for the state via `properties.provisioningState` in the response body."]
#[doc = ""]
#[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
use azure_core::{
error::{Error, ErrorKind},
lro::{body_content::get_provisioning_state, get_retry_after, LroStatus},
sleep::sleep,
};
use std::time::Duration;
loop {
let this = self.clone();
let response = this.send().await?;
let retry_after = get_retry_after(response.as_raw_response().headers());
let status = response.as_raw_response().status();
let body = response.into_body().await?;
let provisioning_state = get_provisioning_state(status, &body)?;
log::trace!("current provisioning_state: {provisioning_state:?}");
match provisioning_state {
LroStatus::Succeeded => return Ok(body),
LroStatus::Failed => return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())),
LroStatus::Canceled => {
return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string()))
}
_ => {
sleep(retry_after).await;
}
}
}
})
}
}
}
pub mod what_if_at_subscription_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WhatIfOperationResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::WhatIfOperationResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
pub fn headers(&self) -> Headers {
Headers(self.0.headers())
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
pub struct Headers<'a>(&'a azure_core::headers::Headers);
impl<'a> Headers<'a> {
#[doc = "URL to get status of this long-running operation."]
pub fn location(&self) -> azure_core::Result<&str> {
self.0.get_str(&azure_core::headers::HeaderName::from_static("location"))
}
#[doc = "Number of seconds to wait before polling for status."]
pub fn retry_after(&self) -> azure_core::Result<&str> {
self.0.get_str(&azure_core::headers::HeaderName::from_static("retry-after"))
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" This `RequestBuilder` implements a Long Running Operation"]
#[doc = r" (LRO)."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the `RequestBuilder` into a future"]
#[doc = r" executes the request and polls the service until the"]
#[doc = r" operation completes."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use"]
#[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) deployment_name: String,
pub(crate) parameters: models::DeploymentWhatIf,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Resources/deployments/{}/whatIf",
self.client.endpoint(),
&self.subscription_id,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::WhatIfOperationResult>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::WhatIfOperationResult>>;
#[doc = "Returns a future that polls the long running operation, returning once the operation completes."]
#[doc = ""]
#[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
use azure_core::{
error::{Error, ErrorKind},
lro::{
get_retry_after,
location::{get_location, get_provisioning_state, FinalState},
LroStatus,
},
sleep::sleep,
};
use std::time::Duration;
let this = self.clone();
let response = this.send().await?;
let headers = response.as_raw_response().headers();
let location = get_location(headers, FinalState::Location)?;
if let Some(url) = location {
loop {
let mut req = azure_core::Request::new(url.clone(), azure_core::Method::Get);
let bearer_token = self.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let response = self.client.send(&mut req).await?;
let headers = response.headers();
let retry_after = get_retry_after(headers);
let bytes = response.into_body().collect().await?;
let provisioning_state = get_provisioning_state(&bytes).ok_or_else(|| {
Error::message(
ErrorKind::Other,
"Long running operation failed (missing provisioning state)".to_string(),
)
})?;
log::trace!("current provisioning_state: {provisioning_state:?}");
match provisioning_state {
LroStatus::Succeeded => {
let mut req = azure_core::Request::new(self.url()?, azure_core::Method::Get);
let bearer_token = self.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let response = self.client.send(&mut req).await?;
return Response(response).into_body().await;
}
LroStatus::Failed => {
return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string()))
}
LroStatus::Canceled => {
return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string()))
}
_ => {
sleep(retry_after).await;
}
}
}
} else {
response.into_body().await
}
})
}
}
}
pub mod export_template_at_subscription_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentExportResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentExportResult = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) deployment_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Resources/deployments/{}/exportTemplate",
self.client.endpoint(),
&self.subscription_id,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::DeploymentExportResult>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::DeploymentExportResult>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod list_at_subscription_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentListResult = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) filter: Option<String>,
pub(crate) top: Option<i32>,
}
impl RequestBuilder {
#[doc = "The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
#[doc = "The number of results to get. If null is passed, returns all deployments."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::DeploymentListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = this.url()?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-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 bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("$top", &top.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Resources/deployments/",
self.client.endpoint(),
&self.subscription_id
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod get {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentExtended> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentExtended = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) deployment_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourcegroups/{}/providers/Microsoft.Resources/deployments/{}",
self.client.endpoint(),
&self.subscription_id,
&self.resource_group_name,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::DeploymentExtended>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::DeploymentExtended>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentExtended> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentExtended = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" This `RequestBuilder` implements a Long Running Operation"]
#[doc = r" (LRO)."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the `RequestBuilder` into a future"]
#[doc = r" executes the request and polls the service until the"]
#[doc = r" operation completes."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use"]
#[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) deployment_name: String,
pub(crate) parameters: models::Deployment,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourcegroups/{}/providers/Microsoft.Resources/deployments/{}",
self.client.endpoint(),
&self.subscription_id,
&self.resource_group_name,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::DeploymentExtended>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::DeploymentExtended>>;
#[doc = "Returns a future that polls the long running operation and checks for the state via `properties.provisioningState` in the response body."]
#[doc = ""]
#[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
use azure_core::{
error::{Error, ErrorKind},
lro::{body_content::get_provisioning_state, get_retry_after, LroStatus},
sleep::sleep,
};
use std::time::Duration;
loop {
let this = self.clone();
let response = this.send().await?;
let retry_after = get_retry_after(response.as_raw_response().headers());
let status = response.as_raw_response().status();
let body = response.into_body().await?;
let provisioning_state = get_provisioning_state(status, &body)?;
log::trace!("current provisioning_state: {provisioning_state:?}");
match provisioning_state {
LroStatus::Succeeded => return Ok(body),
LroStatus::Failed => return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())),
LroStatus::Canceled => {
return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string()))
}
_ => {
sleep(retry_after).await;
}
}
}
})
}
}
}
pub mod delete {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" This `RequestBuilder` implements a Long Running Operation"]
#[doc = r" (LRO)."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the `RequestBuilder` into a future"]
#[doc = r" executes the request and polls the service until the"]
#[doc = r" operation completes."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use"]
#[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) deployment_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourcegroups/{}/providers/Microsoft.Resources/deployments/{}",
self.client.endpoint(),
&self.subscription_id,
&self.resource_group_name,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod check_existence {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) deployment_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Head);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourcegroups/{}/providers/Microsoft.Resources/deployments/{}",
self.client.endpoint(),
&self.subscription_id,
&self.resource_group_name,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod cancel {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) deployment_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourcegroups/{}/providers/Microsoft.Resources/deployments/{}/cancel",
self.client.endpoint(),
&self.subscription_id,
&self.resource_group_name,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod validate {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentValidateResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentValidateResult = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" This `RequestBuilder` implements a Long Running Operation"]
#[doc = r" (LRO)."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the `RequestBuilder` into a future"]
#[doc = r" executes the request and polls the service until the"]
#[doc = r" operation completes."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use"]
#[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) deployment_name: String,
pub(crate) parameters: models::Deployment,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourcegroups/{}/providers/Microsoft.Resources/deployments/{}/validate",
self.client.endpoint(),
&self.subscription_id,
&self.resource_group_name,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::DeploymentValidateResult>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::DeploymentValidateResult>>;
#[doc = "Returns a future that polls the long running operation and checks for the state via `properties.provisioningState` in the response body."]
#[doc = ""]
#[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
use azure_core::{
error::{Error, ErrorKind},
lro::{body_content::get_provisioning_state, get_retry_after, LroStatus},
sleep::sleep,
};
use std::time::Duration;
loop {
let this = self.clone();
let response = this.send().await?;
let retry_after = get_retry_after(response.as_raw_response().headers());
let status = response.as_raw_response().status();
let body = response.into_body().await?;
let provisioning_state = get_provisioning_state(status, &body)?;
log::trace!("current provisioning_state: {provisioning_state:?}");
match provisioning_state {
LroStatus::Succeeded => return Ok(body),
LroStatus::Failed => return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())),
LroStatus::Canceled => {
return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string()))
}
_ => {
sleep(retry_after).await;
}
}
}
})
}
}
}
pub mod what_if {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WhatIfOperationResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::WhatIfOperationResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
pub fn headers(&self) -> Headers {
Headers(self.0.headers())
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
pub struct Headers<'a>(&'a azure_core::headers::Headers);
impl<'a> Headers<'a> {
#[doc = "URL to get status of this long-running operation."]
pub fn location(&self) -> azure_core::Result<&str> {
self.0.get_str(&azure_core::headers::HeaderName::from_static("location"))
}
#[doc = "Number of seconds to wait before polling for status."]
pub fn retry_after(&self) -> azure_core::Result<&str> {
self.0.get_str(&azure_core::headers::HeaderName::from_static("retry-after"))
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" This `RequestBuilder` implements a Long Running Operation"]
#[doc = r" (LRO)."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the `RequestBuilder` into a future"]
#[doc = r" executes the request and polls the service until the"]
#[doc = r" operation completes."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use"]
#[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) deployment_name: String,
pub(crate) parameters: models::DeploymentWhatIf,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourcegroups/{}/providers/Microsoft.Resources/deployments/{}/whatIf",
self.client.endpoint(),
&self.subscription_id,
&self.resource_group_name,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::WhatIfOperationResult>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::WhatIfOperationResult>>;
#[doc = "Returns a future that polls the long running operation, returning once the operation completes."]
#[doc = ""]
#[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
use azure_core::{
error::{Error, ErrorKind},
lro::{
get_retry_after,
location::{get_location, get_provisioning_state, FinalState},
LroStatus,
},
sleep::sleep,
};
use std::time::Duration;
let this = self.clone();
let response = this.send().await?;
let headers = response.as_raw_response().headers();
let location = get_location(headers, FinalState::Location)?;
if let Some(url) = location {
loop {
let mut req = azure_core::Request::new(url.clone(), azure_core::Method::Get);
let bearer_token = self.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let response = self.client.send(&mut req).await?;
let headers = response.headers();
let retry_after = get_retry_after(headers);
let bytes = response.into_body().collect().await?;
let provisioning_state = get_provisioning_state(&bytes).ok_or_else(|| {
Error::message(
ErrorKind::Other,
"Long running operation failed (missing provisioning state)".to_string(),
)
})?;
log::trace!("current provisioning_state: {provisioning_state:?}");
match provisioning_state {
LroStatus::Succeeded => {
let mut req = azure_core::Request::new(self.url()?, azure_core::Method::Get);
let bearer_token = self.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let response = self.client.send(&mut req).await?;
return Response(response).into_body().await;
}
LroStatus::Failed => {
return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string()))
}
LroStatus::Canceled => {
return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string()))
}
_ => {
sleep(retry_after).await;
}
}
}
} else {
response.into_body().await
}
})
}
}
}
pub mod export_template {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentExportResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentExportResult = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) deployment_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourcegroups/{}/providers/Microsoft.Resources/deployments/{}/exportTemplate",
self.client.endpoint(),
&self.subscription_id,
&self.resource_group_name,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::DeploymentExportResult>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::DeploymentExportResult>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod list_by_resource_group {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentListResult = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) filter: Option<String>,
pub(crate) top: Option<i32>,
}
impl RequestBuilder {
#[doc = "The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
#[doc = "The number of results to get. If null is passed, returns all deployments."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::DeploymentListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = this.url()?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-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 bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("$top", &top.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourcegroups/{}/providers/Microsoft.Resources/deployments/",
self.client.endpoint(),
&self.subscription_id,
&self.resource_group_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod calculate_template_hash {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::TemplateHashResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::TemplateHashResult = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) template: serde_json::Value,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.template)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/providers/Microsoft.Resources/calculateTemplateHash",
self.client.endpoint(),
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::TemplateHashResult>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::TemplateHashResult>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod providers {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Unregisters a subscription from a resource provider."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_provider_namespace`: The namespace of the resource provider to unregister."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn unregister(
&self,
resource_provider_namespace: impl Into<String>,
subscription_id: impl Into<String>,
) -> unregister::RequestBuilder {
unregister::RequestBuilder {
client: self.0.clone(),
resource_provider_namespace: resource_provider_namespace.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Registers a management group with a resource provider. Use this operation to register a resource provider with resource types that can be deployed at the management group scope. It does not recursively register subscriptions within the management group. Instead, you must register subscriptions individually."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_provider_namespace`: The namespace of the resource provider to register."]
#[doc = "* `group_id`: The management group ID."]
pub fn register_at_management_group_scope(
&self,
resource_provider_namespace: impl Into<String>,
group_id: impl Into<String>,
) -> register_at_management_group_scope::RequestBuilder {
register_at_management_group_scope::RequestBuilder {
client: self.0.clone(),
resource_provider_namespace: resource_provider_namespace.into(),
group_id: group_id.into(),
}
}
#[doc = "Get the provider permissions."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_provider_namespace`: The namespace of the resource provider."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn provider_permissions(
&self,
resource_provider_namespace: impl Into<String>,
subscription_id: impl Into<String>,
) -> provider_permissions::RequestBuilder {
provider_permissions::RequestBuilder {
client: self.0.clone(),
resource_provider_namespace: resource_provider_namespace.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Registers a subscription with a resource provider."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_provider_namespace`: The namespace of the resource provider to register."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn register(
&self,
resource_provider_namespace: impl Into<String>,
subscription_id: impl Into<String>,
) -> register::RequestBuilder {
register::RequestBuilder {
client: self.0.clone(),
resource_provider_namespace: resource_provider_namespace.into(),
subscription_id: subscription_id.into(),
properties: None,
}
}
#[doc = "Gets all resource providers for a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Gets all resource providers for the tenant."]
pub fn list_at_tenant_scope(&self) -> list_at_tenant_scope::RequestBuilder {
list_at_tenant_scope::RequestBuilder {
client: self.0.clone(),
expand: None,
}
}
#[doc = "Gets the specified resource provider."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_provider_namespace`: The namespace of the resource provider."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn get(&self, resource_provider_namespace: impl Into<String>, subscription_id: impl Into<String>) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_provider_namespace: resource_provider_namespace.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Gets the specified resource provider at the tenant level."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_provider_namespace`: The namespace of the resource provider."]
pub fn get_at_tenant_scope(&self, resource_provider_namespace: impl Into<String>) -> get_at_tenant_scope::RequestBuilder {
get_at_tenant_scope::RequestBuilder {
client: self.0.clone(),
resource_provider_namespace: resource_provider_namespace.into(),
expand: None,
}
}
}
pub mod unregister {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Provider> {
let bytes = self.0.into_body().collect().await?;
let body: models::Provider = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_provider_namespace: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/{}/unregister",
self.client.endpoint(),
&self.subscription_id,
&self.resource_provider_namespace
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::Provider>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::Provider>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod register_at_management_group_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_provider_namespace: String,
pub(crate) group_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/providers/Microsoft.Management/managementGroups/{}/providers/{}/register",
self.client.endpoint(),
&self.group_id,
&self.resource_provider_namespace
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod provider_permissions {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ProviderPermissionListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ProviderPermissionListResult = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_provider_namespace: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/{}/providerPermissions",
self.client.endpoint(),
&self.subscription_id,
&self.resource_provider_namespace
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::ProviderPermissionListResult>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::ProviderPermissionListResult>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod register {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Provider> {
let bytes = self.0.into_body().collect().await?;
let body: models::Provider = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_provider_namespace: String,
pub(crate) subscription_id: String,
pub(crate) properties: Option<models::ProviderRegistrationRequest>,
}
impl RequestBuilder {
#[doc = "The third party consent for S2S."]
pub fn properties(mut self, properties: impl Into<models::ProviderRegistrationRequest>) -> Self {
self.properties = Some(properties.into());
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = if let Some(properties) = &this.properties {
req.insert_header("content-type", "application/json");
azure_core::to_json(properties)?
} else {
azure_core::EMPTY_BODY
};
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/{}/register",
self.client.endpoint(),
&self.subscription_id,
&self.resource_provider_namespace
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::Provider>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::Provider>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod list {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ProviderListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ProviderListResult = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl RequestBuilder {
#[doc = "The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider metadata. To include property aliases in response, use $expand=resourceTypes/aliases."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ProviderListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = this.url()?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-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 bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers",
self.client.endpoint(),
&self.subscription_id
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod list_at_tenant_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ProviderListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ProviderListResult = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) expand: Option<String>,
}
impl RequestBuilder {
#[doc = "The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider metadata. To include property aliases in response, use $expand=resourceTypes/aliases."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ProviderListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = this.url()?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-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 bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!("{}/providers", self.client.endpoint(),))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod get {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Provider> {
let bytes = self.0.into_body().collect().await?;
let body: models::Provider = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_provider_namespace: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl RequestBuilder {
#[doc = "The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/{}",
self.client.endpoint(),
&self.subscription_id,
&self.resource_provider_namespace
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::Provider>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::Provider>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get_at_tenant_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Provider> {
let bytes = self.0.into_body().collect().await?;
let body: models::Provider = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_provider_namespace: String,
pub(crate) expand: Option<String>,
}
impl RequestBuilder {
#[doc = "The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/providers/{}",
self.client.endpoint(),
&self.resource_provider_namespace
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::Provider>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::Provider>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod provider_resource_types {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "List the resource types for a specified resource provider."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_provider_namespace`: The namespace of the resource provider."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn list(&self, resource_provider_namespace: impl Into<String>, subscription_id: impl Into<String>) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
resource_provider_namespace: resource_provider_namespace.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
}
pub mod list {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ProviderResourceTypeListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ProviderResourceTypeListResult = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_provider_namespace: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl RequestBuilder {
#[doc = "The $expand query parameter. For example, to include property aliases in response, use $expand=resourceTypes/aliases."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/{}/resourceTypes",
self.client.endpoint(),
&self.subscription_id,
&self.resource_provider_namespace
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::ProviderResourceTypeListResult>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::ProviderResourceTypeListResult>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod resources {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Get all the resources for a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The resource group with the resources to get."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn list_by_resource_group(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_resource_group::RequestBuilder {
list_by_resource_group::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
filter: None,
expand: None,
top: None,
}
}
#[doc = "Moves resources from one resource group to another resource group."]
#[doc = "The resources to be moved must be in the same source resource group in the source subscription being used. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. "]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `source_resource_group_name`: The name of the resource group from the source subscription containing the resources to be moved."]
#[doc = "* `parameters`: Parameters for moving resources."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn move_resources(
&self,
source_resource_group_name: impl Into<String>,
parameters: impl Into<models::ResourcesMoveInfo>,
subscription_id: impl Into<String>,
) -> move_resources::RequestBuilder {
move_resources::RequestBuilder {
client: self.0.clone(),
source_resource_group_name: source_resource_group_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Validates whether resources can be moved from one resource group to another resource group."]
#[doc = "This operation checks whether the specified resources can be moved to the target. The resources to be moved must be in the same source resource group in the source subscription being used. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `source_resource_group_name`: The name of the resource group from the source subscription containing the resources to be validated for move."]
#[doc = "* `parameters`: Parameters for moving resources."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn validate_move_resources(
&self,
source_resource_group_name: impl Into<String>,
parameters: impl Into<models::ResourcesMoveInfo>,
subscription_id: impl Into<String>,
) -> validate_move_resources::RequestBuilder {
validate_move_resources::RequestBuilder {
client: self.0.clone(),
source_resource_group_name: source_resource_group_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Get all the resources in a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
filter: None,
expand: None,
top: None,
}
}
#[doc = "Gets a resource."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group containing the resource to get. The name is case insensitive."]
#[doc = "* `resource_provider_namespace`: The namespace of the resource provider."]
#[doc = "* `parent_resource_path`: The parent resource identity."]
#[doc = "* `resource_type`: The resource type of the resource."]
#[doc = "* `resource_name`: The name of the resource to get."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
resource_provider_namespace: impl Into<String>,
parent_resource_path: impl Into<String>,
resource_type: impl Into<String>,
resource_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
resource_provider_namespace: resource_provider_namespace.into(),
parent_resource_path: parent_resource_path.into(),
resource_type: resource_type.into(),
resource_name: resource_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates a resource."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group for the resource. The name is case insensitive."]
#[doc = "* `resource_provider_namespace`: The namespace of the resource provider."]
#[doc = "* `parent_resource_path`: The parent resource identity."]
#[doc = "* `resource_type`: The resource type of the resource to create."]
#[doc = "* `resource_name`: The name of the resource to create."]
#[doc = "* `parameters`: Parameters for creating or updating the resource."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
resource_provider_namespace: impl Into<String>,
parent_resource_path: impl Into<String>,
resource_type: impl Into<String>,
resource_name: impl Into<String>,
parameters: impl Into<models::GenericResource>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
resource_provider_namespace: resource_provider_namespace.into(),
parent_resource_path: parent_resource_path.into(),
resource_type: resource_type.into(),
resource_name: resource_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates a resource."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group for the resource. The name is case insensitive."]
#[doc = "* `resource_provider_namespace`: The namespace of the resource provider."]
#[doc = "* `parent_resource_path`: The parent resource identity."]
#[doc = "* `resource_type`: The resource type of the resource to update."]
#[doc = "* `resource_name`: The name of the resource to update."]
#[doc = "* `parameters`: Parameters for updating the resource."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
resource_provider_namespace: impl Into<String>,
parent_resource_path: impl Into<String>,
resource_type: impl Into<String>,
resource_name: impl Into<String>,
parameters: impl Into<models::GenericResource>,
subscription_id: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
resource_provider_namespace: resource_provider_namespace.into(),
parent_resource_path: parent_resource_path.into(),
resource_type: resource_type.into(),
resource_name: resource_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a resource."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group that contains the resource to delete. The name is case insensitive."]
#[doc = "* `resource_provider_namespace`: The namespace of the resource provider."]
#[doc = "* `parent_resource_path`: The parent resource identity."]
#[doc = "* `resource_type`: The resource type."]
#[doc = "* `resource_name`: The name of the resource to delete."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
resource_provider_namespace: impl Into<String>,
parent_resource_path: impl Into<String>,
resource_type: impl Into<String>,
resource_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
resource_provider_namespace: resource_provider_namespace.into(),
parent_resource_path: parent_resource_path.into(),
resource_type: resource_type.into(),
resource_name: resource_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Checks whether a resource exists."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group containing the resource to check. The name is case insensitive."]
#[doc = "* `resource_provider_namespace`: The resource provider of the resource to check."]
#[doc = "* `parent_resource_path`: The parent resource identity."]
#[doc = "* `resource_type`: The resource type."]
#[doc = "* `resource_name`: The name of the resource to check whether it exists."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn check_existence(
&self,
resource_group_name: impl Into<String>,
resource_provider_namespace: impl Into<String>,
parent_resource_path: impl Into<String>,
resource_type: impl Into<String>,
resource_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> check_existence::RequestBuilder {
check_existence::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
resource_provider_namespace: resource_provider_namespace.into(),
parent_resource_path: parent_resource_path.into(),
resource_type: resource_type.into(),
resource_name: resource_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a resource by ID."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_id`: The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}"]
pub fn get_by_id(&self, resource_id: impl Into<String>) -> get_by_id::RequestBuilder {
get_by_id::RequestBuilder {
client: self.0.clone(),
resource_id: resource_id.into(),
}
}
#[doc = "Create a resource by ID."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_id`: The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}"]
#[doc = "* `parameters`: Create or update resource parameters."]
pub fn create_or_update_by_id(
&self,
resource_id: impl Into<String>,
parameters: impl Into<models::GenericResource>,
) -> create_or_update_by_id::RequestBuilder {
create_or_update_by_id::RequestBuilder {
client: self.0.clone(),
resource_id: resource_id.into(),
parameters: parameters.into(),
}
}
#[doc = "Updates a resource by ID."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_id`: The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}"]
#[doc = "* `parameters`: Update resource parameters."]
pub fn update_by_id(
&self,
resource_id: impl Into<String>,
parameters: impl Into<models::GenericResource>,
) -> update_by_id::RequestBuilder {
update_by_id::RequestBuilder {
client: self.0.clone(),
resource_id: resource_id.into(),
parameters: parameters.into(),
}
}
#[doc = "Deletes a resource by ID."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_id`: The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}"]
pub fn delete_by_id(&self, resource_id: impl Into<String>) -> delete_by_id::RequestBuilder {
delete_by_id::RequestBuilder {
client: self.0.clone(),
resource_id: resource_id.into(),
}
}
#[doc = "Checks by ID whether a resource exists. This API currently works only for a limited set of Resource providers. In the event that a Resource provider does not implement this API, ARM will respond with a 405. The alternative then is to use the GET API to check for the existence of the resource."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_id`: The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}"]
pub fn check_existence_by_id(&self, resource_id: impl Into<String>) -> check_existence_by_id::RequestBuilder {
check_existence_by_id::RequestBuilder {
client: self.0.clone(),
resource_id: resource_id.into(),
}
}
}
pub mod list_by_resource_group {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ResourceListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ResourceListResult = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) filter: Option<String>,
pub(crate) expand: Option<String>,
pub(crate) top: Option<i32>,
}
impl RequestBuilder {
#[doc = "The filter to apply on the operation.<br><br>The properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.<br><br>For example, to filter by a resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'<br><br>You can use substringof(value, property) in the filter. The properties you can use for substring are: name and resourceGroup.<br><br>For example, to get all resources with 'demo' anywhere in the name, use: $filter=substringof('demo', name)<br><br>You can link more than one substringof together by adding and/or operators.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, the tags for each resource are not returned in the results.<br><br>You can use some properties together when filtering. The combinations you can use are: substringof and/or resourceType, plan and plan/publisher and plan/name, identity and identity/principalId."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
#[doc = "Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
#[doc = "The number of results to return. If null is passed, returns all resources."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ResourceListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = this.url()?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-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 bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("$top", &top.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/resources",
self.client.endpoint(),
&self.subscription_id,
&self.resource_group_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod move_resources {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" This `RequestBuilder` implements a Long Running Operation"]
#[doc = r" (LRO)."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the `RequestBuilder` into a future"]
#[doc = r" executes the request and polls the service until the"]
#[doc = r" operation completes."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use"]
#[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) source_resource_group_name: String,
pub(crate) parameters: models::ResourcesMoveInfo,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/moveResources",
self.client.endpoint(),
&self.subscription_id,
&self.source_resource_group_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod validate_move_resources {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" This `RequestBuilder` implements a Long Running Operation"]
#[doc = r" (LRO)."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the `RequestBuilder` into a future"]
#[doc = r" executes the request and polls the service until the"]
#[doc = r" operation completes."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use"]
#[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) source_resource_group_name: String,
pub(crate) parameters: models::ResourcesMoveInfo,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/validateMoveResources",
self.client.endpoint(),
&self.subscription_id,
&self.source_resource_group_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod list {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ResourceListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ResourceListResult = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) filter: Option<String>,
pub(crate) expand: Option<String>,
pub(crate) top: Option<i32>,
}
impl RequestBuilder {
#[doc = "The filter to apply on the operation.<br><br>Filter comparison operators include `eq` (equals) and `ne` (not equals) and may be used with the following properties: `location`, `resourceType`, `name`, `resourceGroup`, `identity`, `identity/principalId`, `plan`, `plan/publisher`, `plan/product`, `plan/name`, `plan/version`, and `plan/promotionCode`.<br><br>For example, to filter by a resource type, use `$filter=resourceType eq 'Microsoft.Network/virtualNetworks'`<br><br><br>`substringof(value, property)` can be used to filter for substrings of the following currently-supported properties: `name` and `resourceGroup`<br><br>For example, to get all resources with 'demo' anywhere in the resource name, use `$filter=substringof('demo', name)`<br><br>Multiple substring operations can also be combined using `and`/`or` operators.<br><br>Note that any truncated number of results queried via `$top` may also not be compatible when using a filter.<br><br><br>Resources can be filtered by tag names and values. For example, to filter for a tag name and value, use `$filter=tagName eq 'tag1' and tagValue eq 'Value1'`. Note that when resources are filtered by tag name and value, <b>the original tags for each resource will not be returned in the results.</b> Any list of additional properties queried via `$expand` may also not be compatible when filtering by tag names/values. <br><br>For tag names only, resources can be filtered by prefix using the following syntax: `$filter=startswith(tagName, 'depart')`. This query will return all resources with a tag name prefixed by the phrase `depart` (i.e.`department`, `departureDate`, `departureTime`, etc.)<br><br><br>Note that some properties can be combined when filtering resources, which include the following: `substringof() and/or resourceType`, `plan and plan/publisher and plan/name`, and `identity and identity/principalId`."]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
#[doc = "Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. For example, `$expand=createdTime,changedTime`."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
#[doc = "The number of recommendations per page if a paged version of this API is being used."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ResourceListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = this.url()?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-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 bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("$top", &top.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resources",
self.client.endpoint(),
&self.subscription_id
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod get {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GenericResource> {
let bytes = self.0.into_body().collect().await?;
let body: models::GenericResource = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) resource_provider_namespace: String,
pub(crate) parent_resource_path: String,
pub(crate) resource_type: String,
pub(crate) resource_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourcegroups/{}/providers/{}/{}/{}/{}",
self.client.endpoint(),
&self.subscription_id,
&self.resource_group_name,
&self.resource_provider_namespace,
&self.parent_resource_path,
&self.resource_type,
&self.resource_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GenericResource>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::GenericResource>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GenericResource> {
let bytes = self.0.into_body().collect().await?;
let body: models::GenericResource = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" This `RequestBuilder` implements a Long Running Operation"]
#[doc = r" (LRO)."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the `RequestBuilder` into a future"]
#[doc = r" executes the request and polls the service until the"]
#[doc = r" operation completes."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use"]
#[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) resource_provider_namespace: String,
pub(crate) parent_resource_path: String,
pub(crate) resource_type: String,
pub(crate) resource_name: String,
pub(crate) parameters: models::GenericResource,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourcegroups/{}/providers/{}/{}/{}/{}",
self.client.endpoint(),
&self.subscription_id,
&self.resource_group_name,
&self.resource_provider_namespace,
&self.parent_resource_path,
&self.resource_type,
&self.resource_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GenericResource>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::GenericResource>>;
#[doc = "Returns a future that polls the long running operation and checks for the state via `properties.provisioningState` in the response body."]
#[doc = ""]
#[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
use azure_core::{
error::{Error, ErrorKind},
lro::{body_content::get_provisioning_state, get_retry_after, LroStatus},
sleep::sleep,
};
use std::time::Duration;
loop {
let this = self.clone();
let response = this.send().await?;
let retry_after = get_retry_after(response.as_raw_response().headers());
let status = response.as_raw_response().status();
let body = response.into_body().await?;
let provisioning_state = get_provisioning_state(status, &body)?;
log::trace!("current provisioning_state: {provisioning_state:?}");
match provisioning_state {
LroStatus::Succeeded => return Ok(body),
LroStatus::Failed => return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())),
LroStatus::Canceled => {
return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string()))
}
_ => {
sleep(retry_after).await;
}
}
}
})
}
}
}
pub mod update {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GenericResource> {
let bytes = self.0.into_body().collect().await?;
let body: models::GenericResource = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" This `RequestBuilder` implements a Long Running Operation"]
#[doc = r" (LRO)."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the `RequestBuilder` into a future"]
#[doc = r" executes the request and polls the service until the"]
#[doc = r" operation completes."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use"]
#[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) resource_provider_namespace: String,
pub(crate) parent_resource_path: String,
pub(crate) resource_type: String,
pub(crate) resource_name: String,
pub(crate) parameters: models::GenericResource,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourcegroups/{}/providers/{}/{}/{}/{}",
self.client.endpoint(),
&self.subscription_id,
&self.resource_group_name,
&self.resource_provider_namespace,
&self.parent_resource_path,
&self.resource_type,
&self.resource_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GenericResource>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::GenericResource>>;
#[doc = "Returns a future that polls the long running operation and checks for the state via `properties.provisioningState` in the response body."]
#[doc = ""]
#[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
use azure_core::{
error::{Error, ErrorKind},
lro::{body_content::get_provisioning_state, get_retry_after, LroStatus},
sleep::sleep,
};
use std::time::Duration;
loop {
let this = self.clone();
let response = this.send().await?;
let retry_after = get_retry_after(response.as_raw_response().headers());
let status = response.as_raw_response().status();
let body = response.into_body().await?;
let provisioning_state = get_provisioning_state(status, &body)?;
log::trace!("current provisioning_state: {provisioning_state:?}");
match provisioning_state {
LroStatus::Succeeded => return Ok(body),
LroStatus::Failed => return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())),
LroStatus::Canceled => {
return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string()))
}
_ => {
sleep(retry_after).await;
}
}
}
})
}
}
}
pub mod delete {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" This `RequestBuilder` implements a Long Running Operation"]
#[doc = r" (LRO)."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the `RequestBuilder` into a future"]
#[doc = r" executes the request and polls the service until the"]
#[doc = r" operation completes."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use"]
#[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) resource_provider_namespace: String,
pub(crate) parent_resource_path: String,
pub(crate) resource_type: String,
pub(crate) resource_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourcegroups/{}/providers/{}/{}/{}/{}",
self.client.endpoint(),
&self.subscription_id,
&self.resource_group_name,
&self.resource_provider_namespace,
&self.parent_resource_path,
&self.resource_type,
&self.resource_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod check_existence {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) resource_provider_namespace: String,
pub(crate) parent_resource_path: String,
pub(crate) resource_type: String,
pub(crate) resource_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Head);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourcegroups/{}/providers/{}/{}/{}/{}",
self.client.endpoint(),
&self.subscription_id,
&self.resource_group_name,
&self.resource_provider_namespace,
&self.parent_resource_path,
&self.resource_type,
&self.resource_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod get_by_id {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GenericResource> {
let bytes = self.0.into_body().collect().await?;
let body: models::GenericResource = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!("{}/{}", self.client.endpoint(), &self.resource_id))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GenericResource>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::GenericResource>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update_by_id {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GenericResource> {
let bytes = self.0.into_body().collect().await?;
let body: models::GenericResource = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" This `RequestBuilder` implements a Long Running Operation"]
#[doc = r" (LRO)."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the `RequestBuilder` into a future"]
#[doc = r" executes the request and polls the service until the"]
#[doc = r" operation completes."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use"]
#[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_id: String,
pub(crate) parameters: models::GenericResource,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!("{}/{}", self.client.endpoint(), &self.resource_id))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GenericResource>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::GenericResource>>;
#[doc = "Returns a future that polls the long running operation and checks for the state via `properties.provisioningState` in the response body."]
#[doc = ""]
#[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
use azure_core::{
error::{Error, ErrorKind},
lro::{body_content::get_provisioning_state, get_retry_after, LroStatus},
sleep::sleep,
};
use std::time::Duration;
loop {
let this = self.clone();
let response = this.send().await?;
let retry_after = get_retry_after(response.as_raw_response().headers());
let status = response.as_raw_response().status();
let body = response.into_body().await?;
let provisioning_state = get_provisioning_state(status, &body)?;
log::trace!("current provisioning_state: {provisioning_state:?}");
match provisioning_state {
LroStatus::Succeeded => return Ok(body),
LroStatus::Failed => return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())),
LroStatus::Canceled => {
return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string()))
}
_ => {
sleep(retry_after).await;
}
}
}
})
}
}
}
pub mod update_by_id {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::GenericResource> {
let bytes = self.0.into_body().collect().await?;
let body: models::GenericResource = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" This `RequestBuilder` implements a Long Running Operation"]
#[doc = r" (LRO)."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the `RequestBuilder` into a future"]
#[doc = r" executes the request and polls the service until the"]
#[doc = r" operation completes."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use"]
#[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_id: String,
pub(crate) parameters: models::GenericResource,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!("{}/{}", self.client.endpoint(), &self.resource_id))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::GenericResource>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::GenericResource>>;
#[doc = "Returns a future that polls the long running operation and checks for the state via `properties.provisioningState` in the response body."]
#[doc = ""]
#[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
use azure_core::{
error::{Error, ErrorKind},
lro::{body_content::get_provisioning_state, get_retry_after, LroStatus},
sleep::sleep,
};
use std::time::Duration;
loop {
let this = self.clone();
let response = this.send().await?;
let retry_after = get_retry_after(response.as_raw_response().headers());
let status = response.as_raw_response().status();
let body = response.into_body().await?;
let provisioning_state = get_provisioning_state(status, &body)?;
log::trace!("current provisioning_state: {provisioning_state:?}");
match provisioning_state {
LroStatus::Succeeded => return Ok(body),
LroStatus::Failed => return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string())),
LroStatus::Canceled => {
return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string()))
}
_ => {
sleep(retry_after).await;
}
}
}
})
}
}
}
pub mod delete_by_id {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" This `RequestBuilder` implements a Long Running Operation"]
#[doc = r" (LRO)."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the `RequestBuilder` into a future"]
#[doc = r" executes the request and polls the service until the"]
#[doc = r" operation completes."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use"]
#[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!("{}/{}", self.client.endpoint(), &self.resource_id))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod check_existence_by_id {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Head);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!("{}/{}", self.client.endpoint(), &self.resource_id))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
}
pub mod resource_groups {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group to get. The name is case insensitive."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn get(&self, resource_group_name: impl Into<String>, subscription_id: impl Into<String>) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group to create or update. Can include alphanumeric, underscore, parentheses, hyphen, period (except at end), and Unicode characters that match the allowed characters."]
#[doc = "* `parameters`: Parameters supplied to the create or update a resource group."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
parameters: impl Into<models::ResourceGroup>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates a resource group."]
#[doc = "Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is the same as that for creating a resource group. If a field is unspecified, the current value is retained."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group to update. The name is case insensitive."]
#[doc = "* `parameters`: Parameters supplied to update a resource group."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
parameters: impl Into<models::ResourceGroupPatchable>,
subscription_id: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
parameters: parameters.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a resource group."]
#[doc = "When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group to delete. The name is case insensitive."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn delete(&self, resource_group_name: impl Into<String>, subscription_id: impl Into<String>) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
force_deletion_types: None,
}
}
#[doc = "Checks whether a resource group exists."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group to check. The name is case insensitive."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn check_existence(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> check_existence::RequestBuilder {
check_existence::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Captures the specified resource group as a template."]
#[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 = "* `parameters`: Parameters for exporting the template."]
pub fn export_template(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
parameters: impl Into<models::ExportTemplateRequest>,
) -> export_template::RequestBuilder {
export_template::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
parameters: parameters.into(),
}
}
#[doc = "Gets all the resource groups for a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
filter: None,
top: None,
}
}
}
pub mod get {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ResourceGroup> {
let bytes = self.0.into_body().collect().await?;
let body: models::ResourceGroup = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourcegroups/{}",
self.client.endpoint(),
&self.subscription_id,
&self.resource_group_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::ResourceGroup>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::ResourceGroup>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ResourceGroup> {
let bytes = self.0.into_body().collect().await?;
let body: models::ResourceGroup = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) parameters: models::ResourceGroup,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourcegroups/{}",
self.client.endpoint(),
&self.subscription_id,
&self.resource_group_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::ResourceGroup>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::ResourceGroup>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ResourceGroup> {
let bytes = self.0.into_body().collect().await?;
let body: models::ResourceGroup = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) parameters: models::ResourceGroupPatchable,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourcegroups/{}",
self.client.endpoint(),
&self.subscription_id,
&self.resource_group_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::ResourceGroup>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::ResourceGroup>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" This `RequestBuilder` implements a Long Running Operation"]
#[doc = r" (LRO)."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the `RequestBuilder` into a future"]
#[doc = r" executes the request and polls the service until the"]
#[doc = r" operation completes."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use"]
#[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) force_deletion_types: Option<String>,
}
impl RequestBuilder {
#[doc = "The resource types you want to force delete. Currently, only the following is supported: forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets"]
pub fn force_deletion_types(mut self, force_deletion_types: impl Into<String>) -> Self {
self.force_deletion_types = Some(force_deletion_types.into());
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
if let Some(force_deletion_types) = &this.force_deletion_types {
req.url_mut()
.query_pairs_mut()
.append_pair("forceDeletionTypes", force_deletion_types);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourcegroups/{}",
self.client.endpoint(),
&self.subscription_id,
&self.resource_group_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod check_existence {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Head);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourcegroups/{}",
self.client.endpoint(),
&self.subscription_id,
&self.resource_group_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod export_template {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ResourceGroupExportResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ResourceGroupExportResult = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" This `RequestBuilder` implements a Long Running Operation"]
#[doc = r" (LRO)."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the `RequestBuilder` into a future"]
#[doc = r" executes the request and polls the service until the"]
#[doc = r" operation completes."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use"]
#[doc = r" [`RequestBuilder::send()`], which will return a lower-level"]
#[doc = r" [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) parameters: models::ExportTemplateRequest,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourcegroups/{}/exportTemplate",
self.client.endpoint(),
&self.subscription_id,
&self.resource_group_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::ResourceGroupExportResult>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::ResourceGroupExportResult>>;
#[doc = "Returns a future that polls the long running operation, returning once the operation completes."]
#[doc = ""]
#[doc = "To only submit the request but not monitor the status of the operation until completion, use `send()` instead."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
use azure_core::{
error::{Error, ErrorKind},
lro::{
get_retry_after,
location::{get_location, get_provisioning_state, FinalState},
LroStatus,
},
sleep::sleep,
};
use std::time::Duration;
let this = self.clone();
let response = this.send().await?;
let headers = response.as_raw_response().headers();
let location = get_location(headers, FinalState::Location)?;
if let Some(url) = location {
loop {
let mut req = azure_core::Request::new(url.clone(), azure_core::Method::Get);
let bearer_token = self.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let response = self.client.send(&mut req).await?;
let headers = response.headers();
let retry_after = get_retry_after(headers);
let bytes = response.into_body().collect().await?;
let provisioning_state = get_provisioning_state(&bytes).ok_or_else(|| {
Error::message(
ErrorKind::Other,
"Long running operation failed (missing provisioning state)".to_string(),
)
})?;
log::trace!("current provisioning_state: {provisioning_state:?}");
match provisioning_state {
LroStatus::Succeeded => {
let mut req = azure_core::Request::new(self.url()?, azure_core::Method::Get);
let bearer_token = self.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let response = self.client.send(&mut req).await?;
return Response(response).into_body().await;
}
LroStatus::Failed => {
return Err(Error::message(ErrorKind::Other, "Long running operation failed".to_string()))
}
LroStatus::Canceled => {
return Err(Error::message(ErrorKind::Other, "Long running operation canceled".to_string()))
}
_ => {
sleep(retry_after).await;
}
}
}
} else {
response.into_body().await
}
})
}
}
}
pub mod list {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ResourceGroupListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ResourceGroupListResult = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) filter: Option<String>,
pub(crate) top: Option<i32>,
}
impl RequestBuilder {
#[doc = "The filter to apply on the operation.<br><br>You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'"]
pub fn filter(mut self, filter: impl Into<String>) -> Self {
self.filter = Some(filter.into());
self
}
#[doc = "The number of results to return. If null is passed, returns all resource groups."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::ResourceGroupListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = this.url()?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-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 bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
if let Some(filter) = &this.filter {
req.url_mut().query_pairs_mut().append_pair("$filter", filter);
}
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("$top", &top.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourcegroups",
self.client.endpoint(),
&self.subscription_id
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
}
pub mod tags {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Creates a predefined value for a predefined tag name."]
#[doc = "This operation allows adding a value to the list of predefined values for an existing predefined tag name. A tag value can have a maximum of 256 characters."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `tag_name`: The name of the tag."]
#[doc = "* `tag_value`: The value of the tag to create."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn create_or_update_value(
&self,
tag_name: impl Into<String>,
tag_value: impl Into<String>,
subscription_id: impl Into<String>,
) -> create_or_update_value::RequestBuilder {
create_or_update_value::RequestBuilder {
client: self.0.clone(),
tag_name: tag_name.into(),
tag_value: tag_value.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a predefined tag value for a predefined tag name."]
#[doc = "This operation allows deleting a value from the list of predefined values for an existing predefined tag name. The value being deleted must not be in use as a tag value for the given tag name for any resource."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `tag_name`: The name of the tag."]
#[doc = "* `tag_value`: The value of the tag to delete."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn delete_value(
&self,
tag_name: impl Into<String>,
tag_value: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete_value::RequestBuilder {
delete_value::RequestBuilder {
client: self.0.clone(),
tag_name: tag_name.into(),
tag_value: tag_value.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates a predefined tag name."]
#[doc = "This operation allows adding a name to the list of predefined tag names for the given subscription. A tag name can have a maximum of 512 characters and is case-insensitive. Tag names cannot have the following prefixes which are reserved for Azure use: 'microsoft', 'azure', 'windows'."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `tag_name`: The name of the tag to create."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn create_or_update(
&self,
tag_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
tag_name: tag_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes a predefined tag name."]
#[doc = "This operation allows deleting a name from the list of predefined tag names for the given subscription. The name being deleted must not be in use as a tag name for any resource. All predefined values for the given name must have already been deleted."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `tag_name`: The name of the tag."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn delete(&self, tag_name: impl Into<String>, subscription_id: impl Into<String>) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
tag_name: tag_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a summary of tag usage under the subscription."]
#[doc = "This operation performs a union of predefined tags, resource tags, resource group tags and subscription tags, and returns a summary of usage for each tag name and value under the given subscription. In case of a large number of tags, this operation may return a previously cached result."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets the entire set of tags on a resource or subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `scope`: The resource scope."]
pub fn get_at_scope(&self, scope: impl Into<String>) -> get_at_scope::RequestBuilder {
get_at_scope::RequestBuilder {
client: self.0.clone(),
scope: scope.into(),
}
}
#[doc = "Creates or updates the entire set of tags on a resource or subscription."]
#[doc = "This operation allows adding or replacing the entire set of tags on the specified resource or subscription. The specified entity can have a maximum of 50 tags."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `scope`: The resource scope."]
pub fn create_or_update_at_scope(
&self,
scope: impl Into<String>,
parameters: impl Into<models::TagsResource>,
) -> create_or_update_at_scope::RequestBuilder {
create_or_update_at_scope::RequestBuilder {
client: self.0.clone(),
scope: scope.into(),
parameters: parameters.into(),
}
}
#[doc = "Selectively updates the set of tags on a resource or subscription."]
#[doc = "This operation allows replacing, merging or selectively deleting tags on the specified resource or subscription. The specified entity can have a maximum of 50 tags at the end of the operation. The 'replace' option replaces the entire set of existing tags with a new set. The 'merge' option allows adding tags with new names and updating the values of tags with existing names. The 'delete' option allows selectively deleting tags based on given names or name/value pairs."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `scope`: The resource scope."]
pub fn update_at_scope(
&self,
scope: impl Into<String>,
parameters: impl Into<models::TagsPatchResource>,
) -> update_at_scope::RequestBuilder {
update_at_scope::RequestBuilder {
client: self.0.clone(),
scope: scope.into(),
parameters: parameters.into(),
}
}
#[doc = "Deletes the entire set of tags on a resource or subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `scope`: The resource scope."]
pub fn delete_at_scope(&self, scope: impl Into<String>) -> delete_at_scope::RequestBuilder {
delete_at_scope::RequestBuilder {
client: self.0.clone(),
scope: scope.into(),
}
}
}
pub mod create_or_update_value {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::TagValue> {
let bytes = self.0.into_body().collect().await?;
let body: models::TagValue = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) tag_name: String,
pub(crate) tag_value: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/tagNames/{}/tagValues/{}",
self.client.endpoint(),
&self.subscription_id,
&self.tag_name,
&self.tag_value
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::TagValue>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::TagValue>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete_value {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) tag_name: String,
pub(crate) tag_value: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/tagNames/{}/tagValues/{}",
self.client.endpoint(),
&self.subscription_id,
&self.tag_name,
&self.tag_value
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod create_or_update {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::TagDetails> {
let bytes = self.0.into_body().collect().await?;
let body: models::TagDetails = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) tag_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/tagNames/{}",
self.client.endpoint(),
&self.subscription_id,
&self.tag_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::TagDetails>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::TagDetails>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) tag_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/tagNames/{}",
self.client.endpoint(),
&self.subscription_id,
&self.tag_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod list {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::TagsListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::TagsListResult = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::TagsListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = this.url()?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-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 bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/tagNames",
self.client.endpoint(),
&self.subscription_id
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod get_at_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::TagsResource> {
let bytes = self.0.into_body().collect().await?;
let body: models::TagsResource = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) scope: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/{}/providers/Microsoft.Resources/tags/default",
self.client.endpoint(),
&self.scope
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::TagsResource>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::TagsResource>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update_at_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::TagsResource> {
let bytes = self.0.into_body().collect().await?;
let body: models::TagsResource = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) scope: String,
pub(crate) parameters: models::TagsResource,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/{}/providers/Microsoft.Resources/tags/default",
self.client.endpoint(),
&self.scope
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::TagsResource>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::TagsResource>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update_at_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::TagsResource> {
let bytes = self.0.into_body().collect().await?;
let body: models::TagsResource = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) scope: String,
pub(crate) parameters: models::TagsPatchResource,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.parameters)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/{}/providers/Microsoft.Resources/tags/default",
self.client.endpoint(),
&self.scope
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::TagsResource>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::TagsResource>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete_at_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) scope: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/{}/providers/Microsoft.Resources/tags/default",
self.client.endpoint(),
&self.scope
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
}
pub mod deployment_operations {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a deployments operation."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `scope`: The resource scope."]
#[doc = "* `deployment_name`: The name of the deployment."]
#[doc = "* `operation_id`: The ID of the operation to get."]
pub fn get_at_scope(
&self,
scope: impl Into<String>,
deployment_name: impl Into<String>,
operation_id: impl Into<String>,
) -> get_at_scope::RequestBuilder {
get_at_scope::RequestBuilder {
client: self.0.clone(),
scope: scope.into(),
deployment_name: deployment_name.into(),
operation_id: operation_id.into(),
}
}
#[doc = "Gets all deployments operations for a deployment."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `scope`: The resource scope."]
#[doc = "* `deployment_name`: The name of the deployment."]
pub fn list_at_scope(&self, scope: impl Into<String>, deployment_name: impl Into<String>) -> list_at_scope::RequestBuilder {
list_at_scope::RequestBuilder {
client: self.0.clone(),
scope: scope.into(),
deployment_name: deployment_name.into(),
top: None,
}
}
#[doc = "Gets a deployments operation."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `deployment_name`: The name of the deployment."]
#[doc = "* `operation_id`: The ID of the operation to get."]
pub fn get_at_tenant_scope(
&self,
deployment_name: impl Into<String>,
operation_id: impl Into<String>,
) -> get_at_tenant_scope::RequestBuilder {
get_at_tenant_scope::RequestBuilder {
client: self.0.clone(),
deployment_name: deployment_name.into(),
operation_id: operation_id.into(),
}
}
#[doc = "Gets all deployments operations for a deployment."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `deployment_name`: The name of the deployment."]
pub fn list_at_tenant_scope(&self, deployment_name: impl Into<String>) -> list_at_tenant_scope::RequestBuilder {
list_at_tenant_scope::RequestBuilder {
client: self.0.clone(),
deployment_name: deployment_name.into(),
top: None,
}
}
#[doc = "Gets a deployments operation."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `group_id`: The management group ID."]
#[doc = "* `deployment_name`: The name of the deployment."]
#[doc = "* `operation_id`: The ID of the operation to get."]
pub fn get_at_management_group_scope(
&self,
group_id: impl Into<String>,
deployment_name: impl Into<String>,
operation_id: impl Into<String>,
) -> get_at_management_group_scope::RequestBuilder {
get_at_management_group_scope::RequestBuilder {
client: self.0.clone(),
group_id: group_id.into(),
deployment_name: deployment_name.into(),
operation_id: operation_id.into(),
}
}
#[doc = "Gets all deployments operations for a deployment."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `group_id`: The management group ID."]
#[doc = "* `deployment_name`: The name of the deployment."]
pub fn list_at_management_group_scope(
&self,
group_id: impl Into<String>,
deployment_name: impl Into<String>,
) -> list_at_management_group_scope::RequestBuilder {
list_at_management_group_scope::RequestBuilder {
client: self.0.clone(),
group_id: group_id.into(),
deployment_name: deployment_name.into(),
top: None,
}
}
#[doc = "Gets a deployments operation."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `deployment_name`: The name of the deployment."]
#[doc = "* `operation_id`: The ID of the operation to get."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn get_at_subscription_scope(
&self,
deployment_name: impl Into<String>,
operation_id: impl Into<String>,
subscription_id: impl Into<String>,
) -> get_at_subscription_scope::RequestBuilder {
get_at_subscription_scope::RequestBuilder {
client: self.0.clone(),
deployment_name: deployment_name.into(),
operation_id: operation_id.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all deployments operations for a deployment."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `deployment_name`: The name of the deployment."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn list_at_subscription_scope(
&self,
deployment_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_at_subscription_scope::RequestBuilder {
list_at_subscription_scope::RequestBuilder {
client: self.0.clone(),
deployment_name: deployment_name.into(),
subscription_id: subscription_id.into(),
top: None,
}
}
#[doc = "Gets a deployments operation."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `deployment_name`: The name of the deployment."]
#[doc = "* `operation_id`: The ID of the operation to get."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
deployment_name: impl Into<String>,
operation_id: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
deployment_name: deployment_name.into(),
operation_id: operation_id.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets all deployments operations for a deployment."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `deployment_name`: The name of the deployment."]
#[doc = "* `subscription_id`: The Microsoft Azure subscription ID."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
deployment_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
deployment_name: deployment_name.into(),
subscription_id: subscription_id.into(),
top: None,
}
}
}
pub mod get_at_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentOperation> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentOperation = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) scope: String,
pub(crate) deployment_name: String,
pub(crate) operation_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/{}/providers/Microsoft.Resources/deployments/{}/operations/{}",
self.client.endpoint(),
&self.scope,
&self.deployment_name,
&self.operation_id
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::DeploymentOperation>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::DeploymentOperation>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod list_at_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentOperationsListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentOperationsListResult = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) scope: String,
pub(crate) deployment_name: String,
pub(crate) top: Option<i32>,
}
impl RequestBuilder {
#[doc = "The number of results to return."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::DeploymentOperationsListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = this.url()?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-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 bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("$top", &top.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/{}/providers/Microsoft.Resources/deployments/{}/operations",
self.client.endpoint(),
&self.scope,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod get_at_tenant_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentOperation> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentOperation = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) deployment_name: String,
pub(crate) operation_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/providers/Microsoft.Resources/deployments/{}/operations/{}",
self.client.endpoint(),
&self.deployment_name,
&self.operation_id
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::DeploymentOperation>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::DeploymentOperation>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod list_at_tenant_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentOperationsListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentOperationsListResult = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) deployment_name: String,
pub(crate) top: Option<i32>,
}
impl RequestBuilder {
#[doc = "The number of results to return."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::DeploymentOperationsListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = this.url()?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-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 bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("$top", &top.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/providers/Microsoft.Resources/deployments/{}/operations",
self.client.endpoint(),
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod get_at_management_group_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentOperation> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentOperation = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) group_id: String,
pub(crate) deployment_name: String,
pub(crate) operation_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/providers/Microsoft.Management/managementGroups/{}/providers/Microsoft.Resources/deployments/{}/operations/{}",
self.client.endpoint(),
&self.group_id,
&self.deployment_name,
&self.operation_id
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::DeploymentOperation>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::DeploymentOperation>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod list_at_management_group_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentOperationsListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentOperationsListResult = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) group_id: String,
pub(crate) deployment_name: String,
pub(crate) top: Option<i32>,
}
impl RequestBuilder {
#[doc = "The number of results to return."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::DeploymentOperationsListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = this.url()?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-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 bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("$top", &top.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/providers/Microsoft.Management/managementGroups/{}/providers/Microsoft.Resources/deployments/{}/operations",
self.client.endpoint(),
&self.group_id,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod get_at_subscription_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentOperation> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentOperation = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) deployment_name: String,
pub(crate) operation_id: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Resources/deployments/{}/operations/{}",
self.client.endpoint(),
&self.subscription_id,
&self.deployment_name,
&self.operation_id
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::DeploymentOperation>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::DeploymentOperation>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod list_at_subscription_scope {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentOperationsListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentOperationsListResult = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) deployment_name: String,
pub(crate) subscription_id: String,
pub(crate) top: Option<i32>,
}
impl RequestBuilder {
#[doc = "The number of results to return."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::DeploymentOperationsListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = this.url()?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-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 bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("$top", &top.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Resources/deployments/{}/operations",
self.client.endpoint(),
&self.subscription_id,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
pub mod get {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentOperation> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentOperation = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) deployment_name: String,
pub(crate) operation_id: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourcegroups/{}/deployments/{}/operations/{}",
self.client.endpoint(),
&self.subscription_id,
&self.resource_group_name,
&self.deployment_name,
&self.operation_id
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::DeploymentOperation>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::DeploymentOperation>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod list {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::DeploymentOperationsListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::DeploymentOperationsListResult = 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)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" which will convert the [`RequestBuilder`] into a future"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" In order to execute the request without polling the service"]
#[doc = r" until the operation completes, use `.send().await` instead."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) deployment_name: String,
pub(crate) subscription_id: String,
pub(crate) top: Option<i32>,
}
impl RequestBuilder {
#[doc = "The number of results to return."]
pub fn top(mut self, top: i32) -> Self {
self.top = Some(top);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::DeploymentOperationsListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = this.url()?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-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 bearer_token = this.client.bearer_token().await?;
req.insert_header(azure_core::headers::AUTHORIZATION, format!("Bearer {}", bearer_token.secret()));
if let Some(top) = &this.top {
req.url_mut().query_pairs_mut().append_pair("$top", &top.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
fn url(&self) -> azure_core::Result<azure_core::Url> {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourcegroups/{}/deployments/{}/operations",
self.client.endpoint(),
&self.subscription_id,
&self.resource_group_name,
&self.deployment_name
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
url.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-04-01");
}
Ok(url)
}
}
}
}