#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(unused_imports)]
#![allow(clippy::redundant_clone)]
pub mod models;
#[derive(Clone)]
pub struct Client {
endpoint: String,
credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>,
scopes: Vec<String>,
pipeline: azure_core::Pipeline,
}
#[derive(Clone)]
pub struct ClientBuilder {
credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>,
endpoint: Option<String>,
scopes: Option<Vec<String>>,
options: azure_core::ClientOptions,
}
pub const DEFAULT_ENDPOINT: &str = azure_core::resource_manager_endpoint::AZURE_PUBLIC_CLOUD;
impl ClientBuilder {
#[doc = "Create a new instance of `ClientBuilder`."]
#[must_use]
pub fn new(credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>) -> Self {
Self {
credential,
endpoint: None,
scopes: None,
options: azure_core::ClientOptions::default(),
}
}
#[doc = "Set the endpoint."]
#[must_use]
pub fn endpoint(mut self, endpoint: impl Into<String>) -> Self {
self.endpoint = Some(endpoint.into());
self
}
#[doc = "Set the scopes."]
#[must_use]
pub fn scopes(mut self, scopes: &[&str]) -> Self {
self.scopes = Some(scopes.iter().map(|scope| (*scope).to_owned()).collect());
self
}
#[doc = "Set the retry options."]
#[must_use]
pub fn retry(mut self, retry: impl Into<azure_core::RetryOptions>) -> Self {
self.options = self.options.retry(retry);
self
}
#[doc = "Set the transport options."]
#[must_use]
pub fn transport(mut self, transport: impl Into<azure_core::TransportOptions>) -> Self {
self.options = self.options.transport(transport);
self
}
#[doc = "Convert the builder into a `Client` instance."]
#[must_use]
pub fn build(self) -> Client {
let endpoint = self.endpoint.unwrap_or_else(|| DEFAULT_ENDPOINT.to_owned());
let scopes = self.scopes.unwrap_or_else(|| vec![format!("{}/", endpoint)]);
Client::new(endpoint, self.credential, scopes, self.options)
}
}
impl Client {
pub(crate) fn endpoint(&self) -> &str {
self.endpoint.as_str()
}
pub(crate) fn token_credential(&self) -> &dyn azure_core::auth::TokenCredential {
self.credential.as_ref()
}
pub(crate) fn scopes(&self) -> Vec<&str> {
self.scopes.iter().map(String::as_str).collect()
}
pub(crate) async fn send(&self, request: &mut azure_core::Request) -> azure_core::Result<azure_core::Response> {
let mut context = azure_core::Context::default();
self.pipeline.send(&mut context, request).await
}
#[doc = "Create a new `ClientBuilder`."]
#[must_use]
pub fn builder(credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>) -> ClientBuilder {
ClientBuilder::new(credential)
}
#[doc = "Create a new `Client`."]
#[must_use]
pub fn new(
endpoint: impl Into<String>,
credential: std::sync::Arc<dyn azure_core::auth::TokenCredential>,
scopes: Vec<String>,
options: azure_core::ClientOptions,
) -> Self {
let endpoint = endpoint.into();
let pipeline = azure_core::Pipeline::new(
option_env!("CARGO_PKG_NAME"),
option_env!("CARGO_PKG_VERSION"),
options,
Vec::new(),
Vec::new(),
);
Self {
endpoint,
credential,
scopes,
pipeline,
}
}
pub fn cdn_peering_prefixes_client(&self) -> cdn_peering_prefixes::Client {
cdn_peering_prefixes::Client(self.clone())
}
pub fn connection_monitor_tests_client(&self) -> connection_monitor_tests::Client {
connection_monitor_tests::Client(self.clone())
}
pub fn legacy_peerings_client(&self) -> legacy_peerings::Client {
legacy_peerings::Client(self.clone())
}
pub fn looking_glass_client(&self) -> looking_glass::Client {
looking_glass::Client(self.clone())
}
pub fn operations_client(&self) -> operations::Client {
operations::Client(self.clone())
}
pub fn peer_asns_client(&self) -> peer_asns::Client {
peer_asns::Client(self.clone())
}
pub fn peering_locations_client(&self) -> peering_locations::Client {
peering_locations::Client(self.clone())
}
pub fn peering_service_countries_client(&self) -> peering_service_countries::Client {
peering_service_countries::Client(self.clone())
}
pub fn peering_service_locations_client(&self) -> peering_service_locations::Client {
peering_service_locations::Client(self.clone())
}
pub fn peering_service_providers_client(&self) -> peering_service_providers::Client {
peering_service_providers::Client(self.clone())
}
pub fn peering_services_client(&self) -> peering_services::Client {
peering_services::Client(self.clone())
}
pub fn peerings_client(&self) -> peerings::Client {
peerings::Client(self.clone())
}
pub fn prefixes_client(&self) -> prefixes::Client {
prefixes::Client(self.clone())
}
pub fn received_routes_client(&self) -> received_routes::Client {
received_routes::Client(self.clone())
}
pub fn registered_asns_client(&self) -> registered_asns::Client {
registered_asns::Client(self.clone())
}
pub fn registered_prefixes_client(&self) -> registered_prefixes::Client {
registered_prefixes::Client(self.clone())
}
}
pub mod cdn_peering_prefixes {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists all of the advertised prefixes for the specified peering location"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `peering_location`: The peering location."]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn list(&self, peering_location: impl Into<String>, subscription_id: impl Into<String>) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
peering_location: peering_location.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::CdnPeeringPrefixListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::CdnPeeringPrefixListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) peering_location: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::CdnPeeringPrefixListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Peering/cdnPeeringPrefixes",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
let peering_location = &this.peering_location;
req.url_mut().query_pairs_mut().append_pair("peeringLocation", peering_location);
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
impl Client {
#[doc = "Checks if the peering service provider is present within 1000 miles of customer's location"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `check_service_provider_availability_input`: The CheckServiceProviderAvailabilityInput indicating customer location and service provider."]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn check_service_provider_availability(
&self,
check_service_provider_availability_input: impl Into<models::CheckServiceProviderAvailabilityInput>,
subscription_id: impl Into<String>,
) -> check_service_provider_availability::RequestBuilder {
check_service_provider_availability::RequestBuilder {
client: self.clone(),
check_service_provider_availability_input: check_service_provider_availability_input.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod check_service_provider_availability {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<String> {
let bytes = self.0.into_body().collect().await?;
let body: String = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::Client,
pub(crate) check_service_provider_availability_input: models::CheckServiceProviderAvailabilityInput,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Peering/checkServiceProviderAvailability",
this.client.endpoint(),
&this.subscription_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.check_service_provider_availability_input)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<String>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod legacy_peerings {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists all of the legacy peerings under the given subscription matching the specified kind and location."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `peering_location`: The location of the peering."]
#[doc = "* `kind`: The kind of the peering."]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn list(
&self,
peering_location: impl Into<String>,
kind: impl Into<String>,
subscription_id: impl Into<String>,
) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
peering_location: peering_location.into(),
kind: kind.into(),
subscription_id: subscription_id.into(),
asn: None,
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PeeringListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::PeeringListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) peering_location: String,
pub(crate) kind: String,
pub(crate) subscription_id: String,
pub(crate) asn: Option<i32>,
}
impl RequestBuilder {
#[doc = "The ASN number associated with a legacy peering."]
pub fn asn(mut self, asn: i32) -> Self {
self.asn = Some(asn);
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::PeeringListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Peering/legacyPeerings",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
let peering_location = &this.peering_location;
req.url_mut().query_pairs_mut().append_pair("peeringLocation", peering_location);
let kind = &this.kind;
req.url_mut().query_pairs_mut().append_pair("kind", kind);
if let Some(asn) = &this.asn {
req.url_mut().query_pairs_mut().append_pair("asn", &asn.to_string());
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod looking_glass {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Run looking glass functionality"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `command`: The command to be executed: ping, traceroute, bgpRoute."]
#[doc = "* `source_type`: The type of the source: Edge site or Azure Region."]
#[doc = "* `source_location`: The location of the source."]
#[doc = "* `destination_ip`: The IP address of the destination."]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn invoke(
&self,
command: impl Into<String>,
source_type: impl Into<String>,
source_location: impl Into<String>,
destination_ip: impl Into<String>,
subscription_id: impl Into<String>,
) -> invoke::RequestBuilder {
invoke::RequestBuilder {
client: self.0.clone(),
command: command.into(),
source_type: source_type.into(),
source_location: source_location.into(),
destination_ip: destination_ip.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod invoke {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::LookingGlassOutput> {
let bytes = self.0.into_body().collect().await?;
let body: models::LookingGlassOutput = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) command: String,
pub(crate) source_type: String,
pub(crate) source_location: String,
pub(crate) destination_ip: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Peering/lookingGlass",
this.client.endpoint(),
&this.subscription_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
let command = &this.command;
req.url_mut().query_pairs_mut().append_pair("command", command);
let source_type = &this.source_type;
req.url_mut().query_pairs_mut().append_pair("sourceType", source_type);
let source_location = &this.source_location;
req.url_mut().query_pairs_mut().append_pair("sourceLocation", source_location);
let destination_ip = &this.destination_ip;
req.url_mut().query_pairs_mut().append_pair("destinationIP", destination_ip);
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::LookingGlassOutput>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
}
pub mod operations {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists all of the available API operations for peering resources."]
pub fn list(&self) -> list::RequestBuilder {
list::RequestBuilder { client: self.0.clone() }
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::OperationListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::OperationListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::OperationListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url =
azure_core::Url::parse(&format!("{}/providers/Microsoft.Peering/operations", this.client.endpoint(),))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod peer_asns {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets the peer ASN with the specified name under the given subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `peer_asn_name`: The peer ASN name."]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn get(&self, peer_asn_name: impl Into<String>, subscription_id: impl Into<String>) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
peer_asn_name: peer_asn_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates a new peer ASN or updates an existing peer ASN with the specified name under the given subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `peer_asn_name`: The peer ASN name."]
#[doc = "* `peer_asn`: The peer ASN."]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn create_or_update(
&self,
peer_asn_name: impl Into<String>,
peer_asn: impl Into<models::PeerAsn>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
peer_asn_name: peer_asn_name.into(),
peer_asn: peer_asn.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes an existing peer ASN with the specified name under the given subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `peer_asn_name`: The peer ASN name."]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn delete(&self, peer_asn_name: impl Into<String>, subscription_id: impl Into<String>) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
peer_asn_name: peer_asn_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists all of the peer ASNs under the given subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn list_by_subscription(&self, subscription_id: impl Into<String>) -> list_by_subscription::RequestBuilder {
list_by_subscription::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PeerAsn> {
let bytes = self.0.into_body().collect().await?;
let body: models::PeerAsn = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) peer_asn_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Peering/peerAsns/{}",
this.client.endpoint(),
&this.subscription_id,
&this.peer_asn_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::PeerAsn>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PeerAsn> {
let bytes = self.0.into_body().collect().await?;
let body: models::PeerAsn = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) peer_asn_name: String,
pub(crate) peer_asn: models::PeerAsn,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Peering/peerAsns/{}",
this.client.endpoint(),
&this.subscription_id,
&this.peer_asn_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.peer_asn)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::PeerAsn>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) peer_asn_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Peering/peerAsns/{}",
this.client.endpoint(),
&this.subscription_id,
&this.peer_asn_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod list_by_subscription {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PeerAsnListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::PeerAsnListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::PeerAsnListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Peering/peerAsns",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod peering_locations {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists all of the available peering locations for the specified kind of peering."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `kind`: The kind of the peering."]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn list(&self, kind: impl Into<String>, subscription_id: impl Into<String>) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
kind: kind.into(),
subscription_id: subscription_id.into(),
direct_peering_type: None,
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PeeringLocationListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::PeeringLocationListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) kind: String,
pub(crate) subscription_id: String,
pub(crate) direct_peering_type: Option<String>,
}
impl RequestBuilder {
#[doc = "The type of direct peering."]
pub fn direct_peering_type(mut self, direct_peering_type: impl Into<String>) -> Self {
self.direct_peering_type = Some(direct_peering_type.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::PeeringLocationListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Peering/peeringLocations",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
let kind = &this.kind;
req.url_mut().query_pairs_mut().append_pair("kind", kind);
if let Some(direct_peering_type) = &this.direct_peering_type {
req.url_mut()
.query_pairs_mut()
.append_pair("directPeeringType", direct_peering_type);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod registered_asns {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets an existing registered ASN with the specified name under the given subscription, resource group and peering."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `registered_asn_name`: The name of the registered ASN."]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
peering_name: impl Into<String>,
registered_asn_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
peering_name: peering_name.into(),
registered_asn_name: registered_asn_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates a new registered ASN with the specified name under the given subscription, resource group and peering."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `registered_asn_name`: The name of the ASN."]
#[doc = "* `registered_asn`: The properties needed to create a registered ASN."]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
peering_name: impl Into<String>,
registered_asn_name: impl Into<String>,
registered_asn: impl Into<models::PeeringRegisteredAsn>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
peering_name: peering_name.into(),
registered_asn_name: registered_asn_name.into(),
registered_asn: registered_asn.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes an existing registered ASN with the specified name under the given subscription, resource group and peering."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `registered_asn_name`: The name of the registered ASN."]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
peering_name: impl Into<String>,
registered_asn_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
peering_name: peering_name.into(),
registered_asn_name: registered_asn_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists all registered ASNs under the given subscription, resource group and peering."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn list_by_peering(
&self,
resource_group_name: impl Into<String>,
peering_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_peering::RequestBuilder {
list_by_peering::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
peering_name: peering_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PeeringRegisteredAsn> {
let bytes = self.0.into_body().collect().await?;
let body: models::PeeringRegisteredAsn = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) peering_name: String,
pub(crate) registered_asn_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Peering/peerings/{}/registeredAsns/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.peering_name,
&this.registered_asn_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::PeeringRegisteredAsn>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PeeringRegisteredAsn> {
let bytes = self.0.into_body().collect().await?;
let body: models::PeeringRegisteredAsn = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) peering_name: String,
pub(crate) registered_asn_name: String,
pub(crate) registered_asn: models::PeeringRegisteredAsn,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Peering/peerings/{}/registeredAsns/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.peering_name,
&this.registered_asn_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.registered_asn)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::PeeringRegisteredAsn>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) peering_name: String,
pub(crate) registered_asn_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Peering/peerings/{}/registeredAsns/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.peering_name,
&this.registered_asn_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod list_by_peering {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PeeringRegisteredAsnListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::PeeringRegisteredAsnListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) peering_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::PeeringRegisteredAsnListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Peering/peerings/{}/registeredAsns",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.peering_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod registered_prefixes {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets an existing registered prefix with the specified name under the given subscription, resource group and peering."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `registered_prefix_name`: The name of the registered prefix."]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
peering_name: impl Into<String>,
registered_prefix_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
peering_name: peering_name.into(),
registered_prefix_name: registered_prefix_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates a new registered prefix with the specified name under the given subscription, resource group and peering."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `registered_prefix_name`: The name of the registered prefix."]
#[doc = "* `registered_prefix`: The properties needed to create a registered prefix."]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
peering_name: impl Into<String>,
registered_prefix_name: impl Into<String>,
registered_prefix: impl Into<models::PeeringRegisteredPrefix>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
peering_name: peering_name.into(),
registered_prefix_name: registered_prefix_name.into(),
registered_prefix: registered_prefix.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes an existing registered prefix with the specified name under the given subscription, resource group and peering."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `registered_prefix_name`: The name of the registered prefix."]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
peering_name: impl Into<String>,
registered_prefix_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
peering_name: peering_name.into(),
registered_prefix_name: registered_prefix_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists all registered prefixes under the given subscription, resource group and peering."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn list_by_peering(
&self,
resource_group_name: impl Into<String>,
peering_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_peering::RequestBuilder {
list_by_peering::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
peering_name: peering_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PeeringRegisteredPrefix> {
let bytes = self.0.into_body().collect().await?;
let body: models::PeeringRegisteredPrefix = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) peering_name: String,
pub(crate) registered_prefix_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Peering/peerings/{}/registeredPrefixes/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.peering_name,
&this.registered_prefix_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::PeeringRegisteredPrefix>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PeeringRegisteredPrefix> {
let bytes = self.0.into_body().collect().await?;
let body: models::PeeringRegisteredPrefix = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) peering_name: String,
pub(crate) registered_prefix_name: String,
pub(crate) registered_prefix: models::PeeringRegisteredPrefix,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Peering/peerings/{}/registeredPrefixes/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.peering_name,
&this.registered_prefix_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.registered_prefix)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::PeeringRegisteredPrefix>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) peering_name: String,
pub(crate) registered_prefix_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Peering/peerings/{}/registeredPrefixes/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.peering_name,
&this.registered_prefix_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod list_by_peering {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PeeringRegisteredPrefixListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::PeeringRegisteredPrefixListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) peering_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::PeeringRegisteredPrefixListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Peering/peerings/{}/registeredPrefixes",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.peering_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod peerings {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets an existing peering with the specified name under the given subscription and resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
peering_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
peering_name: peering_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates a new peering or updates an existing peering with the specified name under the given subscription and resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `peering`: The properties needed to create or update a peering."]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
peering_name: impl Into<String>,
peering: impl Into<models::Peering>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
peering_name: peering_name.into(),
peering: peering.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates tags for a peering with the specified name under the given subscription and resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `tags`: The resource tags."]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
peering_name: impl Into<String>,
tags: impl Into<models::ResourceTags>,
subscription_id: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
peering_name: peering_name.into(),
tags: tags.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes an existing peering with the specified name under the given subscription and resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
peering_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
peering_name: peering_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists all of the peerings under the given subscription and resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn list_by_resource_group(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_resource_group::RequestBuilder {
list_by_resource_group::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists all of the peerings under the given subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn list_by_subscription(&self, subscription_id: impl Into<String>) -> list_by_subscription::RequestBuilder {
list_by_subscription::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Peering> {
let bytes = self.0.into_body().collect().await?;
let body: models::Peering = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) peering_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Peering/peerings/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.peering_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Peering>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Peering> {
let bytes = self.0.into_body().collect().await?;
let body: models::Peering = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) peering_name: String,
pub(crate) peering: models::Peering,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Peering/peerings/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.peering_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.peering)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Peering>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::Peering> {
let bytes = self.0.into_body().collect().await?;
let body: models::Peering = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) peering_name: String,
pub(crate) tags: models::ResourceTags,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Peering/peerings/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.peering_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.tags)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::Peering>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) peering_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Peering/peerings/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.peering_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod list_by_resource_group {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PeeringListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::PeeringListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::PeeringListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Peering/peerings",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_subscription {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PeeringListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::PeeringListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::PeeringListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Peering/peerings",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod received_routes {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists the prefixes received over the specified peering under the given subscription and resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `peering_name`: The name of the peering."]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn list_by_peering(
&self,
resource_group_name: impl Into<String>,
peering_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_peering::RequestBuilder {
list_by_peering::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
peering_name: peering_name.into(),
subscription_id: subscription_id.into(),
prefix: None,
as_path: None,
origin_as_validation_state: None,
rpki_validation_state: None,
skip_token: None,
}
}
}
pub mod list_by_peering {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PeeringReceivedRouteListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::PeeringReceivedRouteListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) peering_name: String,
pub(crate) subscription_id: String,
pub(crate) prefix: Option<String>,
pub(crate) as_path: Option<String>,
pub(crate) origin_as_validation_state: Option<String>,
pub(crate) rpki_validation_state: Option<String>,
pub(crate) skip_token: Option<String>,
}
impl RequestBuilder {
#[doc = "The optional prefix that can be used to filter the routes."]
pub fn prefix(mut self, prefix: impl Into<String>) -> Self {
self.prefix = Some(prefix.into());
self
}
#[doc = "The optional AS path that can be used to filter the routes."]
pub fn as_path(mut self, as_path: impl Into<String>) -> Self {
self.as_path = Some(as_path.into());
self
}
#[doc = "The optional origin AS validation state that can be used to filter the routes."]
pub fn origin_as_validation_state(mut self, origin_as_validation_state: impl Into<String>) -> Self {
self.origin_as_validation_state = Some(origin_as_validation_state.into());
self
}
#[doc = "The optional RPKI validation state that can be used to filter the routes."]
pub fn rpki_validation_state(mut self, rpki_validation_state: impl Into<String>) -> Self {
self.rpki_validation_state = Some(rpki_validation_state.into());
self
}
#[doc = "The optional page continuation token that is used in the event of paginated result."]
pub fn skip_token(mut self, skip_token: impl Into<String>) -> Self {
self.skip_token = Some(skip_token.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::PeeringReceivedRouteListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Peering/peerings/{}/receivedRoutes",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.peering_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
if let Some(prefix) = &this.prefix {
req.url_mut().query_pairs_mut().append_pair("prefix", prefix);
}
if let Some(as_path) = &this.as_path {
req.url_mut().query_pairs_mut().append_pair("asPath", as_path);
}
if let Some(origin_as_validation_state) = &this.origin_as_validation_state {
req.url_mut()
.query_pairs_mut()
.append_pair("originAsValidationState", origin_as_validation_state);
}
if let Some(rpki_validation_state) = &this.rpki_validation_state {
req.url_mut()
.query_pairs_mut()
.append_pair("rpkiValidationState", rpki_validation_state);
}
if let Some(skip_token) = &this.skip_token {
req.url_mut().query_pairs_mut().append_pair("$skipToken", skip_token);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod connection_monitor_tests {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets an existing connection monitor test with the specified name under the given subscription, resource group and peering service."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `peering_service_name`: The name of the peering service."]
#[doc = "* `connection_monitor_test_name`: The name of the connection monitor test"]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
peering_service_name: impl Into<String>,
connection_monitor_test_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
peering_service_name: peering_service_name.into(),
connection_monitor_test_name: connection_monitor_test_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates or updates a connection monitor test with the specified name under the given subscription, resource group and peering service."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `peering_service_name`: The name of the peering service."]
#[doc = "* `connection_monitor_test_name`: The name of the connection monitor test"]
#[doc = "* `connection_monitor_test`: The properties needed to create a connection monitor test"]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
peering_service_name: impl Into<String>,
connection_monitor_test_name: impl Into<String>,
connection_monitor_test: impl Into<models::ConnectionMonitorTest>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
peering_service_name: peering_service_name.into(),
connection_monitor_test_name: connection_monitor_test_name.into(),
connection_monitor_test: connection_monitor_test.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes an existing connection monitor test with the specified name under the given subscription, resource group and peering service."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `peering_service_name`: The name of the peering service."]
#[doc = "* `connection_monitor_test_name`: The name of the connection monitor test"]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
peering_service_name: impl Into<String>,
connection_monitor_test_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
peering_service_name: peering_service_name.into(),
connection_monitor_test_name: connection_monitor_test_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists all connection monitor tests under the given subscription, resource group and peering service."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `peering_service_name`: The name of the peering service."]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn list_by_peering_service(
&self,
resource_group_name: impl Into<String>,
peering_service_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_peering_service::RequestBuilder {
list_by_peering_service::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
peering_service_name: peering_service_name.into(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ConnectionMonitorTest> {
let bytes = self.0.into_body().collect().await?;
let body: models::ConnectionMonitorTest = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) peering_service_name: String,
pub(crate) connection_monitor_test_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Peering/peeringServices/{}/connectionMonitorTests/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . peering_service_name , & this . connection_monitor_test_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ConnectionMonitorTest>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ConnectionMonitorTest> {
let bytes = self.0.into_body().collect().await?;
let body: models::ConnectionMonitorTest = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) peering_service_name: String,
pub(crate) connection_monitor_test_name: String,
pub(crate) connection_monitor_test: models::ConnectionMonitorTest,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Peering/peeringServices/{}/connectionMonitorTests/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . peering_service_name , & this . connection_monitor_test_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.connection_monitor_test)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::ConnectionMonitorTest>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) peering_service_name: String,
pub(crate) connection_monitor_test_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core :: Url :: parse (& format ! ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Peering/peeringServices/{}/connectionMonitorTests/{}" , this . client . endpoint () , & this . subscription_id , & this . resource_group_name , & this . peering_service_name , & this . connection_monitor_test_name)) ? ;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod list_by_peering_service {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::ConnectionMonitorTestListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::ConnectionMonitorTestListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) peering_service_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::ConnectionMonitorTestListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Peering/peeringServices/{}/connectionMonitorTests",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.peering_service_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod peering_service_countries {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists all of the available countries for peering service."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PeeringServiceCountryListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::PeeringServiceCountryListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::PeeringServiceCountryListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Peering/peeringServiceCountries",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod peering_service_locations {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists all of the available locations for peering service."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
country: None,
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PeeringServiceLocationListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::PeeringServiceLocationListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
pub(crate) country: Option<String>,
}
impl RequestBuilder {
#[doc = "The country of interest, in which the locations are to be present."]
pub fn country(mut self, country: impl Into<String>) -> Self {
self.country = Some(country.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::PeeringServiceLocationListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Peering/peeringServiceLocations",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
if let Some(country) = &this.country {
req.url_mut().query_pairs_mut().append_pair("country", country);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod prefixes {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets an existing prefix with the specified name under the given subscription, resource group and peering service."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `peering_service_name`: The name of the peering service."]
#[doc = "* `prefix_name`: The name of the prefix."]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
peering_service_name: impl Into<String>,
prefix_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
peering_service_name: peering_service_name.into(),
prefix_name: prefix_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
#[doc = "Creates a new prefix with the specified name under the given subscription, resource group and peering service."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `peering_service_name`: The name of the peering service."]
#[doc = "* `prefix_name`: The name of the prefix."]
#[doc = "* `peering_service_prefix`: The properties needed to create a prefix."]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
peering_service_name: impl Into<String>,
prefix_name: impl Into<String>,
peering_service_prefix: impl Into<models::PeeringServicePrefix>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
peering_service_name: peering_service_name.into(),
prefix_name: prefix_name.into(),
peering_service_prefix: peering_service_prefix.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes an existing prefix with the specified name under the given subscription, resource group and peering service."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `peering_service_name`: The name of the peering service."]
#[doc = "* `prefix_name`: The name of the prefix."]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
peering_service_name: impl Into<String>,
prefix_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
peering_service_name: peering_service_name.into(),
prefix_name: prefix_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists all prefixes under the given subscription, resource group and peering service."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `peering_service_name`: The name of the peering service."]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn list_by_peering_service(
&self,
resource_group_name: impl Into<String>,
peering_service_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_peering_service::RequestBuilder {
list_by_peering_service::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
peering_service_name: peering_service_name.into(),
subscription_id: subscription_id.into(),
expand: None,
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PeeringServicePrefix> {
let bytes = self.0.into_body().collect().await?;
let body: models::PeeringServicePrefix = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) peering_service_name: String,
pub(crate) prefix_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl RequestBuilder {
#[doc = "The properties to be expanded."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Peering/peeringServices/{}/prefixes/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.peering_service_name,
&this.prefix_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::PeeringServicePrefix>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PeeringServicePrefix> {
let bytes = self.0.into_body().collect().await?;
let body: models::PeeringServicePrefix = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) peering_service_name: String,
pub(crate) prefix_name: String,
pub(crate) peering_service_prefix: models::PeeringServicePrefix,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Peering/peeringServices/{}/prefixes/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.peering_service_name,
&this.prefix_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.peering_service_prefix)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::PeeringServicePrefix>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) peering_service_name: String,
pub(crate) prefix_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Peering/peeringServices/{}/prefixes/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.peering_service_name,
&this.prefix_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod list_by_peering_service {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PeeringServicePrefixListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::PeeringServicePrefixListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) peering_service_name: String,
pub(crate) subscription_id: String,
pub(crate) expand: Option<String>,
}
impl RequestBuilder {
#[doc = "The properties to be expanded."]
pub fn expand(mut self, expand: impl Into<String>) -> Self {
self.expand = Some(expand.into());
self
}
pub fn into_stream(self) -> azure_core::Pageable<models::PeeringServicePrefixListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Peering/peeringServices/{}/prefixes",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.peering_service_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
if let Some(expand) = &this.expand {
req.url_mut().query_pairs_mut().append_pair("$expand", expand);
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod peering_service_providers {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Lists all of the available peering service locations for the specified kind of peering."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn list(&self, subscription_id: impl Into<String>) -> list::RequestBuilder {
list::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
}
pub mod list {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PeeringServiceProviderListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::PeeringServiceProviderListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::PeeringServiceProviderListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Peering/peeringServiceProviders",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
}
pub mod peering_services {
use super::models;
pub struct Client(pub(crate) super::Client);
impl Client {
#[doc = "Gets an existing peering service with the specified name under the given subscription and resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `peering_service_name`: The name of the peering."]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn get(
&self,
resource_group_name: impl Into<String>,
peering_service_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> get::RequestBuilder {
get::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
peering_service_name: peering_service_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Creates a new peering service or updates an existing peering with the specified name under the given subscription and resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `peering_service_name`: The name of the peering service."]
#[doc = "* `peering_service`: The properties needed to create or update a peering service."]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn create_or_update(
&self,
resource_group_name: impl Into<String>,
peering_service_name: impl Into<String>,
peering_service: impl Into<models::PeeringService>,
subscription_id: impl Into<String>,
) -> create_or_update::RequestBuilder {
create_or_update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
peering_service_name: peering_service_name.into(),
peering_service: peering_service.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Updates tags for a peering service with the specified name under the given subscription and resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `peering_service_name`: The name of the peering service."]
#[doc = "* `tags`: The resource tags."]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn update(
&self,
resource_group_name: impl Into<String>,
peering_service_name: impl Into<String>,
tags: impl Into<models::ResourceTags>,
subscription_id: impl Into<String>,
) -> update::RequestBuilder {
update::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
peering_service_name: peering_service_name.into(),
tags: tags.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Deletes an existing peering service with the specified name under the given subscription and resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `peering_service_name`: The name of the peering service."]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn delete(
&self,
resource_group_name: impl Into<String>,
peering_service_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> delete::RequestBuilder {
delete::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
peering_service_name: peering_service_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists all of the peering services under the given subscription and resource group."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `resource_group_name`: The name of the resource group."]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn list_by_resource_group(
&self,
resource_group_name: impl Into<String>,
subscription_id: impl Into<String>,
) -> list_by_resource_group::RequestBuilder {
list_by_resource_group::RequestBuilder {
client: self.0.clone(),
resource_group_name: resource_group_name.into(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Lists all of the peerings under the given subscription."]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn list_by_subscription(&self, subscription_id: impl Into<String>) -> list_by_subscription::RequestBuilder {
list_by_subscription::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
#[doc = "Initialize Peering Service for Connection Monitor functionality"]
#[doc = ""]
#[doc = "Arguments:"]
#[doc = "* `subscription_id`: The Azure subscription ID."]
pub fn initialize_connection_monitor(&self, subscription_id: impl Into<String>) -> initialize_connection_monitor::RequestBuilder {
initialize_connection_monitor::RequestBuilder {
client: self.0.clone(),
subscription_id: subscription_id.into(),
}
}
}
pub mod get {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PeeringService> {
let bytes = self.0.into_body().collect().await?;
let body: models::PeeringService = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) peering_service_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Peering/peeringServices/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.peering_service_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::PeeringService>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod create_or_update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PeeringService> {
let bytes = self.0.into_body().collect().await?;
let body: models::PeeringService = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) peering_service_name: String,
pub(crate) peering_service: models::PeeringService,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Peering/peeringServices/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.peering_service_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Put);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.peering_service)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::PeeringService>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod update {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PeeringService> {
let bytes = self.0.into_body().collect().await?;
let body: models::PeeringService = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) peering_service_name: String,
pub(crate) tags: models::ResourceTags,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Peering/peeringServices/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.peering_service_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Patch);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
req.insert_header("content-type", "application/json");
let req_body = azure_core::to_json(&this.tags)?;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
#[doc = "Send the request and return the response body."]
pub fn into_future(self) -> futures::future::BoxFuture<'static, azure_core::Result<models::PeeringService>> {
Box::pin(async move { self.send().await?.into_body().await })
}
}
}
pub mod delete {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) peering_service_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Peering/peeringServices/{}",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name,
&this.peering_service_name
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Delete);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
pub mod list_by_resource_group {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PeeringServiceListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::PeeringServiceListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) resource_group_name: String,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::PeeringServiceListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Peering/peeringServices",
this.client.endpoint(),
&this.subscription_id,
&this.resource_group_name
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod list_by_subscription {
use super::models;
pub struct Response(azure_core::Response);
impl Response {
pub async fn into_body(self) -> azure_core::Result<models::PeeringServiceListResult> {
let bytes = self.0.into_body().collect().await?;
let body: models::PeeringServiceListResult = serde_json::from_slice(&bytes)?;
Ok(body)
}
pub fn into_raw_response(self) -> azure_core::Response {
self.0
}
pub fn as_raw_response(&self) -> &azure_core::Response {
&self.0
}
}
impl From<Response> for azure_core::Response {
fn from(rsp: Response) -> Self {
rsp.into_raw_response()
}
}
impl AsRef<azure_core::Response> for Response {
fn as_ref(&self) -> &azure_core::Response {
self.as_raw_response()
}
}
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
pub fn into_stream(self) -> azure_core::Pageable<models::PeeringServiceListResult, azure_core::error::Error> {
let make_request = move |continuation: Option<String>| {
let this = self.clone();
async move {
let mut url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Peering/peeringServices",
this.client.endpoint(),
&this.subscription_id
))?;
let rsp = match continuation {
Some(value) => {
url.set_path("");
url = url.join(&value)?;
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
let has_api_version_already =
req.url_mut().query_pairs().any(|(k, _)| k == azure_core::query_param::API_VERSION);
if !has_api_version_already {
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
}
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
None => {
let mut req = azure_core::Request::new(url, azure_core::Method::Get);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
let req_body = azure_core::EMPTY_BODY;
req.set_body(req_body);
this.client.send(&mut req).await?
}
};
let rsp = match rsp.status() {
azure_core::StatusCode::Ok => Ok(Response(rsp)),
status_code => Err(azure_core::error::Error::from(azure_core::error::ErrorKind::HttpResponse {
status: status_code,
error_code: None,
})),
};
rsp?.into_body().await
}
};
azure_core::Pageable::new(make_request)
}
}
}
pub mod initialize_connection_monitor {
use super::models;
pub struct Response(azure_core::Response);
#[derive(Clone)]
pub struct RequestBuilder {
pub(crate) client: super::super::Client,
pub(crate) subscription_id: String,
}
impl RequestBuilder {
#[doc = "Send the request and returns the response."]
pub fn send(self) -> futures::future::BoxFuture<'static, azure_core::Result<Response>> {
Box::pin({
let this = self.clone();
async move {
let url = azure_core::Url::parse(&format!(
"{}/subscriptions/{}/providers/Microsoft.Peering/initializeConnectionMonitor",
this.client.endpoint(),
&this.subscription_id
))?;
let mut req = azure_core::Request::new(url, azure_core::Method::Post);
let credential = this.client.token_credential();
let token_response = credential.get_token(&this.client.scopes().join(" ")).await?;
req.insert_header(
azure_core::headers::AUTHORIZATION,
format!("Bearer {}", token_response.token.secret()),
);
req.url_mut()
.query_pairs_mut()
.append_pair(azure_core::query_param::API_VERSION, "2022-01-01");
let req_body = azure_core::EMPTY_BODY;
req.insert_header(azure_core::headers::CONTENT_LENGTH, "0");
req.set_body(req_body);
Ok(Response(this.client.send(&mut req).await?))
}
})
}
}
}
}