#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(unused_imports)]
#![allow(clippy::redundant_clone)]
#![allow(clippy::too_many_arguments)]
#![allow(clippy::module_inception)]
pub mod models;
#[derive(Clone)]
pub struct Client {
endpoint: azure_core::http::Url,
credential: crate::Credential,
scopes: Vec<String>,
pipeline: azure_core::http::Pipeline,
}
#[derive(Clone)]
pub struct ClientBuilder {
credential: crate::Credential,
endpoint: Option<azure_core::http::Url>,
scopes: Option<Vec<String>>,
options: azure_core::http::ClientOptions,
}
azure_core::static_url!(DEFAULT_ENDPOINT, "https://dev.azure.com");
impl ClientBuilder {
#[doc = "Create a new instance of `ClientBuilder`."]
#[must_use]
pub fn new(credential: crate::Credential) -> Self {
Self {
credential,
endpoint: None,
scopes: None,
options: azure_core::http::ClientOptions::default(),
}
}
#[doc = "Set the endpoint."]
#[must_use]
pub fn endpoint(mut self, endpoint: impl Into<azure_core::http::Url>) -> Self {
self.endpoint = Some(endpoint.into());
self
}
#[doc = "Set the scopes."]
#[must_use]
pub fn scopes(mut self, scopes: &[&str]) -> Self {
self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect());
self
}
#[doc = "Set the retry options."]
#[must_use]
pub fn retry(mut self, retry: impl Into<azure_core::http::RetryOptions>) -> Self {
self.options.retry = retry.into();
self
}
#[doc = "Set the transport options."]
#[must_use]
pub fn transport(mut self, transport: impl Into<azure_core::http::Transport>) -> Self {
self.options.transport = Some(transport.into());
self
}
#[doc = "Set per-call policies."]
#[must_use]
pub fn per_call_policies(
mut self,
policies: impl Into<Vec<std::sync::Arc<dyn azure_core::http::policies::Policy>>>,
) -> Self {
self.options.per_call_policies = policies.into();
self
}
#[doc = "Set per-try policies."]
#[must_use]
pub fn per_try_policies(
mut self,
policies: impl Into<Vec<std::sync::Arc<dyn azure_core::http::policies::Policy>>>,
) -> Self {
self.options.per_try_policies = policies.into();
self
}
#[doc = "Convert the builder into a `Client` instance."]
pub fn build(self) -> Client {
let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned());
let scopes = self
.scopes
.unwrap_or_else(|| vec![crate::ADO_SCOPE.to_string()]);
Client::new(endpoint, self.credential, scopes, self.options)
}
}
impl Client {
pub(crate) fn endpoint(&self) -> &azure_core::http::Url {
&self.endpoint
}
pub(crate) fn token_credential(&self) -> &crate::Credential {
&self.credential
}
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::http::Request,
) -> azure_core::Result<azure_core::http::RawResponse> {
let context = azure_core::http::Context::default();
self.pipeline.send(&context, request, None).await
}
#[doc = "Create a new `ClientBuilder`."]
#[must_use]
pub fn builder(credential: crate::Credential) -> ClientBuilder {
ClientBuilder::new(credential)
}
#[doc = "Create a new `Client`."]
#[must_use]
pub fn new(
endpoint: impl Into<azure_core::http::Url>,
credential: crate::Credential,
scopes: Vec<String>,
options: azure_core::http::ClientOptions,
) -> Self {
let endpoint = endpoint.into();
let pipeline = azure_core::http::Pipeline::new(
option_env!("CARGO_PKG_NAME"),
option_env!("CARGO_PKG_VERSION"),
options,
Vec::new(),
Vec::new(),
None,
);
Self {
endpoint,
credential,
scopes,
pipeline,
}
}
pub fn consumers_client(&self) -> consumers::Client {
consumers::Client(self.clone())
}
pub fn diagnostics_client(&self) -> diagnostics::Client {
diagnostics::Client(self.clone())
}
pub fn notifications_client(&self) -> notifications::Client {
notifications::Client(self.clone())
}
pub fn publishers_client(&self) -> publishers::Client {
publishers::Client(self.clone())
}
pub fn subscriptions_client(&self) -> subscriptions::Client {
subscriptions::Client(self.clone())
}
}
pub mod consumers {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Get a list of available service hook consumer services. Optionally filter by consumers that support at least one event type from the specific publisher."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
pub fn list(&self, organization: impl Into<String>) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
publisher_id: None,
}
}
#[doc = "Get a specific consumer service. Optionally filter out consumer actions that do not support any event types for the specified publisher."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `consumer_id`: ID for a consumer."]
pub fn get(
&self,
organization: impl Into<String>,
consumer_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
consumer_id: consumer_id.into(),
publisher_id: None,
}
}
#[doc = "Get a list of consumer actions for a specific consumer."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `consumer_id`: ID for a consumer."]
pub fn list_consumer_actions(
&self,
organization: impl Into<String>,
consumer_id: impl Into<String>,
) -> list_consumer_actions::RequestBuilder {
list_consumer_actions::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
consumer_id: consumer_id.into(),
publisher_id: None,
}
}
#[doc = "Get details about a specific consumer action."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `consumer_id`: ID for a consumer."]
#[doc = "* `consumer_action_id`: ID for a consumerActionId."]
pub fn get_consumer_action(
&self,
organization: impl Into<String>,
consumer_id: impl Into<String>,
consumer_action_id: impl Into<String>,
) -> get_consumer_action::RequestBuilder {
get_consumer_action::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
consumer_id: consumer_id.into(),
consumer_action_id: consumer_action_id.into(),
publisher_id: None,
}
}
}
pub mod list {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(
azure_core::http::Response<models::ConsumerList, azure_core::http::JsonFormat>,
);
impl Response {
pub fn into_body(self) -> azure_core::Result<models::ConsumerList> {
self.0.into_model()
}
pub fn into_raw_response(self) -> azure_core::http::RawResponse {
self.0.into()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" converts the [`RequestBuilder`] into a future,"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) publisher_id: Option<String>,
}
impl RequestBuilder {
pub fn publisher_id(mut self, publisher_id: impl Into<String>) -> Self {
self.publisher_id = Some(publisher_id.into());
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req =
azure_core::http::Request::new(url, azure_core::http::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(
azure_core::http::headers::AUTHORIZATION,
auth_header,
);
}
if let Some(publisher_id) = &this.publisher_id {
req.url_mut()
.query_pairs_mut()
.append_pair("publisherId", publisher_id);
}
let req_body = azure_core::Bytes::new();
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?.into()))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::http::Url> {
let mut url = azure_core::http::Url::parse(&format!(
"{}/{}/_apis/hooks/consumers",
self.client.endpoint(),
&self.organization
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == "api-version");
if !has_api_version_already {
url.query_pairs_mut()
.append_pair("api-version", "7.1-preview");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::ConsumerList>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::ConsumerList>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body() })
}
}
}
pub mod get {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(
azure_core::http::Response<models::Consumer, azure_core::http::JsonFormat>,
);
impl Response {
pub fn into_body(self) -> azure_core::Result<models::Consumer> {
self.0.into_model()
}
pub fn into_raw_response(self) -> azure_core::http::RawResponse {
self.0.into()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" converts the [`RequestBuilder`] into a future,"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) consumer_id: String,
pub(crate) publisher_id: Option<String>,
}
impl RequestBuilder {
pub fn publisher_id(mut self, publisher_id: impl Into<String>) -> Self {
self.publisher_id = Some(publisher_id.into());
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req =
azure_core::http::Request::new(url, azure_core::http::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(
azure_core::http::headers::AUTHORIZATION,
auth_header,
);
}
if let Some(publisher_id) = &this.publisher_id {
req.url_mut()
.query_pairs_mut()
.append_pair("publisherId", publisher_id);
}
let req_body = azure_core::Bytes::new();
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?.into()))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::http::Url> {
let mut url = azure_core::http::Url::parse(&format!(
"{}/{}/_apis/hooks/consumers/{}",
self.client.endpoint(),
&self.organization,
&self.consumer_id
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == "api-version");
if !has_api_version_already {
url.query_pairs_mut()
.append_pair("api-version", "7.1-preview");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::Consumer>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::Consumer>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body() })
}
}
}
pub mod list_consumer_actions {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(
azure_core::http::Response<models::ConsumerActionList, azure_core::http::JsonFormat>,
);
impl Response {
pub fn into_body(self) -> azure_core::Result<models::ConsumerActionList> {
self.0.into_model()
}
pub fn into_raw_response(self) -> azure_core::http::RawResponse {
self.0.into()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" converts the [`RequestBuilder`] into a future,"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) consumer_id: String,
pub(crate) publisher_id: Option<String>,
}
impl RequestBuilder {
pub fn publisher_id(mut self, publisher_id: impl Into<String>) -> Self {
self.publisher_id = Some(publisher_id.into());
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req =
azure_core::http::Request::new(url, azure_core::http::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(
azure_core::http::headers::AUTHORIZATION,
auth_header,
);
}
if let Some(publisher_id) = &this.publisher_id {
req.url_mut()
.query_pairs_mut()
.append_pair("publisherId", publisher_id);
}
let req_body = azure_core::Bytes::new();
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?.into()))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::http::Url> {
let mut url = azure_core::http::Url::parse(&format!(
"{}/{}/_apis/hooks/consumers/{}/actions",
self.client.endpoint(),
&self.organization,
&self.consumer_id
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == "api-version");
if !has_api_version_already {
url.query_pairs_mut()
.append_pair("api-version", "7.1-preview");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::ConsumerActionList>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::ConsumerActionList>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body() })
}
}
}
pub mod get_consumer_action {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(
azure_core::http::Response<models::ConsumerAction, azure_core::http::JsonFormat>,
);
impl Response {
pub fn into_body(self) -> azure_core::Result<models::ConsumerAction> {
self.0.into_model()
}
pub fn into_raw_response(self) -> azure_core::http::RawResponse {
self.0.into()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" converts the [`RequestBuilder`] into a future,"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) consumer_id: String,
pub(crate) consumer_action_id: String,
pub(crate) publisher_id: Option<String>,
}
impl RequestBuilder {
pub fn publisher_id(mut self, publisher_id: impl Into<String>) -> Self {
self.publisher_id = Some(publisher_id.into());
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req =
azure_core::http::Request::new(url, azure_core::http::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(
azure_core::http::headers::AUTHORIZATION,
auth_header,
);
}
if let Some(publisher_id) = &this.publisher_id {
req.url_mut()
.query_pairs_mut()
.append_pair("publisherId", publisher_id);
}
let req_body = azure_core::Bytes::new();
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?.into()))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::http::Url> {
let mut url = azure_core::http::Url::parse(&format!(
"{}/{}/_apis/hooks/consumers/{}/actions/{}",
self.client.endpoint(),
&self.organization,
&self.consumer_id,
&self.consumer_action_id
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == "api-version");
if !has_api_version_already {
url.query_pairs_mut()
.append_pair("api-version", "7.1-preview");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::ConsumerAction>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::ConsumerAction>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body() })
}
}
}
}
pub mod notifications {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Query for notifications. A notification includes details about the event, the request to and the response from the consumer service."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
pub fn query(
&self,
organization: impl Into<String>,
body: impl Into<models::NotificationsQuery>,
) -> query::RequestBuilder {
query::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
}
}
#[doc = "Get a list of notifications for a specific subscription. A notification includes details about the event, the request to and the response from the consumer service."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `subscription_id`: ID for a subscription."]
pub fn list(
&self,
organization: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
subscription_id: subscription_id.into(),
max_results: None,
status: None,
result: None,
}
}
#[doc = "Get a specific notification for a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `subscription_id`: ID for a subscription."]
pub fn get(
&self,
organization: impl Into<String>,
subscription_id: impl Into<String>,
notification_id: i32,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
subscription_id: subscription_id.into(),
notification_id,
}
}
#[doc = "Sends a test notification. This is useful for verifying the configuration of an updated or new service hooks subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
pub fn create(
&self,
organization: impl Into<String>,
body: impl Into<models::Notification>,
) -> create::RequestBuilder {
create::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
use_real_data: None,
}
}
}
pub mod query {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(
azure_core::http::Response<models::NotificationsQuery, azure_core::http::JsonFormat>,
);
impl Response {
pub fn into_body(self) -> azure_core::Result<models::NotificationsQuery> {
self.0.into_model()
}
pub fn into_raw_response(self) -> azure_core::http::RawResponse {
self.0.into()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" converts the [`RequestBuilder`] into a future,"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::NotificationsQuery,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req =
azure_core::http::Request::new(url, azure_core::http::Method::Post);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(
azure_core::http::headers::AUTHORIZATION,
auth_header,
);
}
req.insert_header("content-type", "application/json");
let req_body = azure_core::json::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?.into()))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::http::Url> {
let mut url = azure_core::http::Url::parse(&format!(
"{}/{}/_apis/hooks/notificationsquery",
self.client.endpoint(),
&self.organization
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == "api-version");
if !has_api_version_already {
url.query_pairs_mut()
.append_pair("api-version", "7.1-preview");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::NotificationsQuery>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::NotificationsQuery>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body() })
}
}
}
pub mod list {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(
azure_core::http::Response<models::NotificationList, azure_core::http::JsonFormat>,
);
impl Response {
pub fn into_body(self) -> azure_core::Result<models::NotificationList> {
self.0.into_model()
}
pub fn into_raw_response(self) -> azure_core::http::RawResponse {
self.0.into()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" converts the [`RequestBuilder`] into a future,"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) subscription_id: String,
pub(crate) max_results: Option<i32>,
pub(crate) status: Option<models::NotificationStatus>,
pub(crate) result: Option<models::NotificationResult>,
}
impl RequestBuilder {
#[doc = "Maximum number of notifications to return. Default is **100**."]
pub fn max_results(mut self, max_results: i32) -> Self {
self.max_results = Some(max_results);
self
}
#[doc = "Get only notifications with this status."]
pub fn status(mut self, status: impl Into<models::NotificationStatus>) -> Self {
self.status = Some(status.into());
self
}
#[doc = "Get only notifications with this result type."]
pub fn result(mut self, result: impl Into<models::NotificationResult>) -> Self {
self.result = Some(result.into());
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req =
azure_core::http::Request::new(url, azure_core::http::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(
azure_core::http::headers::AUTHORIZATION,
auth_header,
);
}
if let Some(max_results) = &this.max_results {
req.url_mut()
.query_pairs_mut()
.append_pair("maxResults", &max_results.to_string());
}
if let Some(status) = &this.status {
req.url_mut()
.query_pairs_mut()
.append_pair("status", &status.to_string());
}
if let Some(result) = &this.result {
req.url_mut()
.query_pairs_mut()
.append_pair("result", &result.to_string());
}
let req_body = azure_core::Bytes::new();
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?.into()))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::http::Url> {
let mut url = azure_core::http::Url::parse(&format!(
"{}/{}/_apis/hooks/subscriptions/{}/notifications",
self.client.endpoint(),
&self.organization,
&self.subscription_id
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == "api-version");
if !has_api_version_already {
url.query_pairs_mut()
.append_pair("api-version", "7.1-preview");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::NotificationList>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::NotificationList>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body() })
}
}
}
pub mod get {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(
azure_core::http::Response<models::Notification, azure_core::http::JsonFormat>,
);
impl Response {
pub fn into_body(self) -> azure_core::Result<models::Notification> {
self.0.into_model()
}
pub fn into_raw_response(self) -> azure_core::http::RawResponse {
self.0.into()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" converts the [`RequestBuilder`] into a future,"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) subscription_id: String,
pub(crate) notification_id: i32,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req =
azure_core::http::Request::new(url, azure_core::http::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(
azure_core::http::headers::AUTHORIZATION,
auth_header,
);
}
let req_body = azure_core::Bytes::new();
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?.into()))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::http::Url> {
let mut url = azure_core::http::Url::parse(&format!(
"{}/{}/_apis/hooks/subscriptions/{}/notifications/{}",
self.client.endpoint(),
&self.organization,
&self.subscription_id,
&self.notification_id
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == "api-version");
if !has_api_version_already {
url.query_pairs_mut()
.append_pair("api-version", "7.1-preview");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::Notification>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::Notification>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body() })
}
}
}
pub mod create {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(
azure_core::http::Response<models::Notification, azure_core::http::JsonFormat>,
);
impl Response {
pub fn into_body(self) -> azure_core::Result<models::Notification> {
self.0.into_model()
}
pub fn into_raw_response(self) -> azure_core::http::RawResponse {
self.0.into()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" converts the [`RequestBuilder`] into a future,"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::Notification,
pub(crate) use_real_data: Option<bool>,
}
impl RequestBuilder {
#[doc = "Only allow testing with real data in existing subscriptions."]
pub fn use_real_data(mut self, use_real_data: bool) -> Self {
self.use_real_data = Some(use_real_data);
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req =
azure_core::http::Request::new(url, azure_core::http::Method::Post);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(
azure_core::http::headers::AUTHORIZATION,
auth_header,
);
}
req.insert_header("content-type", "application/json");
let req_body = azure_core::json::to_json(&this.body)?;
if let Some(use_real_data) = &this.use_real_data {
req.url_mut()
.query_pairs_mut()
.append_pair("useRealData", &use_real_data.to_string());
}
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?.into()))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::http::Url> {
let mut url = azure_core::http::Url::parse(&format!(
"{}/{}/_apis/hooks/testnotifications",
self.client.endpoint(),
&self.organization
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == "api-version");
if !has_api_version_already {
url.query_pairs_mut()
.append_pair("api-version", "7.1-preview");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::Notification>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::Notification>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body() })
}
}
}
}
pub mod publishers {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Get a list of publishers."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
pub fn list(&self, organization: impl Into<String>) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
}
}
#[doc = "Get a specific service hooks publisher."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `publisher_id`: ID for a publisher."]
pub fn get(
&self,
organization: impl Into<String>,
publisher_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
publisher_id: publisher_id.into(),
}
}
#[doc = "Get the event types for a specific publisher."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `publisher_id`: ID for a publisher."]
pub fn list_event_types(
&self,
organization: impl Into<String>,
publisher_id: impl Into<String>,
) -> list_event_types::RequestBuilder {
list_event_types::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
publisher_id: publisher_id.into(),
}
}
#[doc = "Get a specific event type."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `publisher_id`: ID for a publisher."]
pub fn get_event_type(
&self,
organization: impl Into<String>,
publisher_id: impl Into<String>,
event_type_id: impl Into<String>,
) -> get_event_type::RequestBuilder {
get_event_type::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
publisher_id: publisher_id.into(),
event_type_id: event_type_id.into(),
}
}
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
pub fn query_input_values(
&self,
organization: impl Into<String>,
body: impl Into<models::InputValuesQuery>,
publisher_id: impl Into<String>,
) -> query_input_values::RequestBuilder {
query_input_values::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
publisher_id: publisher_id.into(),
}
}
#[doc = "Query for service hook publishers."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
pub fn query_publishers(
&self,
organization: impl Into<String>,
body: impl Into<models::PublishersQuery>,
) -> query_publishers::RequestBuilder {
query_publishers::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
}
}
}
pub mod list {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(
azure_core::http::Response<models::PublisherList, azure_core::http::JsonFormat>,
);
impl Response {
pub fn into_body(self) -> azure_core::Result<models::PublisherList> {
self.0.into_model()
}
pub fn into_raw_response(self) -> azure_core::http::RawResponse {
self.0.into()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" converts the [`RequestBuilder`] into a future,"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req =
azure_core::http::Request::new(url, azure_core::http::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(
azure_core::http::headers::AUTHORIZATION,
auth_header,
);
}
let req_body = azure_core::Bytes::new();
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?.into()))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::http::Url> {
let mut url = azure_core::http::Url::parse(&format!(
"{}/{}/_apis/hooks/publishers",
self.client.endpoint(),
&self.organization
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == "api-version");
if !has_api_version_already {
url.query_pairs_mut()
.append_pair("api-version", "7.1-preview");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::PublisherList>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::PublisherList>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body() })
}
}
}
pub mod get {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(
azure_core::http::Response<models::Publisher, azure_core::http::JsonFormat>,
);
impl Response {
pub fn into_body(self) -> azure_core::Result<models::Publisher> {
self.0.into_model()
}
pub fn into_raw_response(self) -> azure_core::http::RawResponse {
self.0.into()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" converts the [`RequestBuilder`] into a future,"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) publisher_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req =
azure_core::http::Request::new(url, azure_core::http::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(
azure_core::http::headers::AUTHORIZATION,
auth_header,
);
}
let req_body = azure_core::Bytes::new();
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?.into()))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::http::Url> {
let mut url = azure_core::http::Url::parse(&format!(
"{}/{}/_apis/hooks/publishers/{}",
self.client.endpoint(),
&self.organization,
&self.publisher_id
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == "api-version");
if !has_api_version_already {
url.query_pairs_mut()
.append_pair("api-version", "7.1-preview");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::Publisher>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::Publisher>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body() })
}
}
}
pub mod list_event_types {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(
azure_core::http::Response<
models::EventTypeDescriptorList,
azure_core::http::JsonFormat,
>,
);
impl Response {
pub fn into_body(self) -> azure_core::Result<models::EventTypeDescriptorList> {
self.0.into_model()
}
pub fn into_raw_response(self) -> azure_core::http::RawResponse {
self.0.into()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" converts the [`RequestBuilder`] into a future,"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) publisher_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req =
azure_core::http::Request::new(url, azure_core::http::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(
azure_core::http::headers::AUTHORIZATION,
auth_header,
);
}
let req_body = azure_core::Bytes::new();
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?.into()))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::http::Url> {
let mut url = azure_core::http::Url::parse(&format!(
"{}/{}/_apis/hooks/publishers/{}/eventtypes",
self.client.endpoint(),
&self.organization,
&self.publisher_id
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == "api-version");
if !has_api_version_already {
url.query_pairs_mut()
.append_pair("api-version", "7.1-preview");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::EventTypeDescriptorList>;
type IntoFuture =
BoxFuture<'static, azure_core::Result<models::EventTypeDescriptorList>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body() })
}
}
}
pub mod get_event_type {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(
azure_core::http::Response<models::EventTypeDescriptor, azure_core::http::JsonFormat>,
);
impl Response {
pub fn into_body(self) -> azure_core::Result<models::EventTypeDescriptor> {
self.0.into_model()
}
pub fn into_raw_response(self) -> azure_core::http::RawResponse {
self.0.into()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" converts the [`RequestBuilder`] into a future,"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) publisher_id: String,
pub(crate) event_type_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req =
azure_core::http::Request::new(url, azure_core::http::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(
azure_core::http::headers::AUTHORIZATION,
auth_header,
);
}
let req_body = azure_core::Bytes::new();
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?.into()))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::http::Url> {
let mut url = azure_core::http::Url::parse(&format!(
"{}/{}/_apis/hooks/publishers/{}/eventtypes/{}",
self.client.endpoint(),
&self.organization,
&self.publisher_id,
&self.event_type_id
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == "api-version");
if !has_api_version_already {
url.query_pairs_mut()
.append_pair("api-version", "7.1-preview");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::EventTypeDescriptor>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::EventTypeDescriptor>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body() })
}
}
}
pub mod query_input_values {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(
azure_core::http::Response<models::InputValuesQuery, azure_core::http::JsonFormat>,
);
impl Response {
pub fn into_body(self) -> azure_core::Result<models::InputValuesQuery> {
self.0.into_model()
}
pub fn into_raw_response(self) -> azure_core::http::RawResponse {
self.0.into()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" converts the [`RequestBuilder`] into a future,"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::InputValuesQuery,
pub(crate) publisher_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req =
azure_core::http::Request::new(url, azure_core::http::Method::Post);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(
azure_core::http::headers::AUTHORIZATION,
auth_header,
);
}
req.insert_header("content-type", "application/json");
let req_body = azure_core::json::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?.into()))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::http::Url> {
let mut url = azure_core::http::Url::parse(&format!(
"{}/{}/_apis/hooks/publishers/{}/inputValuesQuery",
self.client.endpoint(),
&self.organization,
&self.publisher_id
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == "api-version");
if !has_api_version_already {
url.query_pairs_mut()
.append_pair("api-version", "7.1-preview");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::InputValuesQuery>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::InputValuesQuery>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body() })
}
}
}
pub mod query_publishers {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(
azure_core::http::Response<models::PublishersQuery, azure_core::http::JsonFormat>,
);
impl Response {
pub fn into_body(self) -> azure_core::Result<models::PublishersQuery> {
self.0.into_model()
}
pub fn into_raw_response(self) -> azure_core::http::RawResponse {
self.0.into()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" converts the [`RequestBuilder`] into a future,"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::PublishersQuery,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req =
azure_core::http::Request::new(url, azure_core::http::Method::Post);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(
azure_core::http::headers::AUTHORIZATION,
auth_header,
);
}
req.insert_header("content-type", "application/json");
let req_body = azure_core::json::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?.into()))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::http::Url> {
let mut url = azure_core::http::Url::parse(&format!(
"{}/{}/_apis/hooks/publishersquery",
self.client.endpoint(),
&self.organization
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == "api-version");
if !has_api_version_already {
url.query_pairs_mut()
.append_pair("api-version", "7.1-preview");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::PublishersQuery>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::PublishersQuery>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body() })
}
}
}
}
pub mod subscriptions {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Get a list of subscriptions."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
pub fn list(&self, organization: impl Into<String>) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
publisher_id: None,
event_type: None,
consumer_id: None,
consumer_action_id: None,
}
}
#[doc = "Create a subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `body`: Subscription to be created."]
pub fn create(
&self,
organization: impl Into<String>,
body: impl Into<models::Subscription>,
) -> create::RequestBuilder {
create::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
}
}
#[doc = "Get a specific service hooks subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `subscription_id`: ID for a subscription."]
pub fn get(
&self,
organization: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Update a subscription. <param name=\"subscriptionId\">ID for a subscription that you wish to update.</param>"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
pub fn replace_subscription(
&self,
organization: impl Into<String>,
body: impl Into<models::Subscription>,
subscription_id: impl Into<String>,
) -> replace_subscription::RequestBuilder {
replace_subscription::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Delete a specific service hooks subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
#[doc = "* `subscription_id`: ID for a subscription."]
pub fn delete(
&self,
organization: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Query for service hook subscriptions."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
pub fn create_subscriptions_query(
&self,
organization: impl Into<String>,
body: impl Into<models::SubscriptionsQuery>,
) -> create_subscriptions_query::RequestBuilder {
create_subscriptions_query::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
}
}
}
pub mod list {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(
azure_core::http::Response<models::SubscriptionList, azure_core::http::JsonFormat>,
);
impl Response {
pub fn into_body(self) -> azure_core::Result<models::SubscriptionList> {
self.0.into_model()
}
pub fn into_raw_response(self) -> azure_core::http::RawResponse {
self.0.into()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" converts the [`RequestBuilder`] into a future,"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) publisher_id: Option<String>,
pub(crate) event_type: Option<String>,
pub(crate) consumer_id: Option<String>,
pub(crate) consumer_action_id: Option<String>,
}
impl RequestBuilder {
#[doc = "ID for a subscription."]
pub fn publisher_id(mut self, publisher_id: impl Into<String>) -> Self {
self.publisher_id = Some(publisher_id.into());
self
}
#[doc = "The event type to filter on (if any)."]
pub fn event_type(mut self, event_type: impl Into<String>) -> Self {
self.event_type = Some(event_type.into());
self
}
#[doc = "ID for a consumer."]
pub fn consumer_id(mut self, consumer_id: impl Into<String>) -> Self {
self.consumer_id = Some(consumer_id.into());
self
}
#[doc = "ID for a consumerActionId."]
pub fn consumer_action_id(mut self, consumer_action_id: impl Into<String>) -> Self {
self.consumer_action_id = Some(consumer_action_id.into());
self
}
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req =
azure_core::http::Request::new(url, azure_core::http::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(
azure_core::http::headers::AUTHORIZATION,
auth_header,
);
}
if let Some(publisher_id) = &this.publisher_id {
req.url_mut()
.query_pairs_mut()
.append_pair("publisherId", publisher_id);
}
if let Some(event_type) = &this.event_type {
req.url_mut()
.query_pairs_mut()
.append_pair("eventType", event_type);
}
if let Some(consumer_id) = &this.consumer_id {
req.url_mut()
.query_pairs_mut()
.append_pair("consumerId", consumer_id);
}
if let Some(consumer_action_id) = &this.consumer_action_id {
req.url_mut()
.query_pairs_mut()
.append_pair("consumerActionId", consumer_action_id);
}
let req_body = azure_core::Bytes::new();
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?.into()))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::http::Url> {
let mut url = azure_core::http::Url::parse(&format!(
"{}/{}/_apis/hooks/subscriptions",
self.client.endpoint(),
&self.organization
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == "api-version");
if !has_api_version_already {
url.query_pairs_mut()
.append_pair("api-version", "7.1-preview");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::SubscriptionList>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::SubscriptionList>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body() })
}
}
}
pub mod create {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(
azure_core::http::Response<models::Subscription, azure_core::http::JsonFormat>,
);
impl Response {
pub fn into_body(self) -> azure_core::Result<models::Subscription> {
self.0.into_model()
}
pub fn into_raw_response(self) -> azure_core::http::RawResponse {
self.0.into()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" converts the [`RequestBuilder`] into a future,"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::Subscription,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req =
azure_core::http::Request::new(url, azure_core::http::Method::Post);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(
azure_core::http::headers::AUTHORIZATION,
auth_header,
);
}
req.insert_header("content-type", "application/json");
let req_body = azure_core::json::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?.into()))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::http::Url> {
let mut url = azure_core::http::Url::parse(&format!(
"{}/{}/_apis/hooks/subscriptions",
self.client.endpoint(),
&self.organization
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == "api-version");
if !has_api_version_already {
url.query_pairs_mut()
.append_pair("api-version", "7.1-preview");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::Subscription>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::Subscription>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body() })
}
}
}
pub mod get {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(
azure_core::http::Response<models::Subscription, azure_core::http::JsonFormat>,
);
impl Response {
pub fn into_body(self) -> azure_core::Result<models::Subscription> {
self.0.into_model()
}
pub fn into_raw_response(self) -> azure_core::http::RawResponse {
self.0.into()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" converts the [`RequestBuilder`] into a future,"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req =
azure_core::http::Request::new(url, azure_core::http::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(
azure_core::http::headers::AUTHORIZATION,
auth_header,
);
}
let req_body = azure_core::Bytes::new();
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?.into()))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::http::Url> {
let mut url = azure_core::http::Url::parse(&format!(
"{}/{}/_apis/hooks/subscriptions/{}",
self.client.endpoint(),
&self.organization,
&self.subscription_id
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == "api-version");
if !has_api_version_already {
url.query_pairs_mut()
.append_pair("api-version", "7.1-preview");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::Subscription>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::Subscription>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body() })
}
}
}
pub mod replace_subscription {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(
azure_core::http::Response<models::Subscription, azure_core::http::JsonFormat>,
);
impl Response {
pub fn into_body(self) -> azure_core::Result<models::Subscription> {
self.0.into_model()
}
pub fn into_raw_response(self) -> azure_core::http::RawResponse {
self.0.into()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" converts the [`RequestBuilder`] into a future,"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::Subscription,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req =
azure_core::http::Request::new(url, azure_core::http::Method::Put);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(
azure_core::http::headers::AUTHORIZATION,
auth_header,
);
}
req.insert_header("content-type", "application/json");
let req_body = azure_core::json::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?.into()))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::http::Url> {
let mut url = azure_core::http::Url::parse(&format!(
"{}/{}/_apis/hooks/subscriptions/{}",
self.client.endpoint(),
&self.organization,
&self.subscription_id
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == "api-version");
if !has_api_version_already {
url.query_pairs_mut()
.append_pair("api-version", "7.1-preview");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::Subscription>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::Subscription>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body() })
}
}
}
pub mod delete {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(azure_core::http::Response<(), azure_core::http::NoFormat>);
impl Response {
pub fn into_raw_response(self) -> azure_core::http::RawResponse {
self.0.into()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" converts the [`RequestBuilder`] into a future,"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req =
azure_core::http::Request::new(url, azure_core::http::Method::Delete);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(
azure_core::http::headers::AUTHORIZATION,
auth_header,
);
}
let req_body = azure_core::Bytes::new();
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?.into()))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::http::Url> {
let mut url = azure_core::http::Url::parse(&format!(
"{}/{}/_apis/hooks/subscriptions/{}",
self.client.endpoint(),
&self.organization,
&self.subscription_id
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == "api-version");
if !has_api_version_already {
url.query_pairs_mut()
.append_pair("api-version", "7.1-preview");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<()>;
type IntoFuture = BoxFuture<'static, azure_core::Result<()>>;
#[doc = "Returns a future that sends the request and waits for the response."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
let _rsp = self.send().await?;
Ok(())
})
}
}
}
pub mod create_subscriptions_query {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(
azure_core::http::Response<models::SubscriptionsQuery, azure_core::http::JsonFormat>,
);
impl Response {
pub fn into_body(self) -> azure_core::Result<models::SubscriptionsQuery> {
self.0.into_model()
}
pub fn into_raw_response(self) -> azure_core::http::RawResponse {
self.0.into()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" converts the [`RequestBuilder`] into a future,"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::SubscriptionsQuery,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req =
azure_core::http::Request::new(url, azure_core::http::Method::Post);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(
azure_core::http::headers::AUTHORIZATION,
auth_header,
);
}
req.insert_header("content-type", "application/json");
let req_body = azure_core::json::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?.into()))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::http::Url> {
let mut url = azure_core::http::Url::parse(&format!(
"{}/{}/_apis/hooks/subscriptionsquery",
self.client.endpoint(),
&self.organization
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == "api-version");
if !has_api_version_already {
url.query_pairs_mut()
.append_pair("api-version", "7.1-preview");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::SubscriptionsQuery>;
type IntoFuture = BoxFuture<'static, azure_core::Result<models::SubscriptionsQuery>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body() })
}
}
}
}
pub mod diagnostics {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
pub fn get(
&self,
organization: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Arguments:"]
#[doc = "* `organization`: The name of the Azure DevOps organization."]
pub fn update(
&self,
organization: impl Into<String>,
body: impl Into<models::UpdateSubscripitonDiagnosticsParameters>,
subscription_id: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
organization: organization.into(),
body: body.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(
azure_core::http::Response<
models::SubscriptionDiagnostics,
azure_core::http::JsonFormat,
>,
);
impl Response {
pub fn into_body(self) -> azure_core::Result<models::SubscriptionDiagnostics> {
self.0.into_model()
}
pub fn into_raw_response(self) -> azure_core::http::RawResponse {
self.0.into()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" converts the [`RequestBuilder`] into a future,"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req =
azure_core::http::Request::new(url, azure_core::http::Method::Get);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(
azure_core::http::headers::AUTHORIZATION,
auth_header,
);
}
let req_body = azure_core::Bytes::new();
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?.into()))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::http::Url> {
let mut url = azure_core::http::Url::parse(&format!(
"{}/{}/_apis/hooks/subscriptions/{}/diagnostics",
self.client.endpoint(),
&self.organization,
&self.subscription_id
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == "api-version");
if !has_api_version_already {
url.query_pairs_mut()
.append_pair("api-version", "7.1-preview");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::SubscriptionDiagnostics>;
type IntoFuture =
BoxFuture<'static, azure_core::Result<models::SubscriptionDiagnostics>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body() })
}
}
}
pub mod update {
use super::models;
#[cfg(not(target_arch = "wasm32"))]
use futures::future::BoxFuture;
#[cfg(target_arch = "wasm32")]
use futures::future::LocalBoxFuture as BoxFuture;
#[derive(Debug)]
pub struct Response(
azure_core::http::Response<
models::SubscriptionDiagnostics,
azure_core::http::JsonFormat,
>,
);
impl Response {
pub fn into_body(self) -> azure_core::Result<models::SubscriptionDiagnostics> {
self.0.into_model()
}
pub fn into_raw_response(self) -> azure_core::http::RawResponse {
self.0.into()
}
}
#[derive(Clone)]
#[doc = r" `RequestBuilder` provides a mechanism for setting optional parameters on a request."]
#[doc = r""]
#[doc = r" Each `RequestBuilder` parameter method call returns `Self`, so setting of multiple"]
#[doc = r" parameters can be chained."]
#[doc = r""]
#[doc = r" To finalize and submit the request, invoke `.await`, which"]
#[doc = r" converts the [`RequestBuilder`] into a future,"]
#[doc = r" executes the request and returns a `Result` with the parsed"]
#[doc = r" response."]
#[doc = r""]
#[doc = r" If you need lower-level access to the raw response details"]
#[doc = r" (e.g. to inspect response headers or raw body data) then you"]
#[doc = r" can finalize the request using the"]
#[doc = r" [`RequestBuilder::send()`] method which returns a future"]
#[doc = r" that resolves to a lower-level [`Response`] value."]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) organization: String,
pub(crate) body: models::UpdateSubscripitonDiagnosticsParameters,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Returns a future that sends the request and returns a [`Response`] object that provides low-level access to full response details."]
#[doc = ""]
#[doc = "You should typically use `.await` (which implicitly calls `IntoFuture::into_future()`) to finalize and send requests rather than `send()`."]
#[doc = "However, this function can provide more flexibility when required."]
pub fn send(self) -> BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = this.url()?;
let mut req =
azure_core::http::Request::new(url, azure_core::http::Method::Put);
if let Some(auth_header) = this
.client
.token_credential()
.http_authorization_header(&this.client.scopes())
.await?
{
req.insert_header(
azure_core::http::headers::AUTHORIZATION,
auth_header,
);
}
req.insert_header("content-type", "application/json");
let req_body = azure_core::json::to_json(&this.body)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?.into()))
}
})
}
fn url(&self) -> azure_core::Result<azure_core::http::Url> {
let mut url = azure_core::http::Url::parse(&format!(
"{}/{}/_apis/hooks/subscriptions/{}/diagnostics",
self.client.endpoint(),
&self.organization,
&self.subscription_id
))?;
let has_api_version_already = url.query_pairs().any(|(k, _)| k == "api-version");
if !has_api_version_already {
url.query_pairs_mut()
.append_pair("api-version", "7.1-preview");
}
Ok(url)
}
}
impl std::future::IntoFuture for RequestBuilder {
type Output = azure_core::Result<models::SubscriptionDiagnostics>;
type IntoFuture =
BoxFuture<'static, azure_core::Result<models::SubscriptionDiagnostics>>;
#[doc = "Returns a future that sends the request and returns the parsed response body."]
#[doc = ""]
#[doc = "You should not normally call this method directly, simply invoke `.await` which implicitly calls `IntoFuture::into_future`."]
#[doc = ""]
#[doc = "See [IntoFuture documentation](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) for more details."]
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move { self.send().await?.into_body() })
}
}
}
}