#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(unused_imports)]
#![allow(clippy::redundant_clone)]
pub mod models;
#[derive(Clone)]
pub struct Client {
endpoint: String,
credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>,
scopes: Vec<String>,
pipeline: azure_core::Pipeline,
}
#[derive(Clone)]
pub struct ClientBuilder {
credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>,
endpoint: Option<String>,
scopes: Option<Vec<String>>,
options: azure_core::ClientOptions,
}
pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD;
impl ClientBuilder {
#[doc = "Create a new instance of `ClientBuilder`."]
#[must_use]
pub fn new(credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>) -> Self {
Self {
credential,
endpoint: None,
scopes: None,
options: azure_core::ClientOptions::default(),
}
}
#[doc = "Set the endpoint."]
#[must_use]
pub fn endpoint(mut self, endpoint: impl Into<String>) -> Self {
self.endpoint = Some(endpoint.into());
self
}
#[doc = "Set the scopes."]
#[must_use]
pub fn scopes(mut self, scopes: &[&str]) -> Self {
self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect());
self
}
#[doc = "Set the retry options."]
#[must_use]
pub fn retry(mut self, retry: impl Into<azure_core::RetryOptions>) -> Self {
self.options = self.options.retry(retry);
self
}
#[doc = "Set the transport options."]
#[must_use]
pub fn transport(mut self, transport: impl Into<azure_core::TransportOptions>) -> Self {
self.options = self.options.transport(transport);
self
}
#[doc = "Convert the builder into a `Client` instance."]
#[must_use]
pub fn build(self) -> Client {
let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned());
let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]);
Client::new(endpoint, self.credential, scopes, self.options)
}
}
impl Client {
pub(crate) fn endpoint(&self) -> &str {
self.endpoint.as_str()
}
pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential {
self.credential.as_ref()
}
pub(crate) fn scopes(&self) -> Vec<&str> {
self.scopes.iter().map(String::as_str).collect()
}
pub(crate) async fn send(&self, request: &mut azure_core::Request) -> azure_core::Result<azure_core::Response> {
let mut context = azure_core::Context::default();
self.pipeline.send(&mut context, request).await
}
#[doc = "Create a new `ClientBuilder`."]
#[must_use]
pub fn builder(credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>) -> ClientBuilder {
ClientBuilder::new(credential)
}
#[doc = "Create a new `Client`."]
#[must_use]
pub fn new(
endpoint: impl Into<String>,
credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>,
scopes: Vec<String>,
options: azure_core::ClientOptions,
) -> Self {
let endpoint = endpoint.into();
let pipeline = azure_core::Pipeline::new(
option_env!("CARGO_PKG_NAME"),
option_env!("CARGO_PKG_VERSION"),
options,
Vec::new(),
Vec::new(),
);
Self {
endpoint,
credential,
scopes,
pipeline,
}
}
pub fn analytics_items_client(&self) -> analytics_items::Client {
analytics_items::Client(self.clone())
}
pub fn annotations_client(&self) -> annotations::Client {
annotations::Client(self.clone())
}
pub fn api_keys_client(&self) -> api_keys::Client {
api_keys::Client(self.clone())
}
pub fn component_available_features_client(&self) -> component_available_features::Client {
component_available_features::Client(self.clone())
}
pub fn component_current_billing_features_client(&self) -> component_current_billing_features::Client {
component_current_billing_features::Client(self.clone())
}
pub fn component_feature_capabilities_client(&self) -> component_feature_capabilities::Client {
component_feature_capabilities::Client(self.clone())
}
pub fn component_linked_storage_accounts_client(&self) -> component_linked_storage_accounts::Client {
component_linked_storage_accounts::Client(self.clone())
}
pub fn component_quota_status_client(&self) -> component_quota_status::Client {
component_quota_status::Client(self.clone())
}
pub fn components_client(&self) -> components::Client {
components::Client(self.clone())
}
pub fn export_configurations_client(&self) -> export_configurations::Client {
export_configurations::Client(self.clone())
}
pub fn favorites_client(&self) -> favorites::Client {
favorites::Client(self.clone())
}
pub fn live_token_client(&self) -> live_token::Client {
live_token::Client(self.clone())
}
pub fn my_workbooks_client(&self) -> my_workbooks::Client {
my_workbooks::Client(self.clone())
}
pub fn operations_client(&self) -> operations::Client {
operations::Client(self.clone())
}
pub fn proactive_detection_configurations_client(&self) -> proactive_detection_configurations::Client {
proactive_detection_configurations::Client(self.clone())
}
pub fn web_test_locations_client(&self) -> web_test_locations::Client {
web_test_locations::Client(self.clone())
}
pub fn web_tests_client(&self) -> web_tests::Client {
web_tests::Client(self.clone())
}
pub fn work_item_configurations_client(&self) -> work_item_configurations::Client {
work_item_configurations::Client(self.clone())
}
pub fn workbook_templates_client(&self) -> workbook_templates::Client {
workbook_templates::Client(self.clone())
}
pub fn workbooks_client(&self) -> workbooks::Client {
workbooks::Client(self.clone())
}
}
pub mod components {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of all Application Insights components within a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Gets a list of Application Insights components within a resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
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(),
}
}
#[doc = "Returns an Application Insights component."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
}
}
#[doc = "Creates (or updates) an Application Insights component. Note: You cannot specify a different value for InstrumentationKey nor AppId in the Put operation."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `insight_properties`: Properties that need to be specified to create an Application Insights component."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
insight_properties: impl Into<models::ApplicationInsightsComponent>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
insight_properties: insight_properties.into(),
}
}
#[doc = "Updates an existing component's tags. To update other fields use the CreateOrUpdate method."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `component_tags`: Updated tag information to set into the component instance."]
pub fn update_tags(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
component_tags: impl Into<models::TagsResource>,
) -> update_tags::RequestBuilder {
update_tags::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
component_tags: component_tags.into(),
}
}
#[doc = "Deletes an Application Insights component."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
}
}
#[doc = "Purges data in an Application Insights component by a set of user-defined filters.\n\nIn order to manage system resources, purge requests are throttled at 50 requests per hour. You should batch the execution of purge requests by sending a single command whose predicate includes all user identities that require purging. Use the in operator to specify multiple identities. You should run the query prior to using for a purge request to verify that the results are expected.\nNote: this operation is intended for Classic resources, for workspace-based Application Insights resource please run purge operation (directly on the workspace)(https://docs.microsoft.com/en-us/rest/api/loganalytics/workspace-purge/purge) , scoped to specific resource id."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `body`: Describes the body of a request to purge data in a single table of an Application Insights component"]
pub fn purge(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
body: impl Into<models::ComponentPurgeBody>,
) -> purge::RequestBuilder {
purge::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
body: body.into(),
}
}
#[doc = "Get status for an ongoing purge operation."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `purge_id`: In a purge status request, this is the Id of the operation the status of which is returned."]
pub fn get_purge_status(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
purge_id: impl Into<String>,
) -> get_purge_status::RequestBuilder {
get_purge_status::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
purge_id: purge_id.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ApplicationInsightsComponentListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ApplicationInsightsComponentListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ApplicationInsightsComponentListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Insights/components",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2020-02-02");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2020-02-02");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_resource_group {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ApplicationInsightsComponentListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ApplicationInsightsComponentListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ApplicationInsightsComponentListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2020-02-02");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2020-02-02");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ApplicationInsightsComponent> {
let bytes = self.0.into_body().collect().await?;
let body: models::ApplicationInsightsComponent = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2020-02-02");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ApplicationInsightsComponent>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ApplicationInsightsComponent> {
let bytes = self.0.into_body().collect().await?;
let body: models::ApplicationInsightsComponent = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
pub(crate) insight_properties: models::ApplicationInsightsComponent,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2020-02-02");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.insight_properties)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ApplicationInsightsComponent>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update_tags {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ApplicationInsightsComponent> {
let bytes = self.0.into_body().collect().await?;
let body: models::ApplicationInsightsComponent = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
pub(crate) component_tags: models::TagsResource,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2020-02-02");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.component_tags)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ApplicationInsightsComponent>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2020-02-02");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod purge {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ComponentPurgeResponse> {
let bytes = self.0.into_body().collect().await?;
let body: models::ComponentPurgeResponse = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
pub(crate) body: models::ComponentPurgeBody,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/purge",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2020-02-02");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ComponentPurgeResponse>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get_purge_status {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ComponentPurgeStatusResponse> {
let bytes = self.0.into_body().collect().await?;
let body: models::ComponentPurgeStatusResponse = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
pub(crate) purge_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/operations/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.purge_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2020-02-02");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ComponentPurgeStatusResponse>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod annotations {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the list of annotations for a component for given time range"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `start`: The start time to query from for annotations, cannot be older than 90 days from current date."]
#[doc = "* `end`: The end time to query for annotations."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
start: impl Into<String>,
end: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
start: start.into(),
end: end.into(),
}
}
#[doc = "Create an Annotation of an Application Insights component."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `annotation_properties`: Properties that need to be specified to create an annotation of a Application Insights component."]
pub fn create(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
annotation_properties: impl Into<models::Annotation>,
) -> create::RequestBuilder {
create::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
annotation_properties: annotation_properties.into(),
}
}
#[doc = "Get the annotation for given id."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `annotation_id`: The unique annotation ID. This is unique within a Application Insights component."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
annotation_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
annotation_id: annotation_id.into(),
}
}
#[doc = "Delete an Annotation of an Application Insights component."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `annotation_id`: The unique annotation ID. This is unique within a Application Insights component."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
annotation_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
annotation_id: annotation_id.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::AnnotationsListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::AnnotationsListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
pub(crate) start: String,
pub(crate) end: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as the continuation token is not part of the response schema"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/Annotations",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
let start = &this.start;
req.url_mut().query_pairs_mut().append_pair("start", start);
let end = &this.end;
req.url_mut().query_pairs_mut().append_pair("end", end);
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::AnnotationsListResult>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<Vec<models::Annotation>> {
let bytes = self.0.into_body().collect().await?;
let body: Vec<models::Annotation> = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
pub(crate) annotation_properties: models::Annotation,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/Annotations",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.annotation_properties)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<Vec<models::Annotation>>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<Vec<models::Annotation>> {
let bytes = self.0.into_body().collect().await?;
let body: Vec<models::Annotation> = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
pub(crate) annotation_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/Annotations/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.annotation_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<Vec<models::Annotation>>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
pub(crate) annotation_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/Annotations/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.annotation_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod api_keys {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of API keys of an Application Insights component."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
}
}
#[doc = "Create an API Key of an Application Insights component."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `api_key_properties`: Properties that need to be specified to create an API key of a Application Insights component."]
pub fn create(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
api_key_properties: impl Into<models::ApiKeyRequest>,
) -> create::RequestBuilder {
create::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
api_key_properties: api_key_properties.into(),
}
}
#[doc = "Get the API Key for this key id."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `key_id`: The API Key ID. This is unique within a Application Insights component."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
key_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
key_id: key_id.into(),
}
}
#[doc = "Delete an API Key of an Application Insights component."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `key_id`: The API Key ID. This is unique within a Application Insights component."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
key_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
key_id: key_id.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ApplicationInsightsComponentApiKeyListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ApplicationInsightsComponentApiKeyListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as the continuation token is not part of the response schema"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/ApiKeys",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ApplicationInsightsComponentApiKeyListResult>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ApplicationInsightsComponentApiKey> {
let bytes = self.0.into_body().collect().await?;
let body: models::ApplicationInsightsComponentApiKey = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
pub(crate) api_key_properties: models::ApiKeyRequest,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/ApiKeys",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.api_key_properties)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ApplicationInsightsComponentApiKey>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ApplicationInsightsComponentApiKey> {
let bytes = self.0.into_body().collect().await?;
let body: models::ApplicationInsightsComponentApiKey = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
pub(crate) key_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/APIKeys/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.key_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ApplicationInsightsComponentApiKey>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ApplicationInsightsComponentApiKey> {
let bytes = self.0.into_body().collect().await?;
let body: models::ApplicationInsightsComponentApiKey = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
pub(crate) key_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/APIKeys/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.key_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ApplicationInsightsComponentApiKey>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod export_configurations {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of Continuous Export configuration of an Application Insights component."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
}
}
#[doc = "Create a Continuous Export configuration of an Application Insights component."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `export_properties`: Properties that need to be specified to create a Continuous Export configuration of a Application Insights component."]
pub fn create(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
export_properties: impl Into<models::ApplicationInsightsComponentExportRequest>,
) -> create::RequestBuilder {
create::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
export_properties: export_properties.into(),
}
}
#[doc = "Get the Continuous Export configuration for this export id."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `export_id`: The Continuous Export configuration ID. This is unique within a Application Insights component."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
export_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
export_id: export_id.into(),
}
}
#[doc = "Update the Continuous Export configuration for this export id."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `export_id`: The Continuous Export configuration ID. This is unique within a Application Insights component."]
#[doc = "* `export_properties`: Properties that need to be specified to update the Continuous Export configuration."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
export_id: impl Into<String>,
export_properties: impl Into<models::ApplicationInsightsComponentExportRequest>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
export_id: export_id.into(),
export_properties: export_properties.into(),
}
}
#[doc = "Delete a Continuous Export configuration of an Application Insights component."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `export_id`: The Continuous Export configuration ID. This is unique within a Application Insights component."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
export_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
export_id: export_id.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ApplicationInsightsComponentExportConfigurationListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ApplicationInsightsComponentExportConfigurationListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/exportconfiguration",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ApplicationInsightsComponentExportConfigurationListResult>>
{
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ApplicationInsightsComponentExportConfigurationListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ApplicationInsightsComponentExportConfigurationListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
pub(crate) export_properties: models::ApplicationInsightsComponentExportRequest,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/exportconfiguration",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.export_properties)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ApplicationInsightsComponentExportConfigurationListResult>>
{
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ApplicationInsightsComponentExportConfiguration> {
let bytes = self.0.into_body().collect().await?;
let body: models::ApplicationInsightsComponentExportConfiguration = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
pub(crate) export_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/exportconfiguration/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.export_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ApplicationInsightsComponentExportConfiguration>>
{
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ApplicationInsightsComponentExportConfiguration> {
let bytes = self.0.into_body().collect().await?;
let body: models::ApplicationInsightsComponentExportConfiguration = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
pub(crate) export_id: String,
pub(crate) export_properties: models::ApplicationInsightsComponentExportRequest,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/exportconfiguration/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.export_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.export_properties)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ApplicationInsightsComponentExportConfiguration>>
{
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ApplicationInsightsComponentExportConfiguration> {
let bytes = self.0.into_body().collect().await?;
let body: models::ApplicationInsightsComponentExportConfiguration = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
pub(crate) export_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/exportconfiguration/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.export_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ApplicationInsightsComponentExportConfiguration>>
{
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod component_current_billing_features {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Returns current billing features for an Application Insights component."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
}
}
#[doc = "Update current billing features for an Application Insights component."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `billing_features_properties`: Properties that need to be specified to update billing features for an Application Insights component."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
billing_features_properties: impl Into<models::ApplicationInsightsComponentBillingFeatures>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
billing_features_properties: billing_features_properties.into(),
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ApplicationInsightsComponentBillingFeatures> {
let bytes = self.0.into_body().collect().await?;
let body: models::ApplicationInsightsComponentBillingFeatures = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/currentbillingfeatures",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ApplicationInsightsComponentBillingFeatures>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ApplicationInsightsComponentBillingFeatures> {
let bytes = self.0.into_body().collect().await?;
let body: models::ApplicationInsightsComponentBillingFeatures = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
pub(crate) billing_features_properties: models::ApplicationInsightsComponentBillingFeatures,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/currentbillingfeatures",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.billing_features_properties)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ApplicationInsightsComponentBillingFeatures>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod component_quota_status {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Returns daily data volume cap (quota) status for an Application Insights component."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ApplicationInsightsComponentQuotaStatus> {
let bytes = self.0.into_body().collect().await?;
let body: models::ApplicationInsightsComponentQuotaStatus = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/quotastatus",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ApplicationInsightsComponentQuotaStatus>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod component_feature_capabilities {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Returns feature capabilities of the application insights component."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ApplicationInsightsComponentFeatureCapabilities> {
let bytes = self.0.into_body().collect().await?;
let body: models::ApplicationInsightsComponentFeatureCapabilities = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/featurecapabilities",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ApplicationInsightsComponentFeatureCapabilities>>
{
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod component_available_features {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Returns all available features of the application insights component."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ApplicationInsightsComponentAvailableFeatures> {
let bytes = self.0.into_body().collect().await?;
let body: models::ApplicationInsightsComponentAvailableFeatures = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/getavailablebillingfeatures",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ApplicationInsightsComponentAvailableFeatures>>
{
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod proactive_detection_configurations {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of ProactiveDetection configurations of an Application Insights component."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
}
}
#[doc = "Get the ProactiveDetection configuration for this configuration id."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `configuration_id`: The ProactiveDetection configuration ID. This is unique within a Application Insights component."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
configuration_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
configuration_id: configuration_id.into(),
}
}
#[doc = "Update the ProactiveDetection configuration for this configuration id."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `configuration_id`: The ProactiveDetection configuration ID. This is unique within a Application Insights component."]
#[doc = "* `proactive_detection_properties`: Properties that need to be specified to update the ProactiveDetection configuration."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
configuration_id: impl Into<String>,
proactive_detection_properties: impl Into<models::ApplicationInsightsComponentProactiveDetectionConfiguration>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
configuration_id: configuration_id.into(),
proactive_detection_properties: proactive_detection_properties.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(
self,
) -> azure_core::Result<models::ApplicationInsightsComponentProactiveDetectionConfigurationListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ApplicationInsightsComponentProactiveDetectionConfigurationListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/ProactiveDetectionConfigs",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<
'static,
azure_core::Result<models::ApplicationInsightsComponentProactiveDetectionConfigurationListResult>,
> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ApplicationInsightsComponentProactiveDetectionConfiguration> {
let bytes = self.0.into_body().collect().await?;
let body: models::ApplicationInsightsComponentProactiveDetectionConfiguration = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
pub(crate) configuration_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/ProactiveDetectionConfigs/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.configuration_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ApplicationInsightsComponentProactiveDetectionConfiguration>>
{
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ApplicationInsightsComponentProactiveDetectionConfiguration> {
let bytes = self.0.into_body().collect().await?;
let body: models::ApplicationInsightsComponentProactiveDetectionConfiguration = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
pub(crate) configuration_id: String,
pub(crate) proactive_detection_properties: models::ApplicationInsightsComponentProactiveDetectionConfiguration,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/ProactiveDetectionConfigs/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.configuration_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.proactive_detection_properties)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ApplicationInsightsComponentProactiveDetectionConfiguration>>
{
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod work_item_configurations {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the list work item configurations that exist for the application"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
}
}
#[doc = "Create a work item configuration for an Application Insights component."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `work_item_configuration_properties`: Properties that need to be specified to create a work item configuration of a Application Insights component."]
pub fn create(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
work_item_configuration_properties: impl Into<models::WorkItemCreateConfiguration>,
) -> create::RequestBuilder {
create::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
work_item_configuration_properties: work_item_configuration_properties.into(),
}
}
#[doc = "Gets default work item configurations that exist for the application"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
pub fn get_default(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
) -> get_default::RequestBuilder {
get_default::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
}
}
#[doc = "Gets specified work item configuration for an Application Insights component."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `work_item_config_id`: The unique work item configuration Id. This can be either friendly name of connector as defined in connector configuration"]
pub fn get_item(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
work_item_config_id: impl Into<String>,
) -> get_item::RequestBuilder {
get_item::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
work_item_config_id: work_item_config_id.into(),
}
}
#[doc = "Update a work item configuration for an Application Insights component."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `work_item_config_id`: The unique work item configuration Id. This can be either friendly name of connector as defined in connector configuration"]
#[doc = "* `work_item_configuration_properties`: Properties that need to be specified to update a work item configuration for this Application Insights component."]
pub fn update_item(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
work_item_config_id: impl Into<String>,
work_item_configuration_properties: impl Into<models::WorkItemCreateConfiguration>,
) -> update_item::RequestBuilder {
update_item::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
work_item_config_id: work_item_config_id.into(),
work_item_configuration_properties: work_item_configuration_properties.into(),
}
}
#[doc = "Delete a work item configuration of an Application Insights component."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `work_item_config_id`: The unique work item configuration Id. This can be either friendly name of connector as defined in connector configuration"]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
work_item_config_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
work_item_config_id: work_item_config_id.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkItemConfigurationsListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkItemConfigurationsListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as the continuation token is not part of the response schema"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/WorkItemConfigs",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::WorkItemConfigurationsListResult>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkItemConfiguration> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkItemConfiguration = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
pub(crate) work_item_configuration_properties: models::WorkItemCreateConfiguration,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/WorkItemConfigs",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.work_item_configuration_properties)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::WorkItemConfiguration>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get_default {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkItemConfiguration> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkItemConfiguration = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/DefaultWorkItemConfig",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::WorkItemConfiguration>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get_item {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkItemConfiguration> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkItemConfiguration = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
pub(crate) work_item_config_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/WorkItemConfigs/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.work_item_config_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::WorkItemConfiguration>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update_item {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkItemConfiguration> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkItemConfiguration = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
pub(crate) work_item_config_id: String,
pub(crate) work_item_configuration_properties: models::WorkItemCreateConfiguration,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/WorkItemConfigs/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.work_item_config_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.work_item_configuration_properties)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::WorkItemConfiguration>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
pub(crate) work_item_config_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/WorkItemConfigs/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.work_item_config_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod favorites {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of favorites defined within an Application Insights component."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
favorite_type: None,
source_type: None,
can_fetch_content: None,
tags: Vec::new(),
}
}
#[doc = "Get a single favorite by its FavoriteId, defined within an Application Insights component."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `favorite_id`: The Id of a specific favorite defined in the Application Insights component"]
pub fn get(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
favorite_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
favorite_id: favorite_id.into(),
}
}
#[doc = "Adds a new favorites to an Application Insights component."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `favorite_id`: The Id of a specific favorite defined in the Application Insights component"]
#[doc = "* `favorite_properties`: Properties that need to be specified to create a new favorite and add it to an Application Insights component."]
pub fn add(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
favorite_id: impl Into<String>,
favorite_properties: impl Into<models::ApplicationInsightsComponentFavorite>,
) -> add::RequestBuilder {
add::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
favorite_id: favorite_id.into(),
favorite_properties: favorite_properties.into(),
}
}
#[doc = "Updates a favorite that has already been added to an Application Insights component."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `favorite_id`: The Id of a specific favorite defined in the Application Insights component"]
#[doc = "* `favorite_properties`: Properties that need to be specified to update the existing favorite."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
favorite_id: impl Into<String>,
favorite_properties: impl Into<models::ApplicationInsightsComponentFavorite>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
favorite_id: favorite_id.into(),
favorite_properties: favorite_properties.into(),
}
}
#[doc = "Remove a favorite that is associated to an Application Insights component."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `favorite_id`: The Id of a specific favorite defined in the Application Insights component"]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
favorite_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
favorite_id: favorite_id.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<Vec<models::ApplicationInsightsComponentFavorite>> {
let bytes = self.0.into_body().collect().await?;
let body: Vec<models::ApplicationInsightsComponentFavorite> = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
pub(crate) favorite_type: Option<String>,
pub(crate) source_type: Option<String>,
pub(crate) can_fetch_content: Option<bool>,
pub(crate) tags: Vec<String>,
}
impl RequestBuilder {
#[doc = "The type of favorite. Value can be either shared or user."]
pub fn favorite_type(mut self, favorite_type: impl Into<String>) -> Self {
self.favorite_type = Some(favorite_type.into());
self
}
#[doc = "Source type of favorite to return. When left out, the source type defaults to 'other' (not present in this enum)."]
pub fn source_type(mut self, source_type: impl Into<String>) -> Self {
self.source_type = Some(source_type.into());
self
}
#[doc = "Flag indicating whether or not to return the full content for each applicable favorite. If false, only return summary content for favorites."]
pub fn can_fetch_content(mut self, can_fetch_content: bool) -> Self {
self.can_fetch_content = Some(can_fetch_content);
self
}
#[doc = "Tags that must be present on each favorite returned."]
pub fn tags(mut self, tags: Vec<String>) -> Self {
self.tags = tags;
self
}
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/favorites",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
if let Some(favorite_type) = &this.favorite_type {
req.url_mut().query_pairs_mut().append_pair("favoriteType", favorite_type);
}
if let Some(source_type) = &this.source_type {
req.url_mut().query_pairs_mut().append_pair("sourceType", source_type);
}
if let Some(can_fetch_content) = &this.can_fetch_content {
req.url_mut()
.query_pairs_mut()
.append_pair("canFetchContent", &can_fetch_content.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<Vec<models::ApplicationInsightsComponentFavorite>>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ApplicationInsightsComponentFavorite> {
let bytes = self.0.into_body().collect().await?;
let body: models::ApplicationInsightsComponentFavorite = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
pub(crate) favorite_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/favorites/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.favorite_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ApplicationInsightsComponentFavorite>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod add {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ApplicationInsightsComponentFavorite> {
let bytes = self.0.into_body().collect().await?;
let body: models::ApplicationInsightsComponentFavorite = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
pub(crate) favorite_id: String,
pub(crate) favorite_properties: models::ApplicationInsightsComponentFavorite,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/favorites/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.favorite_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.favorite_properties)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ApplicationInsightsComponentFavorite>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ApplicationInsightsComponentFavorite> {
let bytes = self.0.into_body().collect().await?;
let body: models::ApplicationInsightsComponentFavorite = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
pub(crate) favorite_id: String,
pub(crate) favorite_properties: models::ApplicationInsightsComponentFavorite,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/favorites/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.favorite_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.favorite_properties)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ApplicationInsightsComponentFavorite>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
pub(crate) favorite_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/favorites/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.favorite_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod web_test_locations {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of web test locations available to this Application Insights component."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
pub fn list(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ApplicationInsightsWebTestLocationsListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ApplicationInsightsWebTestLocationsListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as the continuation token is not part of the response schema"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/syntheticmonitorlocations",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ApplicationInsightsWebTestLocationsListResult>>
{
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod web_tests {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Get all Application Insights web tests defined for the specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
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(),
}
}
#[doc = "Get a specific Application Insights web test definition."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `web_test_name`: The name of the Application Insights WebTest resource."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
web_test_name: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
web_test_name: web_test_name.into(),
}
}
#[doc = "Creates or updates an Application Insights web test definition."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `web_test_name`: The name of the Application Insights WebTest resource."]
#[doc = "* `web_test_definition`: Properties that need to be specified to create or update an Application Insights web test definition."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
web_test_name: impl Into<String>,
web_test_definition: impl Into<models::WebTest>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
web_test_name: web_test_name.into(),
web_test_definition: web_test_definition.into(),
}
}
#[doc = "Updates the tags associated with an Application Insights web test."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `web_test_name`: The name of the Application Insights WebTest resource."]
#[doc = "* `web_test_tags`: Updated tag information to associate with the web test resource."]
pub fn update_tags(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
web_test_name: impl Into<String>,
web_test_tags: impl Into<models::TagsResource>,
) -> update_tags::RequestBuilder {
update_tags::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
web_test_name: web_test_name.into(),
web_test_tags: web_test_tags.into(),
}
}
#[doc = "Deletes an Application Insights web test."]
#[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 = "* `web_test_name`: The name of the Application Insights WebTest resource."]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
web_test_name: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
web_test_name: web_test_name.into(),
}
}
#[doc = "Get all Application Insights web test definitions for the specified subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Get all Application Insights web tests defined for the specified component."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `component_name`: The name of the Application Insights component resource."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
pub fn list_by_component(
&self,
component_name: impl Into<String>,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_component::RequestBuilder {
list_by_component::RequestBuilder {
client: self.0.clone(),
component_name: component_name.into(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list_by_resource_group {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WebTestListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::WebTestListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::WebTestListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/webtests",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-06-15");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-06-15");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WebTest> {
let bytes = self.0.into_body().collect().await?;
let body: models::WebTest = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) web_test_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/webtests/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.web_test_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-06-15");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::WebTest>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WebTest> {
let bytes = self.0.into_body().collect().await?;
let body: models::WebTest = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) web_test_name: String,
pub(crate) web_test_definition: models::WebTest,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/webtests/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.web_test_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-06-15");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.web_test_definition)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::WebTest>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update_tags {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WebTest> {
let bytes = self.0.into_body().collect().await?;
let body: models::WebTest = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) web_test_name: String,
pub(crate) web_test_tags: models::TagsResource,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/webtests/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.web_test_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-06-15");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.web_test_tags)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::WebTest>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) web_test_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/webtests/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.web_test_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-06-15");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WebTestListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::WebTestListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::WebTestListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Insights/webtests",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-06-15");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-06-15");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_component {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WebTestListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::WebTestListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) component_name: String,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::WebTestListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/components/{}/webtests",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.component_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-06-15");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-06-15");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod analytics_items {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets a list of Analytics Items defined within an Application Insights component."]
#[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 = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `scope_path`: Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component."]
pub fn list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
scope_path: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
scope_path: scope_path.into(),
scope: None,
type_: None,
include_content: None,
}
}
#[doc = "Gets a specific Analytics Items defined within an Application Insights component."]
#[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 = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `scope_path`: Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component."]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
scope_path: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
scope_path: scope_path.into(),
id: None,
name: None,
}
}
#[doc = "Adds or Updates a specific Analytics Item within an Application Insights component."]
#[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 = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `scope_path`: Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component."]
#[doc = "* `item_properties`: Properties that need to be specified to create a new item and add it to an Application Insights component."]
pub fn put(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
scope_path: impl Into<String>,
item_properties: impl Into<models::ApplicationInsightsComponentAnalyticsItem>,
) -> put::RequestBuilder {
put::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
scope_path: scope_path.into(),
item_properties: item_properties.into(),
override_item: None,
}
}
#[doc = "Deletes a specific Analytics Items defined within an Application Insights component."]
#[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 = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `scope_path`: Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component."]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
scope_path: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
scope_path: scope_path.into(),
id: None,
name: None,
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<Vec<models::ApplicationInsightsComponentAnalyticsItem>> {
let bytes = self.0.into_body().collect().await?;
let body: Vec<models::ApplicationInsightsComponentAnalyticsItem> = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
pub(crate) scope_path: String,
pub(crate) scope: Option<String>,
pub(crate) type_: Option<String>,
pub(crate) include_content: Option<bool>,
}
impl RequestBuilder {
#[doc = "Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component."]
pub fn scope(mut self, scope: impl Into<String>) -> Self {
self.scope = Some(scope.into());
self
}
#[doc = "Enum indicating the type of the Analytics item."]
pub fn type_(mut self, type_: impl Into<String>) -> Self {
self.type_ = Some(type_.into());
self
}
#[doc = "Flag indicating whether or not to return the content of each applicable item. If false, only return the item information."]
pub fn include_content(mut self, include_content: bool) -> Self {
self.include_content = Some(include_content);
self
}
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/microsoft.insights/components/{}/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.scope_path
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
if let Some(scope) = &this.scope {
req.url_mut().query_pairs_mut().append_pair("scope", scope);
}
if let Some(type_) = &this.type_ {
req.url_mut().query_pairs_mut().append_pair("type", type_);
}
if let Some(include_content) = &this.include_content {
req.url_mut()
.query_pairs_mut()
.append_pair("includeContent", &include_content.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<Vec<models::ApplicationInsightsComponentAnalyticsItem>>>
{
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ApplicationInsightsComponentAnalyticsItem> {
let bytes = self.0.into_body().collect().await?;
let body: models::ApplicationInsightsComponentAnalyticsItem = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
pub(crate) scope_path: String,
pub(crate) id: Option<String>,
pub(crate) name: Option<String>,
}
impl RequestBuilder {
#[doc = "The Id of a specific item defined in the Application Insights component"]
pub fn id(mut self, id: impl Into<String>) -> Self {
self.id = Some(id.into());
self
}
#[doc = "The name of a specific item defined in the Application Insights component"]
pub fn name(mut self, name: impl Into<String>) -> Self {
self.name = Some(name.into());
self
}
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/microsoft.insights/components/{}/{}/item",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.scope_path
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
if let Some(id) = &this.id {
req.url_mut().query_pairs_mut().append_pair("id", id);
}
if let Some(name) = &this.name {
req.url_mut().query_pairs_mut().append_pair("name", name);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ApplicationInsightsComponentAnalyticsItem>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod put {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ApplicationInsightsComponentAnalyticsItem> {
let bytes = self.0.into_body().collect().await?;
let body: models::ApplicationInsightsComponentAnalyticsItem = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
pub(crate) scope_path: String,
pub(crate) item_properties: models::ApplicationInsightsComponentAnalyticsItem,
pub(crate) override_item: Option<bool>,
}
impl RequestBuilder {
#[doc = "Flag indicating whether or not to force save an item. This allows overriding an item if it already exists."]
pub fn override_item(mut self, override_item: bool) -> Self {
self.override_item = Some(override_item);
self
}
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/microsoft.insights/components/{}/{}/item",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.scope_path
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
if let Some(override_item) = &this.override_item {
req.url_mut()
.query_pairs_mut()
.append_pair("overrideItem", &override_item.to_string());
}
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.item_properties)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(
self,
) -> futures::future::BoxFuture<'static, azure_core::Result<models::ApplicationInsightsComponentAnalyticsItem>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
pub(crate) scope_path: String,
pub(crate) id: Option<String>,
pub(crate) name: Option<String>,
}
impl RequestBuilder {
#[doc = "The Id of a specific item defined in the Application Insights component"]
pub fn id(mut self, id: impl Into<String>) -> Self {
self.id = Some(id.into());
self
}
#[doc = "The name of a specific item defined in the Application Insights component"]
pub fn name(mut self, name: impl Into<String>) -> Self {
self.name = Some(name.into());
self
}
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/microsoft.insights/components/{}/{}/item",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.scope_path
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2015-05-01");
if let Some(id) = &this.id {
req.url_mut().query_pairs_mut().append_pair("id", id);
}
if let Some(name) = &this.name {
req.url_mut().query_pairs_mut().append_pair("name", name);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod operations {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists all of the available insights REST API operations."]
pub fn list(&self) -> list::RequestBuilder {
list::RequestBuilder { client: self.0.clone() }
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::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)]
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 =
azure_core::Url::parse(&format!("{}/providers/Microsoft.Insights/operations", this.client.endpoint(),))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-03-08");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-03-08");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod workbook_templates {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Get all Workbook templates defined within a specified resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
pub fn list_by_resource_group(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
) -> list_by_resource_group::RequestBuilder {
list_by_resource_group::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
}
}
#[doc = "Get a single workbook template by its resourceName."]
#[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 = "* `resource_name`: The name of the Application Insights component resource."]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
}
}
#[doc = "Create a new workbook 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 = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `workbook_template_properties`: Properties that need to be specified to create a new workbook."]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
workbook_template_properties: impl Into<models::WorkbookTemplate>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
workbook_template_properties: workbook_template_properties.into(),
}
}
#[doc = "Updates a workbook template that has already been added."]
#[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 = "* `resource_name`: The name of the Application Insights component resource."]
pub fn update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
workbook_template_update_parameters: None,
}
}
#[doc = "Delete a workbook 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 = "* `resource_name`: The name of the Application Insights component resource."]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
}
}
}
pub mod list_by_resource_group {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkbookTemplatesListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkbookTemplatesListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
}
impl RequestBuilder {
#[doc = "only the first response will be fetched as the continuation token is not part of the response schema"]
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/workbooktemplates",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2020-11-20");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::WorkbookTemplatesListResult>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkbookTemplate> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkbookTemplate = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/workbooktemplates/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2020-11-20");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::WorkbookTemplate>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkbookTemplate> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkbookTemplate = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
pub(crate) workbook_template_properties: models::WorkbookTemplate,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/workbooktemplates/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2020-11-20");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.workbook_template_properties)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::WorkbookTemplate>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkbookTemplate> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkbookTemplate = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
pub(crate) workbook_template_update_parameters: Option<models::WorkbookTemplateUpdateParameters>,
}
impl RequestBuilder {
#[doc = "Properties that need to be specified to patch a workbook template."]
pub fn workbook_template_update_parameters(
mut self,
workbook_template_update_parameters: impl Into<models::WorkbookTemplateUpdateParameters>,
) -> Self {
self.workbook_template_update_parameters = Some(workbook_template_update_parameters.into());
self
}
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/workbooktemplates/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2020-11-20");
let req_body = if let Some(workbook_template_update_parameters) = &this.workbook_template_update_parameters {
req.insert_header("content-type", "application/json");
azure_core::to_json(workbook_template_update_parameters)?
} else {
azure_core::EMPTY_BODY
};
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::WorkbookTemplate>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/workbooktemplates/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2020-11-20");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod my_workbooks {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Get all private workbooks defined within a specified resource group and category."]
#[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 = "* `category`: Category of workbook to return."]
pub fn list_by_resource_group(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
category: impl Into<String>,
) -> list_by_resource_group::RequestBuilder {
list_by_resource_group::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
category: category.into(),
tags: Vec::new(),
source_id: None,
can_fetch_content: None,
}
}
#[doc = "Get all private workbooks defined within a specified subscription and category."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `category`: Category of workbook to return."]
pub fn list_by_subscription(
&self,
subscription_id: impl Into<String>,
category: impl Into<String>,
) -> list_by_subscription::RequestBuilder {
list_by_subscription::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
category: category.into(),
tags: Vec::new(),
can_fetch_content: None,
}
}
#[doc = "Get a single private workbook by its resourceName."]
#[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 = "* `resource_name`: The name of the Application Insights component resource."]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
}
}
#[doc = "Create a new private workbook."]
#[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 = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `workbook_properties`: Properties that need to be specified to create a new private workbook."]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
workbook_properties: impl Into<models::MyWorkbook>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
workbook_properties: workbook_properties.into(),
source_id: None,
}
}
#[doc = "Updates a private workbook that has already been added."]
#[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 = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `workbook_properties`: Properties that need to be specified to create a new private workbook."]
pub fn update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
workbook_properties: impl Into<models::MyWorkbook>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
workbook_properties: workbook_properties.into(),
source_id: None,
}
}
#[doc = "Delete a private workbook."]
#[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 = "* `resource_name`: The name of the Application Insights component resource."]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
}
}
}
pub mod list_by_resource_group {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::MyWorkbooksListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::MyWorkbooksListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) category: String,
pub(crate) tags: Vec<String>,
pub(crate) source_id: Option<String>,
pub(crate) can_fetch_content: Option<bool>,
}
impl RequestBuilder {
#[doc = "Tags presents on each workbook returned."]
pub fn tags(mut self, tags: Vec<String>) -> Self {
self.tags = tags;
self
}
#[doc = "Azure Resource Id that will fetch all linked workbooks."]
pub fn source_id(mut self, source_id: impl Into<String>) -> Self {
self.source_id = Some(source_id.into());
self
}
#[doc = "Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content for workbooks."]
pub fn can_fetch_content(mut self, can_fetch_content: bool) -> Self {
self.can_fetch_content = Some(can_fetch_content);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::MyWorkbooksListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/myWorkbooks",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-03-08");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-03-08");
let category = &this.category;
req.url_mut().query_pairs_mut().append_pair("category", category);
if let Some(source_id) = &this.source_id {
req.url_mut().query_pairs_mut().append_pair("sourceId", source_id);
}
if let Some(can_fetch_content) = &this.can_fetch_content {
req.url_mut()
.query_pairs_mut()
.append_pair("canFetchContent", &can_fetch_content.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_subscription {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::MyWorkbooksListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::MyWorkbooksListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) category: String,
pub(crate) tags: Vec<String>,
pub(crate) can_fetch_content: Option<bool>,
}
impl RequestBuilder {
#[doc = "Tags presents on each workbook returned."]
pub fn tags(mut self, tags: Vec<String>) -> Self {
self.tags = tags;
self
}
#[doc = "Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content for workbooks."]
pub fn can_fetch_content(mut self, can_fetch_content: bool) -> Self {
self.can_fetch_content = Some(can_fetch_content);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::MyWorkbooksListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Insights/myWorkbooks",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-03-08");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-03-08");
let category = &this.category;
req.url_mut().query_pairs_mut().append_pair("category", category);
if let Some(can_fetch_content) = &this.can_fetch_content {
req.url_mut()
.query_pairs_mut()
.append_pair("canFetchContent", &can_fetch_content.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::MyWorkbook> {
let bytes = self.0.into_body().collect().await?;
let body: models::MyWorkbook = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/myWorkbooks/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-03-08");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::MyWorkbook>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::MyWorkbook> {
let bytes = self.0.into_body().collect().await?;
let body: models::MyWorkbook = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
pub(crate) workbook_properties: models::MyWorkbook,
pub(crate) source_id: Option<String>,
}
impl RequestBuilder {
#[doc = "Azure Resource Id that will fetch all linked workbooks."]
pub fn source_id(mut self, source_id: impl Into<String>) -> Self {
self.source_id = Some(source_id.into());
self
}
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/myWorkbooks/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-03-08");
if let Some(source_id) = &this.source_id {
req.url_mut().query_pairs_mut().append_pair("sourceId", source_id);
}
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.workbook_properties)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::MyWorkbook>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::MyWorkbook> {
let bytes = self.0.into_body().collect().await?;
let body: models::MyWorkbook = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
pub(crate) workbook_properties: models::MyWorkbook,
pub(crate) source_id: Option<String>,
}
impl RequestBuilder {
#[doc = "Azure Resource Id that will fetch all linked workbooks."]
pub fn source_id(mut self, source_id: impl Into<String>) -> Self {
self.source_id = Some(source_id.into());
self
}
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/myWorkbooks/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-03-08");
if let Some(source_id) = &this.source_id {
req.url_mut().query_pairs_mut().append_pair("sourceId", source_id);
}
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.workbook_properties)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::MyWorkbook>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/myWorkbooks/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-03-08");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}
pub mod workbooks {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Get all Workbooks defined within a specified subscription and category."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `category`: Category of workbook to return."]
pub fn list_by_subscription(
&self,
subscription_id: impl Into<String>,
category: impl Into<String>,
) -> list_by_subscription::RequestBuilder {
list_by_subscription::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
category: category.into(),
tags: Vec::new(),
can_fetch_content: None,
}
}
#[doc = "Get all Workbooks defined within a specified resource group and category."]
#[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 = "* `category`: Category of workbook to return."]
pub fn list_by_resource_group(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
category: impl Into<String>,
) -> list_by_resource_group::RequestBuilder {
list_by_resource_group::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
category: category.into(),
tags: Vec::new(),
source_id: None,
can_fetch_content: None,
}
}
#[doc = "Get a single workbook by its resourceName."]
#[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 = "* `resource_name`: The name of the resource."]
pub fn get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
can_fetch_content: None,
}
}
#[doc = "Create a new workbook."]
#[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 = "* `resource_name`: The name of the resource."]
#[doc = "* `workbook_properties`: Properties that need to be specified to create a new workbook."]
pub fn create_or_update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
workbook_properties: impl Into<models::Workbook>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
workbook_properties: workbook_properties.into(),
source_id: None,
}
}
#[doc = "Updates a workbook that has already been added."]
#[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 = "* `resource_name`: The name of the resource."]
pub fn update(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
source_id: None,
workbook_update_parameters: None,
}
}
#[doc = "Delete a workbook."]
#[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 = "* `resource_name`: The name of the resource."]
pub fn delete(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
}
}
#[doc = "Get the revisions for the workbook defined by its resourceName."]
#[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 = "* `resource_name`: The name of the resource."]
pub fn revisions_list(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
) -> revisions_list::RequestBuilder {
revisions_list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
}
}
#[doc = "Get a single workbook revision defined by its revisionId."]
#[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 = "* `resource_name`: The name of the resource."]
#[doc = "* `revision_id`: The id of the workbook's revision."]
pub fn revision_get(
&self,
subscription_id: impl Into<String>,
resource_group_name: impl Into<String>,
resource_name: impl Into<String>,
revision_id: impl Into<String>,
) -> revision_get::RequestBuilder {
revision_get::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
resource_group_name: resource_group_name.into(),
resource_name: resource_name.into(),
revision_id: revision_id.into(),
}
}
}
pub mod list_by_subscription {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkbooksListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkbooksListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) category: String,
pub(crate) tags: Vec<String>,
pub(crate) can_fetch_content: Option<bool>,
}
impl RequestBuilder {
#[doc = "Tags presents on each workbook returned."]
pub fn tags(mut self, tags: Vec<String>) -> Self {
self.tags = tags;
self
}
#[doc = "Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content for workbooks."]
pub fn can_fetch_content(mut self, can_fetch_content: bool) -> Self {
self.can_fetch_content = Some(can_fetch_content);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::WorkbooksListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Insights/workbooks",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-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 credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-01");
let category = &this.category;
req.url_mut().query_pairs_mut().append_pair("category", category);
if let Some(can_fetch_content) = &this.can_fetch_content {
req.url_mut()
.query_pairs_mut()
.append_pair("canFetchContent", &can_fetch_content.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_resource_group {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkbooksListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkbooksListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) category: String,
pub(crate) tags: Vec<String>,
pub(crate) source_id: Option<String>,
pub(crate) can_fetch_content: Option<bool>,
}
impl RequestBuilder {
#[doc = "Tags presents on each workbook returned."]
pub fn tags(mut self, tags: Vec<String>) -> Self {
self.tags = tags;
self
}
#[doc = "Azure Resource Id that will fetch all linked workbooks."]
pub fn source_id(mut self, source_id: impl Into<String>) -> Self {
self.source_id = Some(source_id.into());
self
}
#[doc = "Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content for workbooks."]
pub fn can_fetch_content(mut self, can_fetch_content: bool) -> Self {
self.can_fetch_content = Some(can_fetch_content);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::WorkbooksListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/workbooks",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-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 credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-01");
let category = &this.category;
req.url_mut().query_pairs_mut().append_pair("category", category);
if let Some(source_id) = &this.source_id {
req.url_mut().query_pairs_mut().append_pair("sourceId", source_id);
}
if let Some(can_fetch_content) = &this.can_fetch_content {
req.url_mut()
.query_pairs_mut()
.append_pair("canFetchContent", &can_fetch_content.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Workbook> {
let bytes = self.0.into_body().collect().await?;
let body: models::Workbook = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
pub(crate) can_fetch_content: Option<bool>,
}
impl RequestBuilder {
#[doc = "Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content for workbooks."]
pub fn can_fetch_content(mut self, can_fetch_content: bool) -> Self {
self.can_fetch_content = Some(can_fetch_content);
self
}
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/workbooks/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-01");
if let Some(can_fetch_content) = &this.can_fetch_content {
req.url_mut()
.query_pairs_mut()
.append_pair("canFetchContent", &can_fetch_content.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Workbook>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Workbook> {
let bytes = self.0.into_body().collect().await?;
let body: models::Workbook = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
pub(crate) workbook_properties: models::Workbook,
pub(crate) source_id: Option<String>,
}
impl RequestBuilder {
#[doc = "Azure Resource Id that will fetch all linked workbooks."]
pub fn source_id(mut self, source_id: impl Into<String>) -> Self {
self.source_id = Some(source_id.into());
self
}
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/workbooks/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-01");
if let Some(source_id) = &this.source_id {
req.url_mut().query_pairs_mut().append_pair("sourceId", source_id);
}
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.workbook_properties)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Workbook>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Workbook> {
let bytes = self.0.into_body().collect().await?;
let body: models::Workbook = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
pub(crate) source_id: Option<String>,
pub(crate) workbook_update_parameters: Option<models::WorkbookUpdateParameters>,
}
impl RequestBuilder {
#[doc = "Azure Resource Id that will fetch all linked workbooks."]
pub fn source_id(mut self, source_id: impl Into<String>) -> Self {
self.source_id = Some(source_id.into());
self
}
#[doc = "Properties that need to be specified to create a new workbook."]
pub fn workbook_update_parameters(mut self, workbook_update_parameters: impl Into<models::WorkbookUpdateParameters>) -> Self {
self.workbook_update_parameters = Some(workbook_update_parameters.into());
self
}
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/workbooks/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-01");
if let Some(source_id) = &this.source_id {
req.url_mut().query_pairs_mut().append_pair("sourceId", source_id);
}
let req_body = if let Some(workbook_update_parameters) = &this.workbook_update_parameters {
req.insert_header("content-type", "application/json");
azure_core::to_json(workbook_update_parameters)?
} else {
azure_core::EMPTY_BODY
};
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Workbook>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/workbooks/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod revisions_list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::WorkbooksListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::WorkbooksListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::WorkbooksListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/workbooks/{}/revisions",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-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 credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod revision_get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Workbook> {
let bytes = self.0.into_body().collect().await?;
let body: models::Workbook = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) resource_group_name: String,
pub(crate) resource_name: String,
pub(crate) revision_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Insights/workbooks/{}/revisions/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.revision_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-04-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Workbook>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod live_token {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "**Gets an access token for live metrics stream data.**"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_uri`: The identifier of the resource."]
pub fn get(&self, resource_uri: impl Into<String>) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_uri: resource_uri.into(),
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LiveTokenResponse> {
let bytes = self.0.into_body().collect().await?;
let body: models::LiveTokenResponse = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_uri: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/{}/providers/Microsoft.Insights/generatelivetoken",
this.client.endpoint(),
&this.resource_uri
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2021-10-14");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::LiveTokenResponse>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod component_linked_storage_accounts {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Returns the current linked storage settings for an Application Insights component."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `storage_type`: The type of the Application Insights component data source for the linked storage account."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
storage_type: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
storage_type: storage_type.into(),
}
}
#[doc = "Replace current linked storage account for an Application Insights component."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `storage_type`: The type of the Application Insights component data source for the linked storage account."]
#[doc = "* `linked_storage_accounts_properties`: Properties that need to be specified to update linked storage accounts for an Application Insights component."]
pub fn create_and_update(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
storage_type: impl Into<String>,
linked_storage_accounts_properties: impl Into<models::ComponentLinkedStorageAccounts>,
) -> create_and_update::RequestBuilder {
create_and_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
storage_type: storage_type.into(),
linked_storage_accounts_properties: linked_storage_accounts_properties.into(),
}
}
#[doc = "Update linked storage accounts for an Application Insights component."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `storage_type`: The type of the Application Insights component data source for the linked storage account."]
#[doc = "* `linked_storage_accounts_properties`: Properties that need to be specified to update a linked storage accounts for an Application Insights component."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
storage_type: impl Into<String>,
linked_storage_accounts_properties: impl Into<models::ComponentLinkedStorageAccountsPatch>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
storage_type: storage_type.into(),
linked_storage_accounts_properties: linked_storage_accounts_properties.into(),
}
}
#[doc = "Delete linked storage accounts for an Application Insights component."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group. The name is case insensitive."]
#[doc = "* `subscription_id`: The ID of the target subscription."]
#[doc = "* `resource_name`: The name of the Application Insights component resource."]
#[doc = "* `storage_type`: The type of the Application Insights component data source for the linked storage account."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
resource_name: impl Into<String>,
storage_type: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
resource_name: resource_name.into(),
storage_type: storage_type.into(),
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ComponentLinkedStorageAccounts> {
let bytes = self.0.into_body().collect().await?;
let body: models::ComponentLinkedStorageAccounts = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
pub(crate) storage_type: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/microsoft.insights/components/{}/linkedStorageAccounts/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.storage_type
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2020-03-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ComponentLinkedStorageAccounts>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_and_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ComponentLinkedStorageAccounts> {
let bytes = self.0.into_body().collect().await?;
let body: models::ComponentLinkedStorageAccounts = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
pub(crate) storage_type: String,
pub(crate) linked_storage_accounts_properties: models::ComponentLinkedStorageAccounts,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/microsoft.insights/components/{}/linkedStorageAccounts/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.storage_type
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2020-03-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.linked_storage_accounts_properties)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ComponentLinkedStorageAccounts>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ComponentLinkedStorageAccounts> {
let bytes = self.0.into_body().collect().await?;
let body: models::ComponentLinkedStorageAccounts = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
pub(crate) storage_type: String,
pub(crate) linked_storage_accounts_properties: models::ComponentLinkedStorageAccountsPatch,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/microsoft.insights/components/{}/linkedStorageAccounts/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.storage_type
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2020-03-01-preview");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.linked_storage_accounts_properties)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ComponentLinkedStorageAccounts>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
pub(crate) resource_name: String,
pub(crate) storage_type: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/microsoft.insights/components/{}/linkedStorageAccounts/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.resource_name,
&this.storage_type
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2020-03-01-preview");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}